mirror of
https://github.com/ultralytics/yolov5.git
synced 2025-06-03 14:49:29 +08:00
Simplified notebook
This commit is contained in:
parent
fdcb92a938
commit
aed88848a2
67
tutorial.ipynb
vendored
67
tutorial.ipynb
vendored
@ -439,7 +439,7 @@
|
||||
"id": "4JnkELT0cIJg"
|
||||
},
|
||||
"source": [
|
||||
"# 1. Inference\n",
|
||||
"# 1. Detect\n",
|
||||
"\n",
|
||||
"`detect.py` runs YOLOv5 inference on a variety of sources, downloading models automatically from the [latest YOLOv5 release](https://github.com/ultralytics/yolov5/releases), and saving results to `runs/detect`. Example inference sources are:\n",
|
||||
"\n",
|
||||
@ -506,17 +506,7 @@
|
||||
},
|
||||
"source": [
|
||||
"# 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."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "eyTZYGgRjnMc"
|
||||
},
|
||||
"source": [
|
||||
"## COCO val\n",
|
||||
"Download [COCO val 2017](https://github.com/ultralytics/yolov5/blob/74b34872fdf41941cddcf243951cdb090fbac17b/data/coco.yaml#L14) dataset (1GB - 5000 images), and test model accuracy."
|
||||
"Validate a model's accuracy on the [COCO](https://cocodataset.org/#home) dataset's `val` or `test` splits. Models are downloaded automatically from the [latest YOLOv5 release](https://github.com/ultralytics/yolov5/releases). To show results by class use the `--verbose` flag."
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -544,8 +534,8 @@
|
||||
},
|
||||
"source": [
|
||||
"# Download COCO val\n",
|
||||
"torch.hub.download_url_to_file('https://ultralytics.com/assets/coco2017val.zip', 'tmp.zip')\n",
|
||||
"!unzip -q tmp.zip -d ../datasets && rm tmp.zip"
|
||||
"torch.hub.download_url_to_file('https://ultralytics.com/assets/coco2017val.zip', 'tmp.zip') # download COCO val (1GB - 5000 images)\n",
|
||||
"!unzip -q tmp.zip -d ../datasets && rm tmp.zip # unzip"
|
||||
],
|
||||
"execution_count": null,
|
||||
"outputs": [
|
||||
@ -575,7 +565,7 @@
|
||||
"outputId": "19a590ef-363e-424c-d9ce-78bbe0593cd5"
|
||||
},
|
||||
"source": [
|
||||
"# Run YOLOv5x on COCO val\n",
|
||||
"# Validate YOLOv5x on COCO val\n",
|
||||
"!python val.py --weights yolov5x.pt --data coco.yaml --img 640 --iou 0.65 --half"
|
||||
],
|
||||
"execution_count": null,
|
||||
@ -631,40 +621,6 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "rc_KbFk0juX2"
|
||||
},
|
||||
"source": [
|
||||
"## COCO test\n",
|
||||
"Download [COCO test2017](https://github.com/ultralytics/yolov5/blob/74b34872fdf41941cddcf243951cdb090fbac17b/data/coco.yaml#L15) dataset (7GB - 40,000 images), to test model accuracy on test-dev set (**20,000 images, no labels**). Results are saved to a `*.json` file which should be **zipped** and submitted to the evaluation server at https://competitions.codalab.org/competitions/20794."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"metadata": {
|
||||
"id": "V0AJnSeCIHyJ"
|
||||
},
|
||||
"source": [
|
||||
"# Download COCO test-dev2017\n",
|
||||
"!bash data/scripts/get_coco.sh --test"
|
||||
],
|
||||
"execution_count": null,
|
||||
"outputs": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"metadata": {
|
||||
"id": "29GJXAP_lPrt"
|
||||
},
|
||||
"source": [
|
||||
"# Run YOLOv5x on COCO test\n",
|
||||
"!python val.py --weights yolov5x.pt --data coco.yaml --img 640 --iou 0.65 --half --task test"
|
||||
],
|
||||
"execution_count": null,
|
||||
"outputs": []
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
@ -1136,6 +1092,19 @@
|
||||
"execution_count": null,
|
||||
"outputs": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"# Validate on COCO test. Zip results.json and submit to eval server at https://competitions.codalab.org/competitions/20794\n",
|
||||
"!bash data/scripts/get_coco.sh --test # download COCO test-dev2017 (7GB - 40,000 images, test 20,000)\n",
|
||||
"!python val.py --weights yolov5x.pt --data coco.yaml --img 640 --iou 0.65 --half --task test"
|
||||
],
|
||||
"metadata": {
|
||||
"id": "aq4DPWGu0Bl1"
|
||||
},
|
||||
"execution_count": null,
|
||||
"outputs": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"metadata": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user