Fix hyp file read in and dict update.

Add example of hyp yaml
pull/1/head
Alex Stoken 5 years ago
parent 3263a204ea
commit ade023cff2

@ -0,0 +1,18 @@
anchor_t: 10.0
cls: 0.58
cls_pw: 1.0
degrees: 20.0
fl_gamma: 1.0
giou: 0.15
hsv_h: 0.014
hsv_s: 0.68
hsv_v: 0.36
iou_t: 0.2
lr0: 0.001
momentum: 0.900
obj: 1.0
obj_pw: 1.0
scale: 0.5
shear: 0.0
translate: 0.0
weight_decay: 0.000625

@ -408,6 +408,7 @@ if __name__ == '__main__':
opt.cfg = check_file(opt.cfg) # check file opt.cfg = check_file(opt.cfg) # check file
opt.data = check_file(opt.data) # check file opt.data = check_file(opt.data) # check file
opt.hyp = check_file(opt.hyp) if opt.hyp else '' #check file opt.hyp = check_file(opt.hyp) if opt.hyp else '' #check file
print(opt) print(opt)
opt.img_size.extend([opt.img_size[-1]] * (2 - len(opt.img_size))) # extend to 2 sizes (train, test) opt.img_size.extend([opt.img_size[-1]] * (2 - len(opt.img_size))) # extend to 2 sizes (train, test)
device = torch_utils.select_device(opt.device, apex=mixed_precision, batch_size=opt.batch_size) device = torch_utils.select_device(opt.device, apex=mixed_precision, batch_size=opt.batch_size)
@ -419,7 +420,10 @@ if __name__ == '__main__':
tb_writer = SummaryWriter(comment=opt.name) tb_writer = SummaryWriter(comment=opt.name)
#updates hyp defaults from hyp.yaml #updates hyp defaults from hyp.yaml
if opt.hyp: hyp.update(opt.hyp) if opt.hyp:
with open(opt.hyp) as f:
updated_hyp = yaml.load(f, Loader=yaml.FullLoader)
hyp.update(updated_hyp)
# Print focal loss if gamma > 0 # Print focal loss if gamma > 0
if hyp['fl_gamma']: if hyp['fl_gamma']:

Loading…
Cancel
Save