├── .gitignore ├── LICENSE ├── README.md ├── clip ├── __init__.py ├── bpe_simple_vocab_16e6.txt.gz ├── clip.py ├── model.py └── simple_tokenizer.py ├── clip_words.csv ├── configs ├── calibration │ └── TempScaling │ │ └── ep20_lr5e-2.yaml ├── datasets │ ├── caltech101.yaml │ ├── dtd.yaml │ ├── eurosat.yaml │ ├── fgvc_aircraft.yaml │ ├── food101.yaml │ ├── imagenet.yaml │ ├── imagenet_a.yaml │ ├── imagenet_r.yaml │ ├── imagenet_sketch.yaml │ ├── imagenetv2.yaml │ ├── oxford_flowers.yaml │ ├── oxford_pets.yaml │ ├── stanford_cars.yaml │ ├── sun397.yaml │ └── ucf101.yaml └── trainers │ ├── CLIP_Adapter │ └── vit_b16_c4_ep200_batch32.yaml │ ├── CoCoOp │ ├── rn50_c4_ep10_batch1.yaml │ ├── vit_b16_c4_ep10_batch1.yaml │ ├── vit_b32_c4_ep10_batch1.yaml │ └── vit_l14_c4_ep10_batch1.yaml │ ├── CoOp │ ├── rn50_c16_ep200_batch32.yaml │ ├── vit_b16_c16_ep200_batch32.yaml │ ├── vit_b32_c16_ep200_batch32.yaml │ └── vit_l14_c16_ep200_batch32.yaml │ ├── KgCoOp │ ├── rn50_c16_ep200_batch32.yaml │ ├── vit_b16_c16_ep200_batch32.yaml │ ├── vit_b32_c16_ep200_batch32.yaml │ └── vit_l14_c16_ep200_batch32.yaml │ ├── MaPLe │ ├── rn50_c2_ep5_batch4.yaml │ ├── vit_b16_c2_ep5_batch4.yaml │ ├── vit_b32_c2_ep5_batch4.yaml │ └── vit_l14_c2_ep5_batch4.yaml │ ├── ProDA │ ├── rn50_c16_ep100_batch4.yaml │ ├── vit_b16_c16_ep100_batch4.yaml │ ├── vit_b32_c16_ep100_batch4.yaml │ └── vit_l14_c16_ep100_batch4.yaml │ ├── ProGrad │ ├── rn50_c16_ep100_batch32.yaml │ ├── vit_b16_c16_ep100_batch32.yaml │ ├── vit_b32_c16_ep100_batch32.yaml │ └── vit_l14_c16_ep100_batch32.yaml │ ├── PromptSRC │ ├── rn50_c4_ep50_batch4.yaml │ ├── vit_b16_c4_ep50_batch4.yaml │ ├── vit_b32_c4_ep50_batch4.yaml │ └── vit_l14_c4_ep50_batch4.yaml │ ├── TaskRes │ └── vit_b16_c16_ep200_batch256.yaml │ ├── VPT │ └── vit_b16_c2_ep5_batch4_4.yaml │ └── ZeroshotCLIP │ ├── rn50.yaml │ ├── rn50_c0_ep0_batch0.yaml │ ├── vit_b16.yaml │ ├── vit_b16_c0_ep0_batch0.yaml │ ├── vit_b32.yaml │ ├── vit_b32_c0_ep0_batch0.yaml │ ├── vit_l14.yaml │ └── vit_l14_c0_ep0_batch0.yaml ├── datasets ├── __init__.py ├── caltech101.py ├── dtd.py ├── eurosat.py ├── fgvc_aircraft.py ├── food101.py ├── imagenet.py ├── imagenet_a.py ├── imagenet_r.py ├── imagenet_sketch.py ├── imagenetv2.py ├── oxford_flowers.py ├── oxford_pets.py ├── stanford_cars.py ├── sun397.py └── ucf101.py ├── docs ├── DATASETS.md ├── INSTALL.md └── RUN.md ├── evaluators ├── __init__.py └── vl_evaluator.py ├── figures └── ece.png ├── interpret_prompts ├── clip_words.csv └── interpret_prompt.py ├── parse_test_res.py ├── requirements.txt ├── run ├── calibration │ ├── fewshot_bin.sh │ ├── fewshot_scaling.sh │ ├── zeroshot_bin.sh │ └── zeroshot_scaling.sh └── classification │ ├── fewshot.sh │ └── zeroshot.sh ├── scripts ├── calibration │ ├── base2new_scaling_test.sh │ └── base2new_scaling_train.sh └── classification │ ├── base2new_fewshot_test.sh │ ├── base2new_fewshot_train.sh │ ├── base2new_zeroshot_base.sh │ ├── base2new_zeroshot_new.sh │ ├── xd_fewshot_test.sh │ ├── xd_fewshot_train.sh │ └── xd_zeroshot_test.sh ├── tools ├── logger.py ├── metrics.py ├── plot.py └── zsclip_encoder.py ├── train.py └── trainers ├── calibration ├── __init__.py ├── base_model │ ├── __init__.py │ ├── clip_adapter.py │ ├── cocoop.py │ ├── coop.py │ ├── imagenet_templates.py │ ├── kgcoop.py │ ├── maple.py │ ├── proda.py │ ├── prograd.py │ ├── promptsrc.py │ ├── utils.py │ └── zsclip.py ├── basemodel_loader.py ├── density_ratio_calibration.py ├── distanse_aware_calibration.py ├── multi_isotonic_regression.py ├── multi_proximity_isotonic.py ├── proximity.py ├── tempscaling.py └── vl_calibrator.py └── classification ├── __init__.py ├── base_learner.py ├── clip_adapter.py ├── cocoop.py ├── coop.py ├── imagenet_a_r_indexes_v2.py ├── imagenet_templates.py ├── kgcoop.py ├── maple.py ├── proda.py ├── prograd.py ├── promptsrc.py ├── taskres.py ├── vpt.py └── zsclip.py /.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/.gitignore -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/LICENSE -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/README.md -------------------------------------------------------------------------------- /clip/__init__.py: -------------------------------------------------------------------------------- 1 | from .clip import * 2 | -------------------------------------------------------------------------------- /clip/bpe_simple_vocab_16e6.txt.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/clip/bpe_simple_vocab_16e6.txt.gz -------------------------------------------------------------------------------- /clip/clip.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/clip/clip.py -------------------------------------------------------------------------------- /clip/model.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/clip/model.py -------------------------------------------------------------------------------- /clip/simple_tokenizer.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/clip/simple_tokenizer.py -------------------------------------------------------------------------------- /clip_words.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/clip_words.csv -------------------------------------------------------------------------------- /configs/calibration/TempScaling/ep20_lr5e-2.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/calibration/TempScaling/ep20_lr5e-2.yaml -------------------------------------------------------------------------------- /configs/datasets/caltech101.yaml: -------------------------------------------------------------------------------- 1 | DATASET: 2 | NAME: "Caltech101" 3 | -------------------------------------------------------------------------------- /configs/datasets/dtd.yaml: -------------------------------------------------------------------------------- 1 | DATASET: 2 | NAME: "DescribableTextures" 3 | -------------------------------------------------------------------------------- /configs/datasets/eurosat.yaml: -------------------------------------------------------------------------------- 1 | DATASET: 2 | NAME: "EuroSAT" 3 | -------------------------------------------------------------------------------- /configs/datasets/fgvc_aircraft.yaml: -------------------------------------------------------------------------------- 1 | DATASET: 2 | NAME: "FGVCAircraft" 3 | -------------------------------------------------------------------------------- /configs/datasets/food101.yaml: -------------------------------------------------------------------------------- 1 | DATASET: 2 | NAME: "Food101" 3 | -------------------------------------------------------------------------------- /configs/datasets/imagenet.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/datasets/imagenet.yaml -------------------------------------------------------------------------------- /configs/datasets/imagenet_a.yaml: -------------------------------------------------------------------------------- 1 | DATASET: 2 | NAME: "ImageNetA" 3 | -------------------------------------------------------------------------------- /configs/datasets/imagenet_r.yaml: -------------------------------------------------------------------------------- 1 | DATASET: 2 | NAME: "ImageNetR" 3 | -------------------------------------------------------------------------------- /configs/datasets/imagenet_sketch.yaml: -------------------------------------------------------------------------------- 1 | DATASET: 2 | NAME: "ImageNetSketch" 3 | -------------------------------------------------------------------------------- /configs/datasets/imagenetv2.yaml: -------------------------------------------------------------------------------- 1 | DATASET: 2 | NAME: "ImageNetV2" 3 | -------------------------------------------------------------------------------- /configs/datasets/oxford_flowers.yaml: -------------------------------------------------------------------------------- 1 | DATASET: 2 | NAME: "OxfordFlowers" -------------------------------------------------------------------------------- /configs/datasets/oxford_pets.yaml: -------------------------------------------------------------------------------- 1 | DATASET: 2 | NAME: "OxfordPets" -------------------------------------------------------------------------------- /configs/datasets/stanford_cars.yaml: -------------------------------------------------------------------------------- 1 | DATASET: 2 | NAME: "StanfordCars" 3 | -------------------------------------------------------------------------------- /configs/datasets/sun397.yaml: -------------------------------------------------------------------------------- 1 | DATASET: 2 | NAME: "SUN397" 3 | -------------------------------------------------------------------------------- /configs/datasets/ucf101.yaml: -------------------------------------------------------------------------------- 1 | DATASET: 2 | NAME: "UCF101" 3 | -------------------------------------------------------------------------------- /configs/trainers/CLIP_Adapter/vit_b16_c4_ep200_batch32.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/CLIP_Adapter/vit_b16_c4_ep200_batch32.yaml -------------------------------------------------------------------------------- /configs/trainers/CoCoOp/rn50_c4_ep10_batch1.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/CoCoOp/rn50_c4_ep10_batch1.yaml -------------------------------------------------------------------------------- /configs/trainers/CoCoOp/vit_b16_c4_ep10_batch1.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/CoCoOp/vit_b16_c4_ep10_batch1.yaml -------------------------------------------------------------------------------- /configs/trainers/CoCoOp/vit_b32_c4_ep10_batch1.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/CoCoOp/vit_b32_c4_ep10_batch1.yaml -------------------------------------------------------------------------------- /configs/trainers/CoCoOp/vit_l14_c4_ep10_batch1.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/CoCoOp/vit_l14_c4_ep10_batch1.yaml -------------------------------------------------------------------------------- /configs/trainers/CoOp/rn50_c16_ep200_batch32.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/CoOp/rn50_c16_ep200_batch32.yaml -------------------------------------------------------------------------------- /configs/trainers/CoOp/vit_b16_c16_ep200_batch32.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/CoOp/vit_b16_c16_ep200_batch32.yaml -------------------------------------------------------------------------------- /configs/trainers/CoOp/vit_b32_c16_ep200_batch32.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/CoOp/vit_b32_c16_ep200_batch32.yaml -------------------------------------------------------------------------------- /configs/trainers/CoOp/vit_l14_c16_ep200_batch32.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/CoOp/vit_l14_c16_ep200_batch32.yaml -------------------------------------------------------------------------------- /configs/trainers/KgCoOp/rn50_c16_ep200_batch32.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/KgCoOp/rn50_c16_ep200_batch32.yaml -------------------------------------------------------------------------------- /configs/trainers/KgCoOp/vit_b16_c16_ep200_batch32.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/KgCoOp/vit_b16_c16_ep200_batch32.yaml -------------------------------------------------------------------------------- /configs/trainers/KgCoOp/vit_b32_c16_ep200_batch32.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/KgCoOp/vit_b32_c16_ep200_batch32.yaml -------------------------------------------------------------------------------- /configs/trainers/KgCoOp/vit_l14_c16_ep200_batch32.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/KgCoOp/vit_l14_c16_ep200_batch32.yaml -------------------------------------------------------------------------------- /configs/trainers/MaPLe/rn50_c2_ep5_batch4.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/MaPLe/rn50_c2_ep5_batch4.yaml -------------------------------------------------------------------------------- /configs/trainers/MaPLe/vit_b16_c2_ep5_batch4.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/MaPLe/vit_b16_c2_ep5_batch4.yaml -------------------------------------------------------------------------------- /configs/trainers/MaPLe/vit_b32_c2_ep5_batch4.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/MaPLe/vit_b32_c2_ep5_batch4.yaml -------------------------------------------------------------------------------- /configs/trainers/MaPLe/vit_l14_c2_ep5_batch4.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/MaPLe/vit_l14_c2_ep5_batch4.yaml -------------------------------------------------------------------------------- /configs/trainers/ProDA/rn50_c16_ep100_batch4.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/ProDA/rn50_c16_ep100_batch4.yaml -------------------------------------------------------------------------------- /configs/trainers/ProDA/vit_b16_c16_ep100_batch4.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/ProDA/vit_b16_c16_ep100_batch4.yaml -------------------------------------------------------------------------------- /configs/trainers/ProDA/vit_b32_c16_ep100_batch4.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/ProDA/vit_b32_c16_ep100_batch4.yaml -------------------------------------------------------------------------------- /configs/trainers/ProDA/vit_l14_c16_ep100_batch4.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/ProDA/vit_l14_c16_ep100_batch4.yaml -------------------------------------------------------------------------------- /configs/trainers/ProGrad/rn50_c16_ep100_batch32.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/ProGrad/rn50_c16_ep100_batch32.yaml -------------------------------------------------------------------------------- /configs/trainers/ProGrad/vit_b16_c16_ep100_batch32.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/ProGrad/vit_b16_c16_ep100_batch32.yaml -------------------------------------------------------------------------------- /configs/trainers/ProGrad/vit_b32_c16_ep100_batch32.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/ProGrad/vit_b32_c16_ep100_batch32.yaml -------------------------------------------------------------------------------- /configs/trainers/ProGrad/vit_l14_c16_ep100_batch32.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/ProGrad/vit_l14_c16_ep100_batch32.yaml -------------------------------------------------------------------------------- /configs/trainers/PromptSRC/rn50_c4_ep50_batch4.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/PromptSRC/rn50_c4_ep50_batch4.yaml -------------------------------------------------------------------------------- /configs/trainers/PromptSRC/vit_b16_c4_ep50_batch4.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/PromptSRC/vit_b16_c4_ep50_batch4.yaml -------------------------------------------------------------------------------- /configs/trainers/PromptSRC/vit_b32_c4_ep50_batch4.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/PromptSRC/vit_b32_c4_ep50_batch4.yaml -------------------------------------------------------------------------------- /configs/trainers/PromptSRC/vit_l14_c4_ep50_batch4.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/PromptSRC/vit_l14_c4_ep50_batch4.yaml -------------------------------------------------------------------------------- /configs/trainers/TaskRes/vit_b16_c16_ep200_batch256.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/TaskRes/vit_b16_c16_ep200_batch256.yaml -------------------------------------------------------------------------------- /configs/trainers/VPT/vit_b16_c2_ep5_batch4_4.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/VPT/vit_b16_c2_ep5_batch4_4.yaml -------------------------------------------------------------------------------- /configs/trainers/ZeroshotCLIP/rn50.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/ZeroshotCLIP/rn50.yaml -------------------------------------------------------------------------------- /configs/trainers/ZeroshotCLIP/rn50_c0_ep0_batch0.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/ZeroshotCLIP/rn50_c0_ep0_batch0.yaml -------------------------------------------------------------------------------- /configs/trainers/ZeroshotCLIP/vit_b16.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/ZeroshotCLIP/vit_b16.yaml -------------------------------------------------------------------------------- /configs/trainers/ZeroshotCLIP/vit_b16_c0_ep0_batch0.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/ZeroshotCLIP/vit_b16_c0_ep0_batch0.yaml -------------------------------------------------------------------------------- /configs/trainers/ZeroshotCLIP/vit_b32.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/ZeroshotCLIP/vit_b32.yaml -------------------------------------------------------------------------------- /configs/trainers/ZeroshotCLIP/vit_b32_c0_ep0_batch0.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/ZeroshotCLIP/vit_b32_c0_ep0_batch0.yaml -------------------------------------------------------------------------------- /configs/trainers/ZeroshotCLIP/vit_l14.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/ZeroshotCLIP/vit_l14.yaml -------------------------------------------------------------------------------- /configs/trainers/ZeroshotCLIP/vit_l14_c0_ep0_batch0.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/configs/trainers/ZeroshotCLIP/vit_l14_c0_ep0_batch0.yaml -------------------------------------------------------------------------------- /datasets/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /datasets/caltech101.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/datasets/caltech101.py -------------------------------------------------------------------------------- /datasets/dtd.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/datasets/dtd.py -------------------------------------------------------------------------------- /datasets/eurosat.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/datasets/eurosat.py -------------------------------------------------------------------------------- /datasets/fgvc_aircraft.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/datasets/fgvc_aircraft.py -------------------------------------------------------------------------------- /datasets/food101.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/datasets/food101.py -------------------------------------------------------------------------------- /datasets/imagenet.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/datasets/imagenet.py -------------------------------------------------------------------------------- /datasets/imagenet_a.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/datasets/imagenet_a.py -------------------------------------------------------------------------------- /datasets/imagenet_r.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/datasets/imagenet_r.py -------------------------------------------------------------------------------- /datasets/imagenet_sketch.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/datasets/imagenet_sketch.py -------------------------------------------------------------------------------- /datasets/imagenetv2.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/datasets/imagenetv2.py -------------------------------------------------------------------------------- /datasets/oxford_flowers.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/datasets/oxford_flowers.py -------------------------------------------------------------------------------- /datasets/oxford_pets.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/datasets/oxford_pets.py -------------------------------------------------------------------------------- /datasets/stanford_cars.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/datasets/stanford_cars.py -------------------------------------------------------------------------------- /datasets/sun397.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/datasets/sun397.py -------------------------------------------------------------------------------- /datasets/ucf101.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/datasets/ucf101.py -------------------------------------------------------------------------------- /docs/DATASETS.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/docs/DATASETS.md -------------------------------------------------------------------------------- /docs/INSTALL.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/docs/INSTALL.md -------------------------------------------------------------------------------- /docs/RUN.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /evaluators/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /evaluators/vl_evaluator.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/evaluators/vl_evaluator.py -------------------------------------------------------------------------------- /figures/ece.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/figures/ece.png -------------------------------------------------------------------------------- /interpret_prompts/clip_words.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/interpret_prompts/clip_words.csv -------------------------------------------------------------------------------- /interpret_prompts/interpret_prompt.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/interpret_prompts/interpret_prompt.py -------------------------------------------------------------------------------- /parse_test_res.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/parse_test_res.py -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | ftfy==6.1.1 2 | regex 3 | tqdm 4 | packaging 5 | matplotlib 6 | netcal 7 | statsmodels -------------------------------------------------------------------------------- /run/calibration/fewshot_bin.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/run/calibration/fewshot_bin.sh -------------------------------------------------------------------------------- /run/calibration/fewshot_scaling.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/run/calibration/fewshot_scaling.sh -------------------------------------------------------------------------------- /run/calibration/zeroshot_bin.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/run/calibration/zeroshot_bin.sh -------------------------------------------------------------------------------- /run/calibration/zeroshot_scaling.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/run/calibration/zeroshot_scaling.sh -------------------------------------------------------------------------------- /run/classification/fewshot.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/run/classification/fewshot.sh -------------------------------------------------------------------------------- /run/classification/zeroshot.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/run/classification/zeroshot.sh -------------------------------------------------------------------------------- /scripts/calibration/base2new_scaling_test.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/scripts/calibration/base2new_scaling_test.sh -------------------------------------------------------------------------------- /scripts/calibration/base2new_scaling_train.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/scripts/calibration/base2new_scaling_train.sh -------------------------------------------------------------------------------- /scripts/classification/base2new_fewshot_test.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/scripts/classification/base2new_fewshot_test.sh -------------------------------------------------------------------------------- /scripts/classification/base2new_fewshot_train.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/scripts/classification/base2new_fewshot_train.sh -------------------------------------------------------------------------------- /scripts/classification/base2new_zeroshot_base.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/scripts/classification/base2new_zeroshot_base.sh -------------------------------------------------------------------------------- /scripts/classification/base2new_zeroshot_new.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/scripts/classification/base2new_zeroshot_new.sh -------------------------------------------------------------------------------- /scripts/classification/xd_fewshot_test.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/scripts/classification/xd_fewshot_test.sh -------------------------------------------------------------------------------- /scripts/classification/xd_fewshot_train.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/scripts/classification/xd_fewshot_train.sh -------------------------------------------------------------------------------- /scripts/classification/xd_zeroshot_test.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/scripts/classification/xd_zeroshot_test.sh -------------------------------------------------------------------------------- /tools/logger.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/tools/logger.py -------------------------------------------------------------------------------- /tools/metrics.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/tools/metrics.py -------------------------------------------------------------------------------- /tools/plot.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/tools/plot.py -------------------------------------------------------------------------------- /tools/zsclip_encoder.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/tools/zsclip_encoder.py -------------------------------------------------------------------------------- /train.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/train.py -------------------------------------------------------------------------------- /trainers/calibration/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /trainers/calibration/base_model/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /trainers/calibration/base_model/clip_adapter.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/trainers/calibration/base_model/clip_adapter.py -------------------------------------------------------------------------------- /trainers/calibration/base_model/cocoop.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/trainers/calibration/base_model/cocoop.py -------------------------------------------------------------------------------- /trainers/calibration/base_model/coop.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/trainers/calibration/base_model/coop.py -------------------------------------------------------------------------------- /trainers/calibration/base_model/imagenet_templates.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/trainers/calibration/base_model/imagenet_templates.py -------------------------------------------------------------------------------- /trainers/calibration/base_model/kgcoop.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/trainers/calibration/base_model/kgcoop.py -------------------------------------------------------------------------------- /trainers/calibration/base_model/maple.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/trainers/calibration/base_model/maple.py -------------------------------------------------------------------------------- /trainers/calibration/base_model/proda.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/trainers/calibration/base_model/proda.py -------------------------------------------------------------------------------- /trainers/calibration/base_model/prograd.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/trainers/calibration/base_model/prograd.py -------------------------------------------------------------------------------- /trainers/calibration/base_model/promptsrc.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/trainers/calibration/base_model/promptsrc.py -------------------------------------------------------------------------------- /trainers/calibration/base_model/utils.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/trainers/calibration/base_model/utils.py -------------------------------------------------------------------------------- /trainers/calibration/base_model/zsclip.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/trainers/calibration/base_model/zsclip.py -------------------------------------------------------------------------------- /trainers/calibration/basemodel_loader.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/trainers/calibration/basemodel_loader.py -------------------------------------------------------------------------------- /trainers/calibration/density_ratio_calibration.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/trainers/calibration/density_ratio_calibration.py -------------------------------------------------------------------------------- /trainers/calibration/distanse_aware_calibration.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/trainers/calibration/distanse_aware_calibration.py -------------------------------------------------------------------------------- /trainers/calibration/multi_isotonic_regression.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/trainers/calibration/multi_isotonic_regression.py -------------------------------------------------------------------------------- /trainers/calibration/multi_proximity_isotonic.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/trainers/calibration/multi_proximity_isotonic.py -------------------------------------------------------------------------------- /trainers/calibration/proximity.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/trainers/calibration/proximity.py -------------------------------------------------------------------------------- /trainers/calibration/tempscaling.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/trainers/calibration/tempscaling.py -------------------------------------------------------------------------------- /trainers/calibration/vl_calibrator.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/trainers/calibration/vl_calibrator.py -------------------------------------------------------------------------------- /trainers/classification/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /trainers/classification/base_learner.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/trainers/classification/base_learner.py -------------------------------------------------------------------------------- /trainers/classification/clip_adapter.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/trainers/classification/clip_adapter.py -------------------------------------------------------------------------------- /trainers/classification/cocoop.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/trainers/classification/cocoop.py -------------------------------------------------------------------------------- /trainers/classification/coop.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/trainers/classification/coop.py -------------------------------------------------------------------------------- /trainers/classification/imagenet_a_r_indexes_v2.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/trainers/classification/imagenet_a_r_indexes_v2.py -------------------------------------------------------------------------------- /trainers/classification/imagenet_templates.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/trainers/classification/imagenet_templates.py -------------------------------------------------------------------------------- /trainers/classification/kgcoop.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/trainers/classification/kgcoop.py -------------------------------------------------------------------------------- /trainers/classification/maple.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/trainers/classification/maple.py -------------------------------------------------------------------------------- /trainers/classification/proda.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/trainers/classification/proda.py -------------------------------------------------------------------------------- /trainers/classification/prograd.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/trainers/classification/prograd.py -------------------------------------------------------------------------------- /trainers/classification/promptsrc.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/trainers/classification/promptsrc.py -------------------------------------------------------------------------------- /trainers/classification/taskres.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/trainers/classification/taskres.py -------------------------------------------------------------------------------- /trainers/classification/vpt.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/trainers/classification/vpt.py -------------------------------------------------------------------------------- /trainers/classification/zsclip.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-stat-Sustech/CLIP_Calibration/HEAD/trainers/classification/zsclip.py --------------------------------------------------------------------------------