Open wenchima opened 3 years ago
I tried to do the inference test with the command
python tools/test.py ./configs/swin/mask_rcnn_swin_tiny_patch4_window7_mstrain_480-800_adamw_3x_coco.py ./checkpoints/mask_rcnn_swin_tiny_patch4_window7.pth --eval bbox segm
But I always got the following Traceback as below.
loading annotations into memory... Done (t=0.29s) creating index... index created! Traceback (most recent call last): File "/home/wma/anaconda3/envs/openmmlab/lib/python3.7/site-packages/mmcv/utils/registry.py", line 52, in build_from_cfg return obj_cls(**args) TypeError: __init__() got an unexpected keyword argument 'ape' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/wma/anaconda3/envs/openmmlab/lib/python3.7/site-packages/mmcv/utils/registry.py", line 52, in build_from_cfg return obj_cls(**args) File "/home/wma/anaconda3/envs/openmmlab/lib/python3.7/site-packages/mmdet/models/detectors/mask_rcnn.py", line 27, in __init__ init_cfg=init_cfg) File "/home/wma/anaconda3/envs/openmmlab/lib/python3.7/site-packages/mmdet/models/detectors/two_stage.py", line 32, in __init__ self.backbone = build_backbone(backbone) File "/home/wma/anaconda3/envs/openmmlab/lib/python3.7/site-packages/mmdet/models/builder.py", line 20, in build_backbone return BACKBONES.build(cfg) File "/home/wma/anaconda3/envs/openmmlab/lib/python3.7/site-packages/mmcv/utils/registry.py", line 212, in build return self.build_func(*args, **kwargs, registry=self) File "/home/wma/anaconda3/envs/openmmlab/lib/python3.7/site-packages/mmcv/cnn/builder.py", line 27, in build_model_from_cfg return build_from_cfg(cfg, registry, default_args) File "/home/wma/anaconda3/envs/openmmlab/lib/python3.7/site-packages/mmcv/utils/registry.py", line 55, in build_from_cfg raise type(e)(f'{obj_cls.__name__}: {e}') TypeError: SwinTransformer: __init__() got an unexpected keyword argument 'ape'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "tools/test.py", line 220, in <module> main() File "tools/test.py", line 173, in main model = build_detector(cfg.model, test_cfg=cfg.get('test_cfg')) File "/home/wma/anaconda3/envs/openmmlab/lib/python3.7/site-packages/mmdet/models/builder.py", line 59, in build_detector cfg, default_args=dict(train_cfg=train_cfg, test_cfg=test_cfg)) File "/home/wma/anaconda3/envs/openmmlab/lib/python3.7/site-packages/mmcv/utils/registry.py", line 212, in build return self.build_func(*args, **kwargs, registry=self) File "/home/wma/anaconda3/envs/openmmlab/lib/python3.7/site-packages/mmcv/cnn/builder.py", line 27, in build_model_from_cfg return build_from_cfg(cfg, registry, default_args) File "/home/wma/anaconda3/envs/openmmlab/lib/python3.7/site-packages/mmcv/utils/registry.py", line 55, in build_from_cfg raise type(e)(f'{obj_cls.__name__}: {e}') TypeError: MaskRCNN: SwinTransformer: __init__() got an unexpected keyword argument 'ape'
I think the problems come from the mismatch of the keyword definition between the mmcv, mmdet packages and the configuration files. There are at least "embed_dim", "ape", and "use_checkpoint" that can not be recognized by the two packages above. It is easy to figure the "embed_dim" out which should be "embed_dims". But what about the other two?
Please provide me with some possible solutions to this problem.
Thank you!
I have met the same problem, do you have any solutions now? Thanks.
Nope, I have not figured it out although I tried to install the latest mmcv, mmdet packages. Please share any idea or solution if possible.
Nope, I have not figured it out although I tried to install the latest mmcv, mmdet packages. Please share any idea or solution if possible.
Hi, I have solved the problem by run python setup.py develop
in Swin-Transformer-Object-Detection folder, you can refer to here. But I still meet some strange situation here, please give me any suggestion.
执行命令cd mmdetection pip install . -e后问题解决,感谢维护者的付出。我安装mmdet环境的时候克隆了mmdetection,但是在使用mmdetection的时候,修改mmdet内的mmdet/datasets/voc.py文件直接训练了,并没有重新编译安装mmdet,导致后面的报错,再次表示感谢。 After executing the order, the problem is solved. Thank the maintainer for his efforts. When I installed mmdet, I cloned mmdetection, but when I used mmdetection, I modified the mmdet / datasets / voc.py file in mmdet, and then trained directly. I didn't recompile and install mmdet, resulting in subsequent errors. Thank you again.
Nope, I have not figured it out although I tried to install the latest mmcv, mmdet packages. Please share any idea or solution if possible.
Hi, I have solved the problem by run
python setup.py develop
in Swin-Transformer-Object-Detection folder, you can refer to here. But I still meet some strange situation here, please give me any suggestion.
Thank you for your reply. While the same python setup.py develop
seems does not work for me. Any progress now?
执行命令cd mmdetection pip install . -e后问题解决,感谢维护者的付出。我安装mmdet环境的时候克隆了mmdetection,但是在使用mmdetection的时候,修改mmdet内的mmdet/datasets/voc.py文件直接训练了,并没有重新编译安装mmdet,导致后面的报错,再次表示感谢。 After executing the order, the problem is solved. Thank the maintainer for his efforts. When I installed mmdet, I cloned mmdetection, but when I used mmdetection, I modified the mmdet / datasets / voc.py file in mmdet, and then trained directly. I didn't recompile and install mmdet, resulting in subsequent errors. Thank you again.
Thank you for your comment. I tried to reinstall mmcv
and mmdetection
. I also cd mmdetection pip install . -e
, but the same problem still exists there. Could you provide more details?
@wenchima It doesn't work for me either. First, it happened with embed_dim
, which I changed to embed_dims
. Now the keyword ape
has a problem. I tried to delete the ape
parameter from the config file, then it threw an error for the use_checkpoint
parameter.
执行命令cd mmdetection pip install . -e后问题解决,感谢维护者的付出。我安装mmdet环境的时候克隆了mmdetection,但是在使用mmdetection的时候,修改mmdet内的mmdet/datasets/voc.py文件直接训练了,并没有重新编译安装mmdet,导致后面的报错,再次表示感谢。 After executing the order, the problem is solved. Thank the maintainer for his efforts. When I installed mmdet, I cloned mmdetection, but when I used mmdetection, I modified the mmdet / datasets / voc.py file in mmdet, and then trained directly. I didn't recompile and install mmdet, resulting in subsequent errors. Thank you again.
Thank you for your comment. I tried to reinstall
mmcv
andmmdetection
. I alsocd mmdetection pip install . -e
, but the same problem still exists there. Could you provide more details?
不客气,在接下来的使用中我有一些发现:
1、我安装mmdet的时候使用的是比较新的mmdetection进行编译安装的
2、在使用的时候如果用老版本的mmdection就会报错embed_dim
之类的
总上所述
1、使用你编译安装的mmdet的mmdetection的代码进行训练
2、按照官方推荐的方法组织conf文件https://mmdetection.readthedocs.io/en/latest/2_new_data_model.html#prepare-a-config
`这个新的配置文件继承自一个原始配置文件,只需要突出必要的修改部分即可 base = 'mask_rcnn/mask_rcnn_r50_caffe_fpn_mstrain-poly_1x_coco.py'
我们需要对头中的类别数量进行修改来匹配数据集的标注 model = dict( roi_head=dict( bbox_head=dict(num_classes=1), mask_head=dict(num_classes=1)))
修改数据集相关设置 dataset_type = 'COCODataset' classes = ('balloon',) data = dict( train=dict( img_prefix='balloon/train/', classes=classes, ann_file='balloon/train/annotation_coco.json'), val=dict( img_prefix='balloon/val/', classes=classes, ann_file='balloon/val/annotation_coco.json'), test=dict( img_prefix='balloon/val/', classes=classes, ann_file='balloon/val/annotation_coco.json'))
same issue for me.. i tried reinstall library and 'python setup.py develop' . but still got error with ape.
@wenchima It doesn't work for me either. First, it happened with
embed_dim
, which I changed toembed_dims
. Now the keywordape
has a problem. I tried to delete theape
parameter from the config file, then it threw an error for theuse_checkpoint
parameter.
well, you solved it or not finally ? can you share the solution experience?
The swin_transformer backbone in this program has a few differences between the one in mmdetection so you cannot just use the config file in this program.
I am getting the same error regarding ape
are we suppose to use the MMDet repo? They don't have the updated configs and they have a different format.
I'm facing the same error regarding ape
keyword, did anyone succeed to solve the issue?
I tried to do the inference test with the command
python tools/test.py ./configs/swin/mask_rcnn_swin_tiny_patch4_window7_mstrain_480-800_adamw_3x_coco.py ./checkpoints/mask_rcnn_swin_tiny_patch4_window7.pth --eval bbox segm
But I always got the following Traceback as below.
During handling of the above exception, another exception occurred:
I think the problems come from the mismatch of the keyword definition between the mmcv, mmdet packages and the configuration files. There are at least "embed_dim", "ape", and "use_checkpoint" that can not be recognized by the two packages above. It is easy to figure the "embed_dim" out which should be "embed_dims". But what about the other two?
Please provide me with some possible solutions to this problem.
Thank you!