sungnyun / understanding-cdfsl

(NeurIPS 2022) Understanding Cross-Domain Few-Shot Learning Based on Domain Similarity and Few-Shot Difficulty
MIT License
29 stars 9 forks source link

The data loading of tieredImageNet #5

Closed nuistji closed 1 year ago

nuistji commented 1 year ago

Hi, I have evaluated the results of 'Same Domain FSL Experiments' on miniImageNet. However, I can not run the code on the tieredImageNet, I found that the 'https://github.com/sungnyun/understanding-cdfsl/blob/main/datasets/split_seed_1/ tieredImageNet_test_unlabeled_20.csv' document can not load the dataset. So, can you provide me with the tieredImageNet which can be loaded correctly?

sungnyun commented 1 year ago

Hi @nuistji,

Have you downloaded the tieredImageNet dataset in the ImageFolder format? (like this) The csv file is not for loading the dataset but splitting the dataset into labeled/unlabeled 80/20 sets.

nuistji commented 1 year ago

The error is like this: python pretrain.py --pls --ut --source_dataset tieredImageNet --target_dataset tieredImageNet_test --backbone resnet10 --model "byol" --tag "default" --previous_tag "default" Using default num_workers=3 Using default optimizer for model byol: adam Using default lr for model byol: 0.0003 Using target data tieredImageNet_test (unlabeled) Using default image size: 224 Loading unlabeled split from /home/jifanfan/understanding/datasets/split_seed_1/tieredImageNet_test_unlabeled_20.csv Loading labeled split from /home/jifanfan/understanding/datasets/split_seed_1/tieredImageNet_test_labeled_80.csv Traceback (most recent call last): File "/home/jifanfan/understanding/pretrain.py", line 296, in main(params) File "/home/jifanfan/understanding/pretrain.py", line 97, in main labeled_source_loader, unlabeled_source_loader, unlabeled_target_loader = _get_dataloaders(params) File "/home/jifanfan/understanding/pretrain.py", line 58, in _get_dataloaders ut = get_unlabeled_dataloader(dataset_name=params.target_dataset, augmentation=params.augmentation, File "/home/jifanfan/understanding/datasets/dataloader.py", line 106, in get_unlabeled_dataloader unlabeled, labeled = get_split_dataloader(dataset_name, augmentation, batch_size, image_size, siamese=siamese, File "/home/jifanfan/understanding/datasets/dataloader.py", line 88, in get_split_dataloader dataloader = torch.utils.data.DataLoader(dataset, batch_size=batch_size, num_workers=num_workers, File "/home/jifanfan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 268, in init sampler = RandomSampler(dataset, generator=generator) File "/home/jifanfan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/utils/data/sampler.py", line 102, in init raise ValueError("num_samples should be a positive integer " ValueError: num_samples should be a positive integer value, but got num_samples=0

I have followed the instruction [https://github.com/yaoyao-liu/tiered-imagenet-tools], and I got the tieredImageNet which is organized like this: 1.tieredImageNet 1.1 train 1.1.1 n04208210 n0420821000000030.jpg n0420821000000003.jpg 1.1.2 n04154565 1.1.3 n03970156 1.2 val 1.3 test

I think the data organization is wrong. So can you provide me the TieredImageNet dataset which can be split correctly?

sungnyun commented 1 year ago

Oh yes, the data organization is different from what we have.

Our tieredImageNet looks like this:

Screenshot 2023-06-13 at 13 59 06

We originally used the instruction in this link, but now it seems the link is broken. Let me figure out how I can share our dataset, and provide you with the instruction.

sungnyun commented 1 year ago

Hi @nuistji,

I just uploaded our tieredImageNet dataset in my Dropbox. You may find it in this link. Download it and untar.

Feel free to reach out for any further questions :)

nuistji commented 1 year ago

Thank you very much, your reply has help me a lot!

季繁繁

@. | ---- Replied Message ---- | From | Sungnyun @.> | | Date | 6/13/2023 15:02 | | To | @.> | | Cc | @.> , @.***> | | Subject | Re: [sungnyun/understanding-cdfsl] The data loading of tieredImageNet (Issue #5) |

Hi @nuistji,

I just uploaded our tieredImageNet dataset in my Dropbox. You may find it in this link. Download it and untar.

Feel free to reach out for any further questions :)

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>