I have trained ssd_mobilenet_v1_pets. Cannot understand why I cannot open it with my C++ code and the error is refers to cafe, when I use tensorflow. Maybe the configuration of builded OpenCV is wrong? I set WITH_PROTOBUF=ON and BUILD_opencv_dnn=ON.
frozen_inference_graph.pb opencv download
Download Zip
https://provstinerbo.blogspot.com/?ba=2x5SLU
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
Before you start the installation of the libraries, you can customize the requirements.txt, excluding or including (for example, opencv-python) some dependencies. The below line initiates requirements installation into the previously activated virtual environment:
That gives me a frozen_inference_graph.pbfile that i can use to make my object detection program in OpenCV DNN. Also following this example i prepared a .pbtxt file of the model and pipeline config as the second argument for the cv2.dnn.readNetFromTensorflow function. Here is the code just enough to reproduce the error i'm having:
You have to specify config file as well. I consider if you have done transfer learning using tensorflow API, then you will find a file named pipeline.config along with frozen_inference_graph.pb file. Use that file as --config pipeline.config along with syntax. It should solve the problem.
Hi Jean,
your demo is very helpful.
1- in opencv GitHub ( ) I see scale factor and mean values for tensorflow SSDs. I tried to used them, but no object was detected, but with your settings it works. Do you know why? usually they should be employed in generating blob.
2- it is good if you also add a few lines to print label of each object on it.
Thanks!
We will start by downloading the tensorflow model to the current Mask-RCNN working directory. After the download is complete we extract the model files. We will be using the frozen graph file frozen_inference_graph.pb to get the model weights.
For this project, I will be using OpenCV an Open Source computer vision library for my video and image processing.
I'll be using a trained TensorFlow model from TensorFlow Zoo, specifically the SSD MobileNet V1 Coco model.
The model is contained within the'frozen_inference_graph.pb' from the zip file, and will allow me to identify objects.
The labels.txt file is also necessary to get the corresponding labels.
I'll also be using pictures and videos from pixabay to test the object recognition model.
this part, at the beginning of the program, because running it for each frame was taking lots of ressources for nothing, then I tried to run line by line my opencv image processing, and it appears that this line :
Cloning the repository downloads frozen_inference_graph.pb as well as classes.pbtxt for Inception V2 SSD detector into the demo/ssd_inception_v2 subfolder. A sample video is downloaded into the same folder as well. You can change these values at the top of the main function, or better still, set up command line parameter parsing.
Be sure to download the algorithm. pre-trained object detection model frozen_inference_graph.pb and its configuration file ssd_mobilenet_v3_large_coco_2020_01_14.pbtxt from the TensorFlow Object Detection.
Go to the Import Model page as described in Import Models. Select TensorFlow in the drop-down list. Do not uncheck the Is Frozen Model box, because this is a frozen model. Choose the frozen_inference_graph.pb file. The name of the model is automatically filled in based on the name of the file you choose first.
Exception Type: error at /Exception Value: OpenCV(4.5.1) /tmp/pip-req-build-ms668fyv/opencv/modules/dnn/src/caffe/caffe_io.cpp:1133: error: (-2:Unspecified error) FAILED: fs.is_open(). Can't open "frozen_east_text_detection.pb" in function 'ReadProtoFromBinaryFile'
35fe9a5643