Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pytorch->ONNX->TF-> SNPE Error for batchnorm variance #749

Open
Ashutosh1995 opened this issue Sep 1, 2020 · 3 comments
Open

Pytorch->ONNX->TF-> SNPE Error for batchnorm variance #749

Ashutosh1995 opened this issue Sep 1, 2020 · 3 comments

Comments

@Ashutosh1995
Copy link

I converted Mobilenet V1 SSD Pytorch model to ONNX format(https://github.com/qfgaohao/pytorch-ssd) and from there to protobuf format using ONNX TF (TF==1.15). ONNX version == 1.3 and SNPE == 1.36

Now when trying to convert protobuf file to DLC format for SNPE, I am getting the following error

ERROR - Conversion failed: Cannot resolve BatchNorm layer due to missing variance value.

Upon googling, I found this link https://developer.qualcomm.com/forum/qdn-forums/software/snapdragon-neural-processing-engine-sdk/35033 which says batchnorm variance should be either Const or Identity.

Since I am newbie in TF, could someone help resolve the issue

The command to convert pb file to DLC format is

snpe-tensorflow-to-dlc --input_network mb.pb --input_dim input.1 "1,3,300,300" --out_node 'boxes' --out_node 'scores' --output_path mb.dlc --allow_unconsumed_nodes

@Ashutosh1995 Ashutosh1995 changed the title ONNX->TF-> SNPE Error for batchnorm variance Pytorch->ONNX->TF-> SNPE Error for batchnorm variance Sep 1, 2020
@jjfrog
Copy link

jjfrog commented Sep 23, 2020

I had the same problem too when converting even a simple CNN from PyTorch -> ONNX ->TF ->SNPE . My CNN is just composed of Conv2D, BatchNormalization, Pooling and Activation function.
Then I tried another way to convert: PyTorch -> ONNX -> Caffe2 -> SNPE, and it worked fine.
But now I need to convert another model which is yolov5 to SNPE, and sadly some of its layers are not supported when converting ONNX -> Caffe2. Therefore, I go back to try TF -> SNPE again and still get this error.
Really need someone to solve this.

PyTorch 1.6.0
ONNX 1.7.0
Tensorflow 1.15.0
SNPE 1.40.0.2130

@WeihengXia0123
Copy link

Is there any update of this issue?

@chinhuang007
Copy link
Collaborator

A couple of updates:

  1. TF 1.15 is no longer supported by onnx-tf
  2. We need the code that leads to the error message and the onnx file to debug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants