hikvision-research / opera

A Unified Toolbox for Object Perception & Application
Apache License 2.0
139 stars 12 forks source link

inference_detector error #10

Closed Yamameeee closed 1 year ago

Yamameeee commented 1 year ago

When I use inference_detector to try PETR, tensor shape error is caused like this:

RuntimeError: Expected 4-dimensional input for 4-dimensional weight [64, 3, 7, 7], but got 3-dimensional input of size [3, 800, 1067] instead

How to fix this?

Yamameeee commented 1 year ago

Here, data['img'] is not cast to DataContainer.

https://github.com/hikvision-research/opera/blob/33ec0771f2040dabc98512550a17475cffec85c2/opera/apis/inference.py#L196

Yamameeee commented 1 year ago

I investigated this problem. This is caused by replace_ImageToTensor in mmdetection. replace_ImageToTensor doesn't deal with mmdet.ImageToTensor and mmdet.DefaultFormatBundle.

https://github.com/hikvision-research/opera/blob/33ec0771f2040dabc98512550a17475cffec85c2/opera/apis/inference.py#L180

shidahu commented 1 year ago

Thanks for your suggestion. We have fixed this issue and you can use inference_detector to try PETR now.