1
$\begingroup$

I am wondering is it possible to have two true positive predictions for one bounding box ground truth only. Following this section from Stanford. They define truth positive like this:

We start with IoU to decide if each prediction is correct or not. For a ground truth object and nearby prediction, if

  1. the predicted class matches the actual class, and
  2. the IoU is greater than a threshold,

we say that the network got that prediction right (true positive). Otherwise, the prediction is a false positive.

Now, take an example, in the image below, the red box is ground truth and the black box is prediction. Assume both black boxes predict correctly in the classification task, and both yellow areas are bigger than IoU threshold. In this case, both of them satisfy the condition to be true positive, then the true positive is not "true" anymore?

special case

$\endgroup$
2
  • $\begingroup$ You could avoid the issue if the intersection-over-union threshold is over $\frac12$ $\endgroup$
    – Henry
    Commented Nov 26, 2020 at 2:07
  • $\begingroup$ @Henry, thank for your answer. However, I think there is a chance that two bounding boxes with the same ground truth but their overlap is not enough to remove one of them by non-max-supression $\endgroup$
    – CuCaRot
    Commented Nov 26, 2020 at 2:43

2 Answers 2

0
$\begingroup$

As logical it seems to me, I would opt for calculating one true positive per ground truth. That is, if you have a ground_truth array and a prediction array, to care only about the corresponding red bounding box of these two arrays:

if IoU(ground_truth[red_bbox], prediction[red_bbox]) >= 0.5: 
    true_pos = true_pos + 1

So, the yellow area in this case will be > 0.5 of the bbox in ground truth, meaning a correct detection.

Now, if the prediction black bounding boxes are extending far away from the ground truth bbox, then again it is correctly detected even though the algorithm will have so many false positive pixels.

$\endgroup$
0
$\begingroup$

Note that a single ground-truth box may assign positive labels to multiple anchors. Usually the second condition is sufficient to determine the positive samples; but we still adopt the first condition for the reason that in some rare cases the second condition may find no positive sample. We assign a negative label to a non-positive anchor if its IoU ratio is lower than 0.3 for all ground-truth boxes. Anchors that are neither positive nor negative do not contribute to the training objective. (Ren, et al., 2015)

There might be different approaches, but one of the hallmark papers does not shy away from using multiple positives from the same ground truth. Since this behavior will transfer over to inference, people use non-maximum suppression to remove predictions likely to cover the same object. You can tune the threshold used to define true positives and the threshold used to perform non-maximum suppression independently. This technique would not work if the boxes weren't touching. For that reason, let's reformulate the question: how small must our ground truth threshold be for this to occur?

To simplify the problem, let's assume three things.

  1. The boxes are the same size.
  2. They overlap diagonally.
  3. They overlap symmetrically.

For the two outer boxes to be considered ground truth, we need that $$\mathrm{IoU}(B_1, B_2) = \frac{1 - 2 x + x^2}{1 + 2 x - x^2} \geq t$$ where $x$ denotes the offset between each outer box and the inner box, and $t$ the ground truth threshold. The boxes will stop overlapping when their corners meet in the middle, leading to the additional constraint $$2x \geq 1$$ that we can use to solve for $t$. We get that $t \leq \frac{1}{7}$ can lead to this scenario, but the threshold is usually set to a greater value. For example, the paper above uses $t \geq \frac{1}{2}$. If use this value instead, we get $$\mathrm{IoU}(B_1, B_3) = \frac{-4x^2 +4x-1}{4x^2-4x-1} \geq \frac{1}{71} (24 \sqrt{6} - 41) \approx 0.25.$$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.