Fixed randomizer gets integers only!

pull/2109/head
hanoch 2024-08-15 15:46:47 +03:00
parent c1a580e621
commit c8c3363926
1 changed files with 2 additions and 2 deletions

View File

@ -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)