Closed Lihi-Gur-Arie closed 1 year ago
Sure!
When evaluating my tracker using py-motmetrics on a custom dataset, I encountered a KeyError on line 262 in mot.py:
abs(frameid - self.last_occurrence[o]) <= self.max_switch_time) Upon investigation, I found that the error occurs when an object ID (o) that has not been seen in previous frames suddenly appears in the current frame. This is especially common in scenarios where objects are temporarily occluded or not detected in some frames and then reappear. The self.last_occurrence dictionary does not have an entry for such object IDs, leading to the KeyError.
I noticed that other users have faced a similar issue, as mentioned in this thread: https://github.com/cheind/py-motmetrics/issues/129.
My PR addresses this bug by ensuring that the object ID (o) exists in the self.last_occurrence dictionary before referencing it, thereby preventing the KeyError. This provides a more robust way of handling scenarios where object IDs might not appear continuously in every frame.
@Lihi-Gur-Arie thanks for your explanation. Did you run the unit-tests?
I just added some fixes to the develop branch to make the unit-testing pipeline working again. would you mind rebasing your PR on the current state of develop and resubmit? then the above 3 checks should pass
@cheind Sure, just merged it. Thanks!
thanks - didn't notice that I had to manually trigger the CI.
thanks again - merged into develop.
hey, thanks for your contribution. could you explain which bug you address?