retrained tensorflow model with Dnn.readNetFromTensorflow

asked 2019-05-08 07:26:59 -0500

updated 2019-05-08 09:08:30 -0500

berak gravatar image


I have retrained MobileNet v2 following the tutorial on using the script at 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 script. I adapted the ssd_mobilenet_v2_coco.config from to match the number of classes (num_classes: 5) and the fixed shape resizer to 224X224. Executing 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

edit retag flag offensive close merge delete