Answers.Body: <p>The example given based on the yolov1 paper:</p>
  
  <p><img src="https://cdn-images-1.medium.com/max/1600/1*ZbmrsQJW-Lp72C5KoTnzUg.jpeg" alt="">
  The last layer has a tensor of the dimension 7x7x30. but the dimension of the last tensor is not in every case 7x7x30.</p>
  
  <p>let be:
  S: the number of grid cells in X and Y direction
  C: the number classes to train
  B: the number of bounding boxes in every grid cell</p>
  
  <p>The dimension of the output tensor is calculated with this formula: SxSx(5*B+C). The given example in their paper has the following values:
  S:7
  B:2
  C:20
  (7X7X(5*2+20) = 7x7x30)</p>
  
  <p>With this configuration you can detect at most 96 object (S<em>S</em>B -> 7*7*2) and 2 objects per grid cell. (e.g. it's not possible to detect many small object in a few grid cells)</p>
  
  <p>now lets consider what are each feature map of the last tensor used for:</p>
  
  <p>The data of every bounding box is stored in 5 feature maps:
  - 1 Feature map for the bounding box center in x direction
  - 1 Feature map for the bounding box center in y direction
  - 1 Feature map for the height of the bounding box
  - 1 Feature map for the width of the bounding box
  - 1 Feature map for the "confidence score" of the feature map</p>
  
  <p>(confidence score = P(Object)*IoU(BoundingBox,Object))</p>
  
  <ul>
  <li><p>P(Object): the probability that in this cell is an object</p></li>
  <li><p>IoU: Intersection over Union. A ration between the overlapping area and the union area:
  <img src="https://www.pyimagesearch.com/wp-content/uploads/2016/09/iou_equation.png" alt=""></p></li>
  </ul>
  
  <p>additional there are a feature map for every class. In every cell the following probability is calculated: P(Cass|Object)</p>
  
  <p><strong>Long story short:</strong>
  If the bounding box is bigger than one grid cell, then some neurons share the same values (they share the bounding box center, the bounding box size and the confidence score, because they refer to the same bounding box).</p>
  
  <p><strong>Source:</strong>
  <a href="https://pjreddie.com/media/files/papers/yolo_1.pdf" rel="nofollow noreferrer">https://pjreddie.com/media/files/papers/yolo_1.pdf</a></p>
  
  <p><strong>edit no Bounding boxes on the image</strong></p>
  
  <p>if there are no bounding boxes on the image, then the confidence score would be zero, because there are no overlapping area. you can configure the threshold of the confidence score. look at this sample picture with threshold 0: <img src="https://camo.githubusercontent.com/1025ff29cd0e7427d108820ca87ea39d25fc82b0/687474703a2f2f706a7265646469652e636f6d2f6d656469612f696d6167652f53637265656e5f53686f745f323031352d30382d31345f61745f31312e34322e30325f414d2e706e67" alt=""></p>
  
  <p>additionally the feature maps of the classes would be zero because every neuron represents this probability P(Class|Object) because P(Class|Object) = P(Class And Object) / p(Object); (P(Class) = 0 -> P(Class and Object) = 0)</p>
  
  <p>Is adding images without bounding boxes to the training set useful?
  I <em>think</em> it helps to lower the number of false positive matches. But that is just a guess. I have trained yolo to detect this plant <a href="https://en.wikipedia.org/wiki/Rumex_obtusifolius" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Rumex_obtusifolius</a> and I added a lot of picture without bouding boxes, becuase a low number of false positive matches was important. The result: the specificity was >99%.  </p>
  
  <p>Hope this helps</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-15T17:40:53.167Z
Answers.Text: Thanks for the explanation. Indeed, there's a feature map for every class. But is it useful to have images with no bounding boxes at all in the training set? Suppose there's only one class, does YOLO treat the images with no bounding boxes as negatives?
Answers.UserDisplayName: John M.
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-18T11:21:09.243Z
Answers.Text: I edited my answer. I hope it answers your questions.
Answers.UserDisplayName: james
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-18T11:43:05.400Z
Answers.Text: Thanks again. Just for comparison, do you happen to know what the specificity was without throwing in images without bounding boxes?
Answers.UserDisplayName: John M.
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-20T17:14:03.973Z
Answers.Text: If my memory is correct: the specifucity was 1-2% lower but the sensitivity was 0.5% higher.
Answers.UserDisplayName: james
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-15T00:25:08.377Z
Answers.LastActivityDate: 2018-04-18T11:34:28.503Z
Answers.LastEditDate: 2018-04-18T11:34:28.503Z
Answers.UserDisplayName: james
Body: <p>I have a rather basic question about YOLO for bounding box detection.</p>
  <p>My understanding is that it effectively associates each anchor box to an 8-dimension output.</p>
  <p>During testing, does YOLO take each anchor box and classify on it alone? What happens if the object is big and spans over several anchor boxes (e.g., covering 70% of the image)? How can YOLO classify and detect objects spanning over many anchor boxes?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-04-14T13:56:22.430Z
Comments.Text: If my memory is correct, I have seen objects larger than 70% of the image be detected.  Have you tried to test on your own?
Comments.UserDisplayName: Brian O'Donnell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-04-15T19:23:02.320Z
Comments.Text: @BrianO'Donnell Yes I have, but I'm just getting low f1 score for large objects.
Comments.UserDisplayName: John M.
Tags: <convolutional-neural-networks><computer-vision><object-detection><yolo>
Title: Can YOLO detect large objects?
UserDisplayName: John M.
ThreadText: # Can YOLO detect large objects?
  
  (Asked by: username_0 on 2018-04-14)
  
  I have a rather basic question about YOLO for bounding box detection.
  
  My understanding is that it effectively associates each anchor box to an 8-dimension output.
  
  During testing, does YOLO take each anchor box and classify on it alone? What happens if the object is big and spans over several anchor boxes (e.g., covering 70% of the image)? How can YOLO classify and detect objects spanning over many anchor boxes?
  
  **Tags:** convolutional-neural-networks, computer-vision, object-detection, yolo
  > **Comments:**
  > **username_1**: If my memory is correct, I have seen objects larger than 70% of the image be detected.  Have you tried to test on your own?  
  > **username_0**: @BrianO'Donnell Yes I have, but I'm just getting low f1 score for large objects.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2018-04-15. Score: 4
  
  The example given based on the yolov1 paper:
  
  ![](https://cdn-images-1.medium.com/max/1600/1*ZbmrsQJW-Lp72C5KoTnzUg.jpeg)
  The last layer has a tensor of the dimension 7x7x30. but the dimension of the last tensor is not in every case 7x7x30.
  
  let be:
  S: the number of grid cells in X and Y direction
  C: the number classes to train
  B: the number of bounding boxes in every grid cell
  
  The dimension of the output tensor is calculated with this formula: SxSx(5\*B+C). The given example in their paper has the following values:
  S:7
  B:2
  C:20
  (7X7X(5\*2+20) = 7x7x30)
  
  With this configuration you can detect at most 96 object (S*S*B -> 7\*7\*2) and 2 objects per grid cell. (e.g. it's not possible to detect many small object in a few grid cells)
  
  now lets consider what are each feature map of the last tensor used for:
  
  The data of every bounding box is stored in 5 feature maps:
  - 1 Feature map for the bounding box center in x direction
  - 1 Feature map for the bounding box center in y direction
  - 1 Feature map for the height of the bounding box
  - 1 Feature map for the width of the bounding box
  - 1 Feature map for the "confidence score" of the feature map
  
  (confidence score = P(Object)\*IoU(BoundingBox,Object))
  
  * P(Object): the probability that in this cell is an object
  * IoU: Intersection over Union. A ration between the overlapping area and the union area:
    ![](https://www.pyimagesearch.com/wp-content/uploads/2016/09/iou_equation.png)
  
  additional there are a feature map for every class. In every cell the following probability is calculated: P(Cass|Object)
  
  **Long story short:**
  If the bounding box is bigger than one grid cell, then some neurons share the same values (they share the bounding box center, the bounding box size and the confidence score, because they refer to the same bounding box).
  
  **Source:**
  <https://pjreddie.com/media/files/papers/yolo_1.pdf>
  
  **edit no Bounding boxes on the image**
  
  if there are no bounding boxes on the image, then the confidence score would be zero, because there are no overlapping area. you can configure the threshold of the confidence score. look at this sample picture with threshold 0: ![](https://camo.githubusercontent.com/1025ff29cd0e7427d108820ca87ea39d25fc82b0/687474703a2f2f706a7265646469652e636f6d2f6d656469612f696d6167652f53637265656e5f53686f745f323031352d30382d31345f61745f31312e34322e30325f414d2e706e67)
  
  additionally the feature maps of the classes would be zero because every neuron represents this probability P(Class|Object) because P(Class|Object) = P(Class And Object) / p(Object); (P(Class) = 0 -> P(Class and Object) = 0)
  
  Is adding images without bounding boxes to the training set useful?
  I *think* it helps to lower the number of false positive matches. But that is just a guess. I have trained yolo to detect this plant <https://en.wikipedia.org/wiki/Rumex_obtusifolius> and I added a lot of picture without bouding boxes, becuase a low number of false positive matches was important. The result: the specificity was >99%.
  
  Hope this helps
  
  > **Comments:**
  > **username_0**: Thanks for the explanation. Indeed, there's a feature map for every class. But is it useful to have images with no bounding boxes at all in the training set? Suppose there's only one class, does YOLO treat the images with no bounding boxes as negatives?  
  > **username_2**: I edited my answer. I hope it answers your questions.  
  > **username_0**: Thanks again. Just for comparison, do you happen to know what the specificity was without throwing in images without bounding boxes?  
  > **username_2**: If my memory is correct: the specifucity was 1-2% lower but the sensitivity was 0.5% higher.  
  
  ---
  
  