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

person tracking and counting #74

Closed JonathanB-96 closed 4 years ago

JonathanB-96 commented 4 years ago

Hi, I am a beginner in deep learning and object detection using CNNs, I would appreciate all the help I can get. I have managed to create my own dataset for person detection from an overhead view using an IP camera, I have also trained the SSD mobilenet model on my dataset and the result is satisfactory.

I am using the object_tracking.py with my trained model to track the people's movement while assigning a unique ID. Now I wish to count the people entering a room i.e as soon as they cross the ROI in one direction as well as count the people leaving the room while crossing the same ROI in the other direction (up/down direction, two counters). I hope I have explained myself well enough and would appreciate any feedback. TIA

cabildocl commented 4 years ago

Hello, did you manage to count in both directions?

JonathanB-96 commented 4 years ago

Hello, did you manage to count in both directions?

Hello, Yes I am saving the bottom box position for each unique ID assigned of each frame. As soon as a person crosses the line (ROI) I am obtaining the mean position of all previous positions. The current position is subtracted by the mean position and if the result is positive that means the person is moving out/down. If the result is negative the person is moving in/up.

Hope this helps.

cabildocl commented 4 years ago

And how do you get the ID of each object?

JonathanB-96 commented 4 years ago

And how do you get the ID of each object?

If you look at backbone.py all you need is to grab the value in trk.id.