Hi,
I try to run ssd_mobilenet_v1_0.25 with OpenCV DNN. The wet was trained by the Tensorflow object detection API.
In the forward step in C++ (cv::Mat output = m_net.forward();
), I get following errror:
OpenCV Error: Assertion failed (!_aspectRatios.empty(), _minSize > 0) in cv::dnn::PriorBoxLayerImpl::PriorBoxLayerImpl, file C:\build\master_winpack-build-win64-vc15\opencv\modules\dnn\src\layers\prior_box_layer.cpp, line 207
I did follow this article: https://github.com/opencv/opencv/wiki/TensorFlow-Object-Detection-API
1). I trained my model with TF object detection API
2). I freezed the trained model with
py export_inference_graph.py --input_type image_tensor --pipeline_config_path training/ssd_mobilenet_v1.config --trained_checkpoint_prefix training/model.ckpt-14623 --output_directory inference_graph
3). constructed pbtxt file with: tf_text_graph_ssd.py
4.) At this stage I tried to read in the pb-file in C++:
m_net = cv::dnn::readNetFromTensorflow(sPathToTensorflowModel_PB, sPathToTensorflowModel_PBTXT);
--> Exception: Could not load the net
5.) Thus I followed the trouble shooting section and used optimize_for_inference.py
on my frozen_inference_graph.pb and re-constructed the pbtxt file on the optimized file see 3.)
After this, I re-tried 4.), which was successful. But now the forward cv::Mat output = m_net.forward();
gives an exception (see error shown above).
I already successfully loaded and forwarded the ssd_mobilenet_v1 with depth_multiplier=1.0 in openCV dnn. The ssd_mobilenet_v1_0.25 = ssd_mobilenet_v1 with depth_multiplier 0.25 trains and inferences (forwards) successfully in tensorflow (tested with the object_detection_tuorial.py script)
Any suggestions, how to build a valid pbtxt file for the 25% ssd_mobilenet_v1? Any help is greatly appreciated.