Multitarget-tracker icon indicating copy to clipboard operation
Multitarget-tracker copied to clipboard

Detection, Tracking and ID

Open scianand opened this issue 2 years ago • 20 comments

Dear @Nuzhny007 , @Smorodov ,

I am creating an application where I am trying to detect moving objects such as birds & flies, track them and if they are detected for more than 5 times then give them an ID. I am trying to use example 1 - MotionDetector for that. Can you give me suggestions on how to approach this problem?

Thanks,

Vimal

scianand avatar Mar 22 '22 12:03 scianand

Hi! Can you send me a sample video? There are many nuances: birds size, static or dynamic background, wind+three letters etc.

Nuzhny007 avatar Mar 22 '22 20:03 Nuzhny007

Hi @Nuzhny007,

Thanks for your response. The object size is around 3-4 pixels sometimes less than that. The camera will be static.

Vimal

scianand avatar Mar 23 '22 09:03 scianand

So, it works with latest version: https://github.com/Smorodov/Multitarget-tracker/pull/368 Make git pull and rebuild. And run: Multitargettracker.exe 159662171-6c4f290c-8b5e-43d2-af04-c76992df8bf3.mp4 -e=1 -a=0 -o=159662171_res.mp4

https://user-images.githubusercontent.com/5041357/159964512-9379eb66-6013-4131-9566-20d321922fb8.mp4

Nuzhny007 avatar Mar 24 '22 16:03 Nuzhny007

Some notes:

  • We will detect very small objects: https://github.com/Smorodov/Multitarget-tracker/blob/master/example/examples.h#L57
  • The best background subtraction algorithm - MOG: https://github.com/Smorodov/Multitarget-tracker/blob/master/example/examples.h#L62
  • New Kalman settings: https://github.com/Smorodov/Multitarget-tracker/blob/master/example/examples.h#L123
  • And here mnimal trajectory size: https://github.com/Smorodov/Multitarget-tracker/blob/master/example/examples.h#L200

Nuzhny007 avatar Mar 24 '22 16:03 Nuzhny007

Hi @Nuzhny007,

Thanks a lot for your help. Is it possible to use this functionality using Python code as my application is in Python?

Vimal

scianand avatar Mar 25 '22 12:03 scianand

Oh, I'll try to rescue my python integration. Do you use Windows or Linux?

Nuzhny007 avatar Mar 25 '22 12:03 Nuzhny007

Hi @Nuzhny007,

I am using Linux.

Vimal

scianand avatar Mar 25 '22 12:03 scianand

I'm not a big Python master: https://github.com/Smorodov/Multitarget-tracker/pull/369 But on my Ubuntu worked this example: https://github.com/Smorodov/Multitarget-tracker/blob/master/demo.py

Do not forget: git pull and cmake -DMTRACKER_PYTHON=ON

Nuzhny007 avatar Apr 07 '22 20:04 Nuzhny007

@scianand Might I use your video as Tracker example on my Youtube channel and on main page in this repository?

Nuzhny007 avatar Apr 07 '22 20:04 Nuzhny007

@Nuzhny007 ,

Thanks for your help. Yes, you can use it in your repository. I am still not able to build the repository with Python bindings. This error is showing: mtt_issue_1

How can I solve this?

Thanks,

Vimal

scianand avatar Apr 11 '22 15:04 scianand

Probably fixed: https://github.com/Smorodov/Multitarget-tracker/pull/370

Yes, you can use it in your repository Thnx!

Nuzhny007 avatar Apr 12 '22 10:04 Nuzhny007

Hi @Nuzhny007,

Thanks. It is working now. There are some more problems that I am facing right now:

  1. Some of the videos I have are of 1920x1080 resolution and the object size is 1x1 pixel. I want to detect and track the objects in those videos. Would this repository be able to process videos with FHD resolution in real-time?
  2. In some of the videos I am getting lots of false positives due to clouds and the movement of trees due to the wind. Is it possible to reject these detections?

Thanks in advance.

Vimal

scianand avatar Apr 12 '22 14:04 scianand

Hi!

  1. Yes.
  2. May be. About trees: I think than it can add filter for trajectory (speed, direction etc) - postprocessing for tracking results. Birds fly directly with high speed. But trees stays on one place. And clouds move very slow.

I can try to add such filter for trajectories.

Nuzhny007 avatar Apr 12 '22 14:04 Nuzhny007

Thanks @Nuzhny007.

scianand avatar Apr 12 '22 14:04 scianand

Hi! Now I have not a final answer but you can use a very simple filter for fast objects. Each track has a velocity from Kalman filter pixels per second): https://github.com/Smorodov/Multitarget-tracker/blob/8c0193f2b5cd32a236a1e84fc8c75d140254bdd8/src/Tracker/trajectory.h#L181

So, the final result:

 auto val = sqrt(rack.m_velocity[0] * rack.m_velocity[0]) + track.m_velocity[1] * rack.m_velocity[1]));
if (val > 30) // some threshold
   // Draw track - it's probably bird

Now I think about more complex filter with trajectory least squares approximation but don't sure in result

Nuzhny007 avatar Apr 20 '22 03:04 Nuzhny007

You can try new version: https://github.com/Smorodov/Multitarget-tracker/pull/371 If it doesn't work correctly on another videos then you can share they.

Nuzhny007 avatar Apr 23 '22 21:04 Nuzhny007

So, it works with latest version: #368 Make git pull and rebuild. And run: Multitargettracker.exe 159662171-6c4f290c-8b5e-43d2-af04-c76992df8bf3.mp4 -e=1 -a=0 -o=159662171_res.mp4

159662171_res.mp4

Could you please share the original video of this little goal?

Mickeyyyang avatar Oct 16 '22 03:10 Mickeyyyang

Hi @scianand ,

I would also be interested to get the video in order to validate my setup.

In advance thanks, Louis

CloudRider-pixel avatar Nov 17 '22 11:11 CloudRider-pixel

I have this videos but don't sure that topic starter doesn't mind

Nuzhny007 avatar Nov 17 '22 12:11 Nuzhny007

Hi, Very interested on your work!, Now I have some issue with the import lib step, the pymtracking lib seems like not appear, could you checking the syntax again?

tgbaoo avatar Nov 09 '23 12:11 tgbaoo