From 2813de7cc31da84eea392ffef08b51f6b7454291 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Mon, 19 Dec 2022 10:57:59 +0100 Subject: [PATCH] Created using Colaboratory --- tutorial.ipynb | 262 ++++++++++++++++++++++--------------------------- 1 file changed, 116 insertions(+), 146 deletions(-) diff --git a/tutorial.ipynb b/tutorial.ipynb index 1450682b..17a0f62f 100644 --- a/tutorial.ipynb +++ b/tutorial.ipynb @@ -5,7 +5,6 @@ "colab": { "name": "YOLOv3 Tutorial", "provenance": [], - "collapsed_sections": [], "include_colab_link": true }, "kernelspec": { @@ -402,7 +401,7 @@ "colab": { "base_uri": "https://localhost:8080/" }, - "outputId": "7efd38e6-c41f-4fe3-9864-ce4fa43fbb5b" + "outputId": "141002fc-fe49-48d2-a575-2555bf903413" }, "source": [ "!git clone https://github.com/ultralytics/yolov3 # clone\n", @@ -413,15 +412,8 @@ "from yolov3 import utils\n", "display = utils.notebook_init() # checks" ], - "execution_count": 24, + "execution_count": 1, "outputs": [ - { - "output_type": "stream", - "name": "stderr", - "text": [ - "YOLOv3 🚀 v9.6.0-1-g93a2bcc torch 1.10.0+cu111 CUDA:0 (A100-SXM4-40GB, 40536MiB)\n" - ] - }, { "output_type": "stream", "name": "stdout", @@ -459,27 +451,27 @@ "colab": { "base_uri": "https://localhost:8080/" }, - "outputId": "486202a4-bae2-454f-da62-2c74676a3058" + "outputId": "c29b082a-8e56-4799-b32a-056425f130d1" }, "source": [ "!python detect.py --weights yolov3.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": 22, + "execution_count": 4, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "\u001b[34m\u001b[1mdetect: \u001b[0mweights=['yolov3.pt'], source=data/images, imgsz=[640, 640], conf_thres=0.25, iou_thres=0.45, max_det=1000, device=, view_img=False, save_txt=False, save_conf=False, save_crop=False, nosave=False, classes=None, agnostic_nms=False, augment=False, visualize=False, update=False, project=runs/detect, name=exp, exist_ok=False, line_thickness=3, hide_labels=False, hide_conf=False, half=False, dnn=False\n", - "YOLOv3 🚀 v9.6.0-1-g93a2bcc torch 1.10.0+cu111 CUDA:0 (A100-SXM4-40GB, 40536MiB)\n", + "YOLOv3 🚀 v9.6.0-29-ga441ab1 torch 1.13.0+cu116 CUDA:0 (Tesla T4, 15110MiB)\n", "\n", "Fusing layers... \n", - "Model Summary: 261 layers, 61922845 parameters, 0 gradients, 156.1 GFLOPs\n", - "image 1/2 /content/yolov3/data/images/bus.jpg: 640x480 4 persons, 1 bus, 1 tie, 1 sports ball, Done. (0.020s)\n", - "image 2/2 /content/yolov3/data/images/zidane.jpg: 384x640 2 persons, 3 ties, Done. (0.020s)\n", - "Speed: 0.5ms pre-process, 20.0ms inference, 1.3ms NMS per image at shape (1, 3, 640, 640)\n", - "Results saved to \u001b[1mruns/detect/exp\u001b[0m\n" + "Model Summary: 261 layers, 61922845 parameters, 0 gradients\n", + "image 1/2 /content/yolov3/data/images/bus.jpg: 640x480 4 persons, 1 bicycle, 1 bus, Done. (0.050s)\n", + "image 2/2 /content/yolov3/data/images/zidane.jpg: 384x640 2 persons, 2 ties, Done. (0.038s)\n", + "Speed: 0.5ms pre-process, 44.3ms inference, 1.3ms NMS per image at shape (1, 3, 640, 640)\n", + "Results saved to \u001b[1mruns/detect/exp2\u001b[0m\n" ] } ] @@ -542,7 +534,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": 4, + "execution_count": null, "outputs": [ { "output_type": "display_data", @@ -573,7 +565,7 @@ "# Run YOLOv3 on COCO val\n", "!python val.py --weights yolov3.pt --data coco.yaml --img 640 --iou 0.65 --half" ], - "execution_count": 23, + "execution_count": null, "outputs": [ { "output_type": "stream", @@ -690,20 +682,6 @@ "execution_count": null, "outputs": [] }, - { - "cell_type": "code", - "metadata": { - "id": "2fLAV42oNb7M" - }, - "source": [ - "# Weights & Biases (optional)\n", - "%pip install -q wandb\n", - "import wandb\n", - "wandb.login()" - ], - "execution_count": null, - "outputs": [] - }, { "cell_type": "code", "metadata": { @@ -711,13 +689,13 @@ "colab": { "base_uri": "https://localhost:8080/" }, - "outputId": "a601aa72-687c-4dda-a16c-c0b2d9073910" + "outputId": "c77013e3-347d-42a4-84de-3ca42ea3aee9" }, "source": [ "# Train YOLOv3 on COCO128 for 3 epochs\n", "!python train.py --img 640 --batch 16 --epochs 3 --data coco128.yaml --weights yolov3.pt --cache" ], - "execution_count": 21, + "execution_count": 3, "outputs": [ { "output_type": "stream", @@ -725,12 +703,18 @@ "text": [ "\u001b[34m\u001b[1mtrain: \u001b[0mweights=yolov3.pt, cfg=, data=coco128.yaml, hyp=data/hyps/hyp.scratch.yaml, epochs=3, batch_size=16, imgsz=640, rect=False, resume=False, nosave=False, noval=False, noautoanchor=False, evolve=None, bucket=, cache=ram, image_weights=False, device=, multi_scale=False, single_cls=False, adam=False, sync_bn=False, workers=8, project=runs/train, name=exp, exist_ok=False, quad=False, linear_lr=False, label_smoothing=0.0, patience=100, freeze=0, save_period=-1, local_rank=-1, entity=None, upload_dataset=False, bbox_interval=-1, artifact_alias=latest\n", "\u001b[34m\u001b[1mgithub: \u001b[0mup to date with https://github.com/ultralytics/yolov3 ✅\n", - "YOLOv3 🚀 v9.6.0-1-g93a2bcc torch 1.10.0+cu111 CUDA:0 (A100-SXM4-40GB, 40536MiB)\n", + "YOLOv3 🚀 v9.6.0-29-ga441ab1 torch 1.13.0+cu116 CUDA:0 (Tesla T4, 15110MiB)\n", "\n", "\u001b[34m\u001b[1mhyperparameters: \u001b[0mlr0=0.01, lrf=0.1, momentum=0.937, weight_decay=0.0005, warmup_epochs=3.0, warmup_momentum=0.8, warmup_bias_lr=0.1, box=0.05, cls=0.5, cls_pw=1.0, obj=1.0, obj_pw=1.0, iou_t=0.2, anchor_t=4.0, fl_gamma=0.0, hsv_h=0.015, hsv_s=0.7, hsv_v=0.4, degrees=0.0, translate=0.1, scale=0.5, shear=0.0, perspective=0.0, flipud=0.0, fliplr=0.5, mosaic=1.0, mixup=0.0, copy_paste=0.0\n", "\u001b[34m\u001b[1mWeights & Biases: \u001b[0mrun 'pip install wandb' to automatically track and visualize YOLOv3 🚀 runs (RECOMMENDED)\n", "\u001b[34m\u001b[1mTensorBoard: \u001b[0mStart with 'tensorboard --logdir runs/train', view at http://localhost:6006/\n", "\n", + "WARNING: Dataset not found, nonexistent paths: ['/content/datasets/coco128/images/train2017']\n", + "Downloading https://ultralytics.com/assets/coco128.zip to coco128.zip...\n", + "100% 6.66M/6.66M [00:00<00:00, 10.2MB/s]\n", + "Dataset autodownload success, saved to ../datasets\n", + "\n", + "\n", " from n params module arguments \n", " 0 -1 1 928 models.common.Conv [3, 32, 3, 1] \n", " 1 -1 1 18560 models.common.Conv [32, 64, 3, 2] \n", @@ -744,7 +728,7 @@ " 9 -1 1 4720640 models.common.Conv [512, 1024, 3, 2] \n", " 10 -1 4 20983808 models.common.Bottleneck [1024, 1024] \n", " 11 -1 1 5245952 models.common.Bottleneck [1024, 1024, False] \n", - " 12 -1 1 525312 models.common.Conv [1024, 512, [1, 1]] \n", + " 12 -1 1 525312 models.common.Conv [1024, 512, 1, 1] \n", " 13 -1 1 4720640 models.common.Conv [512, 1024, 3, 1] \n", " 14 -1 1 525312 models.common.Conv [1024, 512, 1, 1] \n", " 15 -1 1 4720640 models.common.Conv [512, 1024, 3, 1] \n", @@ -761,119 +745,120 @@ " 26 -1 1 344832 models.common.Bottleneck [384, 256, False] \n", " 27 -1 2 656896 models.common.Bottleneck [256, 256, False] \n", " 28 [27, 22, 15] 1 457725 models.yolo.Detect [80, [[10, 13, 16, 30, 33, 23], [30, 61, 62, 45, 59, 119], [116, 90, 156, 198, 373, 326]], [256, 512, 1024]]\n", - "Model Summary: 333 layers, 61949149 parameters, 61949149 gradients, 156.3 GFLOPs\n", + "Model Summary: 333 layers, 61949149 parameters, 61949149 gradients, 156.6 GFLOPs\n", "\n", "Transferred 439/439 items from yolov3.pt\n", "Scaled weight_decay = 0.0005\n", "\u001b[34m\u001b[1moptimizer:\u001b[0m SGD with parameter groups 72 weight, 75 weight (no decay), 75 bias\n", - "\u001b[34m\u001b[1malbumentations: \u001b[0mversion 1.0.3 required by YOLOv3, but version 0.1.12 is currently installed\n", - "\u001b[34m\u001b[1mtrain: \u001b[0mScanning '../datasets/coco128/labels/train2017.cache' images and labels... 128 found, 0 missing, 2 empty, 0 corrupted: 100% 128/128 [00:00\"Weights

" - ] - }, { "cell_type": "markdown", "metadata": { @@ -1080,4 +1050,4 @@ "outputs": [] } ] -} +} \ No newline at end of file