Ask Your Question

chamath's profile - activity

2019-01-07 19:19:03 -0500 received badge  Popular Question (source)
2018-01-29 12:26:00 -0500 marked best answer Tensorflow Custom Model in OpenCV

I have trained new model on top of ssd_mobilenet_v1_coco for a custom data set. This model works fine in tensorflow. But now I want to use this in OpenCV.

net = cv2.dnn.readNetFromTensorflow("model/frozen_inference_graph.pb", "model/protobuf.pbtxt")
detections = net.forward()

So for the config file I convert frozen_graph to pbtxt and add it. But then I got the following error [libprotobuf ERROR /home/chamath/Projects/opencv/opencv/3rdparty/protobuf/src/google/protobuf/text_format.cc:298] Error parsing text-format tensorflow.GraphDef: 731:5: Unknown enumeration value of "DT_RESOURCE" for field "type".

As suggested here I try to use this config file mentioned in the thread but when I use it object detection is not working properly. Incorrect number of squares detected and they are misplaced.

Is there any method to create a pbtxt config file that works with OpenCV? Or any suggestions how to make my model work in OpenCV?

Result in OpenCV :

image description

Result in Tensorflow

image description

2018-01-24 21:15:15 -0500 received badge  Supporter (source)
2018-01-24 05:15:03 -0500 received badge  Student (source)
2017-12-11 07:09:00 -0500 commented question Tensorflow Custom Model in OpenCV

@dkurt, any suggestions to solve this?

2017-12-10 10:05:29 -0500 commented question Tensorflow Custom Model in OpenCV

Yes for training replaced num_classes: 1 and PATH_TO_BE_CONFIGURED in the mentioned config file. Model is available in

2017-12-10 09:30:02 -0500 commented question Tensorflow Custom Model in OpenCV

Tensorflow code used for my model, https://gist.github.com/chamathabeysinghe/40200360e6938ed5aa4c349b89477b0e. This is e

2017-12-10 08:37:21 -0500 commented question Tensorflow Custom Model in OpenCV

@dkurt, Yes I have changed num_classes. I made your change to image blob but still the issue is there.

2017-12-10 05:28:49 -0500 commented question Tensorflow Custom Model in OpenCV

@dkurt, My opencv code is https://github.com/chamathabeysinghe/DeepLearningObjectDetection/blob/master/my_model_test.py

2017-12-10 05:19:53 -0500 commented question Tensorflow Custom Model in OpenCV

My opencv code is https://github.com/chamathabeysinghe/DeepLearningObjectDetection/blob/master/my_model_test.py . Number

2017-12-10 05:17:39 -0500 received badge  Editor (source)
2017-12-10 05:17:39 -0500 edited question Tensorflow Custom Model in OpenCV

Tensorflow Custom Model in OpenCV I have trained new model on top of ssd_mobilenet_v1_coco for a custom data set. This m

2017-12-10 02:27:20 -0500 asked a question Tensorflow Custom Model in OpenCV

Tensorflow Custom Model in OpenCV I have trained new model on top of ssd_mobilenet_v1_coco for a custom data set. This m