File size: 41,454 Bytes
4364751 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 |
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "advanced_logging_test.ipynb",
"provenance": [],
"authorship_tag": "ABX9TyPFy7j0vPOSgtY60fQfXjdq",
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"accelerator": "GPU"
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/github/alexstoken/yolov5/blob/advanced_logging/advanced_logging_test.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "-cMOOhIGFBJa",
"colab_type": "text"
},
"source": [
"# **Test Advanced Logging Branch Features**"
]
},
{
"cell_type": "code",
"metadata": {
"id": "YwXvkCXB9Yif",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 136
},
"outputId": "9a7ab9a3-c73d-4dae-ae35-237c9d84728f"
},
"source": [
"!git clone -b advanced_logging https://github.com/alexstoken/yolov5.git"
],
"execution_count": 1,
"outputs": [
{
"output_type": "stream",
"text": [
"Cloning into 'yolov5'...\n",
"remote: Enumerating objects: 53, done.\u001b[K\n",
"remote: Counting objects: 100% (53/53), done.\u001b[K\n",
"remote: Compressing objects: 100% (39/39), done.\u001b[K\n",
"remote: Total 1223 (delta 28), reused 35 (delta 14), pack-reused 1170\u001b[K\n",
"Receiving objects: 100% (1223/1223), 3.50 MiB | 3.20 MiB/s, done.\n",
"Resolving deltas: 100% (811/811), done.\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "pNJbzKWK9r3l",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
},
"outputId": "67d82040-b5af-48b5-fb93-4ed962e48680"
},
"source": [
"!pip install -r yolov5/requirements.txt # install dependencies\n",
"%cd yolov5\n",
"\n",
"import torch\n",
"from IPython.display import Image, clear_output # to display images\n",
"from utils.google_utils import gdrive_download # to download models/datasets\n",
"\n",
"clear_output()\n",
"print('Setup complete. Using torch %s %s' % (torch.__version__, torch.cuda.get_device_properties(0) if torch.cuda.is_available() else 'CPU'))"
],
"execution_count": 2,
"outputs": [
{
"output_type": "stream",
"text": [
"Setup complete. Using torch 1.5.1+cu101 _CudaDeviceProperties(name='Tesla K80', major=3, minor=7, total_memory=11441MB, multi_processor_count=13)\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "amtgnroz901E",
"colab_type": "text"
},
"source": [
"## Train"
]
},
{
"cell_type": "code",
"metadata": {
"id": "0NSb22om9ybq",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
},
"outputId": "ee202bce-ad59-4bba-fcd2-77a3dd98fd4a"
},
"source": [
"# Download tutorial dataset coco128.yaml\n",
"gdrive_download('1n_oKgR81BJtqk75b00eAjdv03qVCQn2f','coco128.zip') # tutorial dataset\n",
"!mv ./coco128 ../ # move folder alongside /yolov5"
],
"execution_count": 3,
"outputs": [
{
"output_type": "stream",
"text": [
"Downloading https://drive.google.com/uc?export=download&id=1n_oKgR81BJtqk75b00eAjdv03qVCQn2f as coco128.zip... unzipping... Done (5.1s)\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "71hxUTfvFJky",
"colab_type": "text"
},
"source": [
"**Verify Help Arg Works**"
]
},
{
"cell_type": "code",
"metadata": {
"id": "6SLw4hNi-C1L",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 544
},
"outputId": "e0ca506c-ddfb-4b86-d5e8-ca98729672b9"
},
"source": [
"!python train.py --help"
],
"execution_count": 4,
"outputs": [
{
"output_type": "stream",
"text": [
"Apex recommended for faster mixed precision training: https://github.com/NVIDIA/apex\n",
"usage: train.py [-h] [--cfg CFG] [--data DATA] [--hyp HYP] [--epochs EPOCHS]\n",
" [--batch-size BATCH_SIZE] [--img-size IMG_SIZE [IMG_SIZE ...]]\n",
" [--rect] [--resume [RESUME]] [--nosave] [--notest]\n",
" [--noautoanchor] [--evolve] [--bucket BUCKET] [--cache-images]\n",
" [--weights WEIGHTS] [--name NAME] [--device DEVICE]\n",
" [--multi-scale] [--single-cls]\n",
"\n",
"optional arguments:\n",
" -h, --help show this help message and exit\n",
" --cfg CFG model cfg path[*.yaml]\n",
" --data DATA data cfg path [*.yaml]\n",
" --hyp HYP hyp cfg path [*.yaml].\n",
" --epochs EPOCHS\n",
" --batch-size BATCH_SIZE\n",
" --img-size IMG_SIZE [IMG_SIZE ...]\n",
" train,test sizes. Assumes square imgs.\n",
" --rect rectangular training\n",
" --resume [RESUME] resume training from given path/to/last.pt, or most\n",
" recent run if blank.\n",
" --nosave only save final checkpoint\n",
" --notest only test final epoch\n",
" --noautoanchor disable autoanchor check\n",
" --evolve evolve hyperparameters\n",
" --bucket BUCKET gsutil bucket\n",
" --cache-images cache images for faster training\n",
" --weights WEIGHTS initial weights path\n",
" --name NAME renames results.txt to results_name.txt if supplied\n",
" --device DEVICE cuda device, i.e. 0 or 0,1,2,3 or cpu\n",
" --multi-scale vary img-size +/- 50%\n",
" --single-cls train as single-class dataset\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "ou1ochfx-VTr",
"colab_type": "text"
},
"source": [
"**Run with hyperparameters from yaml file**"
]
},
{
"cell_type": "code",
"metadata": {
"id": "wLHoZYbk-EqT",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 1000
},
"outputId": "63ed4676-22b8-4852-e663-5c3cfefe19df"
},
"source": [
"!python train.py --img 320 --batch 32 --epochs 3 --data ./data/coco128.yaml --cfg ./models/yolov5s.yaml --weights yolov5s.pt --name tutorial --cache --hyp new_hyp.yaml"
],
"execution_count": 9,
"outputs": [
{
"output_type": "stream",
"text": [
"Apex recommended for faster mixed precision training: https://github.com/NVIDIA/apex\n",
"Namespace(batch_size=32, bucket='', cache_images=True, cfg='./models/yolov5s.yaml', data='./data/coco128.yaml', device='', epochs=3, evolve=False, hyp='new_hyp.yaml', img_size=[320], multi_scale=False, name='tutorial', noautoanchor=False, nosave=False, notest=False, rect=False, resume=False, single_cls=False, weights='yolov5s.pt')\n",
"Using CUDA device0 _CudaDeviceProperties(name='Tesla K80', total_memory=11441MB)\n",
"\n",
"2020-07-07 16:03:25.684542: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1\n",
"Using FocalLoss(gamma=1)\n",
"Beginning training with {'optimizer': 'adam', 'lr0': 0.001, 'momentum': 0.9, 'weight_decay': 0.000625, 'giou': 0.15, 'cls': 0.58, 'cls_pw': 1.0, 'obj': 1.0, 'obj_pw': 1.0, 'iou_t': 0.2, 'anchor_t': 10.0, 'fl_gamma': 1.0, 'hsv_h': 0.014, 'hsv_s': 0.68, 'hsv_v': 0.36, 'degrees': 20.0, 'translate': 0.0, 'scale': 0.5, 'shear': 0.0}\n",
"\n",
"\n",
"Start Tensorboard with \"tensorboard --logdir=runs\", view at http://localhost:6006/\n",
"\n",
" from n params module arguments \n",
" 0 -1 1 3520 models.common.Focus [3, 32, 3] \n",
" 1 -1 1 18560 models.common.Conv [32, 64, 3, 2] \n",
" 2 -1 1 19904 models.common.BottleneckCSP [64, 64, 1] \n",
" 3 -1 1 73984 models.common.Conv [64, 128, 3, 2] \n",
" 4 -1 1 161152 models.common.BottleneckCSP [128, 128, 3] \n",
" 5 -1 1 295424 models.common.Conv [128, 256, 3, 2] \n",
" 6 -1 1 641792 models.common.BottleneckCSP [256, 256, 3] \n",
" 7 -1 1 1180672 models.common.Conv [256, 512, 3, 2] \n",
" 8 -1 1 656896 models.common.SPP [512, 512, [5, 9, 13]] \n",
" 9 -1 1 1248768 models.common.BottleneckCSP [512, 512, 1, False] \n",
" 10 -1 1 131584 models.common.Conv [512, 256, 1, 1] \n",
" 11 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest'] \n",
" 12 [-1, 6] 1 0 models.common.Concat [1] \n",
" 13 -1 1 378624 models.common.BottleneckCSP [512, 256, 1, False] \n",
" 14 -1 1 33024 models.common.Conv [256, 128, 1, 1] \n",
" 15 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest'] \n",
" 16 [-1, 4] 1 0 models.common.Concat [1] \n",
" 17 -1 1 95104 models.common.BottleneckCSP [256, 128, 1, False] \n",
" 18 -1 1 32895 torch.nn.modules.conv.Conv2d [128, 255, 1, 1] \n",
" 19 -2 1 147712 models.common.Conv [128, 128, 3, 2] \n",
" 20 [-1, 14] 1 0 models.common.Concat [1] \n",
" 21 -1 1 313088 models.common.BottleneckCSP [256, 256, 1, False] \n",
" 22 -1 1 65535 torch.nn.modules.conv.Conv2d [256, 255, 1, 1] \n",
" 23 -2 1 590336 models.common.Conv [256, 256, 3, 2] \n",
" 24 [-1, 10] 1 0 models.common.Concat [1] \n",
" 25 -1 1 1248768 models.common.BottleneckCSP [512, 512, 1, False] \n",
" 26 -1 1 130815 torch.nn.modules.conv.Conv2d [512, 255, 1, 1] \n",
" 27 [-1, 22, 18] 1 0 models.yolo.Detect [80, [[116, 90, 156, 198, 373, 326], [30, 61, 62, 45, 59, 119], [10, 13, 16, 30, 33, 23]]]\n",
"Model Summary: 191 layers, 7.46816e+06 parameters, 7.46816e+06 gradients\n",
"\n",
"Optimizer groups: 62 .bias, 70 conv.weight, 59 other\n",
"/usr/local/lib/python3.6/dist-packages/torch/optim/lr_scheduler.py:123: UserWarning: Detected call of `lr_scheduler.step()` before `optimizer.step()`. In PyTorch 1.1.0 and later, you should call them in the opposite order: `optimizer.step()` before `lr_scheduler.step()`. Failure to do this will result in PyTorch skipping the first value of the learning rate schedule. See more details at https://pytorch.org/docs/stable/optim.html#how-to-adjust-learning-rate\n",
" \"https://pytorch.org/docs/stable/optim.html#how-to-adjust-learning-rate\", UserWarning)\n",
"Caching labels ../coco128/labels/train2017 (126 found, 0 missing, 2 empty, 0 duplicate, for 128 images): 100% 128/128 [00:00<00:00, 6343.82it/s]\n",
"Caching images (0.0GB): 100% 128/128 [00:00<00:00, 137.36it/s]\n",
"Caching labels ../coco128/labels/train2017 (126 found, 0 missing, 2 empty, 0 duplicate, for 128 images): 100% 128/128 [00:00<00:00, 4530.37it/s]\n",
"Caching images (0.0GB): 100% 128/128 [00:01<00:00, 124.18it/s]\n",
"\n",
"Analyzing anchors... Best Possible Recall (BPR) = 0.9968\n",
"Image sizes 320 train, 320 test\n",
"Using 2 dataloader workers\n",
"Starting training for 3 epochs...\n",
"\n",
" Epoch gpu_mem GIoU obj cls total targets img_size\n",
" 0/2 2.71G 0.2492 0.08469 0.01266 0.3466 469 320: 100% 4/4 [00:06<00:00, 1.56s/it]\n",
" Class Images Targets P R [email protected] [email protected]:.95: 100% 4/4 [00:21<00:00, 5.39s/it]\n",
" all 128 929 0.0866 0.26 0.14 0.0587\n",
"\n",
" Epoch gpu_mem GIoU obj cls total targets img_size\n",
" 1/2 2.67G 0.245 0.07209 0.01212 0.3292 424 320: 100% 4/4 [00:02<00:00, 1.69it/s]\n",
" Class Images Targets P R [email protected] [email protected]:.95: 0% 0/4 [00:00<?, ?it/s]tcmalloc: large alloc 1076248576 bytes == 0x6d04e000 @ 0x7fd07507bb6b 0x7fd07509b379 0x7fd029dce04e 0x7fd029dcff4a 0x7fd062ec0f3b 0x7fd062b0ff7e 0x7fd062d79075 0x7fd062d6b081 0x7fd062d6a5ce 0x7fd062d6b081 0x7fd0647c173a 0x7fd062d6b081 0x7fd062b0ad17 0x7fd062b0b940 0x7fd062e29fda 0x7fd0648a8ebe 0x7fd062d6b532 0x7fd010be3a51 0x7fd010be2dca 0x7fd010be22f1 0x7fd010be19b7 0x7fd010be0f74 0x7fd010bdf3a3 0x7fd010b47a1e 0x7fd010b58607 0x7fd064b4df34 0x7fd07142a49f 0x7fd0713f9a94 0x7fd0710f1213 0x50a635 0x50bfb4\n",
"tcmalloc: large alloc 1448099840 bytes == 0x6d04e000 @ 0x7fd07507bb6b 0x7fd07509b379 0x7fd029dce04e 0x7fd029dcff4a 0x7fd062ec0f3b 0x7fd062b0ff7e 0x7fd062d79075 0x7fd062d6b081 0x7fd062d6a5ce 0x7fd062d6b081 0x7fd0647c173a 0x7fd062d6b081 0x7fd062b0ad17 0x7fd062b0b940 0x7fd062e29fda 0x7fd0648a8ebe 0x7fd062d6b532 0x7fd010be3a51 0x7fd010be2dca 0x7fd010be22f1 0x7fd010be19b7 0x7fd010be0f74 0x7fd010bdf3a3 0x7fd010b47a1e 0x7fd010b58607 0x7fd064b4df34 0x7fd07142a49f 0x7fd0713f9a94 0x7fd0710f1213 0x50a635 0x50bfb4\n",
"tcmalloc: large alloc 1466916864 bytes == 0x6d04e000 @ 0x7fd07507bb6b 0x7fd07509b379 0x7fd029dce04e 0x7fd029dcff4a 0x7fd062ec0f3b 0x7fd062b0ff7e 0x7fd062d79075 0x7fd062d6b081 0x7fd062d6a5ce 0x7fd062d6b081 0x7fd0647c173a 0x7fd062d6b081 0x7fd062b0ad17 0x7fd062b0b940 0x7fd062e29fda 0x7fd0648a8ebe 0x7fd062d6b532 0x7fd010be3a51 0x7fd010be2dca 0x7fd010be22f1 0x7fd010be19b7 0x7fd010be0f74 0x7fd010bdf3a3 0x7fd010b47a1e 0x7fd010b58607 0x7fd064b4df34 0x7fd07142a49f 0x7fd0713f9a94 0x7fd0710f1213 0x50a635 0x50bfb4\n",
" Class Images Targets P R [email protected] [email protected]:.95: 25% 1/4 [00:12<00:37, 12.65s/it]tcmalloc: large alloc 1618354176 bytes == 0x6d04e000 @ 0x7fd07507bb6b 0x7fd07509b379 0x7fd029dce04e 0x7fd029dcff4a 0x7fd062ec0f3b 0x7fd062b0ff7e 0x7fd062d79075 0x7fd062d6b081 0x7fd062d6a5ce 0x7fd062d6b081 0x7fd0647c173a 0x7fd062d6b081 0x7fd062b0ad17 0x7fd062b0b940 0x7fd062e29fda 0x7fd0648a8ebe 0x7fd062d6b532 0x7fd010be3a51 0x7fd010be2dca 0x7fd010be22f1 0x7fd010be19b7 0x7fd010be0f74 0x7fd010bdf3a3 0x7fd010b47a1e 0x7fd010b58607 0x7fd064b4df34 0x7fd07142a49f 0x7fd0713f9a94 0x7fd0710f1213 0x50a635 0x50bfb4\n",
"tcmalloc: large alloc 1809465344 bytes == 0x6d04e000 @ 0x7fd07507bb6b 0x7fd07509b379 0x7fd029dce04e 0x7fd029dcff4a 0x7fd062ec0f3b 0x7fd062b0ff7e 0x7fd062d79075 0x7fd062d6b081 0x7fd062d6a5ce 0x7fd062d6b081 0x7fd0647c173a 0x7fd062d6b081 0x7fd062b0ad17 0x7fd062b0b940 0x7fd062e29fda 0x7fd0648a8ebe 0x7fd062d6b532 0x7fd010be3a51 0x7fd010be2dca 0x7fd010be22f1 0x7fd010be19b7 0x7fd010be0f74 0x7fd010bdf3a3 0x7fd010b47a1e 0x7fd010b58607 0x7fd064b4df34 0x7fd07142a49f 0x7fd0713f9a94 0x7fd0710f1213 0x50a635 0x50bfb4\n",
" Class Images Targets P R [email protected] [email protected]:.95: 50% 2/4 [00:23<00:23, 11.97s/it]tcmalloc: large alloc 2126405632 bytes == 0x6d04e000 @ 0x7fd07507bb6b 0x7fd07509b379 0x7fd029dce04e 0x7fd029dcff4a 0x7fd062ec0f3b 0x7fd062b0ff7e 0x7fd062d79075 0x7fd062d6b081 0x7fd062d6a5ce 0x7fd062d6b081 0x7fd0647c173a 0x7fd062d6b081 0x7fd062b0ad17 0x7fd062b0b940 0x7fd062e29fda 0x7fd0648a8ebe 0x7fd062d6b532 0x7fd010be3a51 0x7fd010be2dca 0x7fd010be22f1 0x7fd010be19b7 0x7fd010be0f74 0x7fd010bdf3a3 0x7fd010b47a1e 0x7fd010b58607 0x7fd064b4df34 0x7fd07142a49f 0x7fd0713f9a94 0x7fd0710f1213 0x50a635 0x50bfb4\n",
"tcmalloc: large alloc 2575089664 bytes == 0x6d04e000 @ 0x7fd07507bb6b 0x7fd07509b379 0x7fd029dce04e 0x7fd029dcff4a 0x7fd062ec0f3b 0x7fd062b0ff7e 0x7fd062d79075 0x7fd062d6b081 0x7fd062d6a5ce 0x7fd062d6b081 0x7fd0647c173a 0x7fd062d6b081 0x7fd062b0ad17 0x7fd062b0b940 0x7fd062e29fda 0x7fd0648a8ebe 0x7fd062d6b532 0x7fd010be3a51 0x7fd010be2dca 0x7fd010be22f1 0x7fd010be19b7 0x7fd010be0f74 0x7fd010bdf3a3 0x7fd010b47a1e 0x7fd010b58607 0x7fd064b4df34 0x7fd07142a49f 0x7fd0713f9a94 0x7fd0710f1213 0x50a635 0x50bfb4\n",
" Class Images Targets P R [email protected] [email protected]:.95: 75% 3/4 [00:33<00:11, 11.55s/it]tcmalloc: large alloc 2550161408 bytes == 0x6d04e000 @ 0x7fd07507bb6b 0x7fd07509b379 0x7fd029dce04e 0x7fd029dcff4a 0x7fd062ec0f3b 0x7fd062b0ff7e 0x7fd062d79075 0x7fd062d6b081 0x7fd062d6a5ce 0x7fd062d6b081 0x7fd0647c173a 0x7fd062d6b081 0x7fd062b0ad17 0x7fd062b0b940 0x7fd062e29fda 0x7fd0648a8ebe 0x7fd062d6b532 0x7fd010be3a51 0x7fd010be2dca 0x7fd010be22f1 0x7fd010be19b7 0x7fd010be0f74 0x7fd010bdf3a3 0x7fd010b47a1e 0x7fd010b58607 0x7fd064b4df34 0x7fd07142a49f 0x7fd0713f9a94 0x7fd0710f1213 0x50a635 0x50bfb4\n",
" Class Images Targets P R [email protected] [email protected]:.95: 100% 4/4 [00:44<00:00, 11.08s/it]\n",
" all 128 929 0.00153 0.0283 0.00768 0.002\n",
"\n",
" Epoch gpu_mem GIoU obj cls total targets img_size\n",
" 2/2 9.18G 0.2386 0.06668 0.0113 0.3166 358 320: 100% 4/4 [00:02<00:00, 1.65it/s]\n",
" Class Images Targets P R [email protected] [email protected]:.95: 50% 2/4 [00:21<00:22, 11.30s/it]tcmalloc: large alloc 2955386880 bytes == 0x6d04e000 @ 0x7fd07507bb6b 0x7fd07509b379 0x7fd029dce04e 0x7fd029dcff4a 0x7fd062ec0f3b 0x7fd062b0ff7e 0x7fd062d79075 0x7fd062d6b081 0x7fd062d6a5ce 0x7fd062d6b081 0x7fd0647c173a 0x7fd062d6b081 0x7fd062b0ad17 0x7fd062b0b940 0x7fd062e29fda 0x7fd0648a8ebe 0x7fd062d6b532 0x7fd010be3a51 0x7fd010be2dca 0x7fd010be22f1 0x7fd010be19b7 0x7fd010be0f74 0x7fd010bdf3a3 0x7fd010b47a1e 0x7fd010b58607 0x7fd064b4df34 0x7fd07142a49f 0x7fd0713f9a94 0x7fd0710f1213 0x50a635 0x50bfb4\n",
" Class Images Targets P R [email protected] [email protected]:.95: 75% 3/4 [00:32<00:11, 11.11s/it]tcmalloc: large alloc 3214819328 bytes == 0x6d04e000 @ 0x7fd07507bb6b 0x7fd07509b379 0x7fd029dce04e 0x7fd029dcff4a 0x7fd062ec0f3b 0x7fd062b0ff7e 0x7fd062d79075 0x7fd062d6b081 0x7fd062d6a5ce 0x7fd062d6b081 0x7fd0647c173a 0x7fd062d6b081 0x7fd062b0ad17 0x7fd062b0b940 0x7fd062e29fda 0x7fd0648a8ebe 0x7fd062d6b532 0x7fd010be3a51 0x7fd010be2dca 0x7fd010be22f1 0x7fd010be19b7 0x7fd010be0f74 0x7fd010bdf3a3 0x7fd010b47a1e 0x7fd010b58607 0x7fd064b4df34 0x7fd07142a49f 0x7fd0713f9a94 0x7fd0710f1213 0x50a635 0x50bfb4\n",
" Class Images Targets P R [email protected] [email protected]:.95: 100% 4/4 [00:43<00:00, 10.78s/it]\n",
" all 128 929 0.00137 0.0103 0.00455 0.00129\n",
"Optimizer stripped from runs/Jul07_16-03-25_7d20d25984catutorial/weights/last_tutorial.pt\n",
"Optimizer stripped from runs/Jul07_16-03-25_7d20d25984catutorial/weights/best_tutorial.pt\n",
"3 epochs completed in 0.034 hours.\n",
"\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "ai02PVU6BsOT",
"colab_type": "text"
},
"source": [
"**Resume from last run**"
]
},
{
"cell_type": "code",
"metadata": {
"id": "tPBo4h3xCIJq",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 1000
},
"outputId": "a5f66250-e624-49d3-c1ae-eaa1168951f8"
},
"source": [
"!python train.py --img 320 --batch 32 --epochs 5 --data ./data/coco128.yaml --cfg ./models/yolov5s.yaml --name tutorial --cache --resume"
],
"execution_count": 18,
"outputs": [
{
"output_type": "stream",
"text": [
"Apex recommended for faster mixed precision training: https://github.com/NVIDIA/apex\n",
"Resuming training from ./runs/Jul07_16-15-02_7d20d25984catutorial/weights/last.pt\n",
"Namespace(batch_size=32, bucket='', cache_images=True, cfg='./models/yolov5s.yaml', data='./data/coco128.yaml', device='', epochs=5, evolve=False, hyp='', img_size=[320], multi_scale=False, name='tutorial', noautoanchor=False, nosave=False, notest=False, rect=False, resume='get_last', single_cls=False, weights='./runs/Jul07_16-15-02_7d20d25984catutorial/weights/last.pt')\n",
"Using CUDA device0 _CudaDeviceProperties(name='Tesla K80', total_memory=11441MB)\n",
"\n",
"2020-07-07 16:16:11.652288: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1\n",
"Beginning training with {'optimizer': 'SGD', 'lr0': 0.01, 'momentum': 0.937, 'weight_decay': 0.0005, 'giou': 0.05, 'cls': 0.58, '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.014, 'hsv_s': 0.68, 'hsv_v': 0.36, 'degrees': 0.0, 'translate': 0.0, 'scale': 0.5, 'shear': 0.0}\n",
"\n",
"\n",
"Start Tensorboard with \"tensorboard --logdir=runs\", view at http://localhost:6006/\n",
"\n",
" from n params module arguments \n",
" 0 -1 1 3520 models.common.Focus [3, 32, 3] \n",
" 1 -1 1 18560 models.common.Conv [32, 64, 3, 2] \n",
" 2 -1 1 19904 models.common.BottleneckCSP [64, 64, 1] \n",
" 3 -1 1 73984 models.common.Conv [64, 128, 3, 2] \n",
" 4 -1 1 161152 models.common.BottleneckCSP [128, 128, 3] \n",
" 5 -1 1 295424 models.common.Conv [128, 256, 3, 2] \n",
" 6 -1 1 641792 models.common.BottleneckCSP [256, 256, 3] \n",
" 7 -1 1 1180672 models.common.Conv [256, 512, 3, 2] \n",
" 8 -1 1 656896 models.common.SPP [512, 512, [5, 9, 13]] \n",
" 9 -1 1 1248768 models.common.BottleneckCSP [512, 512, 1, False] \n",
" 10 -1 1 131584 models.common.Conv [512, 256, 1, 1] \n",
" 11 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest'] \n",
" 12 [-1, 6] 1 0 models.common.Concat [1] \n",
" 13 -1 1 378624 models.common.BottleneckCSP [512, 256, 1, False] \n",
" 14 -1 1 33024 models.common.Conv [256, 128, 1, 1] \n",
" 15 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest'] \n",
" 16 [-1, 4] 1 0 models.common.Concat [1] \n",
" 17 -1 1 95104 models.common.BottleneckCSP [256, 128, 1, False] \n",
" 18 -1 1 32895 torch.nn.modules.conv.Conv2d [128, 255, 1, 1] \n",
" 19 -2 1 147712 models.common.Conv [128, 128, 3, 2] \n",
" 20 [-1, 14] 1 0 models.common.Concat [1] \n",
" 21 -1 1 313088 models.common.BottleneckCSP [256, 256, 1, False] \n",
" 22 -1 1 65535 torch.nn.modules.conv.Conv2d [256, 255, 1, 1] \n",
" 23 -2 1 590336 models.common.Conv [256, 256, 3, 2] \n",
" 24 [-1, 10] 1 0 models.common.Concat [1] \n",
" 25 -1 1 1248768 models.common.BottleneckCSP [512, 512, 1, False] \n",
" 26 -1 1 130815 torch.nn.modules.conv.Conv2d [512, 255, 1, 1] \n",
" 27 [-1, 22, 18] 1 0 models.yolo.Detect [80, [[116, 90, 156, 198, 373, 326], [30, 61, 62, 45, 59, 119], [10, 13, 16, 30, 33, 23]]]\n",
"Model Summary: 191 layers, 7.46816e+06 parameters, 7.46816e+06 gradients\n",
"\n",
"Optimizer groups: 62 .bias, 70 conv.weight, 59 other\n",
"/usr/local/lib/python3.6/dist-packages/torch/optim/lr_scheduler.py:123: UserWarning: Detected call of `lr_scheduler.step()` before `optimizer.step()`. In PyTorch 1.1.0 and later, you should call them in the opposite order: `optimizer.step()` before `lr_scheduler.step()`. Failure to do this will result in PyTorch skipping the first value of the learning rate schedule. See more details at https://pytorch.org/docs/stable/optim.html#how-to-adjust-learning-rate\n",
" \"https://pytorch.org/docs/stable/optim.html#how-to-adjust-learning-rate\", UserWarning)\n",
"Caching labels ../coco128/labels/train2017 (126 found, 0 missing, 2 empty, 0 duplicate, for 128 images): 100% 128/128 [00:00<00:00, 6135.81it/s]\n",
"Caching images (0.0GB): 100% 128/128 [00:00<00:00, 137.74it/s]\n",
"Caching labels ../coco128/labels/train2017 (126 found, 0 missing, 2 empty, 0 duplicate, for 128 images): 100% 128/128 [00:00<00:00, 5008.22it/s]\n",
"Caching images (0.0GB): 100% 128/128 [00:01<00:00, 127.06it/s]\n",
"\n",
"Analyzing anchors... Best Possible Recall (BPR) = 0.9828. Attempting to generate improved anchors, please wait...\n",
"WARNING: Extremely small objects found. 35 of 929 labels are < 3 pixels in width or height.\n",
"Running kmeans for 9 anchors on 927 points...\n",
"thr=0.25: 0.9720 best possible recall, 3.73 anchors past thr\n",
"n=9, img_size=320, metric_all=0.260/0.653-mean/best, past_thr=0.471-mean: 9,12, 32,20, 27,49, 74,43, 54,92, 77,164, 160,109, 182,240, 302,188\n",
"Evolving anchors with Genetic Algorithm: fitness = 0.6628: 100% 1000/1000 [00:00<00:00, 1204.58it/s]\n",
"thr=0.25: 0.9860 best possible recall, 3.83 anchors past thr\n",
"n=9, img_size=320, metric_all=0.265/0.664-mean/best, past_thr=0.471-mean: 8,10, 22,12, 19,34, 46,35, 54,74, 57,139, 144,110, 175,217, 317,206\n",
"Original anchors better than new anchors. Proceeding with original anchors.\n",
"\n",
"Image sizes 320 train, 320 test\n",
"Using 2 dataloader workers\n",
"Starting training for 5 epochs...\n",
"\n",
" Epoch gpu_mem GIoU obj cls total targets img_size\n",
" 3/4 2.69G 0.1136 0.07635 0.03795 0.2279 438 320: 100% 4/4 [00:05<00:00, 1.28s/it]\n",
" Class Images Targets P R [email protected] [email protected]:.95: 100% 4/4 [00:08<00:00, 2.09s/it]\n",
" all 128 929 0.13 0.644 0.463 0.247\n",
"\n",
" Epoch gpu_mem GIoU obj cls total targets img_size\n",
" 4/4 2.65G 0.1098 0.07842 0.03901 0.2273 406 320: 100% 4/4 [00:02<00:00, 1.73it/s]\n",
" Class Images Targets P R [email protected] [email protected]:.95: 100% 4/4 [00:04<00:00, 1.01s/it]\n",
" all 128 929 0.132 0.634 0.479 0.247\n",
"Optimizer stripped from runs/Jul07_16-16-11_7d20d25984catutorial/weights/last_tutorial.pt\n",
"Optimizer stripped from runs/Jul07_16-16-11_7d20d25984catutorial/weights/best_tutorial.pt\n",
"2 epochs completed in 0.006 hours.\n",
"\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "whhMiil2EkQS",
"colab_type": "text"
},
"source": [
"**Resume from Specific Run**"
]
},
{
"cell_type": "code",
"metadata": {
"id": "RXYjwze6ECPf",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 1000
},
"outputId": "7b0d4d72-96e7-4f79-c23c-a18211c30654"
},
"source": [
"!python train.py --img 320 --batch 32 --epochs 5 --data ./data/coco128.yaml --cfg ./models/yolov5s.yaml --name tutorial --cache --resume ./runs/Jul07_16-15-02_7d20d25984catutorial/weights/last.pt"
],
"execution_count": 20,
"outputs": [
{
"output_type": "stream",
"text": [
"Apex recommended for faster mixed precision training: https://github.com/NVIDIA/apex\n",
"Resuming training from ./runs/Jul07_16-15-02_7d20d25984catutorial/weights/last.pt\n",
"Namespace(batch_size=32, bucket='', cache_images=True, cfg='./models/yolov5s.yaml', data='./data/coco128.yaml', device='', epochs=5, evolve=False, hyp='', img_size=[320], multi_scale=False, name='tutorial', noautoanchor=False, nosave=False, notest=False, rect=False, resume='./runs/Jul07_16-15-02_7d20d25984catutorial/weights/last.pt', single_cls=False, weights='./runs/Jul07_16-15-02_7d20d25984catutorial/weights/last.pt')\n",
"Using CUDA device0 _CudaDeviceProperties(name='Tesla K80', total_memory=11441MB)\n",
"\n",
"2020-07-07 16:18:01.613770: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1\n",
"Beginning training with {'optimizer': 'SGD', 'lr0': 0.01, 'momentum': 0.937, 'weight_decay': 0.0005, 'giou': 0.05, 'cls': 0.58, '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.014, 'hsv_s': 0.68, 'hsv_v': 0.36, 'degrees': 0.0, 'translate': 0.0, 'scale': 0.5, 'shear': 0.0}\n",
"\n",
"\n",
"Start Tensorboard with \"tensorboard --logdir=runs\", view at http://localhost:6006/\n",
"\n",
" from n params module arguments \n",
" 0 -1 1 3520 models.common.Focus [3, 32, 3] \n",
" 1 -1 1 18560 models.common.Conv [32, 64, 3, 2] \n",
" 2 -1 1 19904 models.common.BottleneckCSP [64, 64, 1] \n",
" 3 -1 1 73984 models.common.Conv [64, 128, 3, 2] \n",
" 4 -1 1 161152 models.common.BottleneckCSP [128, 128, 3] \n",
" 5 -1 1 295424 models.common.Conv [128, 256, 3, 2] \n",
" 6 -1 1 641792 models.common.BottleneckCSP [256, 256, 3] \n",
" 7 -1 1 1180672 models.common.Conv [256, 512, 3, 2] \n",
" 8 -1 1 656896 models.common.SPP [512, 512, [5, 9, 13]] \n",
" 9 -1 1 1248768 models.common.BottleneckCSP [512, 512, 1, False] \n",
" 10 -1 1 131584 models.common.Conv [512, 256, 1, 1] \n",
" 11 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest'] \n",
" 12 [-1, 6] 1 0 models.common.Concat [1] \n",
" 13 -1 1 378624 models.common.BottleneckCSP [512, 256, 1, False] \n",
" 14 -1 1 33024 models.common.Conv [256, 128, 1, 1] \n",
" 15 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest'] \n",
" 16 [-1, 4] 1 0 models.common.Concat [1] \n",
" 17 -1 1 95104 models.common.BottleneckCSP [256, 128, 1, False] \n",
" 18 -1 1 32895 torch.nn.modules.conv.Conv2d [128, 255, 1, 1] \n",
" 19 -2 1 147712 models.common.Conv [128, 128, 3, 2] \n",
" 20 [-1, 14] 1 0 models.common.Concat [1] \n",
" 21 -1 1 313088 models.common.BottleneckCSP [256, 256, 1, False] \n",
" 22 -1 1 65535 torch.nn.modules.conv.Conv2d [256, 255, 1, 1] \n",
" 23 -2 1 590336 models.common.Conv [256, 256, 3, 2] \n",
" 24 [-1, 10] 1 0 models.common.Concat [1] \n",
" 25 -1 1 1248768 models.common.BottleneckCSP [512, 512, 1, False] \n",
" 26 -1 1 130815 torch.nn.modules.conv.Conv2d [512, 255, 1, 1] \n",
" 27 [-1, 22, 18] 1 0 models.yolo.Detect [80, [[116, 90, 156, 198, 373, 326], [30, 61, 62, 45, 59, 119], [10, 13, 16, 30, 33, 23]]]\n",
"Model Summary: 191 layers, 7.46816e+06 parameters, 7.46816e+06 gradients\n",
"\n",
"Optimizer groups: 62 .bias, 70 conv.weight, 59 other\n",
"/usr/local/lib/python3.6/dist-packages/torch/optim/lr_scheduler.py:123: UserWarning: Detected call of `lr_scheduler.step()` before `optimizer.step()`. In PyTorch 1.1.0 and later, you should call them in the opposite order: `optimizer.step()` before `lr_scheduler.step()`. Failure to do this will result in PyTorch skipping the first value of the learning rate schedule. See more details at https://pytorch.org/docs/stable/optim.html#how-to-adjust-learning-rate\n",
" \"https://pytorch.org/docs/stable/optim.html#how-to-adjust-learning-rate\", UserWarning)\n",
"Caching labels ../coco128/labels/train2017 (126 found, 0 missing, 2 empty, 0 duplicate, for 128 images): 100% 128/128 [00:00<00:00, 6058.81it/s]\n",
"Caching images (0.0GB): 100% 128/128 [00:00<00:00, 137.69it/s]\n",
"Caching labels ../coco128/labels/train2017 (126 found, 0 missing, 2 empty, 0 duplicate, for 128 images): 100% 128/128 [00:00<00:00, 6385.39it/s]\n",
"Caching images (0.0GB): 100% 128/128 [00:01<00:00, 125.02it/s]\n",
"\n",
"Analyzing anchors... Best Possible Recall (BPR) = 0.9828. Attempting to generate improved anchors, please wait...\n",
"WARNING: Extremely small objects found. 35 of 929 labels are < 3 pixels in width or height.\n",
"Running kmeans for 9 anchors on 927 points...\n",
"thr=0.25: 0.9720 best possible recall, 3.73 anchors past thr\n",
"n=9, img_size=320, metric_all=0.260/0.653-mean/best, past_thr=0.471-mean: 9,12, 32,20, 27,49, 74,43, 54,92, 77,164, 160,109, 182,240, 302,188\n",
"Evolving anchors with Genetic Algorithm: fitness = 0.6628: 100% 1000/1000 [00:00<00:00, 1213.98it/s]\n",
"thr=0.25: 0.9860 best possible recall, 3.83 anchors past thr\n",
"n=9, img_size=320, metric_all=0.265/0.664-mean/best, past_thr=0.471-mean: 8,10, 22,12, 19,34, 46,35, 54,74, 57,139, 144,110, 175,217, 317,206\n",
"Original anchors better than new anchors. Proceeding with original anchors.\n",
"\n",
"Image sizes 320 train, 320 test\n",
"Using 2 dataloader workers\n",
"Starting training for 5 epochs...\n",
"\n",
" Epoch gpu_mem GIoU obj cls total targets img_size\n",
" 3/4 2.69G 0.1136 0.07635 0.03795 0.2279 438 320: 100% 4/4 [00:05<00:00, 1.26s/it]\n",
" Class Images Targets P R [email protected] [email protected]:.95: 100% 4/4 [00:08<00:00, 2.13s/it]\n",
" all 128 929 0.13 0.644 0.463 0.246\n",
"\n",
" Epoch gpu_mem GIoU obj cls total targets img_size\n",
" 4/4 2.65G 0.1098 0.07842 0.03901 0.2273 406 320: 100% 4/4 [00:02<00:00, 1.80it/s]\n",
" Class Images Targets P R [email protected] [email protected]:.95: 100% 4/4 [00:04<00:00, 1.02s/it]\n",
" all 128 929 0.132 0.634 0.478 0.247\n",
"Optimizer stripped from runs/Jul07_16-18-01_7d20d25984catutorial/weights/last_tutorial.pt\n",
"Optimizer stripped from runs/Jul07_16-18-01_7d20d25984catutorial/weights/best_tutorial.pt\n",
"2 epochs completed in 0.006 hours.\n",
"\n"
],
"name": "stdout"
}
]
}
]
} |