Sense-X / UniFormer

[ICLR2022] official implementation of UniFormer
Apache License 2.0
826 stars 111 forks source link

AssertionError: The `num_classes` (80) in UniFormer of MMDistributedDataParallel does not matches the length of `CLASSES` 54) in CocoDataset #15

Closed Williamlizl closed 2 years ago

Williamlizl commented 2 years ago

AssertionError: Thenum_classes(80) in UniFormer of MMDistributedDataParallel does not matches the length ofCLASSES54) in CocoDataset

Andy1621 commented 2 years ago

Can you provide more details? If you run with your dataset, you need to change the num_classes. https://github.com/Sense-X/UniFormer/blob/57b9086c9b54b144a9ba55d4247e2ed92d894011/object_detection/configs/_base_/models/mask_rcnn_uniformer_fpn.py#L48

Williamlizl commented 2 years ago

Can you provide more details? If you run with your dataset, you need to change the num_classes.

https://github.com/Sense-X/UniFormer/blob/57b9086c9b54b144a9ba55d4247e2ed92d894011/object_detection/configs/_base_/models/mask_rcnn_uniformer_fpn.py#L48

I have changed the num_class in the config py、\mmdet\datasets\coco.py、\mmdet\core\evaluation\class_names.py, then I run python3.7 setup.py install, it still shows the error

Andy1621 commented 2 years ago

54 is the number of classes for your dataset? I guess you don't change the config correctly. You can check the generated file (xxx.log) for training, and find whether you have already changed the num_class. Can you provide the config that you run?

image
Williamlizl commented 2 years ago

Traceback (most recent call last): File "./tools/train.py", line 187, in <module> main() File "./tools/train.py", line 183, in main meta=meta) File "/home/lbc/UniFormer/object_detection/mmdet/apis/train.py", line 185, in train_detector runner.run(data_loaders, cfg.workflow) File "/home/lbc/.local/lib/python3.7/site-packages/mmcv/runner/epoch_based_runner.py", line 127, in run epoch_runner(data_loaders[i], **kwargs) File "/home/lbc/.local/lib/python3.7/site-packages/mmcv/runner/epoch_based_runner.py", line 45, in train self.call_hook('before_train_epoch') File "/home/lbc/.local/lib/python3.7/site-packages/mmcv/runner/base_runner.py", line 307, in call_hook getattr(hook, fn_name)(self) File "/home/lbc/UniFormer/object_detection/mmdet/datasets/utils.py", line 150, in before_train_epoch self._check_head(runner) File "/home/lbc/UniFormer/object_detection/mmdet/datasets/utils.py", line 137, in _check_head (f'Thenum_classes` ({module.num_classes}) in '2022-02-23 16:06:53,711 - mmdet - INFO - Checkpoints will be saved to /home/lbc/UniFormer/object_detection/work_dirs/config by HardDiskBackend.

AssertionError: The num_classes (54) in ConvFCBBoxHead of MMDistributedDataParallel does not matches the length of CLASSES 80) in CocoDataset` QQ截图20220222180015 QQ截图20220223162812——1 QQ截图20220223162835——2

Williamlizl commented 2 years ago

54 is the number of classes for your dataset? I guess you don't change the config correctly. You can check the generated file (xxx.log) for training, and find whether you have already changed the num_class. Can you provide the config that you run?

image

I check the log file, it does show the num_class=54, could you tell me which mmdetection edition you have used?

Andy1621 commented 2 years ago

@Williamlizl You can find the version in version.py. It is 2.11.0. You can install the mmdet under our repo => UniFormer/object_detection/

Andy1621 commented 2 years ago

Moreover, could you share the detailed config and shell you run? Maybe you can open new repo and upload the config you use. I will check it.

Williamlizl commented 2 years ago

Moreover, could you share the detailed config and shell you run? Maybe you can open new repo and upload the config you use. I will check it.

Ok ,thank u

Andy1621 commented 2 years ago

Same issue in issue17.