zhanggang001 / RefineMask

RefineMask: Towards High-Quality Instance Segmentation with Fine-Grained Features (CVPR 2021)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: init_weights() missing 1 required positional argument: 'pretrained'

sanmulab opened this issue · comments

Traceback (most recent call last):
File "tools/train.py", line 188, in
main()
File "tools/train.py", line 162, in main
model.init_weights()
File "/home/ubuntu/.conda/envs/open-mmlab/lib/python3.8/site-packages/mmcv/runner/base_module.py", line 55, in init_weights
m.init_weights()
TypeError: init_weights() missing 1 required positional argument: 'pretrained'

this repo needs mmcv=1.0.5, which version of mmcv did you install?

Hey @chensen668 , I'm facing the same error. Did you solve it? Can you please reply?

Hey @chensen668 , I'm facing the same error. Did you solve it? Can you please reply?

you need to use mmdet=2.3.0. Same version as the author.

Hey @chensen668 , I'm facing the same error. Did you solve it? Can you please reply?

The author's code is not compatible with other mmdet versions

But when I use mmdet==2.3.0 then it says mmcv==1.3.12 is used but incompatible. Install mmcv=1.0.5. Is there any alternative to work with current versions?

There are dependencies between codes,so you need to specially install an environment with mmdet = 2.3.0 and mmcv-full=1.0.5

Hey thank you for your response. But code works fine with mmcv-full=1.3.12 and mmdet= 2.16.0. I just commented it out model.init_weights(). Then after I got some other errors like cfg.nms and cfg.max_per_img not found . But I included them in config file (r50-refinemask-1x.py) And It's running now. Thank you to @zhanggang001 for replaying on other issue patiently. I need to dig into much but atleast first training has started.

Hey thank you for your response. But code works fine with mmcv-full=1.3.12 and mmdet= 2.16.0. I just commented it out model.init_weights(). Then after I got some other errors like cfg.nms and cfg.max_per_img not found . But I included them in config file (r50-refinemask-1x.py) And It's running now. Thank you to @zhanggang001 for replaying on other issue patiently. I need to dig into much but atleast first training has started.

I did the same operation as you. I deleted the 'pretrained' parameter, and then I can train normally. However, after 12 epochs of training, the model mAP is 0. Maybe I changed the classification loss function ,or the environment is still incompatible. Finally, if the mAP of your training model is normal, please be sure to tell me,thank you!

I'm getting this error while I do inference in my trained model. If you know how to solve this then please let me know. Thank you in advance @zhanggang001 @chensen668
File "tools/test.py", line 241, in
main()
File "tools/test.py", line 206, in main
outputs = single_gpu_test(model, data_loader, args.show, args.show_dir,
File "C:\Users\topseven\anaconda3\envs\mmcv\lib\site-packages\mmdet\apis\test.py", line 28, in single_gpu_test
result = model(return_loss=False, rescale=True, **data)
File "C:\Users\topseven\anaconda3\envs\mmcv\lib\site-packages\torch\nn\modules\module.py", line 1051, in _call_impl
return forward_call(*input, **kwargs)
File "C:\Users\topseven\anaconda3\envs\mmcv\lib\site-packages\mmcv\parallel\data_parallel.py", line 42, in forward
return super().forward(*inputs, **kwargs)
File "C:\Users\topseven\anaconda3\envs\mmcv\lib\site-packages\torch\nn\parallel\data_parallel.py", line 166, in forward
return self.module(*inputs[0], **kwargs[0])
File "C:\Users\topseven\anaconda3\envs\mmcv\lib\site-packages\torch\nn\modules\module.py", line 1051, in _call_impl
return forward_call(*input, **kwargs)
File "C:\Users\topseven\anaconda3\envs\mmcv\lib\site-packages\mmcv\runner\fp16_utils.py", line 98, in new_func
return old_func(*args, **kwargs)
File "C:\Users\topseven\anaconda3\envs\mmcv\lib\site-packages\mmdet\models\detectors\base.py", line 174, in forward
return self.forward_test(img, img_metas, **kwargs)
File "C:\Users\topseven\anaconda3\envs\mmcv\lib\site-packages\mmdet\models\detectors\base.py", line 147, in forward_test
return self.simple_test(imgs[0], img_metas[0], **kwargs)
File "C:\Users\topseven\anaconda3\envs\mmcv\lib\site-packages\mmdet\models\detectors\two_stage.py", line 182, in simple_test
return self.roi_head.simple_test(
File "C:\Users\topseven\anaconda3\envs\mmcv\lib\site-packages\mmdet\models\roi_heads\standard_roi_head.py", line 264, in simple_test
segm_results = self.simple_test_mask(
File "C:\Users\topseven\anaconda3\envs\mmcv\lib\site-packages\mmdet\models\roi_heads\refine_roi_head.py", line 92, in simple_test_mask
if det_bboxes.shape[0] == 0:
AttributeError: 'list' object has no attribute 'shape'