Hello, I have imported one tensorflow model (faster RCNN) in opencv and able to draw boxes around the objects using your code below:
cvNet = cv.dnn.readNetFromTensorflow('frozen_inference_graph.pb', 'graph.pbtxt')
img = cv.imread('example.png') rows = img.shape[0] cols = img.shape[1] cvNet.setInput(cv.dnn.blobFromImage(img, size=(800, 600), swapRB=True, crop=False)) cvOut = cvNet.forward()
for detection in cvOut[0,0,:,:]: score = float(detection[2]) if score > 0.25: 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()
Now, can you please tell me how can I print the class name and prediction score along with the boxes. I want to get output like the image below:
https://user-images.githubusercontent.com/7738407/59796425-76b2c100-92ab-11e9-869b-fe9707cdf650.jpg
Thank you