Skip to content

bug in post-process #143

@mkloftdyn

Description

@mkloftdyn

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions