xingyizhou / CenterNet2

Two-stage CenterNet
Apache License 2.0
1.2k stars 189 forks source link

when I start train 2 gpu though python train_net.py --config ./output/CenterNet2/CenterNet-S4_DLA_8x/config.yaml --num-gpus 2 ,when start test ,the model have wrong following : #19

Closed Bin-ze closed 3 years ago

Bin-ze commented 3 years ago

pre_nms_top_n = candidate_inds.contiguous().view(N, -1).sum(1) # N RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead. I change model as (ccandidate_inds.contiguous().view(N, -1).sum(1) # N),but stall have wrong ,can you help me ?

JimKlingshirn commented 3 years ago

This error occurs for me when I run forward inferences on either of the CenterNet models. It's not a problem when running the CenterNet2 models. The fix is simple, and it's suggested in the error message. Replace view(N, -1) with reshape(N, -1).

https://github.com/xingyizhou/CenterNet2/blob/master/projects/CenterNet2/centernet/modeling/dense_heads/centernet.py#L552

#pre_nms_top_n = candidate_inds.view(N, -1).sum(1) # N

pre_nms_top_n = candidate_inds.reshape(N, -1).sum(1) # N

Bin-ze commented 3 years ago

Thank you, not only because you have answered my questions for me, but more importantly, I am a novice in the field of target detection. As a newcomer to this field, I may need to ask a lot of questions. Undoubtedly, this will be a good start.