Hon-Wong / PTSEFormer

[ECCV 2022] PTSEFormer: Progressive Temporal-Spatial Enhanced TransFormer Towards Video Object Detection
https://arxiv.org/abs/2209.02242
MIT License
32 stars 7 forks source link

multi_head_attention error #9

Open ResonWang opened 1 year ago

ResonWang commented 1 year ago

Traceback (most recent call last): File "/AI/videoDetection/algorithm/PTSEFormer-master/tools/train.py", line 261, in main() File "/AI/videoDetection/algorithm/PTSEFormer-master/tools/train.py", line 201, in main train_stats = train_one_epoch( File "/AI/videoDetection/algorithm/PTSEFormer-master/src/engine/engine.py", line 71, in train_one_epoch outputs = model(samples) File "/opt/conda/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1190, in _call_impl return forward_call(*input, kwargs) File "/AI/videoDetection/algorithm/PTSEFormer-master/src/models/model_builder.py", line 188, in forward mem_cur_stg2_level = self.s_decoder1(tgt=mem_cur_level, tgt_mask=None, memory=mem_ref_cat_level, memory_mask=None).squeeze(0) File "/opt/conda/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1190, in _call_impl return forward_call(*input, *kwargs) File "/AI/videoDetection/algorithm/PTSEFormer-master/src/models/transformer/deformable_transformer.py", line 829, in forward output = layer(output, memory, tgt_mask=tgt_mask, File "/opt/conda/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1190, in _call_impl return forward_call(input, kwargs) File "/AI/videoDetection/algorithm/PTSEFormer-master/src/models/transformer/deformable_transformer.py", line 757, in forward return self.forward_post(tgt, memory, tgt_mask, memory_mask, File "/AI/videoDetection/algorithm/PTSEFormer-master/src/models/transformer/deformable_transformer.py", line 712, in forward_post tgt2 = self.multihead_attn(query=self.with_pos_embed(tgt, query_pos), File "/opt/conda/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1190, in _call_impl return forward_call(*input, *kwargs) File "/opt/conda/lib/python3.8/site-packages/torch/nn/modules/activation.py", line 1167, in forward attn_output, attn_output_weights = F.multi_head_attention_forward( File "/opt/conda/lib/python3.8/site-packages/torch/nn/functional.py", line 5097, in multi_head_attention_forward k = k.contiguous().view(k.shape[0], bsz num_heads, head_dim).transpose(0, 1) RuntimeError: shape '[1, 105600, 32]' is invalid for input of size 6758400

Hon-Wong commented 1 year ago

Hi, It seems that you modified some settings, can you provide detailed information?

priy-matroid commented 1 year ago

Hi I got the same error. My dataset has only 2 classes so in the yaml file the only thing I changed was num_classes: 2. I debugged through the dataset classes and I believe my dataset classes r working properly

priy-matroid commented 1 year ago

I can give you more details if you need

priy-matroid commented 1 year ago

did you figure it out?

WCUSTC commented 1 month ago

相同的问题,没有改任何东西,就是简单地运行test.py