How psgame/iim-smcm works
This repository implements few-shot out-of-distribution detection with IIM/SMCM-style local prompts, built around a local CLIP model and Dassl training infrastructure. The main workflow prepares ImageNet ID data, trains prompt parameters using global-guided negative augmentation and local regional regularization, then scores ID and OOD images during evaluation. The README describes these method capabilities; sampled source confirms the IIM trainer, CLIP components, dataset handling, and loader utilities, but does not show the complete training or evaluation call paths.
Main entry points: eval_ood_detection.py OOD evaluation · iim.py IIM trainer · train_eval_util.py Image loaders · train.py Train entry
Components 16
Training and evaluation
- Train entry
train.py - OOD evaluation
eval_ood_detection.py - Zero-shot evaluation
eval_ood_detection_zero_shot.py - Detection scores
trainers/utils/score_function.py - Detection utilities
utils/detection_util.py
Image data
- ImageNet datasets
datasets/imagenet.py - Image loaders
utils/train_eval_util.py - Data manager
Dassl/dassl/data/data_manager.py - OOD collections
utils/train_eval_util.py
IIM method
- IIM trainer
trainers/iim.py - Prompt learner
trainers/iim.py - Regional objectives
trainers/iim.py
Model runtime
- Trainer runtime
Dassl/dassl/engine/trainer.py - Local CLIP
clip_w_local/model.py - CLIP setup
utils/train_eval_util.py
Other components
- Research user
Connections 21
- Research user → Train entry: starts training
- Research user → OOD evaluation: runs evaluation
- Train entry → Data manager: requests batches
- Data manager → ImageNet datasets: builds dataset
- Data manager → Image loaders: builds loaders
- Train entry → IIM trainer: selects trainer
- IIM trainer → Trainer runtime: uses runtime
- IIM trainer → Prompt learner: optimizes prompts
- Prompt learner → Local CLIP: encodes prompts
- IIM trainer → Regional objectives: computes objectives
- IIM trainer → Local CLIP: encodes images
- OOD evaluation → Image loaders: loads ID images
- Image loaders → ImageNet datasets: reads ID samples
- OOD evaluation → OOD collections: loads OOD images
- OOD evaluation → CLIP setup: initializes model
- CLIP setup → Local CLIP: loads CLIP
- OOD evaluation → Detection scores: computes scores
- OOD evaluation → Detection utilities: reports detection
- Research user → Zero-shot evaluation: runs baseline
- Zero-shot evaluation → Image loaders: loads validation data
- Zero-shot evaluation → CLIP setup: initializes model