5
$\begingroup$

This question is regarding YOLO v1 architecture as in here.

I am confused as to why authors have used 2 bounding boxes per grid cell for training. Assuming there can be only one object per grid cell. Would two boxes would be relevant?

If yes:

Then how would the target vector(y) for the grid cell containing the object centre look like? Wont this lead to repeated values of ground truth annotations for both bounding boxes?

else:

What is the exact rationale behind multiple bounding boxes?

enter image description here

$\endgroup$
2

1 Answer 1

0
$\begingroup$

I think we need to have clear separation of training time and inference time.

During training

At the training time, the responsible bounding box of the highest IOU at each cell plays the part in the loss function via $1^{obj}_{ij}$. So we may think why not use just one bounding box per cell.

enter image description here

enter image description here

However, let's not forget that both bounding box predictors of each cell are getting trained. YOLO train the model so that each bounding box predictor at a cell develops their own specializations. We never know which bounding box at a cell gives a better prediction at the inference time.

enter image description here

During inference

At inference time, YOLO uses all the bounding boxes of all the cells to calculate class confidence scores.

enter image description here

Then apply non-max suppression to identify objects from all the bounding boxes of all the cells.

enter image description here

This steps are well explained in YOLO — ‘You only look once’ for Object Detection explained.

Next, we multiply all these class score with bounding box confidence and get class scores for different bounding boxes. We do this for all the grid cells. That is equal to 772 = 98. enter image description here Now we have class scores for each bounding box(Tensor dimension=20*1). Now let us focus on the dog in the image. The dog score for the bounding boxes will be present in (1,1) of the tensor in all the bounding box scores. We will now set a threshold value of scores and sort them descendingly. enter image description here Now we will use Non-max supression algorithm to set score to zero for redundant boxes.

Consider you have dog score for bounding box1 as 0.5 and let this be the highest score and for box47 as 0.3. We will take an Intersection over Union of these values and if the value is greater than 0.5, we will set the value for box2 as zero,otherwise, we will continue to the next box. We do this for all boxes.

Because each bounding box predictor at each cell has developed different specialization, we have more diverse capabilities in the YOLO model than having single bounding box per cell . The first (j=0) bounding box at cell (1, 1) may give a better confidence (IOU) for a dog but the second (j=1) bounding box may give a better one for a cat.

By using multiple bounding boxes (B > 1), YOLO gives better detection capabilities. I believe by increasing B, the capability would improve. However, because YOLO puts the importance on the real-time detection speed, B is set to 2, in my understanding.

$\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.