From c8c3363926b0fb84ca623e93f1d58389528723f2 Mon Sep 17 00:00:00 2001 From: hanoch Date: Thu, 15 Aug 2024 15:46:47 +0300 Subject: [PATCH] Fixed randomizer gets integers only! --- train.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/train.py b/train.py index 8487748..aec31f1 100644 --- a/train.py +++ b/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)