Answers.Body: <p>Not an pro but I think I know some answers to your questions. </p>
  
  <blockquote>
    <p>If we train our classifier, wouldn't the prediction boxes be close to the ground truth labels as training progresses</p>
  </blockquote>
  
  <p>I think that's what YOLO v1 did. According to Andrew NG's video the bounding boxes are introduced to solve multiple objects inside the same grid cell. And according to this <a href="https://medium.com/@vivek.yadav/part-1-generating-anchor-boxes-for-yolo-like-network-for-vehicle-detection-using-kitti-dataset-b2fe033e5807" rel="nofollow noreferrer">post</a> anchor boxes assignment ensures that an anchor box predicts ground truth for an object centered at its own grid center, and not a grid cell far away (like YOLO may)</p>
  
  <blockquote>
    <p>what are those numbers representing anchor boxes representing? </p>
  </blockquote>
  
  <p>They are just width and height (shape). In YOLO v2 it is used to compute IOU assuming all boxes are placed at the same location (ignoring the location), you could think of it just tries to match the shape. And it uses (1-IOU) as the distance when applying the K-means clustering.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-10T06:00:28.730Z
Answers.LastActivityDate: 2018-04-10T06:00:28.730Z
Answers.UserDisplayName: Jamie M Zhang
Body: <p>I'm going through Andrew NG's course, which talks about YOLO, but he doesn't go into the implementation details of anchor boxes.</p>
  <p>After having looked through the code, each anchor box is represented by two values, but what exactly are these values representing?</p>
  <p>As for the need for anchor boxes, I'm also a little confused about that --
  As far as I understand, the ground truth labels have around 6 variables :</p>
  <ol>
  <li><span class="math-container">$P_o$</span> checks if it's an object or background,</li>
  <li><span class="math-container">$B_x$</span> and <span class="math-container">$B_y$</span> are the center coordinates</li>
  <li><span class="math-container">$B_h$</span> and <span class="math-container">$B_w$</span> are the height and width of the box</li>
  <li><span class="math-container">$C$</span> is the object class, which depends on how many classes you have, so you can have multiple <span class="math-container">$C$</span></li>
  </ol>
  <p>As for creating the bounding box,</p>
  <p><span class="math-container">$B_h$</span> is divided by 2, with one half from the center points (<span class="math-container">$B_x, B_y$</span>) to the top, and the other half to the bottom.</p>
  <p>If we train our classifier, wouldn't the prediction boxes be close to the ground truth labels as training progresses? So, if our ground truth label has a high height, small width as boxes for some images, and low hight and large width for other images, wouldn't our classifier automatically
  learn to differentiate between when to use one over the other, as it is being trained? If so then what is the use of anchor boxes? And what are those numbers representing anchor boxes representing?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-01-28T23:21:41.500Z
Comments.Text: [**Please, next time ask only 1 question per post**](https://meta.stackexchange.com/questions/39223/one-post-with-multiple-questions-or-multiple-posts/39224#39224). If you have multiple questions, even though they are about the same model or topic, split them into multiple posts, so that people can focus on 1 question/problem at a time.
Comments.UserDisplayName: nbro
Tags: <neural-networks><convolutional-neural-networks><computer-vision><yolo>
Title: In YOLO, what exactly do the values associated with each anchor box represent?
UserDisplayName: moondra
ThreadText: # In YOLO, what exactly do the values associated with each anchor box represent?
  
  (Asked by: username_0 on 2018-01-24)
  
  I'm going through Andrew NG's course, which talks about YOLO, but he doesn't go into the implementation details of anchor boxes.
  
  After having looked through the code, each anchor box is represented by two values, but what exactly are these values representing?
  
  As for the need for anchor boxes, I'm also a little confused about that --
  As far as I understand, the ground truth labels have around 6 variables :
  
  1. $P\_o$ checks if it's an object or background,
  2. $B\_x$ and $B\_y$ are the center coordinates
  3. $B\_h$ and $B\_w$ are the height and width of the box
  4. $C$ is the object class, which depends on how many classes you have, so you can have multiple $C$
  
  As for creating the bounding box,
  
  $B\_h$ is divided by 2, with one half from the center points ($B\_x, B\_y$) to the top, and the other half to the bottom.
  
  If we train our classifier, wouldn't the prediction boxes be close to the ground truth labels as training progresses? So, if our ground truth label has a high height, small width as boxes for some images, and low hight and large width for other images, wouldn't our classifier automatically
  learn to differentiate between when to use one over the other, as it is being trained? If so then what is the use of anchor boxes? And what are those numbers representing anchor boxes representing?
  
  **Tags:** neural-networks, convolutional-neural-networks, computer-vision, yolo
  > **Comments:**
  > **username_1**: [**Please, next time ask only 1 question per post**](https://meta.stackexchange.com/questions/39223/one-post-with-multiple-questions-or-multiple-posts/39224#39224). If you have multiple questions, even though they are about the same model or topic, split them into multiple posts, so that people can focus on 1 question/problem at a time.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2018-04-10. Score: 1
  
  Not an pro but I think I know some answers to your questions.
  
  > If we train our classifier, wouldn't the prediction boxes be close to the ground truth labels as training progresses
  
  I think that's what YOLO v1 did. According to Andrew NG's video the bounding boxes are introduced to solve multiple objects inside the same grid cell. And according to this [post](https://medium.com/@vivek.yadav/part-1-generating-anchor-boxes-for-yolo-like-network-for-vehicle-detection-using-kitti-dataset-b2fe033e5807) anchor boxes assignment ensures that an anchor box predicts ground truth for an object centered at its own grid center, and not a grid cell far away (like YOLO may)
  
  > what are those numbers representing anchor boxes representing?
  
  They are just width and height (shape). In YOLO v2 it is used to compute IOU assuming all boxes are placed at the same location (ignoring the location), you could think of it just tries to match the shape. And it uses (1-IOU) as the distance when applying the K-means clustering.
  
  
  ---
  
  