Tensorflow model in opencv
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...
Thank you
This will help you solve your problem
About class name you must find class name file in the same site where you download weights and architecture
@eshirima thank you for sharing the link. I am able to print the labels now.
@LBerger thank you for your reply. I have the class name file and I am able to print them.