Giter Site home page Giter Site logo

Tracking with frame skips about sort HOT 7 CLOSED

abewley avatar abewley commented on July 21, 2024 1
Tracking with frame skips

from sort.

Comments (7)

abewley avatar abewley commented on July 21, 2024 3

To clarify the comment about calling the update() method even with empty detections. This is because the tracker makes a constant velocity assumption and also will delete object if too many frames have passed without seeing them. By default this is set to 1 so if you don't supply detections at least every second frame the objects will be lost. See lines 226-227.

In the case when you are sub-sampling frames and maintaining a fixed frequency you could simply treat the image sequence as a different framerate and you do not need to call it between frames when you are not doing any detection. Although your code appears to already be doing this.

from sort.

TheMikeyR avatar TheMikeyR commented on July 21, 2024 3

For other people who encounter same issue as me:

After some debugging it got to my attention that the min_hits=3 will remove the tracks if i feed empty detections in,since the min hit only increase when the function is fed detection, so 3 frames with detections in a row will make the counter go to 3, and the updated tracks will be returned. https://github.com/abewley/sort/blob/master/sort.py#L222

Since I'm trying to feed it every frame, and only feed detections every x frame it requires min_hits=1, so it is able to give tracks back. To solve it either edit the sort.py default value at https://github.com/abewley/sort/blob/master/sort.py#L176 or when creating the object from your script you can give it a new value as input like tracker = Sort(min_hits=1)

Hope this information will help people who encountered the same issue and couldn't figure out a solution.

from sort.

kkyiss avatar kkyiss commented on July 21, 2024 3

Hey @TheMikeyR
I want to try track with some detect frame skip ,and I have tried your idea above which suggest setting
tracker = Sort(min_hits=1)
but still once I feed empty list, the tracker output returns empty

Then I read over the @abewley commented, which said

By default this is set to 1 so if you don't supply detections at least every second frame the objects will be lost. See lines 226-227.

also with #17 Smmothing detections using tracking , the commented below said

I changed the following line to https://github.com/abewley/sort/blob/master/sort.py#L222
if((trk.time_since_update < self.max_age+1) and (trk.hit_streak >= self.min_hits or self.frame_count <= self.min_hits)):

and set min_hits=0 and max_age=4

In my opinion, the line "By default this is set to 1" is refer to parameter max_age
and if we increment the value, the tracker can tolerate every q frames with detection information feed

At the end, by adding self.max_age to Line222 and set
tracker = Sort(max_age=5, min_hits=0)

I could track with every q frames skip (e.g q = 1 or 2 or 3 or 4 )
if q is larger than 5, the max_age has to be larger

not sure I'm doing right, do I miss anything compare to your idea
thanks for any replies

from sort.

TheMikeyR avatar TheMikeyR commented on July 21, 2024 1

@kkyiss really good point, And I'm sorry I've totally missed to add info about max_age parameter, I believe it is due to the reason that I modified it early in my process and forgot that I modified mine when I tried to get frame skip to work. Mine is set to max_age=10 which makes it able to restore tracks to the old id for a longer timer, since the old id is saved for 10 frames (it can also be dangerous to keep a long history/age, but it seems to work fine with my data).

It looks like you are doing the same steps as I did, so I believe you are doing it right! Thanks for your comment, it will definitely help others who try to achieve the same thing!

from sort.

TheMikeyR avatar TheMikeyR commented on July 21, 2024

Arhh, I see! Thanks a lot for your time.

from sort.

vivek-singh-rathore avatar vivek-singh-rathore commented on July 21, 2024

I am also trying to skip some frames for detection. But I am having problem in sending empty detections to sort's update function. It gives error in this line when I send an empty list of detections :

trk.update(dets[d,:][0])

IndexError: too many indices for array

from sort.

rishabh700 avatar rishabh700 commented on July 21, 2024

I understand the role of max_age in the code. It helps to keep the tracker_id alive for the set number of frames and hence would reduce the number of new ids assigned to the same object.

But I am not sure what max_hits is doing? Does it set the minimum number of consecutive detections hits needed to assign the detection a new id if not matched with any other id? Please correct me if I am wrong!

from sort.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.