Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug in post-process #143

Open
mkloftdyn opened this issue Oct 30, 2024 · 0 comments
Open

bug in post-process #143

mkloftdyn opened this issue Oct 30, 2024 · 0 comments

Comments

@mkloftdyn
Copy link

Hi, thanks a lot for the good work, I encountered a small bug in the postprocess function, it basically misses the term to account for image padding. I suggest something like this as a solution, whereas the pad_x and pad_y values are already provided by dwdh out of the letterbox.

cheers

    @staticmethod
    def postprocess_nms(predictions, ratio, pad_x, pad_y):
        boxes = predictions[:, :4]
        scores = predictions[:, 4:5] * predictions[:, 5:]
        boxes_xyxy = np.ones_like(boxes)
        boxes_xyxy[:, 0] = boxes[:, 0] - (boxes[:, 2] / 2.) - pad_x
        boxes_xyxy[:, 1] = boxes[:, 1] - (boxes[:, 3] /2.) - pad_y
        boxes_xyxy[:, 2] = boxes[:, 0] + (boxes[:, 2] / 2.) - pad_x
        boxes_xyxy[:, 3] = boxes[:, 1] + (boxes[:, 3] / 2.)- pad_y
        boxes_xyxy /= ratio
        # dets = multiclass_nms(boxes_xyxy, scores, nms_thr=0.45, score_thr=0.1)
        dets = singleclass_nms(boxes_xyxy,scores,nms_thr=0.45,score_thr=0.2)
        return dets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant