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

how to test the SQR decoder individually ? #8

Open
Originlightwkp opened this issue May 15, 2023 · 0 comments
Open

how to test the SQR decoder individually ? #8

Originlightwkp opened this issue May 15, 2023 · 0 comments

Comments

@Originlightwkp
Copy link

I would like to use the SQR decoder in your paper to improve the decoder in my model. In order not to affect subsequent tasks, I need to test the decoder separately.

I have written a test code, but there are still some issues. Do you have any methods to test the decoder separately?

if __name__ == '__main__':
x = torch.rand((300, 4, 256)).cuda()
valid_ratios = torch.rand((4,1,2))
reference_points = torch.rand((4, 300, 4))
reg_branches = None
model = QRDeformableDetrTransformerDecoder(num_layers=6,
            return_intermediate=True,
            start_q=[0, 0, 1, 2, 4, 7, 12], # 2
            end_q=[1, 2, 4, 7, 12, 20, 33], # 2
            transformerlayers=dict(
                type='DetrTransformerDecoderLayer',
                attn_cfgs=[
                    dict(
                        type='MultiheadAttention',
                        embed_dims=256,
                        num_heads=8,
                        dropout=0.1),
                    dict(
                        type='MultiScaleDeformableAttention',
                        embed_dims=256)
                ],
                feedforward_channels=1024,
                ffn_dropout=0.1,
                operation_order=('self_attn', 'norm', 'cross_attn', 'norm',
                                 'ffn', 'norm'))).cuda()
out = model(x,valid_ratios=valid_ratios,reference_points=reference_points,reg_branches=None)
print(out[0].shape)
print(out[1].shape)

The above code reported an error:


Traceback (most recent call last):
File "/media/cheng/dataset4/codeto2022/FairMOT_modifed/src/sqrtest.py", line 381, in
out = model(x,valid_ratios=valid_ratios,reference_points=reference_points,reg_branches=None)
File "/media/cheng/dataset4/annaconda3/envs/fashionclip/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "/media/cheng/dataset4/codeto2022/FairMOT_modifed/src/sqrtest.py", line 223, in forward
**kwargs)
File "/media/cheng/dataset4/codeto2022/FairMOT_modifed/src/sqrtest.py", line 144, in forward
**kwargs)
File "/media/cheng/dataset4/annaconda3/envs/fashionclip/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "/media/cheng/dataset4/annaconda3/envs/fashionclip/lib/python3.7/site-packages/mmcv/cnn/bricks/transformer.py", line 850, in forward
**kwargs)
File "/media/cheng/dataset4/annaconda3/envs/fashionclip/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "/media/cheng/dataset4/annaconda3/envs/fashionclip/lib/python3.7/site-packages/mmcv/utils/misc.py", line 340, in new_func
output = old_func(*args, **kwargs)
File "/media/cheng/dataset4/annaconda3/envs/fashionclip/lib/python3.7/site-packages/mmcv/ops/multi_scale_deform_attn.py", line 312, in forward
assert (spatial_shapes[:, 0] * spatial_shapes[:, 1]).sum() == num_value
TypeError: 'NoneType' object is not subscriptable


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