导出推理图
python export_inference_graph.py \
--alsologtostderr \
--dataset_name=autohome \ #自定义数据集的名称
--model_name=mobilenet_v2_140 \ #模型名字
--image_size=224 \
--output_file=angle/mobilenet_v2_140_224_inference.pb #待输出的推理图
冻结模型文件
python -m tensorflow.python.tools.freeze_graph \
--input_graph=angle/mobilenet_v2_140_224_inference.pb \ #推理图
--input_binary=true \
--output_node_names=MobilenetV2/Predictions/Reshape_1 \ #根据不同模型确定各自的输出节点
--input_checkpoint=angle/model/model.ckpt-10560 \ #训练的模型文件
--output_graph=angle/model/frozen_angle8.pb #导出的冻结图
使用冻结模型
import tensorflow as tf
import os
import numpy as np
import os, glob, cv2
import sys, argparse
# First, pass the path of the image
dir_path = os.path.dirname(os.path.realpath(__file__))
image_path = sys.argv[1]
filename = dir_path + '/' + image_path
image_size =