Reputation: 35
In the calculation formula of Yolo v3's filter, the number of a bounding box is divided by 3 (why?).
For this reason, the number of the number of a bounding box is only allowed to be multiples of 3.
But I want to set one bounding box. Is this possible?
If it is possible, how many is a filter?
The bellow is I would like to realize the code.
[convolutional]
batch_normalize=1
size=3
stride=1
pad=1
filters=256
activation=leaky
[convolutional]
size=1
stride=1
pad=1
filters=?????????
activation=linear
[yolo]
mask = 0,1,2
anchors = 10,13
classes=20
num=1
jitter=.3
ignore_thresh = .5
truth_thresh = 1
random=1
Upvotes: 2
Views: 2174
Reputation: 111
There are four important variables:
anchors: predetermined set of boxes with particular height-width ratios
mask: list of ids of the bounding boxes(anchors) that the layer is responsible for predicting
num: total number of anchors
filter = (num_classes+5)*k where k=number of masks in one yolo layer
YOLOv3 predicts off-sets from a predetermined set of boxes with particular height-width ratios(anchors). Anchors are initial (width, height) sizes, some of which (the closest to the object size) will be resized to the object size.
Every [yolo]
layer has to know about all of the anchor boxes but is responsible for only a subset of them. The mask tells the layer which of the bounding boxes it is supposed to use for prediction.
Default configuration of YOLOv3:
[convolutional]
size=1
stride=1
pad=1
filters=255
activation=linear
[yolo]
mask = 0,1,2
anchors = 10,13, 16,30, 33,23, 30,61, 62,45, 59,119, 116,90, 156,198, 373,326
classes=80
num=9
jitter=.3
ignore_thresh = .7
truth_thresh = 1
random=1
here mask = 0,1,2
means this [yolo]
layer (last [yolo]
layer in config file) is responsible for predicting bounding boxes related to anchors 0 (10,13), 1 (16,30), 2 (33,23).
Overall,
First [yolo]
layer is responsible for 6,7,8 anchors.
Second [yolo]
layer is responsible for 3,4,5 anchors.
Third [yolo]
layer is responsible for 0,1,2 anchors.
Example configuration for predicting one bounding box at each [yolo]
layer:
[convolutional]
size=1
stride=1
pad=1
filters=85
activation=linear
[yolo]
mask = 0
anchors = 10,13, 30,61, 116,90
classes=80
num=3
jitter=.3
ignore_thresh = .7
truth_thresh = 1
random=1
Upvotes: 5