diff --git a/train.py b/train.py index 6c0ead81..d64257fb 100644 --- a/train.py +++ b/train.py @@ -7,7 +7,7 @@ from utils.utils import * parser = argparse.ArgumentParser() parser.add_argument('-epochs', type=int, default=100, help='number of epochs') -parser.add_argument('-batch_size', type=int, default=4, help='size of each image batch') +parser.add_argument('-batch_size', type=int, default=8, help='size of each image batch') parser.add_argument('-data_config_path', type=str, default='cfg/coco.data', help='data config file path') parser.add_argument('-cfg', type=str, default='cfg/yolov3.cfg', help='cfg file path') parser.add_argument('-img_size', type=int, default=32 * 19, help='size of each image dimension') @@ -128,7 +128,7 @@ def main(opt): loss = model(imgs.to(device), targets, requestPrecision=True) loss.backward() - accumulated_batches = 4 # accumulate gradient for 4 batches before stepping optimizer + accumulated_batches = 2 # accumulate gradient for 4 batches before stepping optimizer if ((i+1) % accumulated_batches == 0) or (i == len(dataloader) - 1): optimizer.step() optimizer.zero_grad() diff --git a/utils/gcp.sh b/utils/gcp.sh index 0643ef30..fd89d383 100644 --- a/utils/gcp.sh +++ b/utils/gcp.sh @@ -1,13 +1,13 @@ #!/usr/bin/env bash # Start -sudo rm -rf yolov3 && git clone https://github.com/ultralytics/yolov3 && cd yolov3 && python3 train.py -img_size 416 +sudo rm -rf yolov3 && git clone https://github.com/ultralytics/yolov3 && cd yolov3 && python3 train.py -batch_size 8 # Resume -python3 train.py -img_size 416 -resume 1 +python3 train.py -resume 1 # Detect -gsutil cp gs://ultralytics/fresh9_5_e201.pt yolov3/weights +gsutil cp gs://ultralytics/yolov3.pt yolov3/weights python3 detect.py # Test