Counting recognized Objects with Yolo Darknet ( 119 )

 

 

I didn't found a Yolo native way to count objects that are displayed on prediction output.
This can be a cool feature, some projects may required it. For example, maybe scientist project wants to track the amount of horses on some specific area.
They install a camera and track/analyse the video/image data using an Object Detection tool like Yolo Darknet or Tensorflow.
Without modifying Yolo core, this count feature can be made using export feature from terminal.

First step is to run detection on specific video/image source like:


./darknet detect cfg/yolov3.cfg yolov3.weights wildhorse.jpg  -out predict_ > output_prediction.txt


Now we have a TXT file having prediction

Using GREP is easy to grab the count of all objects:

grep -i "horse:%*" | wc -l
# output will be 6




Image Source: BLM Seeking New Off-Range Wild Horse, Burro Pasture Bids http://www.westernwhitetail.com/blm-seeking-new-off-range-wild-horse-burro-pasture-bids/