My graph.pbxt file is not working with frozen_inference_graph.pb file

asked 2020-07-07 10:14:06 -0600

pardeep kumar gravatar image

updated 2020-07-08 07:08:40 -0600

supra56 gravatar image

so i am following object detection api for the first time i used mobileNet v1 model and trained it on Tom and jerry and finally convert the graph.pbxt and used it with cv2.dnn.readnetfromtesnsorlfow it was working perfect but now i took another model mobileNet v2 and trained gun detection so inference with tensorflow its working fine but when when i read it with opencv dnn module it throws errors and i don't understand where is the actual problem

The detection architecture used is Faster RCNN

and here is the code in which I am getting errors

import cv2

net = cv2.dnn.readNetFromTensorflow("forzen_inference_graph.pb","graph.pbxt");


error                                     Traceback (most recent call last)
<ipython-input-5-c39683f1b643> in <module>()
      2 # Load a model imported from Tensorflow
      3 # net = cv2.dnn.readNetFromTensorflow('../frozen_inference_graph.pb', '../graph.pbtxt')
----> 4 net = cv2.dnn.readNetFromTensorflow('frozen_inference_graph.pb', 'graph.pbtxt')

error: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\dnn\src\tensorflow\tf_importer.cpp:544: error: (-2:Unspecified error) Input layer not found: FeatureExtractor/MobilenetV2/Conv/weights in function 'cv::dnn::dnn4_v20191202::`anonymous-namespace'::TFImporter::connect'

and here are the models i am using!Ar3jCIzrHUwWga4sS...

edit retag flag offensive close merge delete


modelNet v2

that's not a thing. did you mean MobileNet ? (which is a classification network)

berak gravatar imageberak ( 2020-07-07 11:10:28 -0600 )edit

thanks for editing, can you add the error msg, too ?

berak gravatar imageberak ( 2020-07-08 04:51:24 -0600 )edit

I've added the error too.Thanks,

pardeep kumar gravatar imagepardeep kumar ( 2020-07-08 06:18:50 -0600 )edit