opencv_zoo icon indicating copy to clipboard operation
opencv_zoo copied to clipboard

Refreshing template in Vit (Question)

Open arielkantorovich opened this issue 1 year ago • 4 comments

Hi, I want to ask you about template refreshing in VitTracker. I see in Python code the method self. model. update(image) it looks like there is no update template (always first template), On the other hand, I see when I run some video examples that the tracker "Jump" to another object that is different from the original template and continues with this object. So there is some template udate logic that you implement in your code? and if Yes how I can control this updated template?

arielkantorovich avatar Jan 08 '24 08:01 arielkantorovich

You can try to call self.model.init again with tracking results to set template.

fengyuentau avatar Jan 09 '24 06:01 fengyuentau

Thank you for your comment, So if I understand from your answer there is no template refreshing that you do in the code? (I can do this manually using init method) When I look at the documentation of Vit in OpenCV, for example, I see that the update method gets to frame and cv::Rect bb so what is the difference? in cpp you update the bb with the method or only use the init bb?

arielkantorovich avatar Jan 09 '24 11:01 arielkantorovich

there is no template refreshing

If init() does not count, yes.

so what is the difference? in cpp you update the bb with the method or only use the init bb?

I do not get your question well but if I am not mis-understanding, you are asking the meaning of the second parameter in update(frame, bbox), right? It serves as the return output. See code here for more details:

https://github.com/opencv/opencv/blob/43c1c81c8c70955e3059637a7f0a099ccd2533b4/modules/video/src/tracking/tracker_vit.cpp#L170-L203

Note that although the template is not refreshed in update() but the target bbox does get updated (see line 200).

fengyuentau avatar Jan 09 '24 13:01 fengyuentau

You may try refreshing template to see whether you get a better tracking result that does not make the jump.

fengyuentau avatar Jan 09 '24 13:01 fengyuentau