From 201bafc7cf9545362552ad5b0fc5033d64d7ae77 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Sat, 21 Nov 2020 12:38:35 +0100 Subject: [PATCH] Sync train and test iou_thresh (#1465) * Sync train and test iou_thresh * Sync train and test iou_thresh * weights names .lower() * Notebook update --- README.md | 11 +++++------ test.py | 4 ++-- tutorial.ipynb | 2 +- utils/google_utils.py | 2 +- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index cc978c1..43e480d 100755 --- a/README.md +++ b/README.md @@ -14,7 +14,6 @@ This repository represents Ultralytics open-source research into future object d - **June 19, 2020**: [FP16](https://pytorch.org/docs/stable/nn.html#torch.nn.Module.half) as new default for smaller checkpoints and faster inference [d4c6674](https://github.com/ultralytics/yolov5/commit/d4c6674c98e19df4c40e33a777610a18d1961145). - **June 9, 2020**: [CSP](https://github.com/WongKinYiu/CrossStagePartialNetworks) updates: improved speed, size, and accuracy (credit to @WongKinYiu for CSP). - **May 27, 2020**: Public release. YOLOv5 models are SOTA among all known YOLO implementations. -- **April 1, 2020**: Start development of future compound-scaled [YOLOv3](https://github.com/ultralytics/yolov3)/[YOLOv4](https://github.com/AlexeyAB/darknet)-based PyTorch models. ## Pretrained Checkpoints @@ -30,15 +29,15 @@ This repository represents Ultralytics open-source research into future object d | | | | | | || | | [YOLOv3-SPP](https://github.com/ultralytics/yolov5/releases) | 45.6 | 45.5 | 65.2 | 4.5ms | 222 || 63.0M | 118.0B -** 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 coco.yaml --img 640 --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` +** APtest denotes COCO [test-dev2017](http://cocodataset.org/#upload) server results, all other AP results denote val2017 accuracy. +** All AP numbers are for single-model single-scale without ensemble or TTA. **Reproduce mAP** by `python test.py --data coco.yaml --img 640 --conf 0.001 --iou 0.65` +** SpeedGPU averaged over 5000 COCO val2017 images using a GCP [n1-standard-16](https://cloud.google.com/compute/docs/machine-types#n1_standard_machine_types) V100 instance, and includes image preprocessing, FP16 inference, postprocessing and NMS. NMS is 1-2ms/img. **Reproduce speed** by `python test.py --data coco.yaml --img 640 --conf 0.25 --iou 0.45` ** All checkpoints are trained to 300 epochs with default settings and hyperparameters (no autoaugmentation). -** Test Time Augmentation ([TTA](https://github.com/ultralytics/yolov5/issues/303)) runs at 3 image sizes. **Reproduce** by `python test.py --data coco.yaml --img 832 --augment` +** Test Time Augmentation ([TTA](https://github.com/ultralytics/yolov5/issues/303)) runs at 3 image sizes. **Reproduce TTA** by `python test.py --data coco.yaml --img 832 --iou 0.65 --augment` ## Requirements -Python 3.8 or later with all [requirements.txt](https://github.com/ultralytics/yolov5/blob/master/requirements.txt) dependencies installed, including `torch>=1.6`. To install run: +Python 3.8 or later with all [requirements.txt](https://github.com/ultralytics/yolov5/blob/master/requirements.txt) dependencies installed, including `torch>=1.7`. To install run: ```bash $ pip install -r requirements.txt ``` diff --git a/test.py b/test.py index d82e56c..32401ee 100644 --- a/test.py +++ b/test.py @@ -21,7 +21,7 @@ from utils.torch_utils import select_device, time_synchronized def test(data, weights=None, - batch_size=16, + batch_size=32, imgsz=640, conf_thres=0.001, iou_thres=0.6, # for NMS @@ -279,7 +279,7 @@ if __name__ == '__main__': parser.add_argument('--batch-size', type=int, default=32, help='size of each image batch') parser.add_argument('--img-size', type=int, default=640, help='inference size (pixels)') parser.add_argument('--conf-thres', type=float, default=0.001, help='object confidence threshold') - parser.add_argument('--iou-thres', type=float, default=0.65, help='IOU threshold for NMS') + parser.add_argument('--iou-thres', type=float, default=0.6, help='IOU threshold for NMS') parser.add_argument('--task', default='val', help="'val', 'test', 'study'") parser.add_argument('--device', default='', help='cuda device, i.e. 0 or 0,1,2,3 or cpu') parser.add_argument('--single-cls', action='store_true', help='treat as single-class dataset') diff --git a/tutorial.ipynb b/tutorial.ipynb index 4751bf7..d0afb6a 100644 --- a/tutorial.ipynb +++ b/tutorial.ipynb @@ -727,7 +727,7 @@ }, "source": [ "# Run YOLOv5x on COCO val2017\n", - "!python test.py --weights yolov5x.pt --data coco.yaml --img 640" + "!python test.py --weights yolov5x.pt --data coco.yaml --img 640 --iou 0.65" ], "execution_count": null, "outputs": [ diff --git a/utils/google_utils.py b/utils/google_utils.py index 2cd0682..a311efd 100644 --- a/utils/google_utils.py +++ b/utils/google_utils.py @@ -18,7 +18,7 @@ def gsutil_getsize(url=''): def attempt_download(weights): # Attempt to download pretrained weights if not found locally weights = weights.strip().replace("'", '') - file = Path(weights).name + file = Path(weights).name.lower() msg = weights + ' missing, try downloading from https://github.com/ultralytics/yolov5/releases/' models = ['yolov5s.pt', 'yolov5m.pt', 'yolov5l.pt', 'yolov5x.pt'] # available models