nwojke / deep_sort

Simple Online Realtime Tracking with a Deep Association Metric
GNU General Public License v3.0
5.27k stars 1.47k forks source link

to_xyah() in detection.py and to_tlwh() in track.py #201

Open ssswww4444 opened 4 years ago

ssswww4444 commented 4 years ago

Sorry if i'm wrong....

  1. In function to_xyah() in detection.py It seems like this function will actually return:
    ret = [top + width / 2, left + height / 2, a, h]. (which doesn't make much sense to me)

  2. And we get the final results from track.to_tlwh() implemented in track.py As "mean" is in format (x, y, a, h), this function will actually return:
    ret = [x - width / 2, y - height / 2, width, height] => which means [left, top, width, height].

Both functions looks weird to me, but if I use them together: detection -> pass detection.to_xyah() to tracks -> track returns track.to_tlwh() -> this will gives me the correct tlwh box eventually.

But detection.to_xyah() could affect the initial "mean" and the update() function of tracks, would this cause any problem?

ajaichemmanam commented 4 years ago

Kalman Filter uses bounding box center x, center y, aspect ratio, height. Hence detections are converted to .to_xyah() Track's mean is hence in center x, center y, aspect ratio, height format. Track.to_tlwh() is used to convert the values back to xmin, ymin, width, height