Rename test.py to val.py (#4000)
This commit is contained in:
1 parent
8ee9fd1505
commit
720aaa65c8
11 files changed
+77
-78
No files matched your search
Vendored
+18
-18
@@ -643,8 +643,8 @@
|
||||
"id": "0eq1SMWl6Sfn"
|
||||
},
|
||||
"source": [
|
||||
"# 2. Test\n",
|
||||
"Test a model's accuracy on [COCO](https://cocodataset.org/#home) val or test-dev datasets. Models are downloaded automatically from the [latest YOLOv5 release](https://github.com/ultralytics/yolov5/releases). To show results by class use the `--verbose` flag. Note that `pycocotools` metrics may be ~1% better than the equivalent repo metrics, as is visible below, due to slight differences in mAP computation."
|
||||
"# 2. Validate\n",
|
||||
"Validate a model's accuracy on [COCO](https://cocodataset.org/#home) val or test-dev datasets. Models are downloaded automatically from the [latest YOLOv5 release](https://github.com/ultralytics/yolov5/releases). To show results by class use the `--verbose` flag. Note that `pycocotools` metrics may be ~1% better than the equivalent repo metrics, as is visible below, due to slight differences in mAP computation."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -720,14 +720,14 @@
|
||||
},
|
||||
"source": [
|
||||
"# Run YOLOv5x on COCO val2017\n",
|
||||
"!python test.py --weights yolov5x.pt --data coco.yaml --img 640 --iou 0.65 --half"
|
||||
"!python val.py --weights yolov5x.pt --data coco.yaml --img 640 --iou 0.65 --half"
|
||||
],
|
||||
"execution_count": null,
|
||||
"outputs": [
|
||||
{
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Namespace(augment=False, batch_size=32, conf_thres=0.001, data='./data/coco.yaml', device='', exist_ok=False, half=True, img_size=640, iou_thres=0.65, name='exp', project='runs/test', save_conf=False, save_hybrid=False, save_json=True, save_txt=False, single_cls=False, task='val', verbose=False, weights=['yolov5x.pt'])\n",
|
||||
"Namespace(augment=False, batch_size=32, conf_thres=0.001, data='./data/coco.yaml', device='', exist_ok=False, half=True, img_size=640, iou_thres=0.65, name='exp', project='runs/val', save_conf=False, save_hybrid=False, save_json=True, save_txt=False, single_cls=False, task='val', verbose=False, weights=['yolov5x.pt'])\n",
|
||||
"YOLOv5 🚀 v5.0-157-gc6b51f4 torch 1.8.1+cu101 CUDA:0 (Tesla V100-SXM2-16GB, 16160.5MB)\n",
|
||||
"\n",
|
||||
"Downloading https://github.com/ultralytics/yolov5/releases/download/v5.0/yolov5x.pt to yolov5x.pt...\n",
|
||||
@@ -741,7 +741,7 @@
|
||||
" all 5000 36335 0.746 0.626 0.68 0.49\n",
|
||||
"Speed: 5.3/1.5/6.8 ms inference/NMS/total per 640x640 image at batch-size 32\n",
|
||||
"\n",
|
||||
"Evaluating pycocotools mAP... saving runs/test/exp/yolov5x_predictions.json...\n",
|
||||
"Evaluating pycocotools mAP... saving runs/val/exp/yolov5x_predictions.json...\n",
|
||||
"loading annotations into memory...\n",
|
||||
"Done (t=0.44s)\n",
|
||||
"creating index...\n",
|
||||
@@ -767,7 +767,7 @@
|
||||
" Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.524\n",
|
||||
" Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.735\n",
|
||||
" Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.827\n",
|
||||
"Results saved to runs/test/exp\n"
|
||||
"Results saved to runs/val/exp\n"
|
||||
],
|
||||
"name": "stdout"
|
||||
}
|
||||
@@ -805,7 +805,7 @@
|
||||
},
|
||||
"source": [
|
||||
"# Run YOLOv5s on COCO test-dev2017 using --task test\n",
|
||||
"!python test.py --weights yolov5s.pt --data coco.yaml --task test"
|
||||
"!python val.py --weights yolov5s.pt --data coco.yaml --task test"
|
||||
],
|
||||
"execution_count": null,
|
||||
"outputs": []
|
||||
@@ -976,7 +976,7 @@
|
||||
"Plotting labels... \n",
|
||||
"\n",
|
||||
"\u001b[34m\u001b[1mautoanchor: \u001b[0mAnalyzing anchors... anchors/target = 4.26, Best Possible Recall (BPR) = 0.9946\n",
|
||||
"Image sizes 640 train, 640 test\n",
|
||||
"Image sizes 640 train, 640 val\n",
|
||||
"Using 2 dataloader workers\n",
|
||||
"Logging results to runs/train/exp\n",
|
||||
"Starting training for 3 epochs...\n",
|
||||
@@ -1036,7 +1036,7 @@
|
||||
"source": [
|
||||
"## Local Logging\n",
|
||||
"\n",
|
||||
"All results are logged by default to `runs/train`, with a new experiment directory created for each new training as `runs/train/exp2`, `runs/train/exp3`, etc. View train and test jpgs to see mosaics, labels, predictions and augmentation effects. Note a **Mosaic Dataloader** is used for training (shown below), a new concept developed by Ultralytics and first featured in [YOLOv4](https://arxiv.org/abs/2004.10934)."
|
||||
"All results are logged by default to `runs/train`, with a new experiment directory created for each new training as `runs/train/exp2`, `runs/train/exp3`, etc. View train and val jpgs to see mosaics, labels, predictions and augmentation effects. Note a **Mosaic Dataloader** is used for training (shown below), a new concept developed by Ultralytics and first featured in [YOLOv4](https://arxiv.org/abs/2004.10934)."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1046,8 +1046,8 @@
|
||||
},
|
||||
"source": [
|
||||
"Image(filename='runs/train/exp/train_batch0.jpg', width=800) # train batch 0 mosaics and labels\n",
|
||||
"Image(filename='runs/train/exp/test_batch0_labels.jpg', width=800) # test batch 0 labels\n",
|
||||
"Image(filename='runs/train/exp/test_batch0_pred.jpg', width=800) # test batch 0 predictions"
|
||||
"Image(filename='runs/train/exp/test_batch0_labels.jpg', width=800) # val batch 0 labels\n",
|
||||
"Image(filename='runs/train/exp/test_batch0_pred.jpg', width=800) # val batch 0 predictions"
|
||||
],
|
||||
"execution_count": null,
|
||||
"outputs": []
|
||||
@@ -1062,10 +1062,10 @@
|
||||
"`train_batch0.jpg` shows train batch 0 mosaics and labels\n",
|
||||
"\n",
|
||||
"> <img src=\"https://user-images.githubusercontent.com/26833433/124931217-4826f080-e002-11eb-87b9-ae0925a8c94b.jpg\" width=\"700\"> \n",
|
||||
"`test_batch0_labels.jpg` shows test batch 0 labels\n",
|
||||
"`test_batch0_labels.jpg` shows val batch 0 labels\n",
|
||||
"\n",
|
||||
"> <img src=\"https://user-images.githubusercontent.com/26833433/124931209-46f5c380-e002-11eb-9bd5-7a3de2be9851.jpg\" width=\"700\"> \n",
|
||||
"`test_batch0_pred.jpg` shows test batch 0 _predictions_"
|
||||
"`test_batch0_pred.jpg` shows val batch 0 _predictions_"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1125,7 +1125,7 @@
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"If this badge is green, all [YOLOv5 GitHub Actions](https://github.com/ultralytics/yolov5/actions) Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training ([train.py](https://github.com/ultralytics/yolov5/blob/master/train.py)), testing ([test.py](https://github.com/ultralytics/yolov5/blob/master/test.py)), inference ([detect.py](https://github.com/ultralytics/yolov5/blob/master/detect.py)) and export ([export.py](https://github.com/ultralytics/yolov5/blob/master/export.py)) on MacOS, Windows, and Ubuntu every 24 hours and on every commit.\n"
|
||||
"If this badge is green, all [YOLOv5 GitHub Actions](https://github.com/ultralytics/yolov5/actions) Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training ([train.py](https://github.com/ultralytics/yolov5/blob/master/train.py)), testing ([val.py](https://github.com/ultralytics/yolov5/blob/master/val.py)), inference ([detect.py](https://github.com/ultralytics/yolov5/blob/master/detect.py)) and export ([export.py](https://github.com/ultralytics/yolov5/blob/master/export.py)) on MacOS, Windows, and Ubuntu every 24 hours and on every commit.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1147,8 +1147,8 @@
|
||||
"source": [
|
||||
"# Reproduce\n",
|
||||
"for x in 'yolov5s', 'yolov5m', 'yolov5l', 'yolov5x':\n",
|
||||
" !python test.py --weights {x}.pt --data coco.yaml --img 640 --conf 0.25 --iou 0.45 # speed\n",
|
||||
" !python test.py --weights {x}.pt --data coco.yaml --img 640 --conf 0.001 --iou 0.65 # mAP"
|
||||
" !python val.py --weights {x}.pt --data coco.yaml --img 640 --conf 0.25 --iou 0.45 # speed\n",
|
||||
" !python val.py --weights {x}.pt --data coco.yaml --img 640 --conf 0.001 --iou 0.65 # mAP"
|
||||
],
|
||||
"execution_count": null,
|
||||
"outputs": []
|
||||
@@ -1193,8 +1193,8 @@
|
||||
" for d in 0 cpu; do # devices\n",
|
||||
" python detect.py --weights $m.pt --device $d # detect official\n",
|
||||
" python detect.py --weights runs/train/exp/weights/best.pt --device $d # detect custom\n",
|
||||
" python test.py --weights $m.pt --device $d # test official\n",
|
||||
" python test.py --weights runs/train/exp/weights/best.pt --device $d # test custom\n",
|
||||
" python val.py --weights $m.pt --device $d # val official\n",
|
||||
" python val.py --weights runs/train/exp/weights/best.pt --device $d # val custom\n",
|
||||
" done\n",
|
||||
" python hubconf.py # hub\n",
|
||||
" python models/yolo.py --cfg $m.yaml # inspect\n",
|
||||
|
||||
Reference in new issue
Block a user