Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

size mismatch for roi_head.bbox_head.zs_weights #11

Open
Suncheng2022 opened this issue Apr 26, 2023 · 0 comments
Open

size mismatch for roi_head.bbox_head.zs_weights #11

Suncheng2022 opened this issue Apr 26, 2023 · 0 comments

Comments

@Suncheng2022
Copy link

Suncheng2022 commented Apr 26, 2023

Hello, I used the decoupled training training method, and the training data used should be COCO's category 80 (the same is also true in the training configuration file. In the first stage, category 1 distinguishes the foreground and background, and in the second stage, category 80 distinguishes the categories). When performing inference with probability calibration, the error is as follows:

`Use load_from_local loader
The model and loaded state dict do not match exactly

size mismatch for roi_head.bbox_head.zs_weights: copying a param with shape torch.Size([1024, 81]) from checkpoint, the shape in current model is torch.Size([1024, 1231]).
[ ] 0/5000, elapsed: 0s, ETA:Traceback (most recent call last):
File "/home/suncheng/Projects/UniDetector-main/tools/test.py", line 238, in
main()
File "/home/suncheng/Projects/UniDetector-main/tools/test.py", line 210, in main
outputs = multi_gpu_test(model, data_loader, args.tmpdir,
File "/home/suncheng/Projects/UniDetector-main/mmdet/apis/test.py", line 98, in multi_gpu_test
result = model(return_loss=False, rescale=True, **data)
File "/home/suncheng/anaconda3/envs/torch17/lib/python3.9/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/suncheng/anaconda3/envs/torch17/lib/python3.9/site-packages/torch/nn/parallel/distributed.py", line 705, in forward
output = self.module(*inputs[0], **kwargs[0])
File "/home/suncheng/anaconda3/envs/torch17/lib/python3.9/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/suncheng/anaconda3/envs/torch17/lib/python3.9/site-packages/mmcv/runner/fp16_utils.py", line 98, in new_func
return old_func(*args, **kwargs)
File "/home/suncheng/Projects/UniDetector-main/mmdet/models/detectors/base.py", line 174, in forward
return self.forward_test(img, img_metas, **kwargs)
File "/home/suncheng/Projects/UniDetector-main/mmdet/models/detectors/fast_rcnn.py", line 51, in forward_test
return self.simple_test(imgs[0], img_metas[0], proposals[0],
File "/home/suncheng/Projects/UniDetector-main/mmdet/models/detectors/two_stage.py", line 183, in simple_test
return self.roi_head.simple_test(
File "/home/suncheng/Projects/UniDetector-main/mmdet/models/roi_heads/standard_roi_head.py", line 358, in simple_test
det_bboxes, det_labels = self.simple_test_bboxes(
File "/home/suncheng/Projects/UniDetector-main/mmdet/models/roi_heads/standard_roi_head.py", line 316, in simple_test_bboxes
det_bbox, det_label = self.bbox_head.get_bboxes(
File "/home/suncheng/anaconda3/envs/torch17/lib/python3.9/site-packages/mmcv/runner/fp16_utils.py", line 186, in new_func
return old_func(*args, **kwargs)
File "/home/suncheng/Projects/UniDetector-main/mmdet/models/roi_heads/bbox_heads/bbox_head_clip.py", line 737, in get_bboxes
scores[:,:-1] = scores[:,:-1] * frequencies / frequencies.mean()
RuntimeError: The size of tensor a (1230) must match the size of tensor b (80) at non-singleton dimension 1
Killing subprocess 55356
Traceback (most recent call last):
File "/home/suncheng/anaconda3/envs/torch17/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/suncheng/anaconda3/envs/torch17/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/suncheng/anaconda3/envs/torch17/lib/python3.9/site-packages/torch/distributed/launch.py", line 340, in
main()
File "/home/suncheng/anaconda3/envs/torch17/lib/python3.9/site-packages/torch/distributed/launch.py", line 326, in main
sigkill_handler(signal.SIGTERM, None) # not coming back
File "/home/suncheng/anaconda3/envs/torch17/lib/python3.9/site-packages/torch/distributed/launch.py", line 301, in sigkill_handler
raise subprocess.CalledProcessError(returncode=last_return_code, cmd=cmd)
subprocess.CalledProcessError: Command '['/home/suncheng/anaconda3/envs/torch17/bin/python', '-u', 'tools/test.py', '--local_rank=0', 'configs/inference/clip_decouple_faster_rcnn_r50_c4_1x_lvis_v0.5_2ndstage_withcalibration_01.py', 'work_dirs/clip_decouple_faster_rcnn_r50_c4_1x_coco_2ndstage/latest.pth', '--launcher', 'pytorch', '--eval', 'bbox']' returned non-zero exit status 1.`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant