mmdeploy icon indicating copy to clipboard operation
mmdeploy copied to clipboard

Dynamic num_dets does not take effect when onnx is converted to openvino.

Open hong-kailin opened this issue 3 years ago • 5 comments

When converting maskrcnn into an openvino model, it is found that even if the configuration file uses a dynamic config, the result given by openvino is still a fixed value in the dimension of num_dets (max_per_img+1).

The version of mmdeploy I am using is v0.3.0 The configuration file is as follows: openvino.zip

hong-kailin avatar May 12 '22 05:05 hong-kailin

@SemyonBevzuk Hi, bro. Could you take a look at this issue? It appears that outputs are padded inside openvino. However, similar onnx on onnxruntime woud output dynamically.

RunningLeon avatar May 12 '22 06:05 RunningLeon

Hello! OpenVINO in this implementation supports dynamic shapes with some limitations. It is possible that due to differences in the implementation of some operations, the OpenVINO model may generate more high score results. Thus, a limit of 100 results after NMS can be reached.

The reason for the number of results exceeds the limit by 1, in my opinion, is in the following: https://github.com/open-mmlab/mmdeploy/blob/69111a6b956fd147d1590f0b808e545cebf45eeb/mmdeploy/codebase/mmdet/models/roi_heads/standard_roi_head.py#L43-L56

Here is the part of the graph where the concatenation with 1 takes place: test drawio (1)

Sorry for the wait.

SemyonBevzuk avatar May 19 '22 10:05 SemyonBevzuk

@SemyonBevzuk Hi, you 're right about appending one extra bbox. But it still cannot explain why number of output is always 101 and there are lots of zero bboxes. If you run inference with an image of all 255 pixesl, then there' should be only one output, which is the appended bbox.

RunningLeon avatar May 19 '22 12:05 RunningLeon

Unfortunately, the current implementation always returns the maximum possible tensor when working with dynamic tensors. In version 2021.4.2, dummy results were filled with zeros and could be filtered out. In the current version 2022.1.0 something is broken with the IOU threshold, I think.

SemyonBevzuk avatar May 19 '22 16:05 SemyonBevzuk

Unfortunately, the current implementation always returns the maximum possible tensor when working with dynamic tensors. In version 2021.4.2, dummy results were filled with zeros and could be filtered out. In the current version 2022.1.0 something is broken with the IOU threshold, I think.

@SemyonBevzuk Hi, appreciated your effort. Hope it would be fixed soon.

RunningLeon avatar May 20 '22 03:05 RunningLeon

closed for no activity for a long time.

RunningLeon avatar Aug 11 '22 06:08 RunningLeon