3
$\begingroup$

I was following Pr. Andrew Ng course on Course about Convolutional neural network and I have a doubt regarding one of the points he mentions in the Yolo algorithm.

In one of the slides he mentioned two key points:

1) For each grid in our $3 \times 3$ grid image will have 2 predicted bounding

2) And each of these bounding boxes will be bigger than the size of the grid.

I couldn't get why there will be $2$ predicted bounding boxes? Is it because we consider two anchor boxes?

Also, how can the bounding boxes bigger than the size of the grid? Because we know that each object can belong to one grid only based on the midpoint

YOLO ALGORITHM

$\endgroup$

3 Answers 3

1
$\begingroup$

I guess the other answer is sufficient for the question. I just want to add this point that the algorithm uses different anchor boxed due to this fact that the centre of distinct objects may reside on the same pixel, though the real algorithm uses more than two anchor boxes. For instance, you can clearly see the image that he has used in his slide. The centre of the two objects is on the same pixel. You should also consider that the anchor boxes for each class differ, and is unique for each.

$\endgroup$
6
  • $\begingroup$ Does each grid have different shapes of anchor box? Does the anchor box stay within the each grid? If that's the case how can the predicted bounding box exceeds the size of each grid? Can you clarify on this a little bit. I was not able to understand it. Please $\endgroup$
    – Jeeth
    Jul 11, 2019 at 18:07
  • $\begingroup$ Each grid has its own shape, but this concept is irrelevant to the grid. Employing grids is due to accelerating the use case of naive sliding window algorithm which is also discussed in that course. Does the anchor box stay within the each grid?? Not at all. The grids may be small. predicted bounding box exceeds the size of each grid? By the way it is possible, and it is a non-linear mapping. See, at first that I read those concepts I had similar issues, but the point is that the YOLO algorithm is really capable of learning that complex mapping... $\endgroup$ Jul 11, 2019 at 18:09
  • $\begingroup$ which each grid which contains the centre of the object can be responsible for all the object. $\endgroup$ Jul 11, 2019 at 18:13
  • $\begingroup$ In the course it was mentioned that for each grid we take two anchor box and check which one has the object. You can verify it. I was able to understand that concept. In the final video he showed that slide in which the predicted bounding box shape exceeds the size of grid. He mentioned earlier that each grid is responsible for predicting the target. So how can the output boundary box exceeds the size of the grid. Does each grid communicates with each other? Is that what's happening. I can't understand the inner workings. If you know please do mention it. $\endgroup$
    – Jeeth
    Jul 11, 2019 at 18:14
  • $\begingroup$ So there's some non linear mapping happening maybe weights mixing together or something which is able to correctly predict the bounding box. Is that it? I just wanted to know how it actually works. Sorry if i'm asking too many questions. $\endgroup$
    – Jeeth
    Jul 11, 2019 at 18:16
1
$\begingroup$

1) Exactly. You have two anchor boxes in Andrew's current example, so the algorithm is going to output two predicted bounding boxes for each grid cell.

2) Your statement below is not true:

"Because we know that each object can belong to one grid only based on the midpoint"

I don't remember that being said on the course. The center of the object belongs to a single cell.

TO CLARIFY: The fact that an object spans at a region greater than the grid cell it is assigned to has nothing to do with the grid cell's size itself. The object can and will be larger than its assigned grid cell. However, the output assigns each object to one grid cell because that grid cell contains its midpoint.

Anyway, the receptive field of the neurons is much larger than the single cell they process (i.e. they cover the whole image). Anchors are initialized on a certain width and height but will be resized during inference, based on the identified object size using the final feature map. So one might consider that yolo predicts the occurrence of an object as well as its size.

More on the receptive field of CNNs

Check the: "A regressor rather than a classifier" part

A taste: For every positive position, the network predicts a regression on the bounding box precise position and dimension

This has been also asked here

$\endgroup$
10
  • $\begingroup$ "I don't remember that being said on the course", he mentions that each image can belong to one grid and it is done by calculating the midpoint of the object in the image. $\endgroup$
    – Jeeth
    Jul 11, 2019 at 17:23
  • $\begingroup$ Send me timestamp and video-name please so I can get the context too. $\endgroup$
    – Nikos H.
    Jul 11, 2019 at 17:25
  • $\begingroup$ He mentions only one grid is responsible for predicting a object in the image based on the midpoint of the image. So that's why I have this doubt $\endgroup$
    – Jeeth
    Jul 11, 2019 at 17:26
  • 1
    $\begingroup$ He clearly mentioned that the prediction is done by one grid then in the output how can it predict the boundary box which is larger than the grid size. What exactly happens which makes it predict boundary box larger than grid size . If you were able to understand please do mention it. $\endgroup$
    – Jeeth
    Jul 11, 2019 at 17:53
  • 1
    $\begingroup$ Check the second link in my post $\endgroup$
    – Nikos H.
    Jul 11, 2019 at 18:25
0
$\begingroup$

Few points to recollect: 1. Bounding box is a label. 2. Grids are useful for predicting midpoints.

Though he mentions grids are useful for predicting, the main goal lies in predicting the object itself. The grid suggests if the object is present or not(in other words to locate bx,by). The ground truth for the bounding box is w.r.t. the entire image. So the predictions for the bounding box(bh,bw) is w.r.t. the entire image, which suggests that the bounding boxes can lie within, on or out of the grid.

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