Web Analytics

no-time-to-train

⭐ 292 stars German by miquel-espinosa

🌐 Sprache

🚀 Keine Zeit zum Trainieren!

Trainingsfreie Referenzbasierte Instanzsegmentierung

GitHub Website arXiv

Stand der Technik (Papers with Code) _SOTA 1-shot_ | PWC-21CBCE?style=flat&logo=paperswithcode)

_SOTA 10-shot_ | PWC-21CBCE?style=flat&logo=paperswithcode)

_SOTA 30-shot_ | PWC-21CBCE?style=flat&logo=paperswithcode)


🚨 Update (5. Februar 2026): Das Manuskript des Papers wurde mit umfangreichen Ablationsstudien, Visualisierungen und zusätzlichen Experimenten aktualisiert.
🚨 Update (22. Juli 2025): Anweisungen für benutzerdefinierte Datensätze wurden hinzugefügt!
🔔 Update (16. Juli 2025): Der Code wurde mit Anweisungen aktualisiert!


📋 Inhaltsverzeichnis

🎯 Highlights

Links:

📜 Zusammenfassung

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).

cdfsod-results-final-comic-sans-min

🧠 Architecture

training-free-architecture-comic-sans-min

🛠️ 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-Umgebung erstellen

Wir werden eine Conda-Umgebung mit den benötigten Paketen erstellen.

conda env create -f environment.yml
conda activate no-time-to-train

3. Installieren Sie SAM2 und DINOv2

Wir werden SAM2 und DINOv2 aus dem Quellcode installieren.

pip install -e .
cd dinov2
pip install -e .
cd ..

4. Datensätze herunterladen

Bitte laden Sie den COCO-Datensatz herunter und platzieren Sie ihn in data/coco

5. SAM2- und DINOv2-Checkpoints herunterladen

Wir werden die exakt im Paper verwendeten SAM2-Checkpoints herunterladen. (Beachten Sie jedoch, dass SAM2.1-Checkpoints bereits verfügbar sind und möglicherweise bessere Ergebnisse liefern.)

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 ../..

📊 Inferenzcode

⚠️ Haftungsausschluss: Dies ist Forschungscode – erwarten Sie ein wenig Chaos!

Reproduktion der 30-shot SOTA-Ergebnisse bei Few-shot COCO

Definieren Sie nützliche Variablen und erstellen Sie einen Ordner für die Ergebnisse:

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=4

mkdir -p $RESULTS_DIR FILENAME=few_shot_${SHOTS}shot_seed${SEED}.pkl

#### 0. Referenzsatz erstellen

python no_time_to_train/dataset/few_shot_sampling.py \
        --n-shot $SHOTS \
        --out-path ${RESULTS_DIR}/${FILENAME} \
        --seed $SEED \
        --dataset $CLASS_SPLIT
#### 1. Speicher mit Referenzen füllen

python 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. Nachbearbeitung des Speicherbanks

python 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. Inferenz auf Zielbildern

python 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
Wenn Sie die Inferenz-Ergebnisse online sehen möchten (während sie berechnet werden), fügen Sie das Argument hinzu:

    --model.init_args.model_cfg.test.online_vis True
Um den Schwellenwertparameter score_thr anzupassen, fügen Sie das Argument hinzu (zum Beispiel, um alle Instanzen mit einem Score höher als 0.4 zu visualisieren):
    --model.init_args.model_cfg.test.vis_thr 0.4
Bilder werden nun im Verzeichnis results_analysis/few_shot_classes/ gespeichert. Das Bild links zeigt die Ground Truth, das Bild rechts zeigt die segmentierten Instanzen, die durch unsere trainingsfreie Methode gefunden wurden.

Beachten Sie, dass in diesem Beispiel der few_shot_classes-Split verwendet wird. Daher sollten nur segmentierte Instanzen der Klassen in diesem Split erwartet werden (nicht alle Klassen in COCO).

#### Ergebnisse

Nach der Auswertung aller Bilder im Validierungsdatensatz sollten Sie folgendes erhalten:

BBOX RESULTS:
  Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.368

SEGM RESULTS: Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.342


🔍 Benutzerdefiniertes Datenset

Wir stellen Anleitungen zur Verfügung, wie Sie unsere Pipeline mit einem benutzerdefinierten Datenset ausführen können. Das Annotationsformat ist immer im COCO-Format.

TLDR; Um direkt zu sehen, wie die vollständige Pipeline auf benutzerdefinierten Datensätzen ausgeführt wird, schauen Sie in scripts/matching_cdfsod_pipeline.sh zusammen mit Beispielskripten der CD-FSOD-Datensätze (z.B. scripts/dior_fish.sh)

0. Vorbereitung eines benutzerdefinierten Datensets ⛵🐦

Angenommen, wir möchten Boote⛵ und Vögel🐦 in einem benutzerdefinierten Datenset erkennen. Um unsere Methode zu verwenden, benötigen wir:

Wir haben ein Beispielskript vorbereitet, um mit COCO-Bildern ein benutzerdefiniertes Datenset für ein 1-Shot-Setting zu erstellen.
mkdir -p data/my_custom_dataset
python scripts/make_custom_dataset.py
Dadurch wird ein benutzerdefiniertes Dataset mit der folgenden Ordnerstruktur erstellt:
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)
Referenzbild-Visualisierung (1-shot):

| 1-shot Referenzbild für VOGEL 🐦 | 1-shot Referenzbild für BOOT ⛵ | |:-------------------------------:|:-------------------------------:| | bird_1 | boat_1 |

0.1 Falls nur Bbox-Anmerkungen verfügbar sind

Wir stellen auch ein Skript bereit, um instanzbasierte Segmentierungsmasken mit SAM2 zu generieren. Dies ist nützlich, wenn Sie für die Referenzbilder nur Bounding-Box-Anmerkungen zur Verfügung haben.

# 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
Referenzbilder mit Instanz-Segmentierungsmasken (generiert von SAM2 aus gt-Bounding-Boxen, 1-shot):

Visualisierung der generierten Segmentierungsmasken sind gespeichert in data/my_custom_dataset/annotations/custom_references_with_SAM_segm/references_visualisations/.

| 1-shot Referenzbild für VOGEL 🐦 (automatisch segmentiert mit SAM) | 1-shot Referenzbild für BOOT ⛵ (automatisch segmentiert mit SAM) | |:---------------------------------:|:----------------------------------:| | bird_1_with_SAM_segm | boat_1_with_SAM_segm |

0.2 Konvertiere coco-Annotationen in eine Pickle-Datei

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. Speicher mit Referenzen füllen

Definieren Sie zunächst nützliche Variablen und erstellen Sie einen Ordner für die Ergebnisse. Für die korrekte Visualisierung der Labels sollten die Klassennamen nach der Kategorie-ID sortiert werden, wie sie in der JSON-Datei erscheint. Zum Beispiel hat bird die Kategorie-ID 16, boat hat die Kategorie-ID 9. Daher gilt: 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
Führen Sie Schritt 1 aus:

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. Nachbearbeitungsspeicherbank

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 Visualisierung der nachverarbeiteten Speicherbank

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- und K-means-Visualisierungen für die Memory-Bank-Bilder sind in results_analysis/memory_vis/my_custom_dataset gespeichert.

3. Inferenz auf Zielbildern

Wenn ONLINE_VIS auf True gesetzt ist, werden die Vorhersageergebnisse in results_analysis/my_custom_dataset/ gespeichert und während der Berechnung angezeigt. BEACHTEN SIE, dass der Lauf mit Online-Visualisierung deutlich langsamer ist.

Sie können gerne den Score-Schwellenwert VIS_THR ändern, um mehr oder weniger segmentierte Instanzen zu sehen.

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

Ergebnisse

Leistungskennzahlen (mit genau denselben Parametern wie bei den obigen Befehlen) sollten wie folgt sein:

BBOX RESULTS:
  Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.478

SEGM RESULTS: Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.458

Visuelle Ergebnisse werden in results_analysis/my_custom_dataset/ gespeichert. Beachten Sie, dass unsere Methode für False Negatives funktioniert, also für Bilder, die keine Instanzen der gewünschten Klassen enthalten.

Klicken Sie auf die Bilder, um sie zu vergrößern ⬇️

| Zielbild mit Booten ⛵ (links GT, rechts Vorhersagen) | Zielbild mit Vögeln 🐦 (links GT, rechts Vorhersagen) | |:----------------------:|:----------------------:| | 000000459673 | 000000407180 |

| Zielbild mit Booten und Vögeln ⛵🐦 (links GT, rechts Vorhersagen) | Zielbild ohne Boote oder Vögel 🚫 (links GT, rechts Vorhersagen) | |:---------------------------------:|:----------------------------------:| | 000000517410 | 000000460598 |

🔬 Ablationen

Backbone-Ablation

Um die Übertragbarkeit unserer Methode auf verschiedene Foundation-Modelle zu bewerten, ersetzen wir sowohl den semantischen Encoder (DINOv2) als auch den auf SAM basierenden Segmentierer durch mehrere Alternativen.

Semantische Encoder-Ablation:

# 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.sh

DINOV3 (Sizes: b, l, h)

bash scripts/dinov3/dinov3b.sh bash scripts/dinov3/dinov3l.sh bash scripts/dinov3/dinov3h.sh

PE (Sizes: g14, l14)

bash scripts/pe/PEg14.sh bash scripts/pe/PEl14.sh

Segmentierer-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 Large

VLM-Auswertung auf dem COCO Few-Shot-Datensatz

Wir bewerten QWEN VLM auf dem COCO Few-Shot-Datensatz.

bash scripts/vl-qwen/ablation-vl-qwen.sh

Heuristiken für Referenzbilder

Um zu verstehen, warum unterschiedliche Referenzbilder zu Leistungsschwankungen führen, analysieren wir die statistischen Eigenschaften der COCO-Anmerkungen für neue Klassen.

#### ANALYSE

Wir untersuchen drei Annotationsmerkmale: (1) Maskenfläche (Objektgröße), (2) Maskenzentrumslage und (3) Abstand zu den Bildrändern.

Anweisungen:

# 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-density

Bbox 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

[AUSGABE] Maskenflächenverteilung mask_area_distribution

[AUSGABE] Bbox-Zentrum-Dichte grid_bbox_positions

[AUSGABE] Bbox-Kantenabstand-Histogramme bbox_edge_distance_histograms

#### AUSWAHL

Wir wählen für jede Klasse 100 verschiedene Referenzbilder aus, die explizit eine Bandbreite an Maskengrößen, Zentren und Kantenabständen abdecken. Jede Referenz wird auf einem festen, reduzierten Validierungsteilmenge evaluiert.

Anleitung:

Setup-Skript: scripts/1shot_ref_ablation/setup.sh:

  • Erstelle eine JSON-Datei pro Klasse
  • Analysiere eine bestimmte Klasse
  • Erstelle Referenzsatz mit verschiedenen Heuristiken
bash scripts/1shot_ref_ablation/setup.sh

Skripte ausführen: scripts/1shot_ref_ablation/gpu*.sh:

  • Pipeline für jedes Referenzset ausführen
# Example launch script that calls template script for each reference set
bash scripts/1shot_ref_ablation/gpu0.sh

#### ERGEBNISSE

Wir analysieren, wie Erkennungswerte mit den Eigenschaften der Referenzbilder korrelieren (Maskengröße, Mittelpunktposition, Abstand zum Rand).

Anleitung:

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

[AUSGABE] Balkendiagramme. Einfluss der Maskenfläche (links) und Zentriertheit (rechts) auf die Leistung barplot

[AUSGABE] Heatmaps. 2D-Scorekarten der Leistung in Abhängigkeit vom Maskenzentrum heatmap

[AUSGABE] Referenzbild-Leistung vs. Maskenfläche für alle neuen COCO-Klassen class_performance

Verschlechterung des Referenzbildes

Wir evaluieren unsere Methode mit schrittweise verschlechterten Referenzbildern, indem wir zunehmende Stufen von Gaußscher Unschärfe anwenden. ablation-blur

Anleitung:

# Run different blur levels
bash scripts/blur_ablation/blur_ablation.sh

Plot 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.png

Merkmalähnlichkeit

Skript zur Visualisierung der Merkmalähnlichkeit zwischen Referenzbildern und Zielbildern.

Es erzeugt Einzelmerkmal-Ähnlichkeiten (Pfadmerkmale) und prototypbasierte Ähnlichkeiten (aggregierte Merkmale). feature_similarity_small

Anleitung:

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-Diagramme (DINOv2-Feature-Trennschärfe)

t-SNE der DINOv2-Features zeigt eine klare Trennung für unähnliche Klassen, aber starke Überlappung bei ähnlichen, was darauf hindeutet, dass die Verwechslung eher von der Geometrie der Backbone-Features als von der Auswahl der Prototypen herrührt. tsne

Anleitung:

Features extrahieren

python no_time_to_train/make_plots/tsne-coco.py --extract

T-SNE-Diagramme darstellen

# Example spoon vs fork
python no_time_to_train/make_plots/tsne-coco.py --classes cat dog

🛠️ Helfer

Arbeitsspeicher visualisieren

Fügen Sie das Bild feature_comparison_small.png hier ein

Anleitung

Um die Memory Bank (PCA- und K-means-Visualisierungen) für ein bestimmtes Experiment zu visualisieren, passen Sie den folgenden Befehl an.

Setzen Sie DO_NOT_CROP auf True/False (in no_time_to_train/models/Sam2MatchingBaseline_noAMG.py), um das Referenzbild mit/ohne die zugeschnittene Maske throughzusehen.

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

Bilder auf 512x512 skalieren (Bilder quadratisch machen)

Um die Bilder auf 512x512 zu skalieren und in ein neues Verzeichnis zu speichern, führen Sie den folgenden Befehl aus. Dies gilt für die Abbildungen im Paper.

Anleitung:

python no_time_to_train/make_plots/paper_fig_square_imgs.py

Modellgröße und Speicher

Um die Modellgröße und den Speicher zu berechnen, führen Sie den folgenden Befehl aus.

Anleitung:

  • Siehe no_time_to_train/models/Sam2MatchingBaseline_noAMG_model_and_memory.py für die Berechnung der Modellgröße und des Speichers.
(Am einfachsten: vorübergehend durch Sam2MatchingBaseline_noAMG.py ersetzen, dann wieder umbenennen.)

🌍 EO-Datensätze

Auswertungsskripte (EO-Datensätze)

Auswertungsskripte befinden sich im Verzeichnis scripts/EO. Die EO-Datensätze verwenden das Skript ./scripts/EO/EO_template.sh für die Auswertung.

Jeder EO-Experimentdurchlauf wird im Verzeichnis ./EO_results gespeichert. Im Experimentordner speichern wir:

Abbildungen und Tabellen

Zusätzliche Skripte zur Erstellung von Abbildungen und Tabellen.

Zusammenfassende LaTeX-Tabelle der EO-Datensätze:

python scripts/convert_datasets/summary_table_datasets.py

Generiere LaTeX-Tabelle der EO-Datensätze:

python scripts/paper_figures/table_EO_results.py ./EO_results_no_heuristics

Genauigkeitsdiagramm der EO-Datensätze:

python scripts/paper_figures/plot_EO_accuracy.py \
  --input-root ./EO_results \
  --output-root ./EO_results

Zusammenfassung der Auswirkungen von Heuristiken auf die EO-Datensätze:

python scripts/paper_figures/plot_EO_heuristic.py \
  --no-heuristics ./EO_results_no_heuristics \
  --heuristics ./EO_results

Laufzeitdiagramm der EO-Datensätze:

python scripts/paper_figures/plot_EO_runtime.py \
  --input-root ./EO_results \
  --output-root ./EO_results

Erzeuge EO-Gittervisualisierungen für die Abbildung im Papier:

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 ---