1 目录结构
接着上一小节继续做,在log文件夹中新建out文件夹。
2 ckpt转pb文件
上一节中num_steps = 200,当设置num_steps = 200000时
cd C:\Users\Administrator\Desktop\Tensorflow\ObjectDetection\models\research\object_detection
python export_inference_graph.py --input_type=image_tensor --pipeline_config_path="C:/Users/Administrator/Desktop/opmask/mask/mask_rcnn_inception_v2_coco_2018_01_28/mask_rcnn_inception_v2_coco.config" --trained_checkpoint_prefix="C:/Users/Administrator/Desktop/opmask/mask/log/model.ckpt-200000" --output_directory="C:/Users/Administrator/Desktop/opmask/mask/log/out"
3 生成pbtxt文件
找到opencv中sources/samples/dnn模块中tf_text_graph_mask_rcnn.py,复制并重命名为tf_text_graph_mask_rcnn_me.py,修改文件中的下述路径。
parser.add_argument('--input', default='C:/Users/Administrator/Desktop/opmask/mask/log/out/frozen_inference_graph.pb', help='Path to frozen TensorFlow graph.')
parser.add_argument('--output', default='C:/Users/Administrator/Desktop/opmask/mask/log/out/mask_rcnn.pbtxt', help='Path to output text graph.')
parser.add_argument('--config', default='C:/Users/Administrator/Desktop/opmask/mask/mask_rcnn_inception_v2_coco_2018_01_28/mask_rcnn_inception_v2_coco.config', help='Path to a *.config file is used for training.')
args = parser.parse_args()
cd C:\Users\Administrator\Desktop\opencv4\opencv\sources\samples\dnn
python tf_text_graph_mask_rcnn_me.py
4 mscoco_labels.names
0.0
0.4
0.8
1.2
1.6
point
<