Westlake-AI / openmixup

CAIRI Supervised, Semi- and Self-Supervised Visual Representation Learning Toolbox and Benchmark
https://openmixup.readthedocs.io
Apache License 2.0
611 stars 61 forks source link

AutoMix tutorial for ImageNet #21

Closed 774911840 closed 1 year ago

774911840 commented 2 years ago

Hi,i run AutoMix use Cifar100 dateset,but the image is low pixel.So i want to use ImageNet,i would appreciate it if you provide some help!

Lupin1998 commented 2 years ago

Hi @774911840, thanks for your attention and appreciation of our AutoMix. We have provided training configs of AutoMix on ImageNet, and you can train ResNet variants by CUDA_VISIBLE_DEVICES=0,1,2,3 bash tools/dist_train.sh ${CONFIG_FILE} 4.

For example, AutoMix with ResNet-18: CUDA_VISIBLE_DEVICES=0,1,2,3 bash tools/dist_train.sh configs/classification/imagenet/automix/basic/r18_l2_a2_near_lam_cat_mb_mlr1e_3_bb_mlr0.py 4. Visualization of mixed samples will be saved in the relevant work_dirs. You can modify max_epochs for longer training time. Feel to ask me if you have more questions.

Lupin1998 commented 2 years ago

Currently, we are busy working on other projections, thus, it might take a bit long time for us to collect pre-trained models, logs, and visualization results on ImageNet. You can refer to mixed samples of AutoMix provided on Places205, iNat2017, and iNat2018 @774911840. Please watch us for the latest update of OpenMixup.

774911840 commented 2 years ago

Hi @Lupin1998 .Thanks for answer,i know your means.Actually i am confused of openmixup/data structure for imagenet. I paster dataset config configs/classification/_base_/datasets/imagenet/basic_sz224_4xbs64.py down here. image And i paste imagenet official screenshot down here. image Then i download datasets pointed by red arrows.I show these documents down here. Training images (Task 3).I only download this training dataset because this dataset is small and i only want to test imagenet. image If i should unzip these documents and put them to one catalogue.

Validation images(all tasks). image

Development kit(task3). image

I don't know where to put this, where to put that.If i should unzip these documents.Thanks you very much for you answer.

Jacky1128 commented 2 years ago

Hi @774911840, I have viewed your questions above and here are my replies:

  1. For the training set of ImageNet, the folders for different categories need to be unzipped and be placed under data/ImageNet/train.
  2. For the validation one, all the images should be placed under data/ImageNet/val.
  3. The corresponding meta files ought to be put under data/meta.

Notice that the detailed guidelines for data preparation are given in tutorial. Please refer to it for more information.

774911840 commented 2 years ago

Hi @Jacky1128 ,thanks for your answer,i also want know if this method could use in semantic segmentation?

Lupin1998 commented 2 years ago

Hi, @774911840. Unfortunately, AutoMix only supports classification tasks because it requires a mixup classification loss (e.g., mixup with CE loss or BCE loss) to train the mixed sample generation process in the MixBlock. You can try to transfer it to downstream tasks like objection detection and semantic segmentation. For example, a simple way is first to adopt a multi-label classification loss with mixup to pre-train a MixBlock in AutoMix or SAMix, and then generate augmented images (with instance-level objects) by the given labels to perform segmentation. Moreover, mixup augmentations in OpenMixup also support classification tasks only.

As for mixup augmentation on downstream tasks in computer vision, Mixup and CutMix might be the only two mixup techniques adopted in object detection and segmentation (e.g., Yolo.V4 uses CutMix and Mixup for detection, SegMix uses Mixup for segmentation). More recently, CycleMix tries to adopt PuzzleMix in medical image segmentation tasks. You can refer to CycleMix to adopt AutoMix on segmentation tasks.

Lupin1998 commented 1 year ago

Thanks again for using our framework. I will close this issue if there is no more question. If you have more questions, you can reopen it or start a new issue.