From e5589632446526f1db934991fcab71c2eb42464d Mon Sep 17 00:00:00 2001 From: Janko Ondras Date: Mon, 13 Jul 2020 12:55:43 +0200 Subject: [PATCH 1/7] Log hyperparameters in tensorboard Log both hyperparameters and command line options in tensorboard. --- train.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/train.py b/train.py index 1fca64c53b2a..7b3494a19cec 100644 --- a/train.py +++ b/train.py @@ -58,6 +58,14 @@ def train(hyp): with open(Path(log_dir) / 'opt.yaml', 'w') as f: yaml.dump(vars(opt), f, sort_keys=False) + # Log hyperparameters in tensorboard + if tb_writer: + tb_hparams_dict = hyp + tb_hparams_dict.update(vars(opt)) + tb_hparams_dict['img_size_w'], tb_hparams_dict['img_size_h'] = tb_hparams_dict['img_size'] + del tb_hparams_dict['img_size'] + tb_writer.add_hparams(tb_hparams_dict, {}) + epochs = opt.epochs # 300 batch_size = opt.batch_size # 64 weights = opt.weights # initial training weights From 38acc5f3c5ad6aa9960896caeb92fd54196b91a0 Mon Sep 17 00:00:00 2001 From: Janko Ondras Date: Tue, 14 Jul 2020 08:48:46 +0200 Subject: [PATCH 2/7] Fix img_size naming in hyperparameters logging --- train.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/train.py b/train.py index 7b3494a19cec..7669219eb7f1 100644 --- a/train.py +++ b/train.py @@ -62,7 +62,7 @@ def train(hyp): if tb_writer: tb_hparams_dict = hyp tb_hparams_dict.update(vars(opt)) - tb_hparams_dict['img_size_w'], tb_hparams_dict['img_size_h'] = tb_hparams_dict['img_size'] + tb_hparams_dict['img_size_train'], tb_hparams_dict['img_size_test'] = tb_hparams_dict['img_size'] del tb_hparams_dict['img_size'] tb_writer.add_hparams(tb_hparams_dict, {}) From 2bf86b892fa2fd712f6530903a0d9b8533d7447a Mon Sep 17 00:00:00 2001 From: NanoCode012 Date: Tue, 14 Jul 2020 22:18:15 +0700 Subject: [PATCH 3/7] Fixed world_size not found when called from test --- utils/datasets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/datasets.py b/utils/datasets.py index 3d724e6fae62..2da3940c3c95 100755 --- a/utils/datasets.py +++ b/utils/datasets.py @@ -59,7 +59,7 @@ def create_dataloader(path, imgsz, batch_size, stride, opt, hyp=None, augment=Fa pad=pad) batch_size = min(batch_size, len(dataset)) - nw = min([os.cpu_count()//opt.world_size, batch_size if batch_size > 1 else 0, 8]) # number of workers + nw = min([os.cpu_count()//(opt.world_size if hasattr(opt, "world_size") else 1), batch_size if batch_size > 1 else 0, 8]) # number of workers train_sampler = torch.utils.data.distributed.DistributedSampler(dataset) if local_rank != -1 else None dataloader = torch.utils.data.DataLoader(dataset, batch_size=batch_size, From 120d40c06aab8dea1e80f5c581c98d9511f491ed Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Tue, 14 Jul 2020 12:32:08 -0700 Subject: [PATCH 4/7] Update train.py This updates the PR to a one-liner to minimize additions. Perhaps we can include opt in the future but let's start with this for now. --- train.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/train.py b/train.py index 7669219eb7f1..2beeb2f05ece 100644 --- a/train.py +++ b/train.py @@ -58,14 +58,6 @@ def train(hyp): with open(Path(log_dir) / 'opt.yaml', 'w') as f: yaml.dump(vars(opt), f, sort_keys=False) - # Log hyperparameters in tensorboard - if tb_writer: - tb_hparams_dict = hyp - tb_hparams_dict.update(vars(opt)) - tb_hparams_dict['img_size_train'], tb_hparams_dict['img_size_test'] = tb_hparams_dict['img_size'] - del tb_hparams_dict['img_size'] - tb_writer.add_hparams(tb_hparams_dict, {}) - epochs = opt.epochs # 300 batch_size = opt.batch_size # 64 weights = opt.weights # initial training weights @@ -194,6 +186,7 @@ def train(hyp): # model._initialize_biases(cf.to(device)) plot_labels(labels, save_dir=log_dir) if tb_writer: + tb_writer.add_hparams(hyp, {}) tb_writer.add_histogram('classes', c, 0) # Check anchors From 611ec44359432b3a3ac510e3d407dcae1bb1b7af Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Tue, 14 Jul 2020 13:18:35 -0700 Subject: [PATCH 5/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7de8d5e7a789..6df01224efe5 100755 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ $ pip install -U -r requirements.txt ## Tutorials * [Notebook](https://github.com/ultralytics/yolov5/blob/master/tutorial.ipynb) Open In Colab -* [Kaggle](https://www.kaggle.com/ultralytics/yolov5-tutorial) +* [Kaggle](https://www.kaggle.com/ultralytics/yolov5) * [Train Custom Data](https://github.com/ultralytics/yolov5/wiki/Train-Custom-Data) * [PyTorch Hub](https://github.com/ultralytics/yolov5/issues/36) * [ONNX and TorchScript Export](https://github.com/ultralytics/yolov5/issues/251) From 7d19f98273e36a3bd04ae54b46471009ca2362ec Mon Sep 17 00:00:00 2001 From: Doug Date: Tue, 14 Jul 2020 16:34:54 -0600 Subject: [PATCH 6/7] Update requirements.txt numpy 1.17.3 is required for python3.8 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index bca726aa33f0..0deceacc74fb 100755 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ # pip install -U -r requirements.txt Cython -numpy==1.17 +numpy==1.17.3 opencv-python torch>=1.5.1 matplotlib From bd3fdbbf1b08ef87931eef49fa8340621caa7e87 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Tue, 14 Jul 2020 18:38:20 -0700 Subject: [PATCH 7/7] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 44e17bafeab8..fc09cfc94ff5 100755 --- a/README.md +++ b/README.md @@ -25,8 +25,8 @@ This repository represents Ultralytics open-source research into future object d ** APtest denotes COCO [test-dev2017](http://cocodataset.org/#upload) server results, all other AP results in the table denote val2017 accuracy. -** All AP numbers are for single-model single-scale without ensemble or test-time augmentation. Reproduce by `python test.py --data data/coco.yaml --img 736 --conf 0.001` -** SpeedGPU measures end-to-end time per image averaged over 5000 COCO val2017 images using a GCP [n1-standard-16](https://cloud.google.com/compute/docs/machine-types#n1_standard_machine_types) instance with one V100 GPU, and includes image preprocessing, PyTorch FP16 image inference at --batch-size 32 --img-size 640, postprocessing and NMS. Average NMS time included in this chart is 1-2ms/img. Reproduce by `python test.py --data data/coco.yaml --img 640 --conf 0.1` +** All AP numbers are for single-model single-scale without ensemble or test-time augmentation. Reproduce by `python test.py --data coco.yaml --img 736 --conf 0.001` +** SpeedGPU measures end-to-end time per image averaged over 5000 COCO val2017 images using a GCP [n1-standard-16](https://cloud.google.com/compute/docs/machine-types#n1_standard_machine_types) instance with one V100 GPU, and includes image preprocessing, PyTorch FP16 image inference at --batch-size 32 --img-size 640, postprocessing and NMS. Average NMS time included in this chart is 1-2ms/img. Reproduce by `python test.py --data coco.yaml --img 640 --conf 0.1` ** All checkpoints are trained to 300 epochs with default settings and hyperparameters (no autoaugmentation).