This commit is contained in:
Glenn Jocher 2018-11-05 23:34:26 +01:00
parent 6e5da1ce27
commit edfad8095d
2 changed files with 5 additions and 5 deletions

View File

@ -7,7 +7,7 @@ from utils.utils import *
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('-epochs', type=int, default=100, help='number of epochs') 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('-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('-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') 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 = model(imgs.to(device), targets, requestPrecision=True)
loss.backward() 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): if ((i+1) % accumulated_batches == 0) or (i == len(dataloader) - 1):
optimizer.step() optimizer.step()
optimizer.zero_grad() optimizer.zero_grad()

View File

@ -1,13 +1,13 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Start # 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 # Resume
python3 train.py -img_size 416 -resume 1 python3 train.py -resume 1
# Detect # Detect
gsutil cp gs://ultralytics/fresh9_5_e201.pt yolov3/weights gsutil cp gs://ultralytics/yolov3.pt yolov3/weights
python3 detect.py python3 detect.py
# Test # Test