Answers.Body: <p>As said by @brale in the comment below the question:</p>
  
  <pre><code>filters = (classes + 5) * 3
  = (classes + width + height + x + y + confidence) * num
  = (classes + 1+1+1+1+1) * num
  = (classes + 5) * num
  </code></pre>
  
  <p>YOLOv3 dectects <strong>3 boxes per grid cell</strong>, so it is:</p>
  
  <pre><code>filters = (classes + 5) * 3
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-28T09:43:10.673Z
Answers.LastActivityDate: 2020-02-28T09:43:10.673Z
Answers.UserDisplayName: Dan D.
Body: <p>Here's a tutorial about doing custom training of YOLO (Darknet): <a href="https://medium.com/@manivannan_data/how-to-train-yolov3-to-detect-custom-objects-ccbcafeb13d2" rel="nofollow noreferrer">https://medium.com/@manivannan_data/how-to-train-yolov3-to-detect-custom-objects-ccbcafeb13d2</a></p>
  
  <p>The tutorial guides how to set values in the <code>.cfg</code> files:</p>
  
  <ul>
  <li>classes = Number of classes, OK</li>
  <li>filters = (classes + 5) * 3</li>
  </ul>
  
  <p><strong>Why is it 'plus 5' then 'times 3'?</strong></p>
  
  <p>Some say it's (classes + coords + 1) * num, but I can't guess it out the meaning.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-02-27T11:15:09.943Z
Comments.Text: 3 boxes per feature map and for every box you predict class probabilities + width + height + x + y + object confidence.
Comments.UserDisplayName: Brale
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-02-28T02:27:37.333Z
Comments.Text: uhm, and what is that 'coords'?
Comments.UserDisplayName: Dan D.
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-02-28T08:57:12.053Z
Comments.Text: well its x, y, height and width
Comments.UserDisplayName: Brale
Tags: <computer-vision><yolo><darknet><models><filters>
Title: YOLOv3 Model Structure: Why is filters = (classes + coords + 1) * num?
UserDisplayName: Dan D.
ThreadText: # YOLOv3 Model Structure: Why is filters = (classes + coords + 1) * num?
  
  (Asked by: username_0 on 2020-02-27)
  
  Here's a tutorial about doing custom training of YOLO (Darknet): <https://medium.com/@manivannan_data/how-to-train-yolov3-to-detect-custom-objects-ccbcafeb13d2>
  
  The tutorial guides how to set values in the `.cfg` files:
  
  * classes = Number of classes, OK
  * filters = (classes + 5) \* 3
  
  **Why is it 'plus 5' then 'times 3'?**
  
  Some say it's (classes + coords + 1) \* num, but I can't guess it out the meaning.
  
  **Tags:** computer-vision, yolo, darknet, models, filters
  
  > **Comments:**
  > **username_1**: 3 boxes per feature map and for every box you predict class probabilities + width + height + x + y + object confidence.  
  > **username_0**: uhm, and what is that 'coords'?  
  > **username_1**: well its x, y, height and width  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2020-02-28. Score: 1 | Accepted answer
  
  As said by @username_1 in the comment below the question:
  
  ```
  filters = (classes + 5) * 3
  = (classes + width + height + x + y + confidence) * num
  = (classes + 1+1+1+1+1) * num
  = (classes + 5) * num
  
  ```
  
  YOLOv3 dectects **3 boxes per grid cell**, so it is:
  
  ```
  filters = (classes + 5) * 3
  
  ```
  
  
  ---
  
  