YonghaoHe / LFFD-A-Light-and-Fast-Face-Detector-for-Edge-Devices

A light and fast one class detection framework for edge devices. We provide face detector, head detector, pedestrian detector, vehicle detector......
MIT License
1.32k stars 329 forks source link

Question about onnx - confidence score (softmax) did not output as expected. #39

Closed kai06046 closed 3 years ago

kai06046 commented 5 years ago

I generated onnx model file for your v2 by to_onnx.py and run it on onnxruntime.

There are 10 groups of output for an inference, which are one confidence score and bbox for 5 scales. Bbox output is exactly same with mxnet inference but not confidence score. To verify it, I modified mxnet symbol to output convolution score before softmax operation. Then I calculate softmax myself and found the result consistant with mxnet inference.

I wonder if this problem could come from onnxruntime/mxnet softmax symbol/onnx convertion? p.s. thank you for this great work!

YonghaoHe commented 5 years ago

Indeed, the onnx is upgraded frequently, mxnet can not use the lateast version of ONNX. This may bring about some unkown issues. It seems that you found the problem, so you can do some extra work to fix it.

thibault20cent commented 5 years ago

I also encountrered this problem and wrote my own softmax too as a work around. The ONNX op for softmax is not the same as the mxnet softmax. See http://www.xavierdupre.fr/app/mlprodict/helpsphinx/api/onnxrt_ops.html#softmax