🚀 Geen Tijd om te Trainen!
Training-vrije Referentie-gebaseerde Instance Segmentatie
State-of-the-art (Papers with Code)
_SOTA 1-shot_ | -21CBCE?style=flat&logo=paperswithcode)
🚨 Update (5 februari 2026): Het papermanuscript is bijgewerkt met uitgebreide ablatieve studies, visualisaties en extra experimenten.
🚨 Update (22 juli 2025): Instructies voor aangepaste datasets zijn toegevoegd!
🔔 Update (16 juli 2025): Code is bijgewerkt met instructies!
📋 Inhoudsopgave
- 🎯 Highlights
- 📜 Samenvatting
- 🧠 Architectuur
- 🛠️ Installatie-instructies
- 1. Clone de repository
- 2. Maak conda-omgeving
- 3. Installeer SAM2 en DINOv2
- 4. Download datasets
- 5. Download SAM2 en DINOv2 checkpoints
- 📊 Inferentiecode: Reproduceer 30-shot SOTA-resultaten in Few-shot COCO
- 0. Maak referentieset
- 1. Vul geheugen met referenties
- 2. Post-process geheugenbank
- 3. Inferentie op doeldbeelden
- Resultaten
- 🔍 Aangepaste dataset
- 0. Bereid een aangepaste dataset voor ⛵🐦
- 0.1 Als alleen bbox-annotaties beschikbaar zijn
- 0.2 Converteer coco-annotaties naar pickle-bestand
- 1. Vul het geheugen met referenties
- 2. Post-process geheugenbank
- 📚 Referentie
🎯 Hoogtepunten
- 💡 Zonder Training: Geen fine-tuning, geen prompt engineering—alleen een referentieafbeelding.
- 🖼️ Referentie-gebaseerd: Segmenteer nieuwe objecten met slechts enkele voorbeelden.
- 🔥 SOTA Prestaties: Overtreft eerdere training-vrije methoden op COCO, PASCAL VOC en Cross-Domain FSOD.
📜 Samenvatting
The performance of image segmentation models has historically been constrained by the high cost of collecting large-scale annotated data. The Segment Anything Model (SAM) alleviates this original problem through a promptable, semantics-agnostic, segmentation paradigm and yet still requires manual visual-prompts or complex domain-dependent prompt-generation rules to process a new image. Towards reducing this new burden, our work investigates the task of object segmentation when provided with, alternatively, only a small set of reference images. Our key insight is to leverage strong semantic priors, as learned by foundation models, to identify corresponding regions between a reference and a target image. We find that correspondences enable automatic generation of instance-level segmentation masks for downstream tasks and instantiate our ideas via a multi-stage, training-free method incorporating (1) memory bank construction; (2) representation aggregation and (3) semantic-aware feature matching. Our experiments show significant improvements on segmentation metrics, leading to state-of-the-art performance on COCO FSOD (36.8% nAP), PASCAL VOC Few-Shot (71.2% nAP50) and outperforming existing training-free approaches on the Cross-Domain FSOD benchmark (22.4% nAP).
🧠 Architecture
🛠️ Installation instructions
1. Clone the repository
git clone https://github.com/miquel-espinosa/no-time-to-train.git
cd no-time-to-train
2. Conda-omgeving aanmaken
We zullen een conda-omgeving aanmaken met de vereiste pakketten.
conda env create -f environment.yml
conda activate no-time-to-train3. Installeer SAM2 en DINOv2
We zullen SAM2 en DINOv2 vanaf de bron installeren.
pip install -e .
cd dinov2
pip install -e .
cd ..4. Download datasets
Download alstublieft de COCO dataset en plaats deze in data/coco
5. Download SAM2 en DINOv2 checkpoints
We zullen exact dezelfde SAM2 checkpoints downloaden als in het artikel gebruikt zijn. (Let op, SAM2.1 checkpoints zijn inmiddels beschikbaar en kunnen beter presteren.)
mkdir -p checkpoints/dinov2
cd checkpoints
wget https://dl.fbaipublicfiles.com/segment_anything_2/072824/sam2_hiera_large.pt
cd dinov2
wget https://dl.fbaipublicfiles.com/dinov2/dinov2_vitl14/dinov2_vitl14_pretrain.pth
cd ../..
📊 Inferentiecode
⚠️ Disclaimer: Dit is onderzoeks-code — verwacht wat chaos!
Reproduceren van 30-shot SOTA resultaten in Few-shot COCO
Definieer nuttige variabelen en maak een map aan voor de resultaten:
CONFIG=./no_time_to_train/new_exps/coco_fewshot_10shot_Sam2L.yaml
CLASS_SPLIT="few_shot_classes"
RESULTS_DIR=work_dirs/few_shot_results
SHOTS=30
SEED=33
GPUS=4mkdir -p $RESULTS_DIR
FILENAME=few_shot_${SHOTS}shot_seed${SEED}.pkl
#### 0. Referentieset aanmakenpython no_time_to_train/dataset/few_shot_sampling.py \
--n-shot $SHOTS \
--out-path ${RESULTS_DIR}/${FILENAME} \
--seed $SEED \
--dataset $CLASS_SPLIT
#### 1. Vul het geheugen met referentiespython run_lightening.py test --config $CONFIG \
--model.test_mode fill_memory \
--out_path ${RESULTS_DIR}/memory.ckpt \
--model.init_args.model_cfg.memory_bank_cfg.length $SHOTS \
--model.init_args.dataset_cfgs.fill_memory.memory_pkl ${RESULTS_DIR}/${FILENAME} \
--model.init_args.dataset_cfgs.fill_memory.memory_length $SHOTS \
--model.init_args.dataset_cfgs.fill_memory.class_split $CLASS_SPLIT \
--trainer.logger.save_dir ${RESULTS_DIR}/ \
--trainer.devices $GPUS
#### 2. Post-processing geheugenbankpython run_lightening.py test --config $CONFIG \
--model.test_mode postprocess_memory \
--model.init_args.model_cfg.memory_bank_cfg.length $SHOTS \
--ckpt_path ${RESULTS_DIR}/memory.ckpt \
--out_path ${RESULTS_DIR}/memory_postprocessed.ckpt \
--trainer.devices 1
#### 3. Inferentie op doelfoto'spython run_lightening.py test --config $CONFIG \
--ckpt_path ${RESULTS_DIR}/memory_postprocessed.ckpt \
--model.init_args.test_mode test \
--model.init_args.model_cfg.memory_bank_cfg.length $SHOTS \
--model.init_args.model_cfg.dataset_name $CLASS_SPLIT \
--model.init_args.dataset_cfgs.test.class_split $CLASS_SPLIT \
--trainer.logger.save_dir ${RESULTS_DIR}/ \
--trainer.devices $GPUS
Als u de inferentieresultaten online wilt zien (terwijl ze worden berekend), voeg dan het argument toe: --model.init_args.model_cfg.test.online_vis True
Om de score-drempelparameter score_thr aan te passen, voegt u het argument toe (bijvoorbeeld om alle instanties met een score hoger dan 0.4 te visualiseren):
--model.init_args.model_cfg.test.vis_thr 0.4
Afbeeldingen worden nu opgeslagen in results_analysis/few_shot_classes/. De afbeelding links toont de grondwaarheid, de afbeelding rechts toont de gesegmenteerde instanties gevonden door onze training-vrije methode.Let op dat we in dit voorbeeld de few_shot_classes splitsing gebruiken, dus we zouden alleen gesegmenteerde instanties moeten zien van de klassen in deze splitsing (niet alle klassen in COCO).
#### Resultaten
Na het verwerken van alle afbeeldingen in de validatieset, zou je het volgende moeten verkrijgen:
BBOX RESULTS:
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.368SEGM RESULTS:
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.342
🔍 Aangepaste dataset
We geven de instructies voor het uitvoeren van onze pipeline op een aangepaste dataset. Het annotatieformaat is altijd in COCO-formaat.
TLDR; Om direct te zien hoe je de volledige pipeline draait op aangepaste datasets, kijk naarscripts/matching_cdfsod_pipeline.shsamen met voorbeeldscripts van CD-FSOD-datasets (bijv.scripts/dior_fish.sh)
0. Bereid een aangepaste dataset voor ⛵🐦
Stel dat we boten⛵ en vogels🐦 willen detecteren in een aangepaste dataset. Om onze methode te gebruiken hebben we nodig:
- Minimaal 1 geannoteerde referentieafbeelding per klasse (d.w.z. 1 referentieafbeelding voor boot en 1 referentieafbeelding voor vogel)
- Meerdere doelafbeeldingen om instanties van onze gewenste klassen te vinden.
mkdir -p data/my_custom_dataset
python scripts/make_custom_dataset.py
Dit zal een aangepaste dataset aanmaken met de volgende mappenstructuur:
data/my_custom_dataset/
├── annotations/
│ ├── custom_references.json
│ ├── custom_targets.json
│ └── references_visualisations/
│ ├── bird_1.jpg
│ └── boat_1.jpg
└── images/
├── 429819.jpg
├── 101435.jpg
└── (all target and reference images)
Referentieafbeeldingen visualisatie (1-shot):| 1-shot Referentieafbeelding voor VOGEL 🐦 | 1-shot Referentieafbeelding voor BOOT ⛵ |
|:-----------------------------------------:|:----------------------------------------:|
| |
|
0.1 Als alleen bbox-annotaties beschikbaar zijn
We bieden ook een script om instance-level segmentatiemaskers te genereren met SAM2. Dit is handig als je alleen bounding box-annotaties hebt voor de referentieafbeeldingen.
# Download sam_h checkpoint. Feel free to use more recent checkpoints (note: code might need to be adapted)
wget https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth -O checkpoints/sam_vit_h_4b8939.pth
Run automatic instance segmentation from ground truth bounding boxes.
python no_time_to_train/dataset/sam_bbox_to_segm_batch.py \
--input_json data/my_custom_dataset/annotations/custom_references.json \
--image_dir data/my_custom_dataset/images \
--sam_checkpoint checkpoints/sam_vit_h_4b8939.pth \
--model_type vit_h \
--device cuda \
--batch_size 8 \
--visualize
Referentieafbeeldingen met segmentatiemaskers op instantie-niveau (gegenereerd door SAM2 uit gt bounding boxes, 1-shot):Visualisaties van de gegenereerde segmentatiemaskers zijn opgeslagen in data/my_custom_dataset/annotations/custom_references_with_SAM_segm/references_visualisations/.
| 1-shot Referentieafbeelding voor VOGEL 🐦 (automatisch gesegmenteerd met SAM) | 1-shot Referentieafbeelding voor BOOT ⛵ (automatisch gesegmenteerd met SAM) |
|:---------------------------------:|:----------------------------------:|
| |
|
0.2 Zet coco-annotaties om naar pickle-bestand
python no_time_to_train/dataset/coco_to_pkl.py \
data/my_custom_dataset/annotations/custom_references_with_segm.json \
data/my_custom_dataset/annotations/custom_references_with_segm.pkl \
1
1. Vul het geheugen met referenties
Definieer eerst bruikbare variabelen en maak een map aan voor de resultaten. Voor een correcte visualisatie van labels moeten de class-namen geordend zijn op categorie-id, zoals deze voorkomt in het json-bestand. Bijvoorbeeld: bird heeft categorie-id 16, boat heeft categorie-id 9. Dus, CAT_NAMES=boat,bird.
DATASET_NAME=my_custom_dataset
DATASET_PATH=data/my_custom_dataset
CAT_NAMES=boat,bird
CATEGORY_NUM=2
SHOT=1
YAML_PATH=no_time_to_train/pl_configs/matching_cdfsod_template.yaml
PATH_TO_SAVE_CKPTS=./tmp_ckpts/my_custom_dataset
mkdir -p $PATH_TO_SAVE_CKPTS
Voer stap 1 uit:python run_lightening.py test --config $YAML_PATH \
--model.test_mode fill_memory \
--out_path $PATH_TO_SAVE_CKPTS/$DATASET_NAME\_$SHOT\_refs_memory.pth \
--model.init_args.dataset_cfgs.fill_memory.root $DATASET_PATH/images \
--model.init_args.dataset_cfgs.fill_memory.json_file $DATASET_PATH/annotations/custom_references_with_segm.json \
--model.init_args.dataset_cfgs.fill_memory.memory_pkl $DATASET_PATH/annotations/custom_references_with_segm.pkl \
--model.init_args.dataset_cfgs.fill_memory.memory_length $SHOT \
--model.init_args.dataset_cfgs.fill_memory.cat_names $CAT_NAMES \
--model.init_args.model_cfg.dataset_name $DATASET_NAME \
--model.init_args.model_cfg.memory_bank_cfg.length $SHOT \
--model.init_args.model_cfg.memory_bank_cfg.category_num $CATEGORY_NUM \
--trainer.devices 1
2. Geheugenbank na verwerking
python run_lightening.py test --config $YAML_PATH \
--model.test_mode postprocess_memory \
--ckpt_path $PATH_TO_SAVE_CKPTS/$DATASET_NAME\_$SHOT\_refs_memory.pth \
--out_path $PATH_TO_SAVE_CKPTS/$DATASET_NAME\_$SHOT\_refs_memory_postprocessed.pth \
--model.init_args.model_cfg.dataset_name $DATASET_NAME \
--model.init_args.model_cfg.memory_bank_cfg.length $SHOT \
--model.init_args.model_cfg.memory_bank_cfg.category_num $CATEGORY_NUM \
--trainer.devices 1#### 2.1 Visualiseer nabewerkte geheugenbank
python run_lightening.py test --config $YAML_PATH \
--model.test_mode vis_memory \
--ckpt_path $PATH_TO_SAVE_CKPTS/$DATASET_NAME\_$SHOT\_refs_memory_postprocessed.pth \
--model.init_args.dataset_cfgs.fill_memory.root $DATASET_PATH/images \
--model.init_args.dataset_cfgs.fill_memory.json_file $DATASET_PATH/annotations/custom_references_with_segm.json \
--model.init_args.dataset_cfgs.fill_memory.memory_pkl $DATASET_PATH/annotations/custom_references_with_segm.pkl \
--model.init_args.dataset_cfgs.fill_memory.memory_length $SHOT \
--model.init_args.dataset_cfgs.fill_memory.cat_names $CAT_NAMES \
--model.init_args.model_cfg.dataset_name $DATASET_NAME \
--model.init_args.model_cfg.memory_bank_cfg.length $SHOT \
--model.init_args.model_cfg.memory_bank_cfg.category_num $CATEGORY_NUM \
--trainer.devices 1
PCA- en K-means-visualisaties voor de geheugenbankafbeeldingen worden opgeslagen in results_analysis/memory_vis/my_custom_dataset.3. Inferentie op doeldataset-afbeeldingen
Als ONLINE_VIS op True staat, worden de predictieresultaten opgeslagen in results_analysis/my_custom_dataset/ en weergegeven zodra ze zijn berekend. LET OP dat draaien met online visualisatie veel langzamer is.
Voel je vrij om de score drempel VIS_THR aan te passen om meer of minder gesegmenteerde instanties te zien.
ONLINE_VIS=True
VIS_THR=0.4
python run_lightening.py test --config $YAML_PATH \
--model.test_mode test \
--ckpt_path $PATH_TO_SAVE_CKPTS/$DATASET_NAME\_$SHOT\_refs_memory_postprocessed.pth \
--model.init_args.model_cfg.dataset_name $DATASET_NAME \
--model.init_args.model_cfg.memory_bank_cfg.length $SHOT \
--model.init_args.model_cfg.memory_bank_cfg.category_num $CATEGORY_NUM \
--model.init_args.model_cfg.test.imgs_path $DATASET_PATH/images \
--model.init_args.model_cfg.test.online_vis $ONLINE_VIS \
--model.init_args.model_cfg.test.vis_thr $VIS_THR \
--model.init_args.dataset_cfgs.test.root $DATASET_PATH/images \
--model.init_args.dataset_cfgs.test.json_file $DATASET_PATH/annotations/custom_targets.json \
--model.init_args.dataset_cfgs.test.cat_names $CAT_NAMES \
--trainer.devices 1
Resultaten
Prestatie-indicatoren (met exact dezelfde parameters als de bovenstaande commando's) zouden moeten zijn:
BBOX RESULTS:
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.478SEGM RESULTS:
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.458
Visuele resultaten worden opgeslagen in results_analysis/my_custom_dataset/. Let op dat onze methode werkt voor false negatives, dat wil zeggen, afbeeldingen die geen exemplaren van de gewenste klassen bevatten.Klik op afbeeldingen om te vergroten ⬇️
| Doelafbeelding met boten ⛵ (links GT, rechts voorspellingen) | Doelafbeelding met vogels 🐦 (links GT, rechts voorspellingen) |
|:----------------------:|:----------------------:|
| |
|
| Doelafbeelding met boten en vogels ⛵🐦 (links GT, rechts voorspellingen) | Doelafbeelding zonder boten of vogels 🚫 (links GT, rechts voorspellingen) |
|:---------------------------------:|:----------------------------------:|
| |
|
🔬 Ablaties
Backbone ablatie
Om de overdraagbaarheid van onze methode over foundation models te evalueren, vervangen we zowel de semantische encoder (DINOv2) als de op SAM gebaseerde segmenter door verschillende alternatieven.
Semantische encoder ablatie:
# CLIP (Sizes: b16, b32, l14, l14@336px)
bash scripts/clip/clipl14@336px.sh
bash scripts/clip/clipl14.sh
bash scripts/clip/clipb16.sh
bash scripts/clip/clipb32.shDINOV3 (Sizes: b, l, h)
bash scripts/dinov3/dinov3b.sh
bash scripts/dinov3/dinov3l.sh
bash scripts/dinov3/dinov3h.shPE (Sizes: g14, l14)
bash scripts/pe/PEg14.sh
bash scripts/pe/PEl14.shSegmentatie-ablation:
# SAM2 (Sizes: tiny, small, base+, large)
bash scripts/sam2/sam2_tiny.sh
bash scripts/sam2/sam2_small.sh
bash scripts/sam2/sam2_base_plus.sh
bash scripts/baseline/dinov2_sam_baseline.sh # SAM2 LargeVLM-evaluatie op COCO few-shot dataset
We evalueren QWEN VLM op het COCO few-shot dataset.
bash scripts/vl-qwen/ablation-vl-qwen.shHeuristieken voor referentieafbeeldingen
Om te begrijpen waarom verschillende referentieafbeeldingen tot prestatievariatie leiden, analyseren we de statistische eigenschappen van COCO-novelle klasseannotaties.
#### ANALYSE
We bestuderen drie annotatiekenmerken: (1) maskeeroppervlak (objectgrootte), (2) maskeercentrumlocatie, en (3) afstand tot de afbeeldingsranden.
Instructies:
# Mask area distribution
python no_time_to_train/make_plots/mask_area_distribution.py \
--input data/coco/annotations/instances_val2017.json \
--output no_time_to_train/make_plots/mask_area_distribution/mask_area_distribution.png \
--edges-output no_time_to_train/make_plots/mask_area_distribution/bbox_edge_distance_histograms.png \
--center-output no_time_to_train/make_plots/mask_area_distribution/bbox_center_density.png \
--bins 80 \
--distance-bins 80 \
--disable-center-densityBbox center positions
python no_time_to_train/make_plots/bbox_positions.py \
--per-class-root data/coco/annotations/per_class_instances \
--filename centeredness_2d_hist_plain.png \
--max-cols 6 \
--output-dir ./no_time_to_train/make_plots/bbox_positions \
--outfile grid_bbox_positions.png
[UITVOER] Maskeroppervlakteverdeling
[UITVOER] Dichtheid van bbox-centra
[UITVOER] Histogrammen van bbox-randafstanden
#### SELECTIE
We nemen 100 diverse referentieafbeeldingen per klasse, expliciet gespreid over een reeks maskergroottes, centra en randafstanden. Elke referentie wordt geëvalueerd op een vaste verkleinde validatieset.
Instructies:
Setup script: scripts/1shot_ref_ablation/setup.sh:
- Maak per klasse een json-bestand aan
- Analyseer specifieke klasse
- Maak referentieset met verschillende heuristieken
bash scripts/1shot_ref_ablation/setup.shVoer scripts uit: scripts/1shot_ref_ablation/gpu*.sh:
- Voer de pijplijn uit voor elke referentieset
# Example launch script that calls template script for each reference set
bash scripts/1shot_ref_ablation/gpu0.sh#### RESULTATEN
We analyseren hoe detectiescores correleren met kenmerken van referentieafbeeldingen (maskergrootte, centrale positie, afstand tot rand).
Instructies:
python no_time_to_train/make_plots/heuristics_analysis.py
Outputs:
- no_time_to_train/make_plots/heuristics_analysis/heatmap_bbox_norm_scores.png
- no_time_to_train/make_plots/heuristics_analysis/heatmap_segm_norm_scores.png
- no_time_to_train/make_plots/heuristics_analysis/heatmap_center_bbox_norm_scores_kde_smooth.png
- no_time_to_train/make_plots/heuristics_analysis/heatmap_center_bbox_norm_scores.png
- no_time_to_train/make_plots/heuristics_analysis/heatmap_center_segm_norm_scores_kde_smooth.png
- no_time_to_train/make_plots/heuristics_analysis/heatmap_center_segm_norm_scores.png
- no_time_to_train/make_plots/heuristics_analysis/per_class_area_vs_raw_scores.png
- no_time_to_train/make_plots/heuristics_analysis/all_classes_area_vs_norm_scores.png
- no_time_to_train/make_plots/heuristics_analysis/edge_distance_vs_norm_scores.png
- no_time_to_train/make_plots/heuristics_analysis/bars_area_category_norm_scores.png
- no_time_to_train/make_plots/heuristics_analysis/bars_centered_norm_scores.png
- no_time_to_train/make_plots/heuristics_analysis/bars_avoid_sides_norm_scores.png
[OUTPUT] Staafdiagrammen. Effect van maskergebied (links) en gecentreerdheid (rechts) op prestaties
[OUTPUT] Heatmaps. 2D-scoorkaarten van prestaties als functie van maskercentrumlocatie
[OUTPUT] Referentie-beeld prestaties vs. maskergebied voor alle nieuwe COCO-klassen
Referentie-beeld degradatie
We evalueren onze methode onder progressief gedegradeerde referentiebeelden door toenemende
niveaus van Gaussiaanse vervaging toe te passen.
Instructies:
# Run different blur levels
bash scripts/blur_ablation/blur_ablation.shPlot grid of blur ablation results
python no_time_to_train/make_plots/plot_blur_results.py \
--results-root ./work_dirs/blur_ablation \
--class-id 0 \
--max-cols 4 \
--output-dir ./no_time_to_train/make_plots/blur_ablation \
--outfile grid_blur_ablation_class_0.pngKenmerkovereenkomst
Script voor het visualiseren van kenmerkovereenkomst tussen referentieafbeeldingen en doelafbeeldingen.
Het genereert enkelvoudige kenmerkovereenkomst (padkenmerken) en prototype-gebaseerde overeenkomst (geaggregeerde kenmerken).
Instructies:
python no_time_to_train/make_plots/feature_similarity.py \
--classes orange \
--num-images 20 \
--min-area 12 \
--max-area 25000 \
--min-instances 2 \
--seed 123 \
--max-per-class 12
T-SNE plots (DINOv2 kenmerkenscheidbaarheid)
t-SNE van DINOv2 kenmerken toont duidelijke scheiding voor uiteenlopende klassen
maar sterke overlap voor vergelijkbare, wat suggereert dat verwarring voortkomt uit
de geometrie van backbone kenmerken in plaats van de selectie van prototypes.
Instructies:
Extraheer kenmerken
python no_time_to_train/make_plots/tsne-coco.py --extractPlot T-SNE grafieken
# Example spoon vs fork
python no_time_to_train/make_plots/tsne-coco.py --classes cat dog🛠️ Helpers
Visualiseer geheugen
voeg afbeelding feature_comparison_small.png hier toe
Instructies
Om de geheugenbank (PCA- en K-means-visualisaties) voor een bepaald experiment te visualiseren, pas je het volgende commando aan.
Stel DO_NOT_CROP in op True/False (in no_time_to_train/models/Sam2MatchingBaseline_noAMG.py) om de referentieafbeelding met/zonder het bijgesneden masker te visualiseren.
python run_lightening.py test --config $CONFIG \
--model.test_mode vis_memory \
--ckpt_path $RESULTS_DIR/memory_postprocessed.ckpt \
--model.init_args.dataset_cfgs.fill_memory.memory_pkl $RESULTS_DIR/$FILENAME \
--model.init_args.dataset_cfgs.fill_memory.memory_length $SHOT \
--model.init_args.dataset_cfgs.fill_memory.class_split $CLASS_SPLIT \
--model.init_args.model_cfg.dataset_name $CLASS_SPLIT \
--model.init_args.model_cfg.memory_bank_cfg.length $SHOT \
--model.init_args.model_cfg.memory_bank_cfg.category_num $CATEGORY_NUM \
--trainer.devices 1
Afbeeldingen wijzigen naar 512x512 (maak de afbeeldingen vierkant)
Om de afbeeldingen te wijzigen naar 512x512 en op te slaan in een nieuwe map, voer je de volgende opdracht uit. Dit is voor de figuren uit het paper.
Instructies:
python no_time_to_train/make_plots/paper_fig_square_imgs.py
Modelgrootte en geheugen
Om de modelgrootte en het geheugen te berekenen, voer je de volgende opdracht uit.
Instructies:
- Zie
no_time_to_train/models/Sam2MatchingBaseline_noAMG_model_and_memory.pyvoor de berekening van modelgrootte en geheugen.
🌍 EO-datasets
Evaluatiescripts (EO-datasets)
Evaluatiescripts zijn te vinden in de map scripts/EO. De EO-datasets gebruiken het script ./scripts/EO/EO_template.sh om de evaluatie uit te voeren.
Elke EO-experimentrun wordt opgeslagen in de map ./EO_results. In de experimentmap bewaren we:
- Het summary.txt-bestand met de configuratie en de looptijd van het experiment.
- De voorspellingvisualisaties op de testset (
results_analysis-map). - De geheugenvisualisaties (
memory_vis-map). - Het pickle-bestand met few-shot annotaties.
- De checkpoints van het model (indien niet opgeschoond).
Figuren en tabellen
Aanvullende scripts voor het genereren van figuren en tabellen.Samenvattende latex-tabel van de EO-datasets:
python scripts/convert_datasets/summary_table_datasets.py
Genereer LaTeX-tabel van de EO-datasets:
python scripts/paper_figures/table_EO_results.py ./EO_results_no_heuristics
Nauwkeurigheidsplot van de EO-datasets:
python scripts/paper_figures/plot_EO_accuracy.py \
--input-root ./EO_results \
--output-root ./EO_resultsSamenvatting van het effect van heuristieken op de EO-datasets:
python scripts/paper_figures/plot_EO_heuristic.py \
--no-heuristics ./EO_results_no_heuristics \
--heuristics ./EO_results
Runtime plot van de EO-datasets:
python scripts/paper_figures/plot_EO_runtime.py \
--input-root ./EO_results \
--output-root ./EO_resultsGenereer EO-rastervisualisaties voor figuur in het artikel:
python scripts/paper_figures/plot_EO_grid.py \
--root ./EO_results_no_heuristics \
--dataset ISAID \
--shots 1📚 Citation
If you use this work, please cite us:
@article{espinosa2025notimetotrain,
title={No time to train! Training-Free Reference-Based Instance Segmentation},
author={Miguel Espinosa and Chenhongyi Yang and Linus Ericsson and Steven McDonagh and Elliot J. Crowley},
journal={arXiv preprint arXiv:2507.02798},
year={2025},
primaryclass={cs.CV}
}--- Tranlated By Open Ai Tx | Last indexed: 2026-03-13 ---