ahmetozlu / tensorflow_object_counting_api

🚀 The TensorFlow Object Counting API is an open source framework built on top of TensorFlow and Keras that makes it easy to develop object counting systems!
https://www.youtube.com/watch?v=yT_1eKJTdfk
MIT License
1.32k stars 545 forks source link

Get the class names and number of counts in a separate datastructure (dictionary, array) #70

Closed rambalachandran closed 3 years ago

rambalachandran commented 4 years ago

Hi,

I'm able to reproduce your object counting code single_image_object_counting.py. However, my requirements are that I need the class name and counts to be available separately in a datastructure (like a dictionary) and not necessarily on the image. How can I modify the code to obtain this

bidyutchanda commented 4 years ago

https://github.com/ahmetozlu/tensorflow_object_counting_api/blob/f962997d747f274805d7a936995bf129b5a52a2b/api/object_counting_api.py#L480

You might have to change the code in this function def here.

mahamatnoumai commented 3 years ago

@rambalachandran any update on how you get it done. if not add the following code in the visualization_utils.py create a dic above as count = {} if class_name not in count: count[class_name]=1 else: count[class_name] = count[class_name] +1 Hope this may help. if you have done share your method for other to benefit.

ahmetozlu commented 3 years ago

You should parse the string [counting_result], that keep the counted objects, and push that parsed key, value pairs to dictionary variable.