diff --git a/yolox/utils/boxes.py b/yolox/utils/boxes.py index dbe10d957..af4e09311 100644 --- a/yolox/utils/boxes.py +++ b/yolox/utils/boxes.py @@ -31,10 +31,10 @@ def filter_box(output, scale_range): def postprocess(prediction, num_classes, conf_thre=0.7, nms_thre=0.45, class_agnostic=False): box_corner = prediction.new(prediction.shape) - box_corner[:, :, 0] = prediction[:, :, 0] - prediction[:, :, 2] / 2 - box_corner[:, :, 1] = prediction[:, :, 1] - prediction[:, :, 3] / 2 - box_corner[:, :, 2] = prediction[:, :, 0] + prediction[:, :, 2] / 2 - box_corner[:, :, 3] = prediction[:, :, 1] + prediction[:, :, 3] / 2 + box_corner[:, :, 0] = torch.nn.functional.relu(prediction[:, :, 0] - prediction[:, :, 2] / 2) + box_corner[:, :, 1] = torch.nn.functional.relu(prediction[:, :, 1] - prediction[:, :, 3] / 2) + box_corner[:, :, 2] = torch.nn.functional.relu(prediction[:, :, 0] + prediction[:, :, 2] / 2) + box_corner[:, :, 3] = torch.nn.functional.relu(prediction[:, :, 1] + prediction[:, :, 3] / 2) prediction[:, :, :4] = box_corner[:, :, :4] output = [None for _ in range(len(prediction))]