Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

TensorFlow Custom Trained Models on OpenCV

Guys, I been able to run the default TF models provided here, but on trying the custom trained models, I face the following error:

[libprotobuf ERROR /home/my_username/opencv/3rdparty/protobuf/src/google/protobuf/text_format.cc:288] Error parsing text-format tensorflow.GraphDef: 1:6: Message type "tensorflow.GraphDef" has no field named "item". OpenCV(3.4.1) Error: Unspecified error (FAILED: ReadProtoFromTextFile(param_file, param). Failed to parse GraphDef file: /home/my_username/testing_zone/object-detection.pbtxt) in ReadTFNetParamsFromTextFileOrDie, file /home/my_username/opencv/modules/dnn/src/tensorflow/tf_io.cpp, line 54 Traceback (most recent call last): File "tf_example_2.py", line 3, in <module> cvNet = cv.dnn.readNetFromTensorflow('/home/my_username/testing_zone/frozen_inference_graph3.pb', '/home/my_username/testing_zone/object-detection.pbtxt') cv2.error: OpenCV(3.4.1) /home/my_username/opencv/modules/dnn/src/tensorflow/tf_io.cpp:54: error: (-2) FAILED: ReadProtoFromTextFile(param_file, param). Failed to parse GraphDef file: /home/my_username/testing_zone/object-detection.pbtxt in function ReadTFNetParamsFromTextFileOrDie

Troubleshooting using optimize_for_inference.py and then generating the new .pbtxt using tf_text_graph_ssd.py, gave the following error:

[ INFO:0] Initialize OpenCL runtime... OpenCV(3.4.1) Error: Assertion failed (int(numPriors * _numClasses) == inputs[1][1]) in getMemoryShapes, file /home/my_username/opencv/modules/dnn/src/layers/detection_output_layer.cpp, line 209 Traceback (most recent call last): File "tf_example_2.py", line 10, in <module> cvOut = cvNet.forward() cv2.error: OpenCV(3.4.1) /home/my_username/opencv/modules/dnn/src/layers/detection_output_layer.cpp:209: error: (-215) int(numPriors * _numClasses) == inputs[1][1] in function getMemoryShapes

I have OpenCV 3.4.1 installed on 64-bit system with Ubuntu 17.10.

TensorFlow Custom Trained Models on OpenCV

Guys, I been able to run the default TF models provided here, but on trying the custom trained models, I face the following error:

[libprotobuf ERROR /home/my_username/opencv/3rdparty/protobuf/src/google/protobuf/text_format.cc:288] Error parsing text-format tensorflow.GraphDef: 1:6: Message type "tensorflow.GraphDef" has no field named "item". OpenCV(3.4.1) Error: Unspecified error (FAILED: ReadProtoFromTextFile(param_file, param). Failed to parse GraphDef file: /home/my_username/testing_zone/object-detection.pbtxt) in ReadTFNetParamsFromTextFileOrDie, file /home/my_username/opencv/modules/dnn/src/tensorflow/tf_io.cpp, line 54 Traceback (most recent call last): File "tf_example_2.py", line 3, in <module> cvNet = cv.dnn.readNetFromTensorflow('/home/my_username/testing_zone/frozen_inference_graph3.pb', '/home/my_username/testing_zone/object-detection.pbtxt') cv2.error: OpenCV(3.4.1) /home/my_username/opencv/modules/dnn/src/tensorflow/tf_io.cpp:54: error: (-2) FAILED: ReadProtoFromTextFile(param_file, param). Failed to parse GraphDef file: /home/my_username/testing_zone/object-detection.pbtxt in function ReadTFNetParamsFromTextFileOrDie

Troubleshooting using optimize_for_inference.py and then generating the new .pbtxt using tf_text_graph_ssd.py, gave the following error:

[ INFO:0] Initialize OpenCL runtime... OpenCV(3.4.1) Error: Assertion failed (int(numPriors * _numClasses) == inputs[1][1]) in getMemoryShapes, file /home/my_username/opencv/modules/dnn/src/layers/detection_output_layer.cpp, line 209 Traceback (most recent call last): File "tf_example_2.py", line 10, in <module> cvOut = cvNet.forward() cv2.error: OpenCV(3.4.1) /home/my_username/opencv/modules/dnn/src/layers/detection_output_layer.cpp:209: error: (-215) int(numPriors * _numClasses) == inputs[1][1] in function getMemoryShapes

I have OpenCV 3.4.1 installed on 64-bit system with Ubuntu 17.10.

TensorFlow Custom Trained Models on OpenCV

Guys, I been able to run the default TF models provided here, but on trying the custom trained models, I face the following error:

[libprotobuf ERROR /home/my_username/opencv/3rdparty/protobuf/src/google/protobuf/text_format.cc:288] Error parsing text-format tensorflow.GraphDef: 1:6: Message type "tensorflow.GraphDef" has no field named "item". OpenCV(3.4.1) Error: Unspecified error (FAILED: ReadProtoFromTextFile(param_file, param). Failed to parse GraphDef file: /home/my_username/testing_zone/object-detection.pbtxt) in ReadTFNetParamsFromTextFileOrDie, file /home/my_username/opencv/modules/dnn/src/tensorflow/tf_io.cpp, line 54 Traceback (most recent call last): File "tf_example_2.py", line 3, in <module> cvNet = cv.dnn.readNetFromTensorflow('/home/my_username/testing_zone/frozen_inference_graph3.pb', '/home/my_username/testing_zone/object-detection.pbtxt') cv2.error: OpenCV(3.4.1) /home/my_username/opencv/modules/dnn/src/tensorflow/tf_io.cpp:54: error: (-2) FAILED: ReadProtoFromTextFile(param_file, param). Failed to parse GraphDef file: /home/my_username/testing_zone/object-detection.pbtxt in function ReadTFNetParamsFromTextFileOrDie

Troubleshooting using optimize_for_inference.py and then generating the new .pbtxt using tf_text_graph_ssd.py, gave the following error:

[ INFO:0] Initialize OpenCL runtime... OpenCV(3.4.1) Error: Assertion failed (int(numPriors * _numClasses) == inputs[1][1]) in getMemoryShapes, file /home/my_username/opencv/modules/dnn/src/layers/detection_output_layer.cpp, line 209 Traceback (most recent call last): File "tf_example_2.py", line 10, in <module> cvOut = cvNet.forward() cv2.error: OpenCV(3.4.1) /home/my_username/opencv/modules/dnn/src/layers/detection_output_layer.cpp:209: error: (-215) int(numPriors * _numClasses) == inputs[1][1] in function getMemoryShapes

I have OpenCV 3.4.1 installed on 64-bit system with Ubuntu 17.10.

TensorFlow Custom Trained Models on OpenCV

Guys, I been able to run the default TF models provided here, but on trying the custom trained models, I face the following error:

[libprotobuf ERROR /home/my_username/opencv/3rdparty/protobuf/src/google/protobuf/text_format.cc:288] Error parsing text-format tensorflow.GraphDef: 1:6: Message type "tensorflow.GraphDef" has no field named "item". OpenCV(3.4.1) Error: Unspecified error (FAILED: ReadProtoFromTextFile(param_file, param). Failed to parse GraphDef file: /home/my_username/testing_zone/object-detection.pbtxt) in ReadTFNetParamsFromTextFileOrDie, file /home/my_username/opencv/modules/dnn/src/tensorflow/tf_io.cpp, line 54 Traceback (most recent call last): File "tf_example_2.py", line 3, in <module> cvNet = cv.dnn.readNetFromTensorflow('/home/my_username/testing_zone/frozen_inference_graph3.pb', '/home/my_username/testing_zone/object-detection.pbtxt') cv2.error: OpenCV(3.4.1) /home/my_username/opencv/modules/dnn/src/tensorflow/tf_io.cpp:54: error: (-2) FAILED: ReadProtoFromTextFile(param_file, param). Failed to parse GraphDef file: /home/my_username/testing_zone/object-detection.pbtxt in function ReadTFNetParamsFromTextFileOrDie

Troubleshooting using optimize_for_inference.py and then generating the new .pbtxt using tf_text_graph_ssd.py, gave the following error:

[ INFO:0] Initialize OpenCL runtime... OpenCV(3.4.1) Error: Assertion failed (int(numPriors * _numClasses) == inputs[1][1]) in getMemoryShapes, file /home/my_username/opencv/modules/dnn/src/layers/detection_output_layer.cpp, line 209 Traceback (most recent call last): File "tf_example_2.py", line 10, in <module> cvOut = cvNet.forward() cv2.error: OpenCV(3.4.1) /home/my_username/opencv/modules/dnn/src/layers/detection_output_layer.cpp:209: error: (-215) int(numPriors * _numClasses) == inputs[1][1] in function getMemoryShapes

I have OpenCV 3.4.1 installed on 64-bit system with Ubuntu 17.10.