AtsuMiyai / LoCoOp

[NeurIPS2023] LoCoOp: Few-Shot Out-of-Distribution Detection via Prompt Learning
https://arxiv.org/abs/2306.01293
MIT License
63 stars 1 forks source link

FileNotFoundError: [Errno 2] No such file or directory: 'data/imagenet/classnames.txt' #2

Closed JiuqingDong closed 5 months ago

JiuqingDong commented 5 months ago

Dear Authors,

Could you tell me how can I find this file 'data/imagenet/classnames.txt'? when I run the command, there is a error:FileNotFoundError: [Errno 2] No such file or directory: 'data/imagenet/classnames.txt'

https://github.com/xmartlabs/caffeflow/blob/master/examples/imagenet/imagenet-classes.txt Can I use this one?

AtsuMiyai commented 5 months ago

@JiuqingDong Hi, thanks for your interest in our LoCoOp! I follow the dataset setup of https://github.com/KaiyangZhou/CoOp/blob/main/DATASETS.md You can download imagenet-classes.txt via https://drive.google.com/file/d/1-61f_ol79pViBFDG_IDlUQSwoLcn2XXF/view

JiuqingDong commented 5 months ago

Thank you for your reply.

Yesterday, I used this file to evaluate the 16-shot pre-trained models you released. I got the average result as follows. Three results denote Seed 1, 2, and 3.

image

Then I used the file you gave me. I got the same results. However, these results are inconsistent with those shown in Table 1 of your paper. I'm not sure if I did something wrong.

image

I use the inference command 'CUDA_VISIBLE_DEVICES=0 bash scripts/locoop/eval.sh data imagenet vit_b16_ep50 1 output/imagenet/LoCoOp/vit_b16_ep50_16shots/nctx16_cscFalse_ctpend/seed1'

AtsuMiyai commented 5 months ago

Oh, it is strange. Could you give me the log file?

Seed1 result is: MCM avg. FPR:0.3443744680851064, AUROC:0.9273575242446808, AUPR:0.9846419915753499 GL-MCM avg. FPR:0.2815491134751773, AUROC:0.9361394410159575, AUPR:0.9862216511729003

JiuqingDong commented 5 months ago

log.txt

Here is the log file for Seed 1. Thank you so much.

AtsuMiyai commented 5 months ago

What is the performance using CoOp's ckpt? https://drive.google.com/drive/folders/1eV3uJxxQ0hvY3JltwuXds_Qhr77QLfRe?usp=sharing

JiuqingDong commented 5 months ago

log__.txt This is the log file of CoOp.pth

The results I obtained seem to be inconsistent with those published in the paper. Did you modify the code?

AtsuMiyai commented 5 months ago

I think I do not change my code. (I'm going to check now, just to be sure.) I don't think our paper score is wrong. For example, CoOp's OOD detection results on ImageNet are presented in another paper https://arxiv.org/pdf/2306.06048.pdf. And, the result (Fig.5) is very close to mine.

Could you check the Dataset setup, etc.? Besides, you can MCM repo to check your datasets are correct. https://github.com/deeplearning-wisc/MCM

AtsuMiyai commented 5 months ago

@JiuqingDong Sorry for the delay reply. Could you check you really use https://drive.google.com/file/d/1-61f_ol79pViBFDG_IDlUQSwoLcn2XXF/view? Because this file you give and mine are different, so it is strange to have the same results.

JiuqingDong commented 5 months ago

Dear Author,

I confirm that I used the file you gave me.

image

The OOD datasets are downloaded from the MCM repository. The Texture dataset includes more than 5640 images, while the other three datasets include 10,000 images for each. Imagenet-1k include 1,281,167 images. I will download and re-test it again. Thank you!

May I ask one more question that: How to use your repository to implement CoOp? For example, comment out some modules or hyperparameters.

Sincerely,

JiuqingDong commented 5 months ago

Thank you very much. When I totally re-tested(download the code, install the env...), I got a result that is consistent with yours. Maybe I did something wrong by mistake before.

By the way, How to use your repository to implement CoOp? For example, comment out some modules or hyperparameters.

AtsuMiyai commented 5 months ago

I'm glad to hear it! As for the implementation of CoOp, you can comment like # out self.lambda_value * loss_en in https://github.com/AtsuMiyai/LoCoOp/blob/master/trainers/locoop.py#L299 (or in https://github.com/AtsuMiyai/LoCoOp/blob/master/trainers/locoop.py#L317)

JiuqingDong commented 5 months ago

I truly appreciate your timely help.