Exploiting Textual Semantics for Robust Cross-View Object Correspondence
Paper • 2611.02356 • Published
How to use bf0820/TeSCo with sam2:
# Use SAM2 with images
import torch
from sam2.sam2_image_predictor import SAM2ImagePredictor
predictor = SAM2ImagePredictor.from_pretrained("bf0820/TeSCo")
with torch.inference_mode(), torch.autocast("cuda", dtype=torch.bfloat16):
predictor.set_image(<your_image>)
masks, _, _ = predictor.predict(<input_prompts>) # Use SAM2 with videos
import torch
from sam2.sam2_video_predictor import SAM2VideoPredictor
predictor = SAM2VideoPredictor.from_pretrained("bf0820/TeSCo")
with torch.inference_mode(), torch.autocast("cuda", dtype=torch.bfloat16):
state = predictor.init_state(<your_video>)
# add new prompts and instantly get the output on the same frame
frame_idx, object_ids, masks = predictor.add_new_points(state, <your_prompts>)
# propagate the prompts to get masklets throughout the video
for frame_idx, object_ids, masks in predictor.propagate_in_video(state):
...# Use SAM2 with videos
import torch
from sam2.sam2_video_predictor import SAM2VideoPredictor
predictor = SAM2VideoPredictor.from_pretrained("bf0820/TeSCo")
with torch.inference_mode(), torch.autocast("cuda", dtype=torch.bfloat16):
state = predictor.init_state(<your_video>)
# add new prompts and instantly get the output on the same frame
frame_idx, object_ids, masks = predictor.add_new_points(state, <your_prompts>)
# propagate the prompts to get masklets throughout the video
for frame_idx, object_ids, masks in predictor.propagate_in_video(state):
...Paper · Code · Project page
Trained TeSCo checkpoints for the Ego-Exo4D correspondence benchmark, one per direction.
| Setting | resolution | file | IoU/Cont.A/Loc.E | size |
|---|---|---|---|---|
| Ego→Exo | 480 | tesco_ego2exo.pt | 60.40/0.847/0.011 | 790 MB |
| Exo→Ego | 480 | tesco_exo2ego.pt | 70.30/0.808/0.023 | 790 MB |
Place both files in checkpoints/ of the code repository and run, e.g. for Ego→Exo:
python tools/correspondence_inference.py \
--sam2_cfg sam2.1/sam2.1_hiera_b+_egoexo_text.yaml \
--sam2_checkpoint checkpoints/tesco_ego2exo.pt \
--base_video_dir data/EgoExo4D/data_segswap_test \
--input_mask_dir data/EgoExo4D/data_segswap_test \
--output_mask_dir output/ego2exo --caption_subdir dam_frame_captions_v2
For Exo→Ego use tesco_exo2ego.pt with --caption_subdir dam_frame_captions_v2_exo --exo_to_ego. Data preparation, evaluation and training are described in the code repository.
@inproceedings{tesco2026,
title={Exploiting Textual Semantics for Robust Cross-View Object Correspondence},
author={Fan, Bing and Feng, Yunhe and Huang, Yan and Fan, Heng},
booktitle={Advances in Neural Information Processing Systems},
year={2026}
}
# Use SAM2 with images import torch from sam2.sam2_image_predictor import SAM2ImagePredictor predictor = SAM2ImagePredictor.from_pretrained("bf0820/TeSCo") with torch.inference_mode(), torch.autocast("cuda", dtype=torch.bfloat16): predictor.set_image(<your_image>) masks, _, _ = predictor.predict(<input_prompts>)