License each domain has its own License
SA-Co/VEval is an evaluation dataset comprising of 3 domains, each domain has a val and test split.
Install the SA-Co/VEVal required environment
pip install -e ".[veval]"
This will allow us to run:
scripts/eval/veval/saco_yt1b_downloader.py preparing frames for SA-Co/VEval - YT-Temporal-1Bexamples/saco_veval_eval_example.ipynb example of running an offline evaluatorexamples/saco_veval_vis_example.ipynb example of loading and visualizing the dataThe following folder structure is expected after finishing all the download and pre-processing steps in this section
data/ ├── annotation/ │ ├── saco_veval_sav_test.json │ ├── saco_veval_sav_val.json │ ├── saco_veval_smartglasses_test.json │ ├── saco_veval_smartglasses_val.json │ ├── saco_veval_yt1b_test.json │ ├── saco_veval_yt1b_val.json └── media/ ├── saco_sav │ └── JPEGImages_24fps ├── saco_sg │ └── JPEGImages_6fps └── saco_yt1b └── JPEGImages_6fps
The following links provide ready-to-use data, hosted on Roboflow, after completing the pre-processing steps outlined in the next section.
For each domain:
For all three domains:
Special note on SA-Co/VEval - YT-Temporal-1B:
The GT annotations are available at Hugging Face:
annotation/saco_veval_sav_test.jsonannotation/saco_veval_sav_val.jsonannotation/saco_veval_yt1b_test.jsonannotation/saco_veval_yt1b_val.jsonannotation/saco_veval_smartglasses_test.jsonannotation/saco_veval_smartglasses_val.jsonFollow instructions in SA-V dataset. Only the following two datasets are needed:
After untar:
sav_test/ ├── Annotations_6fps [ignore this is the SAM 2 annotation] ├── JPEGImages_24fps sav_val/ ├── Annotations_6fps [ignore this is the SAM 2 annotation] └── JPEGImages_24fps
Then merge the two JPEGImages_24fps together to better match our annotation json file path e.g.
media/ └── saco_sav └── JPEGImages_24fps [merged from the two JPEGImages_24fps above]
Example commands to download and merge folders
cd ../data/media/saco_sav wget -O sav_test.tar <sav_test.tar download link from the SA-V dataset page> wget -O sav_val.tar <sav_val.tar download link from the SA-V dataset page> tar -xf sav_test.tar tar -xf sav_val.tar mkdir JPEGImages_24fps chmod -R u+w sav_test/ chmod -R u+w sav_val/ mv sav_test/JPEGImages_24fps/* JPEGImages_24fps/ mv sav_val/JPEGImages_24fps/* JPEGImages_24fps/
Two files are needed to download the SA-Co/VEval - YT-Temporal-1B Youtube videos.
media/yt1b_start_end_time.json from SA-Co/VEval, which contains the Youtube video ids and the start and end time used in SA-Co/VEval - YT-Temporal-1B.cookies.txt file. Follow instruction in yt-dlp exporting-youtube-cookies and pass-cookies-to-yt-dlp to prepare the cookies_file.
Then run scripts/eval/veval/saco_yt1b_downloader.py to download the videos and prepare the frames e.g.
python saco_yt1b_downloader.py \ --data_dir ../data/media/saco_yt1b \ --cookies_file ../data/media/saco_yt1b/cookies.txt \ --yt1b_start_end_time_file ../data/media/saco_yt1b/yt1b_start_end_time.json \ --yt1b_frame_prep_log_file ../data/media/saco_yt1b/yt1b_frame_prep.log
cookies.txt downloaded aboveyt1b_start_end_time.json downloaded aboveThen run scripts/eval/veval/saco_yt1b_annot_update.py to update the annotation based on the video availability e.g.
python saco_yt1b_annot_update.py \ --yt1b_media_dir ../data/media/saco_yt1b/JPEGImages_6fps \ --yt1b_input_annot_path ../data/annotation/saco_veval_yt1b_val.json \ --yt1b_output_annot_path ../data/annotation/saco_veval_yt1b_val_updated.json \ --yt1b_annot_update_log_path ../data/annotation/saco_veval_yt1b_val_updated.log
NOTE:
saco_yt1b_annot_update.py is used to remove the annotations of the unavailable videos.ffmpeg seems to find it hard to guarantee consistent frame extraction from the same video across different environments. This may cause the re-downloaded and re-extracted frames to have alignment issues with our annotations due to frame shifting. Please be aware of this caveat when evaluating on SA-Co/VEval - YT-Temporal-1B.Go to SACo-VEval download media/saco_sg.tar.gz
cd ../data hf download facebook/SACo-VEval media/saco_sg.tar.gz --repo-type dataset --local-dir . cd ../data/media tar -xzf saco_sg.tar.gz
The format is similar to the YTVIS format.
In the annotation json, e.g. saco_veval_sav_test.json there are 5 fields:
videos - id field abovecategories - id field belowvideos - id abovecategories - id abovenum_masklets > 0 it is a positive video-np pair, and the presenting masklets can be found in the annotations fieldnum_masklets = 0 it is a negative video-np pair, meaning no masklet presenting at alldata { "info": info "videos": [video] "annotations": [annotation] "categories": [category] "video_np_pairs": [video_np_pair] } video { "id": int "video_name": str # e.g. sav_000000 "file_names": List[str] "height": int "width": width "length": length } annotation { "id": int "segmentations": List[RLE] "bboxes": List[List[int, int, int, int]] "areas": List[int] "iscrowd": int "video_id": str "height": int "width": int "category_id": int "noun_phrase": str } category { "id": int "name": str } video_np_pair { "id": int "video_id": str "category_id": int "noun_phrase": str "num_masklets" int }
sam3/examples/saco_veval_vis_example.ipynb shows some examples of the data format and data visualization.
An example notebook and an eval script have been provided for offline evaluation.
sam3/ ├── examples/ │ └── saco_veval_eval_example.ipynb # this notebook will load eval res or run the eval on the fly, and print the results └── sam3/eval/ └── saco_veval_eval.py # this script will run the offline evaluator
saco_veval_eval.py supports two modes, one and all.
one: will take only one pair of gt and pred files to evalall: will eval on all 6 SACo/VEval datasetsExample usage
python saco_veval_eval.py one \ --gt_annot_file ../sam3/assets/veval/toy_gt_and_pred/toy_saco_veval_sav_test_gt.json \ --pred_file ../sam3/assets/veval/toy_gt_and_pred/toy_saco_veval_sav_test_pred.json \ --eval_res_file ../sam3/assets/veval/toy_gt_and_pred/toy_saco_veval_sav_test_eval_res.json
gt_annot_file: the location of the GT filepred_file: the location of the Pred fileeval_res_file: the location where the eval result will be written topython saco_veval_eval.py all \ --gt_annot_dir ../data/annotation \ --pred_dir ../data/pred \ --eval_res_dir ../data/pred
gt_annot_dir: the location of the GT filespred_dir: the location of the Pred fileseval_res_dir: the location where the eval results will be written to