Files
yolov5_ZWgra/advanced_logging_test.ipynb
T

40 KiB

Open In Colab

Test Advanced Logging Branch Features

In [1]:
!git clone -b advanced_logging https://github.com/alexstoken/yolov5.git
Cloning into 'yolov5'...
remote: Enumerating objects: 53, done.
remote: Counting objects: 100% (53/53), done.
remote: Compressing objects: 100% (39/39), done.
remote: Total 1223 (delta 28), reused 35 (delta 14), pack-reused 1170
Receiving objects: 100% (1223/1223), 3.50 MiB | 3.20 MiB/s, done.
Resolving deltas: 100% (811/811), done.
In [2]:
!pip install -r yolov5/requirements.txt  # install dependencies
%cd yolov5

import torch
from IPython.display import Image, clear_output  # to display images
from utils.google_utils import gdrive_download  # to download models/datasets

clear_output()
print('Setup complete. Using torch %s %s' % (torch.__version__, torch.cuda.get_device_properties(0) if torch.cuda.is_available() else 'CPU'))
Setup complete. Using torch 1.5.1+cu101 _CudaDeviceProperties(name='Tesla K80', major=3, minor=7, total_memory=11441MB, multi_processor_count=13)

Train

In [3]:
# Download tutorial dataset coco128.yaml
gdrive_download('1n_oKgR81BJtqk75b00eAjdv03qVCQn2f','coco128.zip')  # tutorial dataset
!mv ./coco128 ../  # move folder alongside /yolov5
Downloading https://drive.google.com/uc?export=download&id=1n_oKgR81BJtqk75b00eAjdv03qVCQn2f as coco128.zip... unzipping... Done (5.1s)

Verify Help Arg Works

In [4]:
!python train.py --help
Apex recommended for faster mixed precision training: https://github.com/NVIDIA/apex
usage: train.py [-h] [--cfg CFG] [--data DATA] [--hyp HYP] [--epochs EPOCHS]
                [--batch-size BATCH_SIZE] [--img-size IMG_SIZE [IMG_SIZE ...]]
                [--rect] [--resume [RESUME]] [--nosave] [--notest]
                [--noautoanchor] [--evolve] [--bucket BUCKET] [--cache-images]
                [--weights WEIGHTS] [--name NAME] [--device DEVICE]
                [--multi-scale] [--single-cls]

optional arguments:
  -h, --help            show this help message and exit
  --cfg CFG             model cfg path[*.yaml]
  --data DATA           data cfg path [*.yaml]
  --hyp HYP             hyp cfg path [*.yaml].
  --epochs EPOCHS
  --batch-size BATCH_SIZE
  --img-size IMG_SIZE [IMG_SIZE ...]
                        train,test sizes. Assumes square imgs.
  --rect                rectangular training
  --resume [RESUME]     resume training from given path/to/last.pt, or most
                        recent run if blank.
  --nosave              only save final checkpoint
  --notest              only test final epoch
  --noautoanchor        disable autoanchor check
  --evolve              evolve hyperparameters
  --bucket BUCKET       gsutil bucket
  --cache-images        cache images for faster training
  --weights WEIGHTS     initial weights path
  --name NAME           renames results.txt to results_name.txt if supplied
  --device DEVICE       cuda device, i.e. 0 or 0,1,2,3 or cpu
  --multi-scale         vary img-size +/- 50%
  --single-cls          train as single-class dataset

Run with hyperparameters from yaml file

In [9]:
!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
Apex recommended for faster mixed precision training: https://github.com/NVIDIA/apex
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')
Using CUDA device0 _CudaDeviceProperties(name='Tesla K80', total_memory=11441MB)

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
Using FocalLoss(gamma=1)
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}


Start Tensorboard with "tensorboard --logdir=runs", view at http://localhost:6006/

                 from  n    params  module                                  arguments                     
  0                -1  1      3520  models.common.Focus                     [3, 32, 3]                    
  1                -1  1     18560  models.common.Conv                      [32, 64, 3, 2]                
  2                -1  1     19904  models.common.BottleneckCSP             [64, 64, 1]                   
  3                -1  1     73984  models.common.Conv                      [64, 128, 3, 2]               
  4                -1  1    161152  models.common.BottleneckCSP             [128, 128, 3]                 
  5                -1  1    295424  models.common.Conv                      [128, 256, 3, 2]              
  6                -1  1    641792  models.common.BottleneckCSP             [256, 256, 3]                 
  7                -1  1   1180672  models.common.Conv                      [256, 512, 3, 2]              
  8                -1  1    656896  models.common.SPP                       [512, 512, [5, 9, 13]]        
  9                -1  1   1248768  models.common.BottleneckCSP             [512, 512, 1, False]          
 10                -1  1    131584  models.common.Conv                      [512, 256, 1, 1]              
 11                -1  1         0  torch.nn.modules.upsampling.Upsample    [None, 2, 'nearest']          
 12           [-1, 6]  1         0  models.common.Concat                    [1]                           
 13                -1  1    378624  models.common.BottleneckCSP             [512, 256, 1, False]          
 14                -1  1     33024  models.common.Conv                      [256, 128, 1, 1]              
 15                -1  1         0  torch.nn.modules.upsampling.Upsample    [None, 2, 'nearest']          
 16           [-1, 4]  1         0  models.common.Concat                    [1]                           
 17                -1  1     95104  models.common.BottleneckCSP             [256, 128, 1, False]          
 18                -1  1     32895  torch.nn.modules.conv.Conv2d            [128, 255, 1, 1]              
 19                -2  1    147712  models.common.Conv                      [128, 128, 3, 2]              
 20          [-1, 14]  1         0  models.common.Concat                    [1]                           
 21                -1  1    313088  models.common.BottleneckCSP             [256, 256, 1, False]          
 22                -1  1     65535  torch.nn.modules.conv.Conv2d            [256, 255, 1, 1]              
 23                -2  1    590336  models.common.Conv                      [256, 256, 3, 2]              
 24          [-1, 10]  1         0  models.common.Concat                    [1]                           
 25                -1  1   1248768  models.common.BottleneckCSP             [512, 512, 1, False]          
 26                -1  1    130815  torch.nn.modules.conv.Conv2d            [512, 255, 1, 1]              
 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]]]
Model Summary: 191 layers, 7.46816e+06 parameters, 7.46816e+06 gradients

Optimizer groups: 62 .bias, 70 conv.weight, 59 other
/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
  "https://pytorch.org/docs/stable/optim.html#how-to-adjust-learning-rate", UserWarning)
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]
Caching images (0.0GB): 100% 128/128 [00:00<00:00, 137.36it/s]
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]
Caching images (0.0GB): 100% 128/128 [00:01<00:00, 124.18it/s]

Analyzing anchors... Best Possible Recall (BPR) = 0.9968
Image sizes 320 train, 320 test
Using 2 dataloader workers
Starting training for 3 epochs...

     Epoch   gpu_mem      GIoU       obj       cls     total   targets  img_size
       0/2     2.71G    0.2492   0.08469   0.01266    0.3466       469       320: 100% 4/4 [00:06<00:00,  1.56s/it]
               Class      Images     Targets           P           R      mAP@.5  mAP@.5:.95: 100% 4/4 [00:21<00:00,  5.39s/it]
                 all         128         929      0.0866        0.26        0.14      0.0587

     Epoch   gpu_mem      GIoU       obj       cls     total   targets  img_size
       1/2     2.67G     0.245   0.07209   0.01212    0.3292       424       320: 100% 4/4 [00:02<00:00,  1.69it/s]
               Class      Images     Targets           P           R      mAP@.5  mAP@.5:.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
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
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
               Class      Images     Targets           P           R      mAP@.5  mAP@.5:.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
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
               Class      Images     Targets           P           R      mAP@.5  mAP@.5:.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
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
               Class      Images     Targets           P           R      mAP@.5  mAP@.5:.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
               Class      Images     Targets           P           R      mAP@.5  mAP@.5:.95: 100% 4/4 [00:44<00:00, 11.08s/it]
                 all         128         929     0.00153      0.0283     0.00768       0.002

     Epoch   gpu_mem      GIoU       obj       cls     total   targets  img_size
       2/2     9.18G    0.2386   0.06668    0.0113    0.3166       358       320: 100% 4/4 [00:02<00:00,  1.65it/s]
               Class      Images     Targets           P           R      mAP@.5  mAP@.5:.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
               Class      Images     Targets           P           R      mAP@.5  mAP@.5:.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
               Class      Images     Targets           P           R      mAP@.5  mAP@.5:.95: 100% 4/4 [00:43<00:00, 10.78s/it]
                 all         128         929     0.00137      0.0103     0.00455     0.00129
Optimizer stripped from runs/Jul07_16-03-25_7d20d25984catutorial/weights/last_tutorial.pt
Optimizer stripped from runs/Jul07_16-03-25_7d20d25984catutorial/weights/best_tutorial.pt
3 epochs completed in 0.034 hours.

Resume from last run

In [18]:
!python train.py --img 320 --batch 32 --epochs 5 --data ./data/coco128.yaml --cfg ./models/yolov5s.yaml --name tutorial --cache --resume
Apex recommended for faster mixed precision training: https://github.com/NVIDIA/apex
Resuming training from ./runs/Jul07_16-15-02_7d20d25984catutorial/weights/last.pt
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')
Using CUDA device0 _CudaDeviceProperties(name='Tesla K80', total_memory=11441MB)

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
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}


Start Tensorboard with "tensorboard --logdir=runs", view at http://localhost:6006/

                 from  n    params  module                                  arguments                     
  0                -1  1      3520  models.common.Focus                     [3, 32, 3]                    
  1                -1  1     18560  models.common.Conv                      [32, 64, 3, 2]                
  2                -1  1     19904  models.common.BottleneckCSP             [64, 64, 1]                   
  3                -1  1     73984  models.common.Conv                      [64, 128, 3, 2]               
  4                -1  1    161152  models.common.BottleneckCSP             [128, 128, 3]                 
  5                -1  1    295424  models.common.Conv                      [128, 256, 3, 2]              
  6                -1  1    641792  models.common.BottleneckCSP             [256, 256, 3]                 
  7                -1  1   1180672  models.common.Conv                      [256, 512, 3, 2]              
  8                -1  1    656896  models.common.SPP                       [512, 512, [5, 9, 13]]        
  9                -1  1   1248768  models.common.BottleneckCSP             [512, 512, 1, False]          
 10                -1  1    131584  models.common.Conv                      [512, 256, 1, 1]              
 11                -1  1         0  torch.nn.modules.upsampling.Upsample    [None, 2, 'nearest']          
 12           [-1, 6]  1         0  models.common.Concat                    [1]                           
 13                -1  1    378624  models.common.BottleneckCSP             [512, 256, 1, False]          
 14                -1  1     33024  models.common.Conv                      [256, 128, 1, 1]              
 15                -1  1         0  torch.nn.modules.upsampling.Upsample    [None, 2, 'nearest']          
 16           [-1, 4]  1         0  models.common.Concat                    [1]                           
 17                -1  1     95104  models.common.BottleneckCSP             [256, 128, 1, False]          
 18                -1  1     32895  torch.nn.modules.conv.Conv2d            [128, 255, 1, 1]              
 19                -2  1    147712  models.common.Conv                      [128, 128, 3, 2]              
 20          [-1, 14]  1         0  models.common.Concat                    [1]                           
 21                -1  1    313088  models.common.BottleneckCSP             [256, 256, 1, False]          
 22                -1  1     65535  torch.nn.modules.conv.Conv2d            [256, 255, 1, 1]              
 23                -2  1    590336  models.common.Conv                      [256, 256, 3, 2]              
 24          [-1, 10]  1         0  models.common.Concat                    [1]                           
 25                -1  1   1248768  models.common.BottleneckCSP             [512, 512, 1, False]          
 26                -1  1    130815  torch.nn.modules.conv.Conv2d            [512, 255, 1, 1]              
 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]]]
Model Summary: 191 layers, 7.46816e+06 parameters, 7.46816e+06 gradients

Optimizer groups: 62 .bias, 70 conv.weight, 59 other
/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
  "https://pytorch.org/docs/stable/optim.html#how-to-adjust-learning-rate", UserWarning)
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]
Caching images (0.0GB): 100% 128/128 [00:00<00:00, 137.74it/s]
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]
Caching images (0.0GB): 100% 128/128 [00:01<00:00, 127.06it/s]

Analyzing anchors... Best Possible Recall (BPR) = 0.9828. Attempting to generate improved anchors, please wait...
WARNING: Extremely small objects found. 35 of 929 labels are < 3 pixels in width or height.
Running kmeans for 9 anchors on 927 points...
thr=0.25: 0.9720 best possible recall, 3.73 anchors past thr
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
Evolving anchors with Genetic Algorithm: fitness = 0.6628: 100% 1000/1000 [00:00<00:00, 1204.58it/s]
thr=0.25: 0.9860 best possible recall, 3.83 anchors past thr
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
Original anchors better than new anchors. Proceeding with original anchors.

Image sizes 320 train, 320 test
Using 2 dataloader workers
Starting training for 5 epochs...

     Epoch   gpu_mem      GIoU       obj       cls     total   targets  img_size
       3/4     2.69G    0.1136   0.07635   0.03795    0.2279       438       320: 100% 4/4 [00:05<00:00,  1.28s/it]
               Class      Images     Targets           P           R      mAP@.5  mAP@.5:.95: 100% 4/4 [00:08<00:00,  2.09s/it]
                 all         128         929        0.13       0.644       0.463       0.247

     Epoch   gpu_mem      GIoU       obj       cls     total   targets  img_size
       4/4     2.65G    0.1098   0.07842   0.03901    0.2273       406       320: 100% 4/4 [00:02<00:00,  1.73it/s]
               Class      Images     Targets           P           R      mAP@.5  mAP@.5:.95: 100% 4/4 [00:04<00:00,  1.01s/it]
                 all         128         929       0.132       0.634       0.479       0.247
Optimizer stripped from runs/Jul07_16-16-11_7d20d25984catutorial/weights/last_tutorial.pt
Optimizer stripped from runs/Jul07_16-16-11_7d20d25984catutorial/weights/best_tutorial.pt
2 epochs completed in 0.006 hours.

Resume from Specific Run

In [20]:
!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
Apex recommended for faster mixed precision training: https://github.com/NVIDIA/apex
Resuming training from ./runs/Jul07_16-15-02_7d20d25984catutorial/weights/last.pt
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')
Using CUDA device0 _CudaDeviceProperties(name='Tesla K80', total_memory=11441MB)

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
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}


Start Tensorboard with "tensorboard --logdir=runs", view at http://localhost:6006/

                 from  n    params  module                                  arguments                     
  0                -1  1      3520  models.common.Focus                     [3, 32, 3]                    
  1                -1  1     18560  models.common.Conv                      [32, 64, 3, 2]                
  2                -1  1     19904  models.common.BottleneckCSP             [64, 64, 1]                   
  3                -1  1     73984  models.common.Conv                      [64, 128, 3, 2]               
  4                -1  1    161152  models.common.BottleneckCSP             [128, 128, 3]                 
  5                -1  1    295424  models.common.Conv                      [128, 256, 3, 2]              
  6                -1  1    641792  models.common.BottleneckCSP             [256, 256, 3]                 
  7                -1  1   1180672  models.common.Conv                      [256, 512, 3, 2]              
  8                -1  1    656896  models.common.SPP                       [512, 512, [5, 9, 13]]        
  9                -1  1   1248768  models.common.BottleneckCSP             [512, 512, 1, False]          
 10                -1  1    131584  models.common.Conv                      [512, 256, 1, 1]              
 11                -1  1         0  torch.nn.modules.upsampling.Upsample    [None, 2, 'nearest']          
 12           [-1, 6]  1         0  models.common.Concat                    [1]                           
 13                -1  1    378624  models.common.BottleneckCSP             [512, 256, 1, False]          
 14                -1  1     33024  models.common.Conv                      [256, 128, 1, 1]              
 15                -1  1         0  torch.nn.modules.upsampling.Upsample    [None, 2, 'nearest']          
 16           [-1, 4]  1         0  models.common.Concat                    [1]                           
 17                -1  1     95104  models.common.BottleneckCSP             [256, 128, 1, False]          
 18                -1  1     32895  torch.nn.modules.conv.Conv2d            [128, 255, 1, 1]              
 19                -2  1    147712  models.common.Conv                      [128, 128, 3, 2]              
 20          [-1, 14]  1         0  models.common.Concat                    [1]                           
 21                -1  1    313088  models.common.BottleneckCSP             [256, 256, 1, False]          
 22                -1  1     65535  torch.nn.modules.conv.Conv2d            [256, 255, 1, 1]              
 23                -2  1    590336  models.common.Conv                      [256, 256, 3, 2]              
 24          [-1, 10]  1         0  models.common.Concat                    [1]                           
 25                -1  1   1248768  models.common.BottleneckCSP             [512, 512, 1, False]          
 26                -1  1    130815  torch.nn.modules.conv.Conv2d            [512, 255, 1, 1]              
 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]]]
Model Summary: 191 layers, 7.46816e+06 parameters, 7.46816e+06 gradients

Optimizer groups: 62 .bias, 70 conv.weight, 59 other
/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
  "https://pytorch.org/docs/stable/optim.html#how-to-adjust-learning-rate", UserWarning)
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]
Caching images (0.0GB): 100% 128/128 [00:00<00:00, 137.69it/s]
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]
Caching images (0.0GB): 100% 128/128 [00:01<00:00, 125.02it/s]

Analyzing anchors... Best Possible Recall (BPR) = 0.9828. Attempting to generate improved anchors, please wait...
WARNING: Extremely small objects found. 35 of 929 labels are < 3 pixels in width or height.
Running kmeans for 9 anchors on 927 points...
thr=0.25: 0.9720 best possible recall, 3.73 anchors past thr
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
Evolving anchors with Genetic Algorithm: fitness = 0.6628: 100% 1000/1000 [00:00<00:00, 1213.98it/s]
thr=0.25: 0.9860 best possible recall, 3.83 anchors past thr
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
Original anchors better than new anchors. Proceeding with original anchors.

Image sizes 320 train, 320 test
Using 2 dataloader workers
Starting training for 5 epochs...

     Epoch   gpu_mem      GIoU       obj       cls     total   targets  img_size
       3/4     2.69G    0.1136   0.07635   0.03795    0.2279       438       320: 100% 4/4 [00:05<00:00,  1.26s/it]
               Class      Images     Targets           P           R      mAP@.5  mAP@.5:.95: 100% 4/4 [00:08<00:00,  2.13s/it]
                 all         128         929        0.13       0.644       0.463       0.246

     Epoch   gpu_mem      GIoU       obj       cls     total   targets  img_size
       4/4     2.65G    0.1098   0.07842   0.03901    0.2273       406       320: 100% 4/4 [00:02<00:00,  1.80it/s]
               Class      Images     Targets           P           R      mAP@.5  mAP@.5:.95: 100% 4/4 [00:04<00:00,  1.02s/it]
                 all         128         929       0.132       0.634       0.478       0.247
Optimizer stripped from runs/Jul07_16-18-01_7d20d25984catutorial/weights/last_tutorial.pt
Optimizer stripped from runs/Jul07_16-18-01_7d20d25984catutorial/weights/best_tutorial.pt
2 epochs completed in 0.006 hours.