From b31f8fb017b288f1bc8bd48f318625dc7bad6956 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Fri, 22 Mar 2019 15:08:03 +0200 Subject: [PATCH] updates --- train.py | 8 +++----- utils/gcp.sh | 7 ++++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/train.py b/train.py index 0791c5db..da1a07fe 100644 --- a/train.py +++ b/train.py @@ -64,6 +64,7 @@ def train( cutoff = load_darknet_weights(model, weights + 'yolov3-tiny.conv.15') if torch.cuda.device_count() > 1: + print('WARNING: MultiGPU Issue: https://github.com/ultralytics/yolov3/issues/146') model = nn.DataParallel(model) # Transfer learning (train only YOLO layers) @@ -88,10 +89,7 @@ def train( # scheduler.step() # Update scheduler (manual) - if epoch > 250: - lr = lr0 / 10 - else: - lr = lr0 + lr = lr0 / 10 if epoch > 250 else lr0 for x in optimizer.param_groups: x['lr'] = lr @@ -119,7 +117,7 @@ def train( plt.figure(figsize=(10, 10)) for ip in range(batch_size): labels = xywh2xyxy(targets[targets[:, 0] == ip, 2:6]).numpy() * img_size - plt.subplot(3, 3, ip + 1).imshow(imgs[ip].numpy().transpose(1, 2, 0)) + plt.subplot(4, 4, ip + 1).imshow(imgs[ip].numpy().transpose(1, 2, 0)) plt.plot(labels[:, [0, 2, 2, 0, 0]].T, labels[:, [1, 1, 3, 3, 1]].T, '.-') plt.axis('off') diff --git a/utils/gcp.sh b/utils/gcp.sh index 03ac0111..1b58f373 100755 --- a/utils/gcp.sh +++ b/utils/gcp.sh @@ -9,14 +9,15 @@ sudo shutdown # Start sudo rm -rf yolov3 && git clone https://github.com/ultralytics/yolov3 cp -r weights yolov3 -cd yolov3 && python3 train.py --batch-size 16 --num-workers 4 +cd yolov3 && python3 train.py --batch-size 16 --epochs 1 +sudo shutdown # Resume python3 train.py --resume # Detect -gsutil cp gs://ultralytics/yolov3.pt yolov3/weights -python3 detect.py +sudo rm -rf yolov3 && git clone https://github.com/ultralytics/yolov3 +cd yolov3 && python3 detect.py # Clone branch sudo rm -rf yolov3 && git clone -b multi_gpu --depth 1 https://github.com/ultralytics/yolov3