From dd7ca339f581b030470d81d4ec04f51127600e52 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Wed, 12 Jun 2019 11:40:17 +0200 Subject: [PATCH] updates --- train.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/train.py b/train.py index dddd2980..ed93b77b 100644 --- a/train.py +++ b/train.py @@ -76,7 +76,7 @@ def train( if multi_scale: img_size = round((img_size / 32) * 1.5) * 32 # initiate with maximum multi_scale size - opt.num_workers = 0 # bug https://github.com/ultralytics/yolov3/issues/174 + # opt.num_workers = 0 # bug https://github.com/ultralytics/yolov3/issues/174 else: torch.backends.cudnn.benchmark = True # unsuitable for multiscale @@ -247,6 +247,14 @@ def train( min_size = round(img_size / 32 / 1.5) max_size = round(img_size / 32 * 1.5) dataset.img_size = random.choice(range(min_size, max_size + 1)) * 32 + + dataloader = DataLoader(dataset, + batch_size=batch_size, + num_workers=opt.num_workers, + shuffle=True, # disable rectangular training if True + pin_memory=True, + collate_fn=dataset.collate_fn) + print('multi_scale img_size = %g' % dataset.img_size) # Calculate mAP (always test final epoch, skip first 5 if opt.nosave) @@ -310,7 +318,7 @@ if __name__ == '__main__': parser.add_argument('--accumulate', type=int, default=4, help='accumulate gradient x batches before optimizing') parser.add_argument('--cfg', type=str, default='cfg/yolov3-spp.cfg', help='cfg file path') parser.add_argument('--data-cfg', type=str, default='data/coco_64img.data', help='coco.data file path') - parser.add_argument('--multi-scale', action='store_true', help='random image sizes per batch 320 - 608') + parser.add_argument('--nomultiscale', action='store_false', help='random image sizes per batch 320 - 608') parser.add_argument('--img-size', type=int, default=416, help='inference size (pixels)') parser.add_argument('--resume', action='store_true', help='resume training flag') parser.add_argument('--transfer', action='store_true', help='transfer learning flag')