Created using Colaboratory

pull/9645/head
Glenn Jocher 2023-08-08 02:10:01 +02:00
parent 38737bdafa
commit 934d5d1a8a
1 changed files with 9 additions and 9 deletions

12
tutorial.ipynb vendored
View File

@ -65,7 +65,7 @@
"import utils\n", "import utils\n",
"display = utils.notebook_init() # checks" "display = utils.notebook_init() # checks"
], ],
"execution_count": 1, "execution_count": null,
"outputs": [ "outputs": [
{ {
"output_type": "stream", "output_type": "stream",
@ -118,7 +118,7 @@
"!python detect.py --weights yolov5s.pt --img 640 --conf 0.25 --source data/images\n", "!python detect.py --weights yolov5s.pt --img 640 --conf 0.25 --source data/images\n",
"# display.Image(filename='runs/detect/exp/zidane.jpg', width=600)" "# display.Image(filename='runs/detect/exp/zidane.jpg', width=600)"
], ],
"execution_count": 13, "execution_count": null,
"outputs": [ "outputs": [
{ {
"output_type": "stream", "output_type": "stream",
@ -174,7 +174,7 @@
"torch.hub.download_url_to_file('https://ultralytics.com/assets/coco2017val.zip', 'tmp.zip') # download (780M - 5000 images)\n", "torch.hub.download_url_to_file('https://ultralytics.com/assets/coco2017val.zip', 'tmp.zip') # download (780M - 5000 images)\n",
"!unzip -q tmp.zip -d ../datasets && rm tmp.zip # unzip" "!unzip -q tmp.zip -d ../datasets && rm tmp.zip # unzip"
], ],
"execution_count": 3, "execution_count": null,
"outputs": [ "outputs": [
{ {
"output_type": "stream", "output_type": "stream",
@ -198,7 +198,7 @@
"# Validate YOLOv5s on COCO val\n", "# Validate YOLOv5s on COCO val\n",
"!python val.py --weights yolov5s.pt --data coco.yaml --img 640 --half" "!python val.py --weights yolov5s.pt --data coco.yaml --img 640 --half"
], ],
"execution_count": 4, "execution_count": null,
"outputs": [ "outputs": [
{ {
"output_type": "stream", "output_type": "stream",
@ -308,7 +308,7 @@
"# Train YOLOv5s on COCO128 for 3 epochs\n", "# Train YOLOv5s on COCO128 for 3 epochs\n",
"!python train.py --img 640 --batch 16 --epochs 3 --data coco128.yaml --weights yolov5s.pt --cache" "!python train.py --img 640 --batch 16 --epochs 3 --data coco128.yaml --weights yolov5s.pt --cache"
], ],
"execution_count": 5, "execution_count": null,
"outputs": [ "outputs": [
{ {
"output_type": "stream", "output_type": "stream",
@ -593,7 +593,7 @@
"# YOLOv5 PyTorch HUB Inference (DetectionModels only)\n", "# YOLOv5 PyTorch HUB Inference (DetectionModels only)\n",
"import torch\n", "import torch\n",
"\n", "\n",
"model = torch.hub.load('ultralytics/yolov5', 'yolov5s', force_reload=True) # yolov5n - yolov5x6 or custom\n", "model = torch.hub.load('ultralytics/yolov5', 'yolov5s', force_reload=True, trust_repo=True) # or yolov5n - yolov5x6 or custom\n",
"im = 'https://ultralytics.com/images/zidane.jpg' # file, Path, PIL.Image, OpenCV, nparray, list\n", "im = 'https://ultralytics.com/images/zidane.jpg' # file, Path, PIL.Image, OpenCV, nparray, list\n",
"results = model(im) # inference\n", "results = model(im) # inference\n",
"results.print() # or .show(), .save(), .crop(), .pandas(), etc." "results.print() # or .show(), .save(), .crop(), .pandas(), etc."