From 3fe395126875db8683d47d38f0fe7d2e452e25c0 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Mon, 10 Dec 2018 13:19:13 +0100 Subject: [PATCH] updates --- detect.py | 2 -- test.py | 19 +++++++++---------- train.py | 30 +++++++++++++----------------- 3 files changed, 22 insertions(+), 29 deletions(-) diff --git a/detect.py b/detect.py index 0bf70621..66465d5d 100755 --- a/detect.py +++ b/detect.py @@ -21,7 +21,6 @@ def detect( save_txt=False, save_images=False, ): - device = torch_utils.select_device() print("Using device: \"{}\"".format(device)) @@ -150,7 +149,6 @@ if __name__ == '__main__': parser.add_argument('--output-folder', type=str, default='output', help='path to outputs') parser.add_argument('--plot-flag', type=bool, default=True) parser.add_argument('--txt-out', type=bool, default=False) - parser.add_argument('--cfg', type=str, default='cfg/yolov3.cfg', help='cfg file path') parser.add_argument('--data-config', type=str, default='cfg/coco.data', help='path to data config file') parser.add_argument('--conf-thres', type=float, default=0.50, help='object confidence threshold') diff --git a/test.py b/test.py index edcdc9f1..dddf404d 100644 --- a/test.py +++ b/test.py @@ -8,15 +8,15 @@ from utils import torch_utils def test( - net_config_path, - data_config_path, - weights_file_path, - batch_size=16, - img_size=416, - iou_thres=0.5, - conf_thres=0.3, - nms_thres=0.45, - n_cpus=0, + net_config_path, + data_config_path, + weights_file_path, + batch_size=16, + img_size=416, + iou_thres=0.5, + conf_thres=0.3, + nms_thres=0.45, + n_cpus=0, ): device = torch_utils.select_device() print("Using device: \"{}\"".format(device)) @@ -126,7 +126,6 @@ def test( if __name__ == '__main__': - parser = argparse.ArgumentParser(prog='test.py') parser.add_argument('--batch-size', type=int, default=32, help='size of each image batch') parser.add_argument('--cfg', type=str, default='cfg/yolov3.cfg', help='path to model config file') diff --git a/train.py b/train.py index cfe90dea..ef8466c7 100644 --- a/train.py +++ b/train.py @@ -12,25 +12,22 @@ from utils import torch_utils import test DARKNET_WEIGHTS_FILENAME = 'darknet53.conv.74' -DARKNET_WEIGHTS_URL = 'https://pjreddie.com/media/files/{}'.format( - DARKNET_WEIGHTS_FILENAME -) +DARKNET_WEIGHTS_URL = 'https://pjreddie.com/media/files/{}'.format(DARKNET_WEIGHTS_FILENAME) def train( - net_config_path, - data_config_path, - img_size=416, - resume=False, - epochs=100, - batch_size=16, - weights_path='weights', - report=False, - multi_scale=False, - freeze_backbone=True, - var=0, + net_config_path, + data_config_path, + img_size=416, + resume=False, + epochs=100, + batch_size=16, + weights_path='weights', + report=False, + multi_scale=False, + freeze_backbone=True, + var=0, ): - device = torch_utils.select_device() print("Using device: \"{}\"".format(device)) @@ -236,13 +233,12 @@ def train( if __name__ == '__main__': - parser = argparse.ArgumentParser() parser.add_argument('--epochs', type=int, default=100, help='number of epochs') parser.add_argument('--batch-size', type=int, default=16, help='size of each image batch') parser.add_argument('--data-config', type=str, default='cfg/coco.data', help='path to data config file') parser.add_argument('--cfg', type=str, default='cfg/yolov3.cfg', help='cfg file path') - parser.add_argument('--multi-scale', default=False, help='random image sizes per batch 320 - 608') + parser.add_argument('--multi-scale', action='store_true', help='random image sizes per batch 320 - 608') parser.add_argument('--img-size', type=int, default=32 * 13, help='pixels') parser.add_argument('--weights-path', type=str, default='weights', help='path to store weights') parser.add_argument('--resume', action='store_true', help='resume training flag')