umd-huang-lab / perceptionCLIP

Code for our ICLR 2024 paper "PerceptionCLIP: Visual Classification by Inferring and Conditioning on Contexts"
MIT License
76 stars 4 forks source link

Replicating Table 4, Image folder error #3

Open LuoyaoChen opened 4 months ago

LuoyaoChen commented 4 months ago

Hi,

I am trying to replicate the numbers in the Table 4, using ImageNet dataset. However, I am seeing this error, for the val/ data folder.

raise FileNotFoundError(f"Couldn't find any class folder in {directory}.")

I saw online that the val/ folder should be of the structure:

val
----
  |-- label_class_0
         |-- image1.JPEG
         |-- image2.JPEG
.....

However, using the imageget website dataset ILSVRC2012, I am not sure how to unzip into label/image.JPEG format automatically. Could you please provide some guidance on how to set up the ImageNet dataset properly?

Thank you very much!

bangann commented 4 months ago

Hi,

Our dataset was downloaded many years ago, and our validation images are sorted into class-specific folders by default. We are not sure what the file structure looks like right now. Do you have any file like val_annotations.txt that details which image belongs to which class? If yes, then you can use that to reconstruct your val/. We also found https://gist.github.com/antoinebrl/7d00d5cb6c95ef194c737392ef7e476a and https://github.com/DoranLyong/ImageNet2012-download, which have data preparation scripts that might help.