<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>

CC BY-SA 4.0
2020-02-28T09:43:10.673Z
2020-02-28T09:43:10.673Z
Dan D.
<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>

CC BY-SA 4.0
2020-02-27T11:15:09.943Z
3 boxes per feature map and for every box you predict class probabilities + width + height + x + y + object confidence.
Brale
CC BY-SA 4.0
2020-02-28T02:27:37.333Z
uhm, and what is that 'coords'?
Dan D.
CC BY-SA 4.0
2020-02-28T08:57:12.053Z
well its x, y, height and width
Brale
<computer-vision><yolo><darknet><models><filters>
YOLOv3 Model Structure: Why is filters = (classes + coords + 1) * num?
Dan D.
# 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 @brale 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


---

