资源算法WindowsML-CoreML-MobileNet-demo

WindowsML-CoreML-MobileNet-demo

2020-02-28 | |  70 |   0 |   0

WindowsML-CoreML-MobileNet-demo

Sample code of converting CoreML MobileNet into Windows Machine Learning.
We prepare CoreML MobileNet for image classification from here.

mobilenet_demo.gif

Prepare model

Download MobileNet model from Core ML Store.
Then you see MobileNet.mlmodel , move model file to ./convert_model directory.

We use coremltools for loading CoreML model and winmltools for converting CoreML model into ONNX format.
First, install coremltools and winmltools by pip.

pip install coremltools winmltools

Second, execute python file for converting CoreML model.

python coreml2onnx.py

After execution, you will get two files mobilenet.onnx and mobilenet.txt.
Third, create C# code describing ONNX model.

"C:Program Files (x86)Windows Kits10bin10.0.17125.0x64mlgen.exe" -i mobilenet.onnx -l CS -n mobilenet -o mobilenet.cs

mobilenet.cs describes three classes MobilenetModelInput and MobilenetModelOutputand MobilenetModel.
Each class correspond Network input(image)Network output(class label and probability) and MobileNet Network and inference method.

Finally, move each files.
mobilenet.cs -> {solution dir}
mobilenet.onnx -> {solution dir}/Assets

Run demo

Start solution application.

Deploying the sample

  • Select Build > Deploy Solution.


上一篇:Mobilenet-CustomData

下一篇: mobilenetv3-tensorflow-printer

用户评价
全部评价

热门资源

  • Keras-ResNeXt

    Keras ResNeXt Implementation of ResNeXt models...

  • seetafaceJNI

    项目介绍 基于中科院seetaface2进行封装的JAVA...

  • spark-corenlp

    This package wraps Stanford CoreNLP annotators ...

  • capsnet-with-caps...

    CapsNet with capsule-wise convolution Project ...

  • inferno-boilerplate

    This is a very basic boilerplate example for pe...