cyrusbehr opened a new issue #17195: Unable to convert Insightface resnet 100 
model to onnx
URL: https://github.com/apache/incubator-mxnet/issues/17195
 
 
   I originally posted this question to the onnxruntime github page, but was 
hold to repost it here. The original post can be found 
[here](https://github.com/microsoft/onnxruntime/issues/2743#issue-542643478): 
   
   
   I am trying to convert the Insightface resnet 100 model (` 
LResNet100E-IR,ArcFace@ms1m-refine-v2`) which can be found 
[here](https://github.com/deepinsight/insightface/wiki/Model-Zoo) to work with 
onnxruntime. 
   
   I use the following conversion python script to convert the model. The model 
converts successfully.
   
   ```
   import mxnet as mx
   import numpy as np
   from mxnet.contrib import onnx as onnx_mxnet
   import logging
   logging.basicConfig(level=logging.INFO)
   
   sym = 'model-symbol.json'
   params = 'model-0000.params'
   
   input_shape = (1,3,112,112)
   
   # Path of the output file
   onnx_file = './insightface_resnet100.onnx'
   converted_model_path = onnx_mxnet.export_model(sym, params, [input_shape], 
np.float32, onnx_file)
   
   from onnx import checker
   import onnx
   
   model_proto = onnx.load_model(converted_model_path)
   
   # Check if converted ONNX protobuf is valid
   checker.check_graph(model_proto.graph)
   ```
   
   Next, I try to load the model in C++ using the following code. Note, I am 
following the example found 
[here](https://github.com/microsoft/onnxruntime/blob/master/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests.Capi/CXX_Api_Sample.cpp)
 : 
   ```
   int main(int argc, char* argv[]) {
       Ort::Env env(ORT_LOGGING_LEVEL_WARNING, "test");
       Ort::SessionOptions session_options;
       session_options.SetIntraOpNumThreads(1);
   
       
session_options.SetGraphOptimizationLevel(GraphOptimizationLevel::ORT_ENABLE_EXTENDED);
       const char* model_path = "../models/insightface_resnet100.onnx";
   
       Ort::Session session(env, model_path, session_options);
   
       return 0;
   }
   ```
   
   When I run this code, I get the following error:
   ```
   terminate called after throwing an instance of 'Ort::Exception'
     what():  Type Error: Type parameter (T) bound to different types 
(tensor(float) and tensor(double) in node (_minusscalar0).
   Aborted
   
   ```
   
   I am using `libonnxruntime.so.1.1.0`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to