glenn-jocher commited on
Commit
201bafc
1 Parent(s): d81bc47

Sync train and test iou_thresh (#1465)

Browse files

* Sync train and test iou_thresh

* Sync train and test iou_thresh

* weights names .lower()

* Notebook update

Files changed (4) hide show
  1. README.md +5 -6
  2. test.py +2 -2
  3. tutorial.ipynb +1 -1
  4. utils/google_utils.py +1 -1
README.md CHANGED
@@ -14,7 +14,6 @@ This repository represents Ultralytics open-source research into future object d
14
  - **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).
15
  - **June 9, 2020**: [CSP](https://github.com/WongKinYiu/CrossStagePartialNetworks) updates: improved speed, size, and accuracy (credit to @WongKinYiu for CSP).
16
  - **May 27, 2020**: Public release. YOLOv5 models are SOTA among all known YOLO implementations.
17
- - **April 1, 2020**: Start development of future compound-scaled [YOLOv3](https://github.com/ultralytics/yolov3)/[YOLOv4](https://github.com/AlexeyAB/darknet)-based PyTorch models.
18
 
19
 
20
  ## Pretrained Checkpoints
@@ -30,15 +29,15 @@ This repository represents Ultralytics open-source research into future object d
30
  | | | | | | || |
31
  | [YOLOv3-SPP](https://github.com/ultralytics/yolov5/releases) | 45.6 | 45.5 | 65.2 | 4.5ms | 222 || 63.0M | 118.0B
32
 
33
- ** AP<sup>test</sup> denotes COCO [test-dev2017](http://cocodataset.org/#upload) server results, all other AP results in the table denote val2017 accuracy.
34
- ** 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`
35
- ** Speed<sub>GPU</sub> 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`
36
  ** All checkpoints are trained to 300 epochs with default settings and hyperparameters (no autoaugmentation).
37
- ** 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`
38
 
39
  ## Requirements
40
 
41
- 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:
42
  ```bash
43
  $ pip install -r requirements.txt
44
  ```
 
14
  - **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).
15
  - **June 9, 2020**: [CSP](https://github.com/WongKinYiu/CrossStagePartialNetworks) updates: improved speed, size, and accuracy (credit to @WongKinYiu for CSP).
16
  - **May 27, 2020**: Public release. YOLOv5 models are SOTA among all known YOLO implementations.
 
17
 
18
 
19
  ## Pretrained Checkpoints
 
29
  | | | | | | || |
30
  | [YOLOv3-SPP](https://github.com/ultralytics/yolov5/releases) | 45.6 | 45.5 | 65.2 | 4.5ms | 222 || 63.0M | 118.0B
31
 
32
+ ** AP<sup>test</sup> denotes COCO [test-dev2017](http://cocodataset.org/#upload) server results, all other AP results denote val2017 accuracy.
33
+ ** 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`
34
+ ** Speed<sub>GPU</sub> 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`
35
  ** All checkpoints are trained to 300 epochs with default settings and hyperparameters (no autoaugmentation).
36
+ ** 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`
37
 
38
  ## Requirements
39
 
40
+ 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:
41
  ```bash
42
  $ pip install -r requirements.txt
43
  ```
test.py CHANGED
@@ -21,7 +21,7 @@ from utils.torch_utils import select_device, time_synchronized
21
 
22
  def test(data,
23
  weights=None,
24
- batch_size=16,
25
  imgsz=640,
26
  conf_thres=0.001,
27
  iou_thres=0.6, # for NMS
@@ -279,7 +279,7 @@ if __name__ == '__main__':
279
  parser.add_argument('--batch-size', type=int, default=32, help='size of each image batch')
280
  parser.add_argument('--img-size', type=int, default=640, help='inference size (pixels)')
281
  parser.add_argument('--conf-thres', type=float, default=0.001, help='object confidence threshold')
282
- parser.add_argument('--iou-thres', type=float, default=0.65, help='IOU threshold for NMS')
283
  parser.add_argument('--task', default='val', help="'val', 'test', 'study'")
284
  parser.add_argument('--device', default='', help='cuda device, i.e. 0 or 0,1,2,3 or cpu')
285
  parser.add_argument('--single-cls', action='store_true', help='treat as single-class dataset')
 
21
 
22
  def test(data,
23
  weights=None,
24
+ batch_size=32,
25
  imgsz=640,
26
  conf_thres=0.001,
27
  iou_thres=0.6, # for NMS
 
279
  parser.add_argument('--batch-size', type=int, default=32, help='size of each image batch')
280
  parser.add_argument('--img-size', type=int, default=640, help='inference size (pixels)')
281
  parser.add_argument('--conf-thres', type=float, default=0.001, help='object confidence threshold')
282
+ parser.add_argument('--iou-thres', type=float, default=0.6, help='IOU threshold for NMS')
283
  parser.add_argument('--task', default='val', help="'val', 'test', 'study'")
284
  parser.add_argument('--device', default='', help='cuda device, i.e. 0 or 0,1,2,3 or cpu')
285
  parser.add_argument('--single-cls', action='store_true', help='treat as single-class dataset')
tutorial.ipynb CHANGED
@@ -727,7 +727,7 @@
727
  },
728
  "source": [
729
  "# Run YOLOv5x on COCO val2017\n",
730
- "!python test.py --weights yolov5x.pt --data coco.yaml --img 640"
731
  ],
732
  "execution_count": null,
733
  "outputs": [
 
727
  },
728
  "source": [
729
  "# Run YOLOv5x on COCO val2017\n",
730
+ "!python test.py --weights yolov5x.pt --data coco.yaml --img 640 --iou 0.65"
731
  ],
732
  "execution_count": null,
733
  "outputs": [
utils/google_utils.py CHANGED
@@ -18,7 +18,7 @@ def gsutil_getsize(url=''):
18
  def attempt_download(weights):
19
  # Attempt to download pretrained weights if not found locally
20
  weights = weights.strip().replace("'", '')
21
- file = Path(weights).name
22
 
23
  msg = weights + ' missing, try downloading from https://github.com/ultralytics/yolov5/releases/'
24
  models = ['yolov5s.pt', 'yolov5m.pt', 'yolov5l.pt', 'yolov5x.pt'] # available models
 
18
  def attempt_download(weights):
19
  # Attempt to download pretrained weights if not found locally
20
  weights = weights.strip().replace("'", '')
21
+ file = Path(weights).name.lower()
22
 
23
  msg = weights + ' missing, try downloading from https://github.com/ultralytics/yolov5/releases/'
24
  models = ['yolov5s.pt', 'yolov5m.pt', 'yolov5l.pt', 'yolov5x.pt'] # available models