Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.

Can not convert LPRNet to IR (tensorflow)

LAI__PEI_YU
Beginner
617 Views

Hello.

I am new to openvino and using Openvino 2020.1.023

I use the LPRNet from the link below:

https://github.com/lyl8213/Plate_Recognition-LPRnet

I freeze the model using the code below:

with tf.Session(graph=tf.Graph()) as sess:
        # We import the meta graph in the current default Graph
        saver = tf.train.import_meta_graph(input_checkpoint + '.meta', clear_devices=clear_devices)
        graph_def = tf.get_default_graph().as_graph_def()
        node_list=[n.name for n in graph_def.node]
        # We restore the weights
        saver.restore(sess, input_checkpoint)
        # Dddd=output_node_names.split(",")

        # We use a built-in TF helper to export variables to constants
        output_graph_def = tf.graph_util.convert_variables_to_constants(
            sess, # The session is used to retrieve the weights
            tf.get_default_graph().as_graph_def(), # The graph_def is used to retrieve the nodes 
            node_list # The output node names are used to select the usefull nodes
        ) 

        # tf.train.write_graph(sess.graph_def, '.', 'tfdroid.pbtxt')

        # Finally we serialize and dump the output graph to the filesystem
        with tf.gfile.GFile(output_graph, "wb") as f:
            f.write(output_graph_def.SerializeToString())
        print("%d ops in the final graph." % len(output_graph_def.node))

    return output_graph_def

and use the command below:

python3 mo.py --input_model /home/ibox/Desktop/BusParkingDetection/frozen_mode/frozen_model.pb --output_dir /home/ibox/Desktop/ --input_shape [2,60,24,3] --input Placeholder --log_level=DEBUG

The debug text and  model.pbtxt are in attach files, Really appreciate your help!

 

0 Kudos
3 Replies
Max_L_Intel
Moderator
617 Views

Hello, LAI, PEI YU.

As I can see, the exception error is the same as in your other topic, so please use my recommendations from there for this one too - https://software.intel.com/en-us/forums/intel-distribution-of-openvino-toolkit/topic/849006

Best regards, Max. 

0 Kudos
LAI__PEI_YU
Beginner
617 Views

I saw a way to solve this problem in https://github.com/opencv/dldt/issues/98

My debug files contains Assign.... , which means it is not a frozen graph.

I examined the output node names and chose the correct one, now I am able to convert the LPRNet! 

0 Kudos
Max_L_Intel
Moderator
617 Views

Hello LAI, PEI YU.

We are really glad that you were able to convert the LPRNet model. Thanks for sharing this information with us.

0 Kudos
Reply