Closed pfuerste closed 3 years ago
It seems that you were trying to load swin_small pretrained weight to swin_tiny.
True, I got that mixed up. Thanks!
Okay, I changed the loaded weights to tiny instead of weights, but now I get another error. It seems like SWIN's output has a different dimensionality than that of ResNet, but I do not know how to find out how big either is or should be. I guess I have to change something like num_heads or out_indices in the backbone or something else in the channel_mapper?
Here is the error:
Traceback (most recent call last):
File "/home/fuerste/mmdetection/tools/train.py", line 207, in <module>
main()
File "/home/fuerste/mmdetection/tools/train.py", line 196, in main
train_detector(
File "/home/fuerste/miniconda3/envs/openmmlab/lib/python3.9/site-packages/mmdet/apis/train.py", line 174, in train_detector
runner.run(data_loaders, cfg.workflow)
File "/home/fuerste/miniconda3/envs/openmmlab/lib/python3.9/site-packages/mmcv/runner/epoch_based_runner.py", line 127, in run
epoch_runner(data_loaders[i], **kwargs)
File "/home/fuerste/miniconda3/envs/openmmlab/lib/python3.9/site-packages/mmcv/runner/epoch_based_runner.py", line 50, in train
self.run_iter(data_batch, train_mode=True, **kwargs)
File "/home/fuerste/miniconda3/envs/openmmlab/lib/python3.9/site-packages/mmcv/runner/epoch_based_runner.py", line 29, in run_iter
outputs = self.model.train_step(data_batch, self.optimizer,
File "/home/fuerste/miniconda3/envs/openmmlab/lib/python3.9/site-packages/mmcv/parallel/data_parallel.py", line 67, in train_step
return self.module.train_step(*inputs[0], **kwargs[0])
File "/home/fuerste/miniconda3/envs/openmmlab/lib/python3.9/site-packages/mmdet/models/detectors/base.py", line 238, in train_step
losses = self(**data)
File "/home/fuerste/miniconda3/envs/openmmlab/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "/home/fuerste/miniconda3/envs/openmmlab/lib/python3.9/site-packages/mmcv/runner/fp16_utils.py", line 98, in new_func
return old_func(*args, **kwargs)
File "/home/fuerste/miniconda3/envs/openmmlab/lib/python3.9/site-packages/mmdet/models/detectors/base.py", line 172, in forward
return self.forward_train(img, img_metas, **kwargs)
File "/home/fuerste/miniconda3/envs/openmmlab/lib/python3.9/site-packages/mmdet/models/detectors/single_stage.py", line 82, in forward_train
x = self.extract_feat(img)
File "/home/fuerste/miniconda3/envs/openmmlab/lib/python3.9/site-packages/mmdet/models/detectors/single_stage.py", line 45, in extract_feat
x = self.neck(x)
File "/home/fuerste/miniconda3/envs/openmmlab/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "/home/fuerste/miniconda3/envs/openmmlab/lib/python3.9/site-packages/mmdet/models/necks/channel_mapper.py", line 92, in forward
assert len(inputs) == len(self.convs)
AssertionError
Nevermind, searching the configs helped, set neck=dict(in_channels=[96, 192, 384, 768]),
I am trying to use Swin as a backbone for Deformable-DETR. I used /swin/mask_rcnn_swin-t-p4-w7_fpn_1x_coco.py and my earlier DDETR-configs to to create a config, only changing the backbone-part, but it throws the following error after I call train.py:
I have no problem when using DDETR with this config without changing the backbone (default ResNet50). I think something in my config is not right, could you tell me what I am missing? Here it is: