Reputation: 612
I trained the model SSD_InceptionV2_coco on my PC with GPU on a customer image set. it works great on my pc so move it to my pi which run ok but super slow 0.7 FPS :( so i read about TFLite and used the script that comes on the Object_detection folder called "export_tflite_ssd_graph.py" it created a new .pb file but i run it on the script that works with regular frozen file i get the following:
Traceback (most recent call last): File "light_A.I_CT.py", line 81, in od_graph_def.ParseFromString(serialized_graph) File "/home/pi/.local/lib/python3.5/site-packages/google/protobuf/message.py", line 185, in ParseFromString self.MergeFromString(serialized) File "/home/pi/.local/lib/python3.5/site-packages/google/protobuf/internal/python_message.py", line 1083, in MergeFromString if self._InternalParse(serialized, 0, length) != length: File "/home/pi/.local/lib/python3.5/site-packages/google/protobuf/internal/python_message.py", line 1120, in InternalParse pos = field_decoder(buffer, new_pos, end, self, field_dict) File "/home/pi/.local/lib/python3.5/site-packages/google/protobuf/internal/decoder.py", line 610, in DecodeRepeatedField raise _DecodeError('Truncated message.') google.protobuf.message.DecodeError: Truncated message.
The code i am using is the following:
Load the Tensorflow model into memory. detection_graph = tf.Graph() with detection_graph.as_default():
od_graph_def = tf.GraphDef() with tf.gfile.GFile(PATH_TO_CKPT, 'rb') as fid: serialized_graph = fid.read() od_graph_def.ParseFromString(serialized_graph) tf.import_graph_def(od_graph_def, name='') sess = tf.Session(graph=detection_graph)
Its pretty basic and taken from the examples but i dont know if i need to do something else as all the TFLite samples are for IOS or Android.
Upvotes: 1
Views: 2689