onnx-coreml icon indicating copy to clipboard operation
onnx-coreml copied to clipboard

convert to CoreML and then get wrong predictions

Open MarcSteven opened this issue 4 years ago • 5 comments

🐞Describe the bug

A clear and brief description of what the bug is.

I converted to CoreML and then got the wrong prediction.

Trace

If applicable, please paste the error trace.

To Reproduce

  • If a python script can reproduce the error, please paste the code snippet

#// #// onnx_convert_coreml.py #// AntsFaceDemo #// #// Created by Marc Zhao on 2019/12/25. #// Copyright © 2019 AntsNetwork. All rights reserved. #//

from onnx_coreml import convert import sys from onnx import onnx_pb import onnx

model_in = "torch_model_20191205.onnx" model_out = "FacialExpressionAnalysisDemo.mlmodel" #print the model list here model = onnx.load(model_in) print(onnx.helper.printable_graph(model.graph))

coreml_model = convert(model_in, mode = None, preprocessing_args = {"image_scale":1/255.0 }, minimum_ios_deployment_target = '13') coreml_model.save('FacialExpressionAnalysisDemo2.mlmodel')

from onnx_coreml import convert
# Paste code snippet here
  • If applicable, please attach ONNX model
    • If model cannot be shared publicly, please attach it via filing a bug report at https://developer.apple.com/bug-reporting/
  • If model conversion succeeds, however, there is numerical mismatch between the original and the coreml model, please paste python script used for comparison (pytorch code, onnx runtime code etc.)

System environment (please complete the following information):

  • coremltools version (e.g., 3.0b5):
  • onnx-coreml version (e.g. 1.0b2):
  • OS (e.g., MacOS, Linux):
  • macOS version (if applicable):
  • How you install python (anaconda, virtualenv, system):
  • python version (e.g. 3.7):
  • any other relevant information:

Additional context

Add any other context about the problem here.

MarcSteven avatar Dec 26 '19 06:12 MarcSteven

@MarcSteven can you share onnx model?

bhushan23 avatar Jan 03 '20 08:01 bhushan23

@bhushan23 Because it's belonged to my company ,so I cannot make it public.

MarcSteven avatar Jan 07 '20 05:01 MarcSteven

Screen Shot 2020-01-07 at 13 57 41 Screen Shot 2020-01-07 at 13 58 03 I only share less about its graph @bhushan23

MarcSteven avatar Jan 07 '20 05:01 MarcSteven

@MarcSteven can you share onnx model?

When I convert it to onnx, i FOUND THERE IS A ERROR. Perhaps that's why the result of prediction was always wrong. So I think it should have a way to verify the conversion when convert it to onnx, right? @bhushan23

MarcSteven avatar Feb 04 '20 07:02 MarcSteven

Hi @bhushan23 , I knew you had released the version 1.2, but I don't find you mention the issue, does it mean you are still trying to modify the issue?

MarcSteven avatar Feb 15 '20 09:02 MarcSteven