GithubHelp home page GithubHelp logo

Comments (6)

aguscas avatar aguscas commented on June 6, 2024 2

When the hit_inertia value of a TrackedObject instance reaches hit_inertia_min, you will find that object in the tracked_objects list of the tracker, but will not be returned when you update your tracker with your current detections until the object finish initializing. The object is being initialized until the hit_inertia value exceeds hit_inertia_min by initialization_delay, after that, the objects has been initialized and will be assigned an id value, and you will see it in the list that is returned when you update the tracker with your detections.

I think the output you showed here corresponds with the tracked_objects list of the tracker, instead of the list returned by the tracker when you update.

from norfair.

dinarkino avatar dinarkino commented on June 6, 2024 1

@joaqo thank you! I see, if the counter starts with hit_inertia_min + 1, then everything fall into place. Yeah, an update of docs will be much appreciated.

from norfair.

joaqo avatar joaqo commented on June 6, 2024 1

Great! Yeah, the docs are in need of a lot of work, we'll fix them soon 😀

from norfair.

joaqo avatar joaqo commented on June 6, 2024

Closing due to inactivity.

from norfair.

dinarkino avatar dinarkino commented on June 6, 2024

When the hit_inertia value of a TrackedObject instance reaches hit_inertia_min, you will find that object in the tracked_objects list of the tracker, but will not be returned when you update your tracker with your current detections until the object finish initializing. The object is being initialized until the hit_inertia value exceeds hit_inertia_min by initialization_delay, after that, the objects have been initialized and will be assigned an id value, and you will see it in the list that is returned when you update the tracker with your detections.

I think the output you showed here corresponds with the tracked_objects list of the tracker, instead of the list returned by the tracker when you update.

Thank you for the replay and sorry for the late answer. I see. You say that there is a difference between tracked_objects inside the tracker and the output of the tracker.update. But still, the behaviour of counters is not clear to me. First of all, here I printed the values of the output of tracker.update. My code:

hit_inertia_min = 5
hit_inertia_max = 10
initialization_delay = 3
visualize = True
    
tracker = Tracker(
        distance_function=euclidean_distance,
        distance_threshold=max_distance_between_points,
        hit_inertia_min=hit_inertia_min,
        hit_inertia_max=hit_inertia_max,
        initialization_delay=initialization_delay,      
    )

for i in range(20):      
    # here I use a message from ROS but never mind it is just a fixed bbox 
    # which I then convert to Norfair format
    test_box = BoundingBox()
    test_box.xmin = 514
    test_box.ymin = 317
    test_box.xmax = 560
    test_box.ymax = 355

    msg = BoundingBoxes()
    msg.bounding_boxes = [test_box]

    detections = msg.bounding_boxes
    detections = ros_detections_to_norfair_detections(detections)
    
    # no boxes from some point
    if i > 10:
        msg = BoundingBoxes()
        detections = msg.bounding_boxes

    tracked_objects = tracker.update(detections=detections)  
    
    print(f'Update number: {i}')
    print(f'tracker.tracked_objects: {tracker.tracked_objects}')
    print(f'tracker.update(detections=detections): {tracked_objects}')
    print('____________')

I don't know how to access these two different entities but for tracker.tracked_objects and tracker.update(detections=detections) output is the following:

Update number: 0
tracker.tracked_objects: [Object_None(age: 0, hit_counter: 6, last_distance: None, init_id: 15)]
tracker.update(detections=detections): []
____________
Update number: 1
tracker.tracked_objects: [Object_None(age: 1, hit_counter: 7, last_distance: 0.00, init_id: 15)]
tracker.update(detections=detections): []
____________
Update number: 2
tracker.tracked_objects: [Object_None(age: 2, hit_counter: 8, last_distance: 0.00, init_id: 15)]
tracker.update(detections=detections): []
____________
Update number: 3
tracker.tracked_objects: [Object_1(age: 3, hit_counter: 9, last_distance: 0.00, init_id: 15)]
tracker.update(detections=detections): [Object_1(age: 3, hit_counter: 9, last_distance: 0.00, init_id: 15)]
____________
Update number: 4
tracker.tracked_objects: [Object_1(age: 4, hit_counter: 10, last_distance: 0.00, init_id: 15)]
tracker.update(detections=detections): [Object_1(age: 4, hit_counter: 10, last_distance: 0.00, init_id: 15)]
____________
Update number: 5
tracker.tracked_objects: [Object_1(age: 5, hit_counter: 11, last_distance: 0.00, init_id: 15)]
tracker.update(detections=detections): [Object_1(age: 5, hit_counter: 11, last_distance: 0.00, init_id: 15)]
____________
Update number: 6
tracker.tracked_objects: [Object_1(age: 6, hit_counter: 10, last_distance: 0.00, init_id: 15)]
tracker.update(detections=detections): [Object_1(age: 6, hit_counter: 10, last_distance: 0.00, init_id: 15)]
____________
Update number: 7
tracker.tracked_objects: [Object_1(age: 7, hit_counter: 11, last_distance: 0.00, init_id: 15)]
tracker.update(detections=detections): [Object_1(age: 7, hit_counter: 11, last_distance: 0.00, init_id: 15)]
____________
Update number: 8
tracker.tracked_objects: [Object_1(age: 8, hit_counter: 10, last_distance: 0.00, init_id: 15)]
tracker.update(detections=detections): [Object_1(age: 8, hit_counter: 10, last_distance: 0.00, init_id: 15)]
____________
Update number: 9
tracker.tracked_objects: [Object_1(age: 9, hit_counter: 11, last_distance: 0.00, init_id: 15)]
tracker.update(detections=detections): [Object_1(age: 9, hit_counter: 11, last_distance: 0.00, init_id: 15)]
____________
Update number: 10
tracker.tracked_objects: [Object_1(age: 10, hit_counter: 10, last_distance: 0.00, init_id: 15)]
tracker.update(detections=detections): [Object_1(age: 10, hit_counter: 10, last_distance: 0.00, init_id: 15)]
____________
Update number: 11
tracker.tracked_objects: [Object_1(age: 11, hit_counter: 9, last_distance: 0.00, init_id: 15)]
tracker.update(detections=detections): [Object_1(age: 11, hit_counter: 9, last_distance: 0.00, init_id: 15)]
____________
Update number: 12
tracker.tracked_objects: [Object_1(age: 12, hit_counter: 8, last_distance: 0.00, init_id: 15)]
tracker.update(detections=detections): [Object_1(age: 12, hit_counter: 8, last_distance: 0.00, init_id: 15)]
____________
Update number: 13
tracker.tracked_objects: [Object_1(age: 13, hit_counter: 7, last_distance: 0.00, init_id: 15)]
tracker.update(detections=detections): [Object_1(age: 13, hit_counter: 7, last_distance: 0.00, init_id: 15)]
____________
Update number: 14
tracker.tracked_objects: [Object_1(age: 14, hit_counter: 6, last_distance: 0.00, init_id: 15)]
tracker.update(detections=detections): [Object_1(age: 14, hit_counter: 6, last_distance: 0.00, init_id: 15)]
____________
Update number: 15
tracker.tracked_objects: [Object_1(age: 15, hit_counter: 5, last_distance: 0.00, init_id: 15)]
tracker.update(detections=detections): [Object_1(age: 15, hit_counter: 5, last_distance: 0.00, init_id: 15)]
____________
Update number: 16
tracker.tracked_objects: [Object_1(age: 16, hit_counter: 4, last_distance: 0.00, init_id: 15)]
tracker.update(detections=detections): [Object_1(age: 16, hit_counter: 4, last_distance: 0.00, init_id: 15)]
____________
Update number: 17
tracker.tracked_objects: []
tracker.update(detections=detections): []
____________
Update number: 18
tracker.tracked_objects: []
tracker.update(detections=detections): []
____________
Update number: 19
tracker.tracked_objects: []
tracker.update(detections=detections): []

We get tracked_objects not after hit_inertia_min, but at the first detection appearance. Then we get objects in the output of tracker.update at third detection appearance, not at hit_inertia_min + initialization_delay. And thirdly, why do we have hit_counter = 6 right at the beginning. Maybe I'm doing something wrong, I will be glad for the help.

from norfair.

joaqo avatar joaqo commented on June 6, 2024

Hey @dinarkino I think the confusion is because each tracked object starts with hit_inertia_min + 1 as its hit_counter. And then if it gets over initialization_delay + 1 (if you set initialization delay) it starts counting as a real object. We know that our docs are not very good with regards to this, and we are going to improve them, and make the api much simpler. Sorry for the inconvenience.

from norfair.

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.