Answers.Body: <p>Ok, let go step by step.</p>
  <p>What you are working on is YOLOv1, in this version of the YOLO algorithm, the maximum bounding boxes that the model can return is 7x7 = 49 boxes as 49 cells since the output shape is 7x7x30.</p>
  <p>For each box, the depth of output is 30 because the number of labels of PASCAL VOCS 2012 is 20 (the author of YOLOv1 trained on this dataset) so from index 0 to index 19 will represent the label of that bounding box. From 20 to 23 are the position and size of that box.</p>
  <p>The 24th represents 2 things, first is the confidence of that box, since this is ground truth so the confidence should be 1. Second, you know that YOLOv1 can only return 49 boxes at maximum (actually, you can edit the number of boxes by yourself) so the ground truth should only handle one per cell, hence the 24th is the binary value to make sure there are no duplicates bounding boxes in one cell. (25 to 29 is because the author predict 2 bounding boxes per cell)</p>
  <p>In your case, the output should be 7x7x(2 + 5 x 2) = 7x7x12 with 2 classes and 2 boxes per cell.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-03-14T07:46:13.387Z
Answers.LastActivityDate: 2021-03-14T07:46:13.387Z
Answers.UserDisplayName: CuCaRot
Body: <p>Hi I am working on a project which requires the <a href="https://arxiv.org/pdf/1506.02640.pdf" rel="nofollow noreferrer">You Only Look Once</a> algorithm in order to classify and localise objects within images. I have to prepare my dataset (which has 2 classes, and predicts 6 objects per grid cell, and the 448 * 448 image is split into a 7*7 grid). What would be a viable approach to do that? I found  <a href="https://gist.githubusercontent.com/maskaravivek/d456a82ae08517fe0bb1964c22f56ced/raw/36e95091bca46d9b578b13f231637c28630705bb/4db7d8e6-bf84-4af8-a870-f6f18c02b465" rel="nofollow noreferrer">this</a> code, found in <a href="https://www.maskaravivek.com/post/yolov1/" rel="nofollow noreferrer">this </a> article. However I do not understand why he has done what he has done, e.g why is he specifically checking the 24th element of the “box”, and so what element of the box would I have to check? Is there any tutorial running through that? Would it be possible for someone to explain or even adapt his approach to fit my dataset?</p>
  <p>FYI: I am coding the YOLO algorithm from scratch</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-04-22T13:04:39.393Z
Comments.Text: You can check this playlist for relevant information: https://www.youtube.com/playlist?list=PLKHYJbyeQ1a3tMm-Wm6YLRzfW1UmwdUIN
Comments.UserDisplayName: Amr Khaled
Tags: <neural-networks><machine-learning><convolutional-neural-networks><keras><yolo>
Title: Preparing data set for the YOLO algorithm
UserDisplayName: jr123456jr987654321
ThreadText: # Preparing data set for the YOLO algorithm
  
  (Asked by: username_0 on 2021-03-14)
  
  Hi I am working on a project which requires the [You Only Look Once](https://arxiv.org/pdf/1506.02640.pdf) algorithm in order to classify and localise objects within images. I have to prepare my dataset (which has 2 classes, and predicts 6 objects per grid cell, and the 448 \* 448 image is split into a 7\*7 grid). What would be a viable approach to do that? I found [this](https://gist.githubusercontent.com/maskaravivek/d456a82ae08517fe0bb1964c22f56ced/raw/36e95091bca46d9b578b13f231637c28630705bb/4db7d8e6-bf84-4af8-a870-f6f18c02b465) code, found in [this](https://www.maskaravivek.com/post/yolov1/)  article. However I do not understand why he has done what he has done, e.g why is he specifically checking the 24th element of the “box”, and so what element of the box would I have to check? Is there any tutorial running through that? Would it be possible for someone to explain or even adapt his approach to fit my dataset?
  
  FYI: I am coding the YOLO algorithm from scratch
  
  **Tags:** neural-networks, machine-learning, convolutional-neural-networks, keras, yolo
  
  > **Comments:**
  > **username_1**: You can check this playlist for relevant information: https://www.youtube.com/playlist?list=PLKHYJbyeQ1a3tMm-Wm6YLRzfW1UmwdUIN  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2021-03-14. Score: 1 | Accepted answer
  
  Ok, let go step by step.
  
  What you are working on is YOLOv1, in this version of the YOLO algorithm, the maximum bounding boxes that the model can return is 7x7 = 49 boxes as 49 cells since the output shape is 7x7x30.
  
  For each box, the depth of output is 30 because the number of labels of PASCAL VOCS 2012 is 20 (the author of YOLOv1 trained on this dataset) so from index 0 to index 19 will represent the label of that bounding box. From 20 to 23 are the position and size of that box.
  
  The 24th represents 2 things, first is the confidence of that box, since this is ground truth so the confidence should be 1. Second, you know that YOLOv1 can only return 49 boxes at maximum (actually, you can edit the number of boxes by yourself) so the ground truth should only handle one per cell, hence the 24th is the binary value to make sure there are no duplicates bounding boxes in one cell. (25 to 29 is because the author predict 2 bounding boxes per cell)
  
  In your case, the output should be 7x7x(2 + 5 x 2) = 7x7x12 with 2 classes and 2 boxes per cell.
  
  
  ---
  
  