From 81f81d3e97e78bf69c88652b4717edcd037c2f4b Mon Sep 17 00:00:00 2001 From: imyhxy <imyhxy@gmail.com> Date: Fri, 24 Mar 2023 03:30:10 +0800 Subject: [PATCH] Fixed randrange warnings in Python>=3.10 (#11161) Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com> --- segment/train.py | 2 +- train.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/segment/train.py b/segment/train.py index 8ed75ba63..de5f7035e 100644 --- a/segment/train.py +++ b/segment/train.py @@ -299,7 +299,7 @@ def train(hyp, opt, device, callbacks): # hyp is path/to/hyp.yaml or hyp dictio # 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) diff --git a/train.py b/train.py index c4e3aac35..960f24c3e 100644 --- a/train.py +++ b/train.py @@ -299,7 +299,7 @@ def train(hyp, opt, device, callbacks): # hyp is path/to/hyp.yaml or hyp dictio # 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)