496 lines
859 KiB
Plaintext
496 lines
859 KiB
Plaintext
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {
|
||
|
"colab_type": "text",
|
||
|
"id": "HvhYZrIZCEyo"
|
||
|
},
|
||
|
"source": [
|
||
|
"<img src=\"https://storage.googleapis.com/ultralytics/logo/logoname1000.png\" width=\"150\">\n",
|
||
|
"\n",
|
||
|
"<table align=\"center\"><td>\n",
|
||
|
" <a target=\"_blank\" href=\"https://github.com/ultralytics/yolov3/blob/master/tutorial.ipynb\">\n",
|
||
|
" <img src=\"https://www.tensorflow.org/images/GitHub-Mark-32px.png\" />View source on github\n",
|
||
|
" </a>\n",
|
||
|
"</td><td>\n",
|
||
|
" <a target=\"_blank\" href=\"https://colab.sandbox.google.com/github/ultralytics/yolov3/blob/master/tutorial.ipynb\">\n",
|
||
|
" <img width=32px src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" />Run in Google Colab</a>\n",
|
||
|
"</td></table>\n",
|
||
|
"\n",
|
||
|
"This notebook contains software developed by Ultralytics LLC, and **is freely available for redistribution under the GPL-3.0 license**. For more information please visit https://github.com/ultralytics/yolov3 and https://www.ultralytics.com.\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 2,
|
||
|
"metadata": {
|
||
|
"colab": {
|
||
|
"base_uri": "https://localhost:8080/",
|
||
|
"height": 34
|
||
|
},
|
||
|
"colab_type": "code",
|
||
|
"id": "e5ylFIvlCEym",
|
||
|
"outputId": "fbc88edd-7b26-4735-83bf-b404b76f9c90"
|
||
|
},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"PyTorch 1.1.0 _CudaDeviceProperties(name='Tesla K80', major=3, minor=7, total_memory=11441MB, multi_processor_count=13)\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"import time\n",
|
||
|
"import glob\n",
|
||
|
"import torch\n",
|
||
|
"import os\n",
|
||
|
"\n",
|
||
|
"from IPython.display import Image, clear_output \n",
|
||
|
"print('PyTorch %s %s' % (torch.__version__, torch.cuda.get_device_properties(0) if torch.cuda.is_available() else 'CPU'))"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {
|
||
|
"colab_type": "text",
|
||
|
"id": "7mGmQbAO5pQb"
|
||
|
},
|
||
|
"source": [
|
||
|
"Clone repository and download COCO 2014 dataset (20GB):"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 0,
|
||
|
"metadata": {
|
||
|
"colab": {
|
||
|
"base_uri": "https://localhost:8080/",
|
||
|
"height": 221
|
||
|
},
|
||
|
"colab_type": "code",
|
||
|
"id": "tIFv0p1TCEyj",
|
||
|
"outputId": "e9230cff-ede4-491a-a74d-063ce77f21cd"
|
||
|
},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"Cloning into 'yolov3'...\n",
|
||
|
"remote: Enumerating objects: 61, done.\u001b[K\n",
|
||
|
"remote: Counting objects: 100% (61/61), done.\u001b[K\n",
|
||
|
"remote: Compressing objects: 100% (44/44), done.\u001b[K\n",
|
||
|
"remote: Total 4781 (delta 35), reused 37 (delta 17), pack-reused 4720\u001b[K\n",
|
||
|
"Receiving objects: 100% (4781/4781), 4.74 MiB | 6.95 MiB/s, done.\n",
|
||
|
"Resolving deltas: 100% (3254/3254), done.\n",
|
||
|
" % Total % Received % Xferd Average Speed Time Time Time Current\n",
|
||
|
" Dload Upload Total Spent Left Speed\n",
|
||
|
"100 388 0 388 0 0 2455 0 --:--:-- --:--:-- --:--:-- 2440\n",
|
||
|
"100 18.8G 0 18.8G 0 0 189M 0 --:--:-- 0:01:42 --:--:-- 174M\n",
|
||
|
"/content/yolov3\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"!git clone https://github.com/ultralytics/yolov3 # clone\n",
|
||
|
"!bash yolov3/data/get_coco_dataset_gdrive.sh # copy COCO2014 dataset (19GB)\n",
|
||
|
"%cd yolov3"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {
|
||
|
"colab_type": "text",
|
||
|
"id": "N3qM6T0W53gh"
|
||
|
},
|
||
|
"source": [
|
||
|
"Run `detect.py` to perform inference on images in `data/samples` folder:"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 0,
|
||
|
"metadata": {
|
||
|
"colab": {
|
||
|
"base_uri": "https://localhost:8080/",
|
||
|
"height": 477
|
||
|
},
|
||
|
"colab_type": "code",
|
||
|
"id": "zR9ZbuQCH7FX",
|
||
|
"outputId": "49268b66-125d-425e-dbd0-17b108914c51"
|
||
|
},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"Namespace(cfg='cfg/yolov3-spp.cfg', conf_thres=0.5, data='data/coco.data', fourcc='mp4v', images='data/samples', img_size=416, nms_thres=0.5, output='output', weights='weights/yolov3-spp.weights')\n",
|
||
|
"Using CUDA with Apex device0 _CudaDeviceProperties(name='Tesla K80', total_memory=11441MB)\n",
|
||
|
"\n",
|
||
|
"image 1/2 data/samples/bus.jpg: 416x320 3 persons, 1 buss, 1 handbags, Done. (0.119s)\n",
|
||
|
"image 2/2 data/samples/zidane.jpg: 256x416 2 persons, 1 ties, Done. (0.085s)\n",
|
||
|
"Results saved to /content/yolov3/output\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/jpeg": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAIBAQEBAQIBAQECAgICAgQDAgICAgUEBAME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Wlb5U/hrQ0+aGObzo3bzl+X\n7/y7q+Ox1GXNKTPewtT4ZI7LT2T/AFM03mt8q7v4a0WuvLUI+6H5v9Wvzbv+BVzVnfTeSH/55q25\nd/3m/wBmp/7UdpI+Nqt8rbWr5DEYeUqp9DRrfDzG5cXySsN9zuVot6qybvu1m3mpRrD5iO0KSRbv\nlf5aqSal8zbNuPm2/J8q1Uk1QSM73KKrrF8nlr8u6tKOHUZe8dvtOhPeahD5yc7v3X975t1Zs0zr\nsfo2/wCZW/h/4FS3F4jKkEyMXX5X3fdaqzLBNJscrsZNqqv8NexhcPGPuozqVOWHKJe+c0hf7Tv3\nfL8tVri3DSPD9pUyr/F91d1aEljH/wAvMylG+4yp91aktdPeRc+Tv+f5fk3V9XluH5dTwcdiIx+0\nYLK6tvfcKry6bN5ezZ+7b/lpG+35q7BfDiNa+XNC37xtq7m27qdY+DXuN0m/hX/1f8NfY4ej7lz5\nXGYjm+E5C10e/Ece+2+fdtXb81XF8P7bqPztwkVGV9vyrt/2a7ux8KzRyJCkLM6/Nt3/ACtU7eDX\nkmj811Ty2+f91ub5q1lTjGZwRrcp5wuihpJIPmZGf/v2tQDwrMzHyXbZ93aqV6ovg/y5FT7zL99V\nT7y0kngvM3nfZmQbWZFWuKpR5vdN6dbl+0eUyeG7mO4Dp0Zf/Hqfp+jzQtLNczZK/wAP92vS28Hm\naOL/AEXa21n/AOA1m3
|
||
|
"text/plain": [
|
||
|
"<IPython.core.display.Image object>"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 26,
|
||
|
"metadata": {
|
||
|
"image/jpeg": {
|
||
|
"width": 600
|
||
|
},
|
||
|
"tags": []
|
||
|
},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"!python3 detect.py\n",
|
||
|
"Image(filename='output/zidane.jpg', width=600)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {
|
||
|
"colab_type": "text",
|
||
|
"id": "ijTFlKcp6JVy"
|
||
|
},
|
||
|
"source": [
|
||
|
"Run `train.py` to train YOLOv3-SPP starting from a darknet53 backbone:"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 0,
|
||
|
"metadata": {
|
||
|
"colab": {},
|
||
|
"colab_type": "code",
|
||
|
"id": "Mupsoa0lzSPo"
|
||
|
},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"!python3 train.py --data data/coco_64img.data --img-size 320 --epochs 3 --nosave"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {
|
||
|
"colab_type": "text",
|
||
|
"id": "0eq1SMWl6Sfn"
|
||
|
},
|
||
|
"source": [
|
||
|
"Run `test.py` to evaluate the performance of a trained darknet or PyTorch model:"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 0,
|
||
|
"metadata": {
|
||
|
"colab": {
|
||
|
"base_uri": "https://localhost:8080/",
|
||
|
"height": 1000
|
||
|
},
|
||
|
"colab_type": "code",
|
||
|
"id": "0v0RFtO-WG9o",
|
||
|
"outputId": "6791f795-cb10-4da3-932f-c4ac47574601"
|
||
|
},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"Namespace(batch_size=16, cfg='cfg/yolov3-spp.cfg', conf_thres=0.001, data='data/coco.data', img_size=416, iou_thres=0.5, nms_thres=0.5, save_json=True, weights='weights/yolov3-spp.weights')\n",
|
||
|
"Using CUDA device0 _CudaDeviceProperties(name='Tesla K80', total_memory=11441MB)\n",
|
||
|
"\n",
|
||
|
"Downloading https://pjreddie.com/media/files/yolov3-spp.weights\n",
|
||
|
" % Total % Received % Xferd Average Speed Time Time Time Current\n",
|
||
|
" Dload Upload Total Spent Left Speed\n",
|
||
|
"100 240M 100 240M 0 0 17.9M 0 0:00:13 0:00:13 --:--:-- 20.3M\n",
|
||
|
" Class Images Targets P R mAP F1: 100% 313/313 [11:14<00:00, 3.02s/it]\n",
|
||
|
" all 5e+03 3.58e+04 0.107 0.749 0.557 0.182\n",
|
||
|
" person 5e+03 1.09e+04 0.138 0.846 0.723 0.238\n",
|
||
|
" bicycle 5e+03 316 0.0663 0.696 0.474 0.121\n",
|
||
|
" car 5e+03 1.67e+03 0.0682 0.781 0.586 0.125\n",
|
||
|
" motorcycle 5e+03 391 0.149 0.785 0.657 0.25\n",
|
||
|
" airplane 5e+03 131 0.17 0.931 0.853 0.287\n",
|
||
|
" bus 5e+03 261 0.177 0.824 0.778 0.291\n",
|
||
|
" train 5e+03 212 0.18 0.892 0.832 0.3\n",
|
||
|
" truck 5e+03 352 0.106 0.656 0.497 0.183\n",
|
||
|
" boat 5e+03 475 0.0851 0.724 0.483 0.152\n",
|
||
|
" traffic light 5e+03 516 0.0448 0.723 0.485 0.0844\n",
|
||
|
" fire hydrant 5e+03 83 0.183 0.904 0.861 0.304\n",
|
||
|
" stop sign 5e+03 84 0.0838 0.881 0.791 0.153\n",
|
||
|
" parking meter 5e+03 59 0.066 0.627 0.508 0.119\n",
|
||
|
" bench 5e+03 473 0.0329 0.609 0.338 0.0625\n",
|
||
|
" bird 5e+03 469 0.0836 0.623 0.47 0.147\n",
|
||
|
" cat 5e+03 195 0.275 0.821 0.735 0.412\n",
|
||
|
" dog 5e+03 223 0.219 0.834 0.771 0.347\n",
|
||
|
" horse 5e+03 305 0.149 0.872 0.806 0.254\n",
|
||
|
" sheep 5e+03 321 0.199 0.822 0.693 0.321\n",
|
||
|
" cow 5e+03 384 0.155 0.753 0.65 0.258\n",
|
||
|
" elephant 5e+03 284 0.219 0.933 0.897 0.354\n",
|
||
|
" bear 5e+03 53 0.414 0.868 0.837 0.561\n",
|
||
|
" zebra 5e+03 277 0.205 0.884 0.831 0.333\n",
|
||
|
" giraffe 5e+03 170 0.202 0.929 0.882 0.331\n",
|
||
|
" backpack 5e+03 384 0.0457 0.63 0.333 0.0853\n",
|
||
|
" umbrella 5e+03 392 0.0874 0.819 0.596 0.158\n",
|
||
|
" handbag 5e+03 483 0.0244 0.592 0.214 0.0468\n",
|
||
|
" tie 5e+03 297 0.0611 0.727 0.492 0.113\n",
|
||
|
" suitcase 5e+03 310 0.13 0.803 0.56 0.223\n",
|
||
|
" frisbee 5e+03 109 0.134 0.862 0.778 0.232\n",
|
||
|
" skis 5e+03 282 0.0624 0.695 0.406 0.114\n",
|
||
|
" snowboard 5e+03 92 0.0958 0.717 0.504 0.169\n",
|
||
|
" sports ball 5e+03 236 0.0715 0.716 0.622 0.13\n",
|
||
|
" kite 5e+03 399 0.142 0.744 0.533 0.238\n",
|
||
|
" baseball bat 5e+03 125 0.0807 0.712 0.576 0.145\n",
|
||
|
" baseball glove 5e+03 139 0.0606 0.655 0.482 0.111\n",
|
||
|
" skateboard 5e+03 218 0.0926 0.794 0.684 0.166\n",
|
||
|
" surfboard 5e+03 266 0.0806 0.789 0.606 0.146\n",
|
||
|
" tennis racket 5e+03 183 0.106 0.836 0.734 0.188\n",
|
||
|
" bottle 5e+03 966 0.0653 0.712 0.441 0.12\n",
|
||
|
" wine glass 5e+03 366 0.0912 0.667 0.49 0.161\n",
|
||
|
" cup 5e+03 897 0.0707 0.708 0.486 0.128\n",
|
||
|
" fork 5e+03 234 0.0521 0.594 0.404 0.0958\n",
|
||
|
" knife 5e+03 291 0.0375 0.526 0.266 0.0701\n",
|
||
|
" spoon 5e+03 253 0.0309 0.553 0.22 0.0585\n",
|
||
|
" bowl 5e+03 620 0.0754 0.763 0.492 0.137\n",
|
||
|
" banana 5e+03 371 0.0922 0.69 0.368 0.163\n",
|
||
|
" apple 5e+03 158 0.0492 0.639 0.227 0.0914\n",
|
||
|
" sandwich 5e+03 160 0.104 0.662 0.454 0.179\n",
|
||
|
" orange 5e+03 189 0.052 0.598 0.265 0.0958\n",
|
||
|
" broccoli 5e+03 332 0.0898 0.774 0.373 0.161\n",
|
||
|
" carrot 5e+03 346 0.0534 0.659 0.272 0.0989\n",
|
||
|
" hot dog 5e+03 164 0.121 0.604 0.484 0.201\n",
|
||
|
" pizza 5e+03 224 0.109 0.804 0.637 0.192\n",
|
||
|
" donut 5e+03 237 0.149 0.755 0.594 0.249\n",
|
||
|
" cake 5e+03 241 0.0964 0.643 0.495 0.168\n",
|
||
|
" chair 5e+03 1.62e+03 0.0597 0.712 0.424 0.11\n",
|
||
|
" couch 5e+03 236 0.125 0.767 0.567 0.214\n",
|
||
|
" potted plant 5e+03 431 0.0531 0.791 0.473 0.0996\n",
|
||
|
" bed 5e+03 195 0.185 0.826 0.725 0.302\n",
|
||
|
" dining table 5e+03 634 0.062 0.801 0.502 0.115\n",
|
||
|
" toilet 5e+03 179 0.209 0.95 0.835 0.342\n",
|
||
|
" tv 5e+03 257 0.115 0.922 0.773 0.204\n",
|
||
|
" laptop 5e+03 237 0.172 0.814 0.714 0.284\n",
|
||
|
" mouse 5e+03 95 0.0716 0.853 0.696 0.132\n",
|
||
|
" remote 5e+03 241 0.058 0.772 0.506 0.108\n",
|
||
|
" keyboard 5e+03 117 0.0813 0.897 0.7 0.149\n",
|
||
|
" cell phone 5e+03 291 0.0381 0.646 0.396 0.072\n",
|
||
|
" microwave 5e+03 88 0.155 0.841 0.727 0.262\n",
|
||
|
" oven 5e+03 142 0.073 0.824 0.556 0.134\n",
|
||
|
" toaster 5e+03 11 0.121 0.636 0.212 0.203\n",
|
||
|
" sink 5e+03 211 0.0581 0.848 0.579 0.109\n",
|
||
|
" refrigerator 5e+03 107 0.0827 0.897 0.755 0.151\n",
|
||
|
" book 5e+03 1.08e+03 0.0519 0.564 0.166 0.0951\n",
|
||
|
" clock 5e+03 292 0.083 0.818 0.731 0.151\n",
|
||
|
" vase 5e+03 353 0.0817 0.745 0.522 0.147\n",
|
||
|
" scissors 5e+03 56 0.0494 0.625 0.427 0.0915\n",
|
||
|
" teddy bear 5e+03 245 0.14 0.816 0.635 0.24\n",
|
||
|
" hair drier 5e+03 11 0.0714 0.273 0.106 0.113\n",
|
||
|
" toothbrush 5e+03 77 0.043 0.61 0.305 0.0803\n",
|
||
|
"loading annotations into memory...\n",
|
||
|
"Done (t=5.40s)\n",
|
||
|
"creating index...\n",
|
||
|
"index created!\n",
|
||
|
"Loading and preparing results...\n",
|
||
|
"DONE (t=2.65s)\n",
|
||
|
"creating index...\n",
|
||
|
"index created!\n",
|
||
|
"Running per image evaluation...\n",
|
||
|
"Evaluate annotation type *bbox*\n",
|
||
|
"DONE (t=58.87s).\n",
|
||
|
"Accumulating evaluation results...\n",
|
||
|
"DONE (t=7.76s).\n",
|
||
|
" Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.337\n",
|
||
|
" Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.568\n",
|
||
|
" Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.350\n",
|
||
|
" Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.152\n",
|
||
|
" Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.359\n",
|
||
|
" Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.496\n",
|
||
|
" Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.279\n",
|
||
|
" Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.432\n",
|
||
|
" Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.460\n",
|
||
|
" Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.257\n",
|
||
|
" Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.494\n",
|
||
|
" Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.623\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"!python3 test.py --data data/coco.data --save-json --img-size 416 # 0.565 mAP"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {
|
||
|
"colab_type": "text",
|
||
|
"id": "VUOiNLtMP5aG"
|
||
|
},
|
||
|
"source": [
|
||
|
"Reproduce tutorial training runs and plot training results:"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 8,
|
||
|
"metadata": {
|
||
|
"colab": {
|
||
|
"base_uri": "https://localhost:8080/",
|
||
|
"height": 417
|
||
|
},
|
||
|
"colab_type": "code",
|
||
|
"id": "LA9qqd_NCEyB",
|
||
|
"outputId": "1521c334-92ef-4f9f-bb8a-916ad5e2d9c2"
|
||
|
},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAACvAAAAV4CAYAAAB8IQgEAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAAewgAAHsIBbtB1PgAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzs3Xd0FNX///HXbkhCIKEHCIQaEkBB\naujVCnwoKiCiHwS/KoqoYPmpoAgKImBDlA+IIHxEsYEFRawE6VUIQSD0HkIIJRASQpL5/cFhPrsh\nuztpm0Sej3P2nLm7d+7cnXCY98687702wzAMAQAAAAAAAAAAAAAAAAAAAPAKe2F3AAAAAAAAAAAA\nAAAAAAAAALiekMALAAAAAAAAAAAAAAAAAAAAeBEJvAAAAAAAAAAAAAAAAAAAAIAXkcALAAAAAAAA\nAAAAAAAAAAAAeBEJvAAAAAAAAAAAAAAAAAAAAIAXkcALAAAAAAAAAAAAAAAAAAAAeBEJvAAAAAAA\nAAAAAAAAAAAAAIAXkcALAAAAAAAAAAAAAAAAAAAAeBEJvAAAAAAAAAAAAAAAAAAAAIAXkcALAAAA\nAAAAAAAAAA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DfIu+KSxwMACjaatSooUmTJmnw\n4MHmez/88INuvfVWS/unpKTozz//1JEjR3Tq1ClVqFBB9957r8qWLet2v+joaMXExCg+Pl6GYahq\n1apq06ZNjq7lrvqzevV
|
||
|
"text/plain": [
|
||
|
"<IPython.core.display.Image object>"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 8,
|
||
|
"metadata": {
|
||
|
"image/png": {
|
||
|
"width": 800
|
||
|
},
|
||
|
"tags": []
|
||
|
},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"!python3 train.py --data data/coco_16img.data --batch-size 16 --accumulate 1 --nosave && mv results.txt results_coco_16img.txt # CUSTOM TRAINING EXAMPLE\n",
|
||
|
"!python3 train.py --data data/coco_64img.data --batch-size 16 --accumulate 1 --nosave && mv results.txt results_coco_64img.txt \n",
|
||
|
"!python3 -c \"from utils import utils; utils.plot_results()\" # plot training results\n",
|
||
|
"Image(filename='results.png', width=800)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {
|
||
|
"colab_type": "text",
|
||
|
"id": "14mT7T7Q6erR"
|
||
|
},
|
||
|
"source": [
|
||
|
"Extras below\n",
|
||
|
"\n",
|
||
|
"---\n",
|
||
|
"\n",
|
||
|
"\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 0,
|
||
|
"metadata": {
|
||
|
"colab": {},
|
||
|
"colab_type": "code",
|
||
|
"id": "42_zEpW6W_N1"
|
||
|
},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"!git pull"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 0,
|
||
|
"metadata": {
|
||
|
"colab": {},
|
||
|
"colab_type": "code",
|
||
|
"id": "9bVTcveIOzDd"
|
||
|
},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"%cd yolov3"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 0,
|
||
|
"metadata": {
|
||
|
"colab": {},
|
||
|
"colab_type": "code",
|
||
|
"id": "odMr0JFnCEyb"
|
||
|
},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"%ls"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 0,
|
||
|
"metadata": {
|
||
|
"colab": {},
|
||
|
"colab_type": "code",
|
||
|
"id": "uB3v5hj_CEyI"
|
||
|
},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"# Unit Tests\n",
|
||
|
"!python3 detect.py # detect 2 persons, 1 tie\n",
|
||
|
"!python3 test.py --data data/coco_32img.data # test mAP = 0.8\n",
|
||
|
"!python3 train.py --data data/coco_32img.data --epochs 3 --nosave # train 3 epochs"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 0,
|
||
|
"metadata": {
|
||
|
"colab": {},
|
||
|
"colab_type": "code",
|
||
|
"id": "6D0si0TNCEx5"
|
||
|
},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"# Evolve Hyperparameters\n",
|
||
|
"!python3 train.py --data data/coco.data --img-size 320 --epochs 1 --evolve"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"metadata": {
|
||
|
"accelerator": "GPU",
|
||
|
"colab": {
|
||
|
"collapsed_sections": [],
|
||
|
"name": "ultralytics/YOLOv3",
|
||
|
"provenance": [],
|
||
|
"version": "0.3.2"
|
||
|
},
|
||
|
"kernelspec": {
|
||
|
"display_name": "Python 3",
|
||
|
"language": "python",
|
||
|
"name": "python3"
|
||
|
},
|
||
|
"language_info": {
|
||
|
"codemirror_mode": {
|
||
|
"name": "ipython",
|
||
|
"version": 3
|
||
|
},
|
||
|
"file_extension": ".py",
|
||
|
"mimetype": "text/x-python",
|
||
|
"name": "python",
|
||
|
"nbconvert_exporter": "python",
|
||
|
"pygments_lexer": "ipython3",
|
||
|
"version": "3.7.4"
|
||
|
}
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 1
|
||
|
}
|