Link of the model zoo--https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/detection_model_zoo.md Link of the model zip--http://download.tensorflow.org/models/object_detection/faster_rcnn_inception_resnet_v2_atrous_oid_2018_01_28.tar.gz
OS : win 10 64 opencv version : 4.1.2, installed by anaconda
Using the opencv dnn module to perform object detection by the tensorflow model. But the results seems weird.
Steps to reproduce
1 : Generate the config file by tf_text_graph_faster_rcnn.py
python tf_text_graph_faster_rcnn.py --input frozen_inference_graph.pb --config pipeline.config --output faster_rcnn_inception_resnet_v2_atrous_oid.pbtxt
2 : detect object by the example codes
import cv2 as cv
cvNet = cv.dnn.readNetFromTensorflow('tensorflow/faster_rcnn_inception_resnet_v2_atrous_oid.pb', 'tensorflow/faster_rcnn_inception_resnet_v2_atrous_oid.pbtxt')
img = cv.imread('traffic_jam.jpg')
rows = img.shape[0]
cols = img.shape[1]
cvNet.setInput(cv.dnn.blobFromImage(img, size=(300, 300), swapRB=True, crop=False))
cvOut = cvNet.forward()
for detection in cvOut[0,0,:,:]:
score = float(detection[2])
if score > 0.1:
left = detection[3] * cols
top = detection[4] * rows
right = detection[5] * cols
bottom = detection[6] * rows
cv.rectangle(img, (int(left), int(top)), (int(right), int(bottom)), (23, 230, 210), thickness=2)
cv.imshow('img', img)
cv.waitKey()
- The results
Input image
results
Almost every cars cannot detected by this network, I have tried to change the size of image, but results become worse in this case. How should I fix this issue?Thanks