marcoslucianops / DeepStream-Yolo-Pose

NVIDIA DeepStream SDK 6.3 / 6.2 / 6.1.1 / 6.1 / 6.0.1 / 6.0 application for YOLO-Pose models
MIT License
119 stars 32 forks source link

Python version (deepstream.py) throws TypeErrors for keypoints with negative coordinates #7

Open hhackbarth opened 11 months ago

hhackbarth commented 11 months ago

In some cases it may occur that theestimated joint keypoints provided by the model have negative coordinates.

In this case in the function parse_pose from_meta() the setting of the circle_params with xc and yc as well as the setting of the line_params with x1, y1,x2, y2 will throw a TypeError. Setting these params to negative values is not allowed.

My suggestion is to make sure, the given coordinates are not negative like: xc = max(0, int((data[i 3 + 0] - pad_x) / gain)) yc = max(0, int((data[i 3 + 1] - pad_y) / gain)) instead of: xc = int((data[i 3 + 0] - pad_x) / gain) yc = int((data[i 3 + 1] - pad_y) / gain)

Same for the calculation of x1, x2, y1, y2.