ortegatron / liveposetracker

Live body pose tracker made with OpenPose + Deep SORT
85 stars 21 forks source link

How can I map the tracking ID in the photo and pose detected by openpose? #2

Open xiaobaozi1996 opened 5 years ago

xiaobaozi1996 commented 5 years ago

Thanks for your code. But how can I get the results shown in your demo? I don't know the relationship between labeled persons and keypoints.

ortegatron commented 5 years ago

Hi, It's actually done on the code: When the Detection objects are created on Input.py, they are asociated to the Openpose keypoints: detections = [Detection(bbox, 1.0, feature, pose) for bbox, feature, pose in zip(boxes_xywh, features, poses) if nonempty(bbox)] The Detection object represents just a particular Detection on a given frame, while the Track object represents the actual object being tracked, it lives more than just a frame. When the tracking algorithm determines that a Detection does belong to the trajectory of a Track, then the Track remembers this last detection. This is on the update method, on Track class: self.last_seen_detection = detection So for any given frame, if you want to know which are the currently seen keypoints for a track, you can do: track.last_seen_detection.pose And that will be it.

You could further expand this, for example instead of just remember the last detection, save on the Track a list of the Detections with whom it was updated.

Hope it's usefull for you, may I ask what are you using this detector for?

xiaobaozi1996 commented 5 years ago

Thank you very much, I just compare different tracking methods to understand which is better.

xiaobaozi1996 commented 5 years ago

Well , I also have a question, if the tracked object is more than the detected object, how can I set up the correspondence? Is there any solution to only get the detected object's related tracking result ?Thanks in advance~

ortegatron commented 5 years ago

You can always make the correspondence Track -> Detection. If on the current frame the track wasn't related to any detection, then you could rely con the prediction made for the track. If you want to get the relation Detection -> Track you can either add that link when the track is updated or look among the tracks for one associated to a detection you want to find.

xiaobaozi1996 commented 5 years ago

Thanks!