Reputation: 1013
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.
Upvotes: 0
Views: 3252
Reputation: 1013
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)
Upvotes: 0
Reputation: 370
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?
Upvotes: 1