FA: Forced Prompt Learning of Vision-Language Models for Out-of-Distribution Detection

November 28, 2025 ยท View on GitHub

FA framework The paper has been accepted by ICCV2025
Arxiv: https://arxiv.org/abs/2507.04511

Requirements

Installation

Create a conda environment and install dependencies (you do not need to install the toolbox Dassl.pytorch first):

pip install -r requirements.txt

Get Started

Configs

The running configurations can be modified in configs/my_config.yaml.
The ID dataset configurations can be modified in my_dataset/.

Train

CUDA_VISIBLE_DEVICES=3 python main.py --config configs/my_config.yaml --is_train 1

:blue_book: Models Zoo

  • ID: ImageNet-1K, backbone: ViT-B/16
K Seed iNaturalist SUN Places Textures Avg Model/log
FPR95 AUROC FPR95 AUROC FPR95 AUROC FPR95 AUROC FPR95 AUROC
2 1 11.83 97.18 27.03 93.71 30.23 92.45 29.29 92.94 24.60 94.07 here
3 15.11 96.44 27.72 93.17 31.36 92.07 30.53 92.97 26.18 93.66 here
5 12.53 96.92 26.68 93.67 31.19 92.16 29.82 92.53 25.06 93.82 here
3 5 15.66 96.23 26.57 93.66 29.51 92.82 28.48 93.14 25.05 93.96 here
4 5 16.44 96.30 27.96 93.54 30.99 92.60 26.37 93.95 25.44 94.10 here

Inference

CUDA_VISIBLE_DEVICES=2 python main.py --config configs/my_config.yaml --is_train 0

The specific paths for different OOD datasets can be modified in the inference section of the main.py code.