0

I have trained my custom object detector using faster_rcnn_inception_v2, tested it using object_detection_tutorial.ipynb and it works perfect, I can find bounding boxes for the objects inside the test image, my problem is how can I actually count the number of those bounding boxes or simply I want to count the number of objects detected for each class.

2 Answers 2

1

Because of low reputations I can not comment.

As far as I know the object detection API unfortunately has no built-in function for this.

You have to write this function by yourself. I assume you run the eval.py for evaluation!? To access the individual detected objects for each image you have to follow the following chain of scripts:

eval.py -> evaluator.py ->object_detection_evaluation.py -> per_image_evaluation.py

In the last script you can count the detected objects and bounding boxes per image. You just have to save the numbers and sum them up over your entire dataset.

Does this already help you?

Sign up to request clarification or add additional context in comments.

2 Comments

thanks for the answer, actually, I'm running the object_detection_tutorial.ipynb and want to know how can I count the bound boxes detected for each class.
If you only work with the tutorial, did you try to get the length of these dictonaries: output_dict['detection_boxes'], output_dict['detection_classes'], These should give you all the detections (bb and class) of one image.
0

I solved this using Tensorflow Object Counting API. We have an example of counting objects in an image using single_image_object_counting.py. I just replaced ssd_mobilenet_v1_coco_2017_11_17 with my own model containing inference graph

input_video = "image.jpg"
detection_graph, category_index = backbone.set_model(MODEL_DIR)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.