Answers.Body: <p>IoU is way to measure how much two areas overlap. As said in the comments IoU is used as a threshold parameter for NMS, so You could decide how much common space two areas have to have to be considered as overlapping.</p>
  <ol>
  <li>According to <a href="https://arxiv.org/pdf/1506.02640.pdf" rel="nofollow noreferrer">first YoLo paper</a> IoU is used first time to calculate confidence score for each bounding box according to the formula:</li>
  </ol>
  <p><a href="https://i.sstatic.net/wKCjO.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/wKCjO.png" alt="confidence formula" /></a></p>
  <p>Confidence is 5th parameter in prediction vector: <code>(x, y, w, h, c)</code> predicted for every bounding box and it tells how good the bounding box is according to ground truth. Thanks to usage of IoU, confidence gives the full information about bounding box position, dimensions and its class probability.</p>
  <ol start="2">
  <li>Using NMS algorithm to merge overlapping boxes is very popular technique in object detection algorithms. However in original YoLo architecture You can see that output is a tensor of <code>SxSx(B*5+C)</code> where <code>SxS</code> are grid dimensions, <code>B</code> is number of bounding boxes per grid and <code>C</code> is number of possible classes. <code>5</code> is there because it's the length of prediction vector. It means that output tensor is constant, and You have to analyze the results it gives by yourself.</li>
  </ol>
  <p>Authors claim that</p>
  <blockquote>
  <p>Non-maximal suppression can be used to fix these multiple detections. While not critical to performance as it is for R-CNN or DPM,
  non-maximal suppression adds 2- 3% in mAP.</p>
  </blockquote>
  <p>Reading the <code>VOC 2007 Error Analysis</code> section of the Yolo paper also might be useful.</p>
  <p>Hope it helps.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-02-07T08:48:44.083Z
Answers.LastActivityDate: 2022-02-07T08:48:44.083Z
Answers.UserDisplayName: MASTER OF CODE
Body: <p>In the Stack Overflow thread <a href="https://stackoverflow.com/a/62502102/18079510">Intersection Over Union (IOU) ground truth in YOLO</a> they say that in YOLO actually the IoU (intersection over union) is used twice:</p>
  <ol>
  <li><p>during training to compare ground truth box to predicted box</p>
  </li>
  <li><p>during the usage of already trained YOLO network this technique is being used to eliminate overlapping boxes which include same object many times.</p>
  </li>
  </ol>
  <p>As far as I know eliminating overlapping boxes is being done by process called Non Maximum Suppression (NMS). Thus I wonder maybe the IOU is a part of a NMS process?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-01-31T12:48:56.633Z
Comments.Text: IoU is used as an threshold parameter for NMS. You just need to choose how much common space two boxes have to have to be considered as overlapping and to merge them. Details are in [this link](https://learnopencv.com/non-maximum-suppression-theory-and-implementation-in-pytorch/).
Comments.UserDisplayName: MASTER OF CODE
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-02-03T11:33:08.340Z
Comments.Text: Thank you sir!
  p.s I have asked here a few more questions about YOLO which I am trying now to use in my research. I would be more than glad if you could help me there also.
Comments.UserDisplayName: Igor
Tags: <deep-learning><convolutional-neural-networks><yolo><non-max-suppression>
Title: YOLO - does the Intersection over Union is actually a part of Non Maximum Suppresion
UserDisplayName: Igor
ThreadText: # YOLO - does the Intersection over Union is actually a part of Non Maximum Suppresion
  
  (Asked by: username_0 on 2022-01-31)
  
  In the Stack Overflow thread [Intersection Over Union (IOU) ground truth in YOLO](https://stackoverflow.com/a/62502102/18079510) they say that in YOLO actually the IoU (intersection over union) is used twice:
  
  1. during training to compare ground truth box to predicted box
  2. during the usage of already trained YOLO network this technique is being used to eliminate overlapping boxes which include same object many times.
  
  As far as I know eliminating overlapping boxes is being done by process called Non Maximum Suppression (NMS). Thus I wonder maybe the IOU is a part of a NMS process?
  
  **Tags:** deep-learning, convolutional-neural-networks, yolo, non-max-suppression
  
  > **Comments:**
  > **username_1**: IoU is used as an threshold parameter for NMS. You just need to choose how much common space two boxes have to have to be considered as overlapping and to merge them. Details are in [this link](https://learnopencv.com/non-maximum-suppression-theory-and-implementation-in-pytorch/).  
  > **username_0**: Thank you sir! p.s I have asked here a few more questions about YOLO which I am trying now to use in my research. I would be more than glad if you could help me there also.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-02-07. Score: 1 | Accepted answer
  
  IoU is way to measure how much two areas overlap. As said in the comments IoU is used as a threshold parameter for NMS, so You could decide how much common space two areas have to have to be considered as overlapping.
  
  1. According to [first YoLo paper](https://arxiv.org/pdf/1506.02640.pdf) IoU is used first time to calculate confidence score for each bounding box according to the formula:
  
  [![confidence formula](https://i.sstatic.net/wKCjO.png)](https://i.sstatic.net/wKCjO.png)
  
  Confidence is 5th parameter in prediction vector: `(x, y, w, h, c)` predicted for every bounding box and it tells how good the bounding box is according to ground truth. Thanks to usage of IoU, confidence gives the full information about bounding box position, dimensions and its class probability.
  
  2. Using NMS algorithm to merge overlapping boxes is very popular technique in object detection algorithms. However in original YoLo architecture You can see that output is a tensor of `SxSx(B*5+C)` where `SxS` are grid dimensions, `B` is number of bounding boxes per grid and `C` is number of possible classes. `5` is there because it's the length of prediction vector. It means that output tensor is constant, and You have to analyze the results it gives by yourself.
  
  Authors claim that
  
  > Non-maximal suppression can be used to fix these multiple detections. While not critical to performance as it is for R-CNN or DPM,
  > non-maximal suppression adds 2- 3% in mAP.
  
  Reading the `VOC 2007 Error Analysis` section of the Yolo paper also might be useful.
  
  Hope it helps.
  
  
  ---
  
  