mirror of https://github.com/WongKinYiu/yolov7.git
Fixed randomizer gets integers only!
parent
c1a580e621
commit
c8c3363926
4
train.py
4
train.py
|
@ -272,7 +272,7 @@ def train(hyp, opt, device, tb_writer=None):
|
|||
# Anchors
|
||||
if not opt.noautoanchor:
|
||||
check_anchors(dataset, model=model, thr=hyp['anchor_t'], imgsz=imgsz)
|
||||
model.half().float() # pre-reduce anchor precision
|
||||
model.half().float() # pre-reduce anchor precision TODO HK Why ?
|
||||
|
||||
# DDP mode
|
||||
if cuda and rank != -1:
|
||||
|
@ -353,7 +353,7 @@ def train(hyp, opt, device, tb_writer=None):
|
|||
|
||||
# Multi-scale
|
||||
if opt.multi_scale:
|
||||
sz = random.randrange(imgsz * 0.5, imgsz * 1.5 + gs) // gs * gs # size
|
||||
sz = random.randrange(int(imgsz * 0.5), int(imgsz * 1.5 + gs)) // gs * gs # size
|
||||
sf = sz / max(imgs.shape[2:]) # scale factor
|
||||
if sf != 1:
|
||||
ns = [math.ceil(x * sf / gs) * gs for x in imgs.shape[2:]] # new shape (stretched to gs-multiple)
|
||||
|
|
Loading…
Reference in New Issue