Object Detection Batching System for Re-Identification

Hello all

I have a single camera setup that uses object detection to track people. For my usecase it is important that the tracked people keep the same id over time. My code works pretty good for easy scenarios, but when there are more people it very easly happens that they loose or switch ids ( when they cross each others path for example ).

When searching around I found this ZED GitHub example that uses the batching system for re-identification: Zed Github Example

From what I understand this would exactly be what I need. But when looking at the code examples and the documentation I don’t really understand how this works. Is it enough to just set these parameters…

detection_parameters.batch_parameters.enable = true;
detection_parameters.batch_parameters.latency = 3.f;

…for re-identification to happen in the background, or do I have to manually handle the result of…

zed.getObjectsBatch(objectsBatch)

…to make use of this feature?

Are there any other C++ examples for the batching system and re-identification?

Thanks for your help!

Hello @prot_on

In the sample, just setting ENABLE_BATCHING_REID at the start to 1 should give you the full sample, so you can reference the parts of the code inside the #if ENABLE_BATCHING_REID tags.

That being said, I can’t make it work, it’s supposed to introduce latency along the re-id feature, so I think we introduced a bug. I’ll log it for investigation on our side, we’ll get back to you. (In case I don’t, do not hesitate to post on this topic, I’ll tell you if there is progress on this).

Hi

Thanks for your answer. I was playing around with the batching - feature a little bit and I noticed the following:

So lets say my detected body has the ID 0 and the created batch also has the ID 0.
When I leave the camera and enter again, I now have the ID 1. But the batch still has ID 0. This is good, so that whay I can re-assign the batch ID 0 as my body ID.

But how can I handle when I walk out of the camera, and another person walks into the camera? Because this person then will use the same Batch ID i previously had, when the second person walks into the camera bevore the retention time is over.

Hi @prot_on,

I think the behavior you describe is essentially the expected behavior. There should be a way to filter the tracked subject/ID regarding its position, though I don’t know if it’s up to you or the SDK.

I’ll try to get you a definite answer as soon as possible.

Hi @prot_on

Very sorry for the delay!

First things first, we don’t have a re-id sample with “visual” feedback, that was my misunderstanding. You can launch the OD sample with the ENABLE_BATCHING_REID, but the batching part will be decorrelated from the image, by the latency. The data in the batching part should be good though.

But how can I handle when I walk out of the camera, and another person walks into the camera? Because this person then will use the same Batch ID i previously had, when the second person walks into the camera bevore the retention time is over.

That is probably because the re-id detects a similar enough appearance between the people. I’m told that the PERSON_HEAD_BOX detection models can have a better chance at differentiating people and thus reattributing the correct ID, so you can try that.

Now for what I said:

There should be a way to filter the tracked subject/ID regarding its position, though I don’t know if it’s up to you or the SDK.

There is a prediction filter in the batching algorithm evaluating the position the tracked subject could be at when they re-enter the frame. The re-id will not give the same id to a subject that moved too far from the place he left the frame when he re-enters it. However, this “too far” value grows with time, so if the latency is enough, pretty much only the “appearance” detection will decide to re-id a subject or not.

I hope this helps you get a better grasp of it, sorry again it took so long gathering this info.