- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I use the following code to freeze the model to a .pb file:
import tensorflow as tf
from core.yolov3 import YOLOV3
pb_file = "./yolov3_yogi.pb"
#ckpt_file = "./checkpoint/yolov3_test_loss=1.4306.ckpt-50"
ckpt_file = '/home/yugendra/Downloads/safety-tensorflow-yolov3/saftey_head_helmet_vest/checkpoint/yolov3_test_loss=1.5784.ckpt-7'
output_node_names = ["input/input_data", "pred_sbbox/concat_2", "pred_mbbox/concat_2", "pred_lbbox/concat_2"]
with tf.name_scope('input'):
input_data = tf.placeholder(dtype=tf.float32, name='input_data')
model = YOLOV3(input_data, trainable=False)
print(model.conv_sbbox, model.conv_mbbox, model.conv_lbbox)
sess = tf.Session(config=tf.ConfigProto(allow_soft_placement=True))
saver = tf.train.Saver()
saver.restore(sess, ckpt_file)
converted_graph_def = tf.graph_util.convert_variables_to_constants(sess,
input_graph_def = sess.graph.as_graph_def(),
output_node_names = output_node_names)
with tf.gfile.GFile(pb_file, "wb") as f:
f.write(converted_graph_def.SerializeToString())
Successfully i got .pb file
THis is my YoloV3.json
[
{
"id": "TFYOLOV3",
"match_kind": "general",
"custom_attributes": {
"classes": 1,
"anchors": [10,9, 15,14, 21,22, 37,32, 25,54, 54,44, 72,65, 192,43, 103,98],
"coords": 4,
"num": 9,
"masks":[[6, 7, 8], [3, 4, 5], [0, 1, 2]],
"entry_points": ["yolo-v3/Reshape", "yolo-v3/Reshape_4", "yolo-v3/Reshape_8"]
}
}
]
Getting error:
- Log level: ERROR
- Batch: Not specified, inherited from the model
- Input layers: Not specified, inherited from the model
- Output layers: Not specified, inherited from the model
- Input shapes: [1,416,416,1]
- Mean values: Not specified
- Scale values: Not specified
- Scale factor: Not specified
- Precision of IR: FP16
- Enable fusing: True
- Enable grouped convolutions fusing: True
- Move mean values to preprocess section: False
- Reverse input channels: False
TensorFlow specific parameters:
- Input model in text protobuf format: False
- Path to model dump for TensorBoard: None
- List of shared libraries with TensorFlow custom layers implementation: None
- Update the configuration file with input/output node names: None
- Use configuration file used to generate the model with Object Detection API: None
- Operations to offload: None
- Patterns to offload: None
- Use the config file: /opt/intel/openvino_2020.1.023/deployment_tools/model_optimizer/extensions/front/tf/yolo_v3.json
Model Optimizer version: 2020.1.0-61-gd349c3ba4a
[ ERROR ] Exception occurred during running replacer "TFYOLOV3" (<class 'extensions.front.YOLO.YoloV3RegionAddon'>): TensorFlow YOLO V3 conversion mechanism was enabled. Entry points "detector/yolo-v3/Reshape, detector/yolo-v3/Reshape_4, detector/yolo-v3/Reshape_8" were provided in the configuration file. Entry points are nodes that feed YOLO Region layers. Node with name detector/yolo-v3/Reshape doesn't exist in the graph. Refer to documentation about converting YOLO models for more information.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thank you for your quick response.
The problem is resolved, I was giving wrong entry points (YoloV3.json) while converting .pb file to IR.
Thank you.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Greetings,
Have you tried our official yolov3 ( https://github.com/mystic123/tensorflow-yolo-v3 ) model beforehand?, if not why dont you give it a shot. Once you have a solid working environment you can start developing on your own.
Here is our official YOLO model conversion tutorial: https://docs.openvinotoolkit.org/latest/openvino_docs_MO_DG_prepare_model_convert_model_tf_specific_Convert_YOLO_From_Tensorflow.html
For the error that you got, it seems like the IR is not properly routed and some node is missing.
To make these process clearer, you can refer to this video: https://www.youtube.com/watch?v=FaqVhvJ6-Uc
Sincerely,
Iffa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thank you for your quick response.
The problem is resolved, I was giving wrong entry points (YoloV3.json) while converting .pb file to IR.
Thank you.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page