Forums - Wrong output rnet Onet - mtcnn

2 posts / 0 new
Last post
Wrong output rnet Onet - mtcnn
jacques.delfrate
Join Date: 30 May 22
Posts: 2
Posted: Tue, 2022-06-28 06:43

Hi,

I am trying to convert the 3 MTCNN models  (PNet, RNet and Onet) from this repo:
https://github.com/timesler/facenet-pytorch/blob/master/models/mtcnn.py

Conversion for PNet worked fine, I was able to get the same output in Python / Pytorch and C++ / NP_SDK.

However, I was not able to get the same output after the conversion of RNet and ONet.
At first I suspected the issue was  operations

        x = x.permute(0, 3, 2, 1).contiguous()
        x = x.view(x.shape[0], -1)

As those operations are not supported, I replaced them by 

        x = x.transpose(1, 3)
        x = x.reshape(x.shape[0], -1)

 

Because they are defined as supported network layers in documentation

 https://developer.qualcomm.com/sites/default/files/docs/snpe/network_lay...,

 

However, I am still not getting the right output when comparing Python / Pytorch vs C++ / NP_SDK.

What am I doing wrong ?

Thanks.

Please note that I export models in ONNX format using Pytorch and use the spne-onnx-to-dlc script for the conversion step.

  • Up0
  • Down0
weihuan
Join Date: 12 Apr 20
Posts: 103
Posted: Sat, 2022-07-09 19:39

Dear customer,

Interesting about your model as mentioned.

What's the SNPE version and platform you have tested? Regarding the onnx model accuracy, you need to convert the output tensor from NCHW(SNPE) to NHWC(onnx) and then go to your more progress.

 

BR.

Wei

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.