mmpretrain icon indicating copy to clipboard operation
mmpretrain copied to clipboard

Why the hrnet_cifar10.py does not exist?

Open freshn opened this issue 2 years ago • 3 comments

Checklist

  • I have searched related issues but cannot get the expected help.
  • I have read related documents and don't know what to do.

Describe the question you meet

When training on CIFAR10 or CIFAR100, the categories are 10 or 100 which are not 1000 as imagenet1K. From my understanding, therefore in the configurations, we have both base/models/resnet50.py and base/models/resnet50_cifar10.py. These two configurations are only different from the output units in the head part. If it is the case, why in hrnet config, there is not a file like base/models/hrnet/hrnet_w32_cifar10.py. I have run training based on configs/hrnet/hrnet-w32_4xb32_cifar100.py without errors. But the num_classes=1000 in the config file is clearly wrong, is it? If I miss anything? And why the code can normally run based on the wrong setting.

Post related information

  1. The output of pip list | grep "mmcv\|mmcls\|^torch" mmcls 0.22.0 /jmain02/home/J2AD019/exk01/jxn92-exk01/repo/mmclassification mmcv-full 1.4.8 torch 1.11.0 torchvision 0.12.0
  2. Your config file if you modified it or created a new one.
# nothing modified
  1. Your train log file if you meet the problem during training. Training is correctly done.
  2. Other code you modified in the mmcls folder. No modifications are related to this issue.

freshn avatar May 10 '22 16:05 freshn

Yes, you can modify a hrnet_cifra.py from resnet101_cifra.py. The easiest way is to modify the head.

Ezra-Yu avatar May 11 '22 02:05 Ezra-Yu

If we add all cifra dataset, it will add a lot of configs, which is very messy, but very few people use it. All here only supports resnet_cifra.py as an example.

Ezra-Yu avatar May 11 '22 02:05 Ezra-Yu

If we add all cifra dataset, it will add a lot of configs, which is very messy, but very few people use it. All here only supports resnet_cifra.py as an example.

Thank you for your reply. It makes sense. Then could you please explain why the code with a wrong num_classes can still run normally? Is it a coincidence? If the result got in this way is valid or not?

freshn avatar May 11 '22 19:05 freshn

When the number of categories of the model is greater than the number of categories in the dataset, it can be trained and no error will be reported.

Ezra-Yu avatar Aug 17 '22 02:08 Ezra-Yu