How junz-debug/lsn works
Project type and purpose
• This is research/experimental code (“lsn”) accompanying the ICLR 2024 paper “Out-of-Distribution Detection with Negative Prompts.”
• It is structured as a set of Python modules and command-line scripts that (a) load a pre-trained CLIP model, (b) generate text and image embeddings (including “negative prompt” variants), and (c) compute OOD scores on ImageNet subsets and other datasets.
File structure
Top level:
• clip/ – the CLIP library (model.py, clip.py, tokenizer, vocabulary)
• coop.py – implementation of the “COOP” OOD detection method
• feature_extra.py – code to extract and manipulate embeddings (e.g., negative prompts)
• get_few_shot_imagenet.py, get_subset_few_shot_imagenet.py
– scripts to sample few-shot subsets of ImageNet
• get_score.py – script to compute OOD detection scores
• main_feature_100_upload.py
– main workflow script to generate and upload features
• show_pictures.py – visualization utilities
• data files (.txt, .npy) – class lists and arrays used by the scripts
README
• Very brief; confirms that this repo implements the negative-prompt OOD detection pipeline based on CLIP.