-
Notifications
You must be signed in to change notification settings - Fork 0
/
cfg.py
82 lines (68 loc) · 1.7 KB
/
cfg.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# -*- coding: utf-8 -*-
'''
@Time : 2020/05/06 21:05
@Author : Tianxiaomo
@File : Cfg.py
@Noice :
@Modificattion :
@Author :
@Time :
@Detail :
'''
import os
from easydict import EasyDict
_BASE_DIR = os.path.dirname(os.path.abspath(__file__))
Cfg = EasyDict()
Cfg.use_darknet_cfg = False
# Cfg.cfgfile = os.path.join(_BASE_DIR, 'cfg', 'yolov4.cfg')
Cfg.cfgfile = os.path.join('/workspace/GitHub/YOLO', 'cfg', 'yolov4.cfg')
Cfg.batch = 64
Cfg.subdivisions = 4
Cfg.width = 416
Cfg.height = Cfg.width
Cfg.channels = 3
Cfg.momentum = 0.949
Cfg.decay = 0.0005
Cfg.angle = 0
Cfg.saturation = 1.5
Cfg.exposure = 1.5
Cfg.hue = .1
Cfg.learning_rate = 0.00261
Cfg.burn_in = 1000
Cfg.max_batches = 500500
Cfg.steps = [400000, 450000]
Cfg.policy = Cfg.steps
Cfg.scales = .1, .1
Cfg.cutmix = 0
Cfg.mosaic = 1
Cfg.letter_box = 0
Cfg.jitter = 0.2
Cfg.classes = 80
Cfg.track = 0
Cfg.w = Cfg.width
Cfg.h = Cfg.height
Cfg.flip = 1
Cfg.blur = 0
Cfg.gaussian = 0
Cfg.boxes = 60 # box num
Cfg.TRAIN_EPOCHS = 300
Cfg.train_label = os.path.join(_BASE_DIR, 'data', 'train.txt')
Cfg.val_label = os.path.join(_BASE_DIR, 'data' ,'val.txt')
Cfg.TRAIN_OPTIMIZER = 'adam'
'''
image_path1 x1,y1,x2,y2,id x1,y1,x2,y2,id x1,y1,x2,y2,id ...
image_path2 x1,y1,x2,y2,id x1,y1,x2,y2,id x1,y1,x2,y2,id ...
...
'''
if Cfg.mosaic and Cfg.cutmix:
Cfg.mixup = 4
elif Cfg.cutmix:
Cfg.mixup = 2
elif Cfg.mosaic:
Cfg.mixup = 3
import datetime
now = datetime.datetime.now().strftime('%Y_%m_%d_%H_%M_%S')
Cfg.checkpoints = os.path.join(_BASE_DIR, 'checkpoints', now)
Cfg.TRAIN_TENSORBOARD_DIR = os.path.join(_BASE_DIR, 'log', now)
Cfg.iou_type = 'iou' # 'giou', 'diou', 'ciou'
Cfg.keep_checkpoint_max = 300