Created
August 16, 2018 03:51
-
-
Save kenwoodjw/d60a0c4247dfebeccce6f6edf1283ae3 to your computer and use it in GitHub Desktop.
AI 模型转换脚本
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#mtk caffe 模型转换 | |
python scripts/caffe2pb_inference.py \ | |
--model=models/resnet/ResNet-50-model.caffemodel \ | |
--proto=models/resnet/ResNet-50-deploy.prototxt | |
python scripts/caffe2pb_inference.py \ | |
--model=models/mobilenet/mobilenet_v2.caffemodel \ | |
--proto=models/mobilenet/mobilenet_v2_deploy.prototxt | |
#华为 caffe 模型转换 | |
./cngen_linux --prototxt mobilenet_v2_deploy.prototxt --model mobilenet_v2.caffemodel | |
#华为 tensorflow 模型转换 | |
cd cpu2ipu && sh run.sh | |
./pb_to_offline --graph=../model/facenet_ipu.pb --param_file=../model/facenet_model.txt | |
#mtk tensorflow to tflite | |
#inception_v3 | |
toco --graph_def_file=/home/tflite/neuropilot_converter/tf2tflite/sample_models/inception_v3.pb \ | |
--input_format=TENSORFLOW_GRAPHDEF \ | |
--output_format=tflite \ | |
--output_file=INCEPTION_V3.TFLITE \ | |
--inference_type=FLOAT \ | |
--inference_input_type=FLOAT \ | |
--input_arrays=input \ | |
--output_arrays=InceptionV3/Predictions/Reshape_1 \ | |
--input_shapes=1,299,299,3 | |
# | |
toco --graph_def_file=/home/tflite/neuropilot_converter/tf2tflite/sample_models/resnet34.pb \ | |
--input_format=TENSORFLOW_GRAPHDEF \ | |
--output_format=tflite \ | |
--output_file=resnet34.TFLITE \ | |
--inference_type=FLOAT \ | |
--inference_input_type=FLOAT \ | |
--input_arrays=Placeholder \ | |
--output_arrays=loss \ | |
--input_shapes=1,224,224,3 | |
#拿到模型input output | |
bazel build tensorflow/tools/graph_transforms:summarize_graph | |
./bazel-bin/tensorflow/tools/graph_transforms/summarize_graph --in_graph=/home/kenwood/snpe-1.17.0/inception_v3.pb | |
bazel run tensorflow/tools/benchmark:benchmark_model -- --graph=/home/kenwood/snpe-1.17.0/inception_v3.pb --show_flops --input_layer=input --input_layer_type=float --input_layer_shape=-1,299,299,3 --output_layer=InceptionV3/Predictions/Reshape_1 | |
bazel run tensorflow/tools/benchmark:benchmark_model -- --graph=/home/kenwood/snpe-1.17.0/resnet34.pb --show_flops --input_layer=Placeholder --input_layer_type=float --input_layer_shape=1,224,224,3 --output_layer=loss | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment