From 57b616b8b11eaa18ec33b6ff5b4a8b611de5f01e Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Sun, 23 Jun 2019 22:01:11 +0200 Subject: [PATCH] updates --- train.py | 35 +---------------------------------- utils/gcp.sh | 5 +++-- utils/utils.py | 2 +- 3 files changed, 5 insertions(+), 37 deletions(-) diff --git a/train.py b/train.py index c8e9408b..a3d45bc3 100644 --- a/train.py +++ b/train.py @@ -25,39 +25,6 @@ hyp = {'giou': .035, # giou loss gain 'weight_decay': 0.0005} # optimizer weight decay -# Hyperparameters: Original, Metrics: 0.172 0.304 0.156 0.205 (square) -# hyp = {'xy': 0.5, # xy loss gain -# 'wh': 0.0625, # wh loss gain -# 'cls': 0.0625, # cls loss gain -# 'conf': 4, # conf loss gain -# 'iou_t': 0.1, # iou target-anchor training threshold -# 'lr0': 0.001, # initial learning rate -# 'lrf': -5., # final learning rate = lr0 * (10 ** lrf) -# 'momentum': 0.9, # SGD momentum -# 'weight_decay': 0.0005} # optimizer weight decay - -# Hyperparameters: train.py --evolve --epochs 2 --img-size 320, Metrics: 0.225 0.251 0.145 0.218 (rect) -# hyp = {'xy': 0.4499, # xy loss gain -# 'wh': 0.05121, # wh loss gain -# 'cls': 0.04207, # cls loss gain -# 'conf': 2.853, # conf loss gain -# 'iou_t': 0.2487, # iou target-anchor training threshold -# 'lr0': 0.0005301, # initial learning rate -# 'lrf': -5., # final learning rate = lr0 * (10 ** lrf) -# 'momentum': 0.8823, # SGD momentum -# 'weight_decay': 0.0004149} # optimizer weight decay - -# Hyperparameters: train.py --evolve --epochs 2 --img-size 320, Metrics: 0.178 0.313 0.167 0.212 (square) -# hyp = {'xy': 0.4664, # xy loss gain -# 'wh': 0.08437, # wh loss gain -# 'cls': 0.05145, # cls loss gain -# 'conf': 4.244, # conf loss gain -# 'iou_t': 0.09121, # iou target-anchor training threshold -# 'lr0': 0.0004938, # initial learning rate -# 'lrf': -5., # final learning rate = lr0 * (10 ** lrf) -# 'momentum': 0.9025, # SGD momentum -# 'weight_decay': 0.0005417} # optimizer weight decay - def train( cfg, data_cfg, @@ -312,7 +279,7 @@ def print_mutation(hyp, results): if __name__ == '__main__': parser = argparse.ArgumentParser() - parser.add_argument('--epochs', type=int, default=68, help='number of epochs') + parser.add_argument('--epochs', type=int, default=100, help='number of epochs') parser.add_argument('--batch-size', type=int, default=8, help='batch size') parser.add_argument('--accumulate', type=int, default=8, help='number of batches to accumulate before optimizing') parser.add_argument('--cfg', type=str, default='cfg/yolov3-spp.cfg', help='cfg file path') diff --git a/utils/gcp.sh b/utils/gcp.sh index 9780baa4..469b8ed0 100755 --- a/utils/gcp.sh +++ b/utils/gcp.sh @@ -3,9 +3,10 @@ # New VM rm -rf yolov3 weights coco git clone https://github.com/ultralytics/yolov3 +git clone https://github.com/cocodataset/cocoapi && cd cocoapi/PythonAPI && make && cd ../.. && cp -r cocoapi/PythonAPI/pycocotools yolov3 +git clone https://github.com/NVIDIA/apex && cd apex && pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" . --user && cd .. && rm -rf apex bash yolov3/weights/download_yolov3_weights.sh && cp -r weights yolov3 bash yolov3/data/get_coco_dataset.sh -git clone https://github.com/cocodataset/cocoapi && cd cocoapi/PythonAPI && make && cd ../.. && cp -r cocoapi/PythonAPI/pycocotools yolov3 sudo shutdown # Re-clone @@ -95,7 +96,7 @@ python3 test.py --data ../supermarket2/supermarket2.data --weights ../darknet/ba # Debug/Development -python3 train.py --data data/coco.data --img-size 320 --single-scale --batch-size 32 --accumulate 2 --epochs 1 +python3 train.py --data data/coco.data --img-size 320 --single-scale --batch-size 64 --accumulate 1 --epochs 1 --evolve python3 test.py --weights weights/latest.pt --cfg cfg/yolov3-spp.cfg --img-size 320 gsutil cp evolve.txt gs://ultralytics diff --git a/utils/utils.py b/utils/utils.py index d737c02d..4dfe6b5b 100755 --- a/utils/utils.py +++ b/utils/utils.py @@ -641,7 +641,7 @@ def plot_targets_txt(): # from utils.utils import *; plot_targets_txt() x = np.loadtxt('targets.txt', dtype=np.float32) x = x.T - s = ['x targets','y targets','width targets','height targets'] + s = ['x targets', 'y targets', 'width targets', 'height targets'] fig, ax = plt.subplots(2, 2, figsize=(8, 8)) ax = ax.ravel() for i in range(4):