retrained tensorflow model with Dnn.readNetFromTensorflow
Hello,
I have retrained MobileNet v2 following the tutorial on https://www.tensorflow.org/hub/tutori... using the retrain.py script at https://raw.githubusercontent.com/ten.... Retraining on the flower data set works fine and I get the graph as pb file. I then try to generate the text graph using the tf_text_graph_ssd.py script. I adapted the ssd_mobilenet_v2_coco.config from https://github.com/tensorflow/models/... to match the number of classes (num_classes: 5) and the fixed shape resizer to 224X224. Executing tf_text_graph_ssd.py script with the adapted config results in an assertion error (assert(num_matched_layers == num_layers)), however a pbtxt file is genrated. Loading this pbtxt together with the retrained pb via readNetFromTensorflow results in the error (-215:Assertion failed) const_layers.insert(std::make_pair(name, li)).second in function 'cv::dnn::dnn4_v20181221::`anonymous-namespace'::addConstNodes'
Does anyone here have experience in using retrained tensorflow models in OpenCV? I would need a workflow to use various retrained models within a image processing pipeline based on OpenCV.
Thanks in advance!
Kind regards, Stefan