From a7a28f16e57a945c7181a19893ed1c221808cd14 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Sat, 30 Jul 2022 21:08:42 +0200 Subject: [PATCH] Created using Colaboratory --- tutorial.ipynb | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/tutorial.ipynb b/tutorial.ipynb index bdfba399a883..4523def5bba1 100644 --- a/tutorial.ipynb +++ b/tutorial.ipynb @@ -369,7 +369,7 @@ "colab_type": "text" }, "source": [ - "\"Open" + "\"Open" ] }, { @@ -414,7 +414,7 @@ "import utils\n", "display = utils.notebook_init() # checks" ], - "execution_count": 1, + "execution_count": null, "outputs": [ { "output_type": "stream", @@ -466,7 +466,7 @@ "!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)" ], - "execution_count": 2, + "execution_count": null, "outputs": [ { "output_type": "stream", @@ -546,7 +546,7 @@ "torch.hub.download_url_to_file('https://ultralytics.com/assets/coco2017val.zip', 'tmp.zip')\n", "!unzip -q tmp.zip -d ../datasets && rm tmp.zip" ], - "execution_count": 3, + "execution_count": null, "outputs": [ { "output_type": "display_data", @@ -577,7 +577,7 @@ "# Run YOLOv5x on COCO val\n", "!python val.py --weights yolov5x.pt --data coco.yaml --img 640 --iou 0.65 --half" ], - "execution_count": 4, + "execution_count": null, "outputs": [ { "output_type": "stream", @@ -737,7 +737,7 @@ "# Train YOLOv5s on COCO128 for 3 epochs\n", "!python train.py --img 640 --batch 16 --epochs 3 --data coco128.yaml --weights yolov5s.pt --cache" ], - "execution_count": 7, + "execution_count": null, "outputs": [ { "output_type": "stream", @@ -1032,24 +1032,22 @@ "id": "FGH0ZjkGjejy" }, "source": [ - "# CI Checks\n", + "# YOLOv5 CI\n", "%%shell\n", - "export PYTHONPATH=\"$PWD\" # to run *.py. files in subdirectories\n", "rm -rf runs # remove runs/\n", - "for m in yolov5n; do # models\n", - " python train.py --img 64 --batch 32 --weights $m.pt --epochs 1 --device 0 # train pretrained\n", - " python train.py --img 64 --batch 32 --weights '' --cfg $m.yaml --epochs 1 --device 0 # train scratch\n", - " for d in 0 cpu; do # devices\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", - " 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", + "m=yolov5n # official weights\n", + "b=runs/train/exp/weights/best # best.pt checkpoint\n", + "python train.py --imgsz 64 --batch 32 --weights $m.pt --cfg $m.yaml --epochs 1 --device 0 # train\n", + "for d in 0 cpu; do # devices\n", + " for w in $m $b; do # weights\n", + " python val.py --imgsz 64 --batch 32 --weights $w.pt --device $d # val\n", + " python detect.py --imgsz 64 --weights $w.pt --device $d # detect\n", " done\n", - " python hubconf.py # hub\n", - " python models/yolo.py --cfg $m.yaml # build PyTorch model\n", - " python models/tf.py --weights $m.pt # build TensorFlow model\n", - " python export.py --img 64 --batch 1 --weights $m.pt --include torchscript onnx # export\n", - "done" + "done\n", + "python hubconf.py --model $m # hub\n", + "python models/tf.py --weights $m.pt # build TF model\n", + "python models/yolo.py --cfg $m.yaml # build PyTorch model\n", + "python export.py --weights $m.pt --img 64 --include torchscript # export" ], "execution_count": null, "outputs": [] @@ -1112,4 +1110,4 @@ "outputs": [] } ] -} +} \ No newline at end of file