此文會繼承我之前寫的這篇~~
💛YOLOv4 training 訓練完整教學(以口罩辨識為範例) 💛
💛如何運用darknet 在yolov4 上面計算anchors 💛
# 207
[implicit_mul]
filters=258 #change
# 208
[implicit_mul]
filters=258 #change
# 209
[implicit_mul]
filters=258 #change
# 210
[implicit_mul]
filters=258 #change
# ============ Head ============ #
# YOLO-3
[route]
layers = 163
[convolutional]
batch_normalize=1
size=3
stride=1
pad=1
filters=256
activation=silu
[shift_channels]
from=203
[convolutional]
size=1
stride=1
pad=1
filters=258 #change
activation=linear
[control_channels]
from=207
[yolo]
mask = 0,1,2
anchors = 19,27, 44,40, 38,94, 96,68, 86,152, 180,137, 140,301, 303,264, 238,542, 436,615, 739,380, 925,792
classes=81 #change
num=12
jitter=.3
ignore_thresh = .7
truth_thresh = 1
random=1
scale_x_y = 1.05
iou_thresh=0.213
cls_normalizer=1.0
iou_normalizer=0.07
iou_loss=ciou
nms_kind=greedynms
beta_nms=0.6
# YOLO-4
[route]
layers = 176
[convolutional]
batch_normalize=1
size=3
stride=1
pad=1
filters=384
activation=silu
[shift_channels]
from=204
[convolutional]
size=1
stride=1
pad=1
filters=258 #change
activation=linear
[control_channels]
from=208
[yolo]
mask = 3,4,5
anchors = 19,27, 44,40, 38,94, 96,68, 86,152, 180,137, 140,301, 303,264, 238,542, 436,615, 739,380, 925,792
classes=81 #change
num=12
jitter=.3
ignore_thresh = .7
truth_thresh = 1
random=1
scale_x_y = 1.05
iou_thresh=0.213
cls_normalizer=1.0
iou_normalizer=0.07
iou_loss=ciou
nms_kind=greedynms
beta_nms=0.6
# YOLO-5
[route]
layers = 189
[convolutional]
batch_normalize=1
size=3
stride=1
pad=1
filters=512
activation=silu
[shift_channels]
from=205
[convolutional]
size=1
stride=1
pad=1
filters=258 #change
activation=linear
[control_channels]
from=209
[yolo]
mask = 6,7,8
anchors = 19,27, 44,40, 38,94, 96,68, 86,152, 180,137, 140,301, 303,264, 238,542, 436,615, 739,380, 925,792
classes=81 #change
num=12
jitter=.3
ignore_thresh = .7
truth_thresh = 1
random=1
scale_x_y = 1.05
iou_thresh=0.213
cls_normalizer=1.0
iou_normalizer=0.07
iou_loss=ciou
nms_kind=greedynms
beta_nms=0.6
# YOLO-6
[route]
layers = 202
[convolutional]
batch_normalize=1
size=3
stride=1
pad=1
filters=640
activation=silu
[shift_channels]
from=206
[convolutional]
size=1
stride=1
pad=1
filters=258 #change
activation=linear
[control_channels]
from=210
[yolo]
mask = 9,10,11
anchors = 19,27, 44,40, 38,94, 96,68, 86,152, 180,137, 140,301, 303,264, 238,542, 436,615, 739,380, 925,792
classes=81 #change
num=12
jitter=.3
ignore_thresh = .7
truth_thresh = 1
random=1
scale_x_y = 1.05
iou_thresh=0.213
cls_normalizer=1.0
iou_normalizer=0.07
iou_loss=ciou
nms_kind=greedynms
beta_nms=0.6
# ============ End of Head ============ #
只要你把上面Highlight的地方改成你要的就可以了!!
記得請把註解#change刪除掉,
cfg檔案裡面不能打註解,
filters的公式是(classes + 5)x3能,
詳情可以看我yolov4的文章,
或者去github的AlexeyAB/darknet看介紹~
💙記得當你的classes要擴充時, 要進去你的.cfg檔案裡面調整參數,
像是你有62個classes的話, 就去把它改成62.
- change line
classes=80
to your number of objects in each of 3[yolo]
-layers:- https://github.com/AlexeyAB/darknet/blob/0039fd26786ab5f71d5af725fc18b3f521e7acfd/cfg/yolov3.cfg#L610
- https://github.com/AlexeyAB/darknet/blob/0039fd26786ab5f71d5af725fc18b3f521e7acfd/cfg/yolov3.cfg#L696
- https://github.com/AlexeyAB/darknet/blob/0039fd26786ab5f71d5af725fc18b3f521e7acfd/cfg/yolov3.cfg#L783
- change [
filters=255
] to filters=(classes + 5)x3 in the 3[convolutional]
before each[yolo]
layer, keep in mind that it only has to be the last[convolutional]
before each of the[yolo]
layers.- https://github.com/AlexeyAB/darknet/blob/0039fd26786ab5f71d5af725fc18b3f521e7acfd/cfg/yolov3.cfg#L603
- https://github.com/AlexeyAB/darknet/blob/0039fd26786ab5f71d5af725fc18b3f521e7acfd/cfg/yolov3.cfg#L689
- https://github.com/AlexeyAB/darknet/blob/0039fd26786ab5f71d5af725fc18b3f521e7acfd/cfg/yolov3.cfg#L776
沒有留言:
張貼留言
喜歡我的文章嗎? 喜歡的話可以留言回應我喔! ^^