Pytorch-yolov3: precision not properly computed

Created on 23 Jan 2020  路  7Comments  路  Source: eriklindernoren/PyTorch-YOLOv3

Hi there,

I noticed, that in your evaluation script, the true positives are probably computed incorrectly, thus affecting average precision. In function get_batch_statistics of utils.py, you are computing the bbox overlap of your current observation/prediction with all of the GT targets. However, computing the overlap with only those GT objects that correspond to the same class, would fix the problem and will change the AP slightly. Right now, some predictions are accidentally evaluated as true positive in some images.

Best regards,
Chris

Most helpful comment

here's my solution.
`

             ...
            # Ignore if label is not one of the target labels
            if pred_label not in target_labels:
                continue    

            iou = bbox_iou(pred_box.unsqueeze(0), target_boxes)
        mask_matched = (target_labels == pred_label) & (iou >= iou_threshold)

        iou_matched = torch.where(mask_matched, iou, torch.zeros_like(iou))
        iou_max, box_index = iou_matched.max(0)

        if iou_max >= iou_threshold and box_index not in detected_boxes:
            true_positives[pred_i] = 1
            detected_boxes += [box_index]

`

All 7 comments

Hi, I find this problems,too.I don't know why, have you solved this problem?

Hi锛宧ave you solved this problem yet?

Hi has anyone solved this problem? What should we change in the code?

can anyone give solution for this please?

Sorry to ask @chris-doe Can you guide how to fix the code?

here's my solution.
`

             ...
            # Ignore if label is not one of the target labels
            if pred_label not in target_labels:
                continue    

            iou = bbox_iou(pred_box.unsqueeze(0), target_boxes)
        mask_matched = (target_labels == pred_label) & (iou >= iou_threshold)

        iou_matched = torch.where(mask_matched, iou, torch.zeros_like(iou))
        iou_max, box_index = iou_matched.max(0)

        if iou_max >= iou_threshold and box_index not in detected_boxes:
            true_positives[pred_i] = 1
            detected_boxes += [box_index]

`

mark

Was this page helpful?
0 / 5 - 0 ratings