I am executing https://github.com/tensorflow/tensorflow this example of detecting objects in image.
I want to get count of detected objects following is the code tha
You should check scores and count objects as manual. Code is here:
#code to test image start
(boxes, scores, classes, num) = sess.run(
[detection_boxes, detection_scores, detection_classes, num_detections],
feed_dict={image_tensor: image_np_expanded})
#code to test image finish
#add this part to count objects
final_score = np.squeeze(scores)
count = 0
for i in range(100):
if scores is None or final_score[i] > 0.5:
count = count + 1
#count is the number of objects detected