YOLO/PASCAL-VOC detection tutorial

This tutorial demonstrates that Akida can perform object detection using a state-of-the-art model architecture. This is illustrated using a subset of the PASCAL-VOC 2007 dataset with “car” and “person” classes only. The YOLOv2 architecture from Redmon et al (2016) has been chosen to tackle this object detection problem.

1. Introduction

1.1 Object detection

Object detection is a computer vision task that combines two elemental tasks:

  • object classification that consists in assigning a class label to an image like shown in the DS-CNN CIFAR10 or the MobileNet ImageNet example

  • object localization that consists in drawing a bounding box around one or several objects in an image

One can learn more about the subject reading this introduction to object detection blog article.

1.2 YOLO key concepts

You Only Look Once (YOLO) is a deep neural network architecture dedicated to object detection.

As opposed to classic networks that handle object detection, YOLO predicts bounding boxes (localization task) and class probabilities (classification task) from a single neural network in a single evaluation. The object detection task is reduced to a regression problem to spatially separated boxes and associated class probabilities.

YOLO base concept is to divide an input image into regions, forming a grid, and to predict bounding boxes and probabilities for each region. The bounding boxes are weighted by the prediction probabilities.

YOLO also uses the concept of “anchors boxes” or “prior boxes”. The network does not actually predict the actual bounding boxes but offsets from anchors boxes which are templates (width/height ratio) computed by clustering the dimensions of the ground truth boxes from the training dataset. The anchors then represent the average shape and size of the objects to detect. More details on the anchors boxes concept are given in this blog article.

Additional information about YOLO can be found on the Darknet website and source code for the preprocessing and postprocessing functions that are included in akida_models package (see the processing section in the model zoo) is largely inspired from experiencor github.

2. Preprocessing tools

As this example focuses on car and person detection only, a subset of VOC has been prepared with test images from VOC2007 that contains at least one of the occurence of the two classes. Just like the VOC dataset, the subset contains an image folder, an annotation folder and a text file listing the file names of interest.

The YOLO toolkit offers several methods to prepare data for processing, see load_image, preprocess_image or parse_voc_annotations.

import os

from tensorflow.keras.utils import get_file
from akida_models.detection.processing import parse_voc_annotations

# Download validation set from Brainchip data server
data_path = get_file(
    "voc_test_car_person.tar.gz",
    "http://data.brainchip.com/dataset-mirror/voc/voc_test_car_person.tar.gz",
    cache_subdir='datasets/voc',
    extract=True)

data_dir = os.path.dirname(data_path)
gt_folder = os.path.join(data_dir, 'voc_test_car_person', 'Annotations')
image_folder = os.path.join(data_dir, 'voc_test_car_person', 'JPEGImages')
file_path = os.path.join(data_dir, 'voc_test_car_person', 'test_car_person.txt')
labels = ['car', 'person']

val_data = parse_voc_annotations(gt_folder, image_folder, file_path, labels)
print("Loaded VOC2007 test data for car and person classes: "
      f"{len(val_data)} images.")

Out:

Downloading data from http://data.brainchip.com/dataset-mirror/voc/voc_test_car_person.tar.gz

     8192/221551911 [..............................] - ETA: 7:29
    65536/221551911 [..............................] - ETA: 3:46
   204800/221551911 [..............................] - ETA: 2:08
   401408/221551911 [..............................] - ETA: 1:34
   598016/221551911 [..............................] - ETA: 1:22
   794624/221551911 [..............................] - ETA: 1:17
   991232/221551911 [..............................] - ETA: 1:13
  1187840/221551911 [..............................] - ETA: 1:11
  1384448/221551911 [..............................] - ETA: 1:09
  1581056/221551911 [..............................] - ETA: 1:08
  1777664/221551911 [..............................] - ETA: 1:07
  1974272/221551911 [..............................] - ETA: 1:06
  2170880/221551911 [..............................] - ETA: 1:05
  2367488/221551911 [..............................] - ETA: 1:04
  2564096/221551911 [..............................] - ETA: 1:04
  2760704/221551911 [..............................] - ETA: 1:03
  2957312/221551911 [..............................] - ETA: 1:03
  3153920/221551911 [..............................] - ETA: 1:03
  3350528/221551911 [..............................] - ETA: 1:02
  3547136/221551911 [..............................] - ETA: 1:02
  3743744/221551911 [..............................] - ETA: 1:02
  3940352/221551911 [..............................] - ETA: 1:02
  4136960/221551911 [..............................] - ETA: 1:01
  4333568/221551911 [..............................] - ETA: 1:01
  4530176/221551911 [..............................] - ETA: 1:01
  4726784/221551911 [..............................] - ETA: 1:01
  4923392/221551911 [..............................] - ETA: 1:01
  5120000/221551911 [..............................] - ETA: 1:01
  5316608/221551911 [..............................] - ETA: 1:00
  5513216/221551911 [..............................] - ETA: 1:00
  5709824/221551911 [..............................] - ETA: 1:00
  5906432/221551911 [..............................] - ETA: 1:00
  6103040/221551911 [..............................] - ETA: 1:00
  6299648/221551911 [..............................] - ETA: 1:00
  6496256/221551911 [..............................] - ETA: 1:00
  6692864/221551911 [..............................] - ETA: 59s 
  6889472/221551911 [..............................] - ETA: 59s
  7086080/221551911 [..............................] - ETA: 59s
  7282688/221551911 [..............................] - ETA: 59s
  7479296/221551911 [>.............................] - ETA: 59s
  7675904/221551911 [>.............................] - ETA: 59s
  7872512/221551911 [>.............................] - ETA: 59s
  8069120/221551911 [>.............................] - ETA: 59s
  8265728/221551911 [>.............................] - ETA: 59s
  8462336/221551911 [>.............................] - ETA: 59s
  8658944/221551911 [>.............................] - ETA: 58s
  8855552/221551911 [>.............................] - ETA: 58s
  9052160/221551911 [>.............................] - ETA: 58s
  9248768/221551911 [>.............................] - ETA: 58s
  9445376/221551911 [>.............................] - ETA: 58s
  9641984/221551911 [>.............................] - ETA: 58s
  9838592/221551911 [>.............................] - ETA: 58s
 10035200/221551911 [>.............................] - ETA: 58s
 10231808/221551911 [>.............................] - ETA: 58s
 10428416/221551911 [>.............................] - ETA: 58s
 10625024/221551911 [>.............................] - ETA: 58s
 10821632/221551911 [>.............................] - ETA: 58s
 11018240/221551911 [>.............................] - ETA: 57s
 11214848/221551911 [>.............................] - ETA: 57s
 11411456/221551911 [>.............................] - ETA: 57s
 11608064/221551911 [>.............................] - ETA: 57s
 11804672/221551911 [>.............................] - ETA: 57s
 12001280/221551911 [>.............................] - ETA: 57s
 12197888/221551911 [>.............................] - ETA: 57s
 12394496/221551911 [>.............................] - ETA: 57s
 12591104/221551911 [>.............................] - ETA: 57s
 12787712/221551911 [>.............................] - ETA: 57s
 12984320/221551911 [>.............................] - ETA: 57s
 13180928/221551911 [>.............................] - ETA: 57s
 13377536/221551911 [>.............................] - ETA: 57s
 13574144/221551911 [>.............................] - ETA: 57s
 13770752/221551911 [>.............................] - ETA: 56s
 13967360/221551911 [>.............................] - ETA: 56s
 14163968/221551911 [>.............................] - ETA: 56s
 14360576/221551911 [>.............................] - ETA: 56s
 14557184/221551911 [>.............................] - ETA: 56s
 14753792/221551911 [>.............................] - ETA: 56s
 14950400/221551911 [=>............................] - ETA: 56s
 15147008/221551911 [=>............................] - ETA: 56s
 15343616/221551911 [=>............................] - ETA: 56s
 15540224/221551911 [=>............................] - ETA: 56s
 15736832/221551911 [=>............................] - ETA: 56s
 15933440/221551911 [=>............................] - ETA: 56s
 16130048/221551911 [=>............................] - ETA: 56s
 16326656/221551911 [=>............................] - ETA: 56s
 16523264/221551911 [=>............................] - ETA: 56s
 16719872/221551911 [=>............................] - ETA: 56s
 16916480/221551911 [=>............................] - ETA: 55s
 17113088/221551911 [=>............................] - ETA: 55s
 17309696/221551911 [=>............................] - ETA: 55s
 17506304/221551911 [=>............................] - ETA: 55s
 17702912/221551911 [=>............................] - ETA: 55s
 17899520/221551911 [=>............................] - ETA: 55s
 18096128/221551911 [=>............................] - ETA: 55s
 18292736/221551911 [=>............................] - ETA: 55s
 18489344/221551911 [=>............................] - ETA: 55s
 18685952/221551911 [=>............................] - ETA: 55s
 18882560/221551911 [=>............................] - ETA: 55s
 19079168/221551911 [=>............................] - ETA: 55s
 19275776/221551911 [=>............................] - ETA: 55s
 19472384/221551911 [=>............................] - ETA: 55s
 19668992/221551911 [=>............................] - ETA: 55s
 19865600/221551911 [=>............................] - ETA: 55s
 20062208/221551911 [=>............................] - ETA: 54s
 20258816/221551911 [=>............................] - ETA: 54s
 20455424/221551911 [=>............................] - ETA: 54s
 20652032/221551911 [=>............................] - ETA: 54s
 20848640/221551911 [=>............................] - ETA: 54s
 21045248/221551911 [=>............................] - ETA: 54s
 21241856/221551911 [=>............................] - ETA: 54s
 21438464/221551911 [=>............................] - ETA: 54s
 21635072/221551911 [=>............................] - ETA: 54s
 21831680/221551911 [=>............................] - ETA: 54s
 22028288/221551911 [=>............................] - ETA: 54s
 22224896/221551911 [==>...........................] - ETA: 54s
 22421504/221551911 [==>...........................] - ETA: 54s
 22618112/221551911 [==>...........................] - ETA: 54s
 22814720/221551911 [==>...........................] - ETA: 54s
 23011328/221551911 [==>...........................] - ETA: 54s
 23207936/221551911 [==>...........................] - ETA: 54s
 23404544/221551911 [==>...........................] - ETA: 53s
 23601152/221551911 [==>...........................] - ETA: 53s
 23797760/221551911 [==>...........................] - ETA: 53s
 23994368/221551911 [==>...........................] - ETA: 53s
 24190976/221551911 [==>...........................] - ETA: 53s
 24387584/221551911 [==>...........................] - ETA: 53s
 24584192/221551911 [==>...........................] - ETA: 53s
 24780800/221551911 [==>...........................] - ETA: 53s
 24977408/221551911 [==>...........................] - ETA: 53s
 25174016/221551911 [==>...........................] - ETA: 53s
 25370624/221551911 [==>...........................] - ETA: 53s
 25567232/221551911 [==>...........................] - ETA: 53s
 25763840/221551911 [==>...........................] - ETA: 53s
 25960448/221551911 [==>...........................] - ETA: 53s
 26157056/221551911 [==>...........................] - ETA: 53s
 26353664/221551911 [==>...........................] - ETA: 53s
 26550272/221551911 [==>...........................] - ETA: 53s
 26746880/221551911 [==>...........................] - ETA: 52s
 26943488/221551911 [==>...........................] - ETA: 52s
 27140096/221551911 [==>...........................] - ETA: 52s
 27336704/221551911 [==>...........................] - ETA: 52s
 27533312/221551911 [==>...........................] - ETA: 52s
 27729920/221551911 [==>...........................] - ETA: 52s
 27926528/221551911 [==>...........................] - ETA: 52s
 28123136/221551911 [==>...........................] - ETA: 52s
 28319744/221551911 [==>...........................] - ETA: 52s
 28516352/221551911 [==>...........................] - ETA: 52s
 28712960/221551911 [==>...........................] - ETA: 52s
 28909568/221551911 [==>...........................] - ETA: 52s
 29106176/221551911 [==>...........................] - ETA: 52s
 29302784/221551911 [==>...........................] - ETA: 52s
 29499392/221551911 [==>...........................] - ETA: 52s
 29696000/221551911 [===>..........................] - ETA: 52s
 29892608/221551911 [===>..........................] - ETA: 52s
 30089216/221551911 [===>..........................] - ETA: 52s
 30285824/221551911 [===>..........................] - ETA: 51s
 30482432/221551911 [===>..........................] - ETA: 51s
 30679040/221551911 [===>..........................] - ETA: 51s
 30875648/221551911 [===>..........................] - ETA: 51s
 31072256/221551911 [===>..........................] - ETA: 51s
 31268864/221551911 [===>..........................] - ETA: 51s
 31465472/221551911 [===>..........................] - ETA: 51s
 31662080/221551911 [===>..........................] - ETA: 51s
 31858688/221551911 [===>..........................] - ETA: 51s
 32055296/221551911 [===>..........................] - ETA: 51s
 32251904/221551911 [===>..........................] - ETA: 51s
 32448512/221551911 [===>..........................] - ETA: 51s
 32645120/221551911 [===>..........................] - ETA: 51s
 32841728/221551911 [===>..........................] - ETA: 51s
 33038336/221551911 [===>..........................] - ETA: 51s
 33234944/221551911 [===>..........................] - ETA: 51s
 33431552/221551911 [===>..........................] - ETA: 51s
 33628160/221551911 [===>..........................] - ETA: 51s
 33824768/221551911 [===>..........................] - ETA: 50s
 34021376/221551911 [===>..........................] - ETA: 50s
 34217984/221551911 [===>..........................] - ETA: 50s
 34414592/221551911 [===>..........................] - ETA: 50s
 34611200/221551911 [===>..........................] - ETA: 50s
 34807808/221551911 [===>..........................] - ETA: 50s
 35004416/221551911 [===>..........................] - ETA: 50s
 35201024/221551911 [===>..........................] - ETA: 50s
 35397632/221551911 [===>..........................] - ETA: 50s
 35594240/221551911 [===>..........................] - ETA: 50s
 35790848/221551911 [===>..........................] - ETA: 50s
 35987456/221551911 [===>..........................] - ETA: 50s
 36184064/221551911 [===>..........................] - ETA: 50s
 36380672/221551911 [===>..........................] - ETA: 50s
 36577280/221551911 [===>..........................] - ETA: 50s
 36773888/221551911 [===>..........................] - ETA: 50s
 36970496/221551911 [====>.........................] - ETA: 50s
 37167104/221551911 [====>.........................] - ETA: 50s
 37363712/221551911 [====>.........................] - ETA: 49s
 37560320/221551911 [====>.........................] - ETA: 49s
 37756928/221551911 [====>.........................] - ETA: 49s
 37953536/221551911 [====>.........................] - ETA: 49s
 38150144/221551911 [====>.........................] - ETA: 49s
 38346752/221551911 [====>.........................] - ETA: 49s
 38543360/221551911 [====>.........................] - ETA: 49s
 38739968/221551911 [====>.........................] - ETA: 49s
 38936576/221551911 [====>.........................] - ETA: 49s
 39133184/221551911 [====>.........................] - ETA: 49s
 39329792/221551911 [====>.........................] - ETA: 49s
 39526400/221551911 [====>.........................] - ETA: 49s
 39723008/221551911 [====>.........................] - ETA: 49s
 39919616/221551911 [====>.........................] - ETA: 49s
 40116224/221551911 [====>.........................] - ETA: 49s
 40312832/221551911 [====>.........................] - ETA: 49s
 40509440/221551911 [====>.........................] - ETA: 49s
 40706048/221551911 [====>.........................] - ETA: 49s
 40902656/221551911 [====>.........................] - ETA: 48s
 41099264/221551911 [====>.........................] - ETA: 48s
 41295872/221551911 [====>.........................] - ETA: 48s
 41492480/221551911 [====>.........................] - ETA: 48s
 41689088/221551911 [====>.........................] - ETA: 48s
 41885696/221551911 [====>.........................] - ETA: 48s
 42082304/221551911 [====>.........................] - ETA: 48s
 42278912/221551911 [====>.........................] - ETA: 48s
 42475520/221551911 [====>.........................] - ETA: 48s
 42672128/221551911 [====>.........................] - ETA: 48s
 42868736/221551911 [====>.........................] - ETA: 48s
 43065344/221551911 [====>.........................] - ETA: 48s
 43261952/221551911 [====>.........................] - ETA: 48s
 43458560/221551911 [====>.........................] - ETA: 48s
 43655168/221551911 [====>.........................] - ETA: 48s
 43851776/221551911 [====>.........................] - ETA: 48s
 44048384/221551911 [====>.........................] - ETA: 48s
 44244992/221551911 [====>.........................] - ETA: 48s
 44441600/221551911 [=====>........................] - ETA: 48s
 44638208/221551911 [=====>........................] - ETA: 47s
 44834816/221551911 [=====>........................] - ETA: 47s
 45031424/221551911 [=====>........................] - ETA: 47s
 45228032/221551911 [=====>........................] - ETA: 47s
 45424640/221551911 [=====>........................] - ETA: 47s
 45621248/221551911 [=====>........................] - ETA: 47s
 45817856/221551911 [=====>........................] - ETA: 47s
 46014464/221551911 [=====>........................] - ETA: 47s
 46211072/221551911 [=====>........................] - ETA: 47s
 46407680/221551911 [=====>........................] - ETA: 47s
 46604288/221551911 [=====>........................] - ETA: 47s
 46800896/221551911 [=====>........................] - ETA: 47s
 46997504/221551911 [=====>........................] - ETA: 47s
 47194112/221551911 [=====>........................] - ETA: 47s
 47390720/221551911 [=====>........................] - ETA: 47s
 47587328/221551911 [=====>........................] - ETA: 47s
 47783936/221551911 [=====>........................] - ETA: 47s
 47980544/221551911 [=====>........................] - ETA: 47s
 48177152/221551911 [=====>........................] - ETA: 46s
 48373760/221551911 [=====>........................] - ETA: 46s
 48570368/221551911 [=====>........................] - ETA: 46s
 48766976/221551911 [=====>........................] - ETA: 46s
 48963584/221551911 [=====>........................] - ETA: 46s
 49160192/221551911 [=====>........................] - ETA: 46s
 49356800/221551911 [=====>........................] - ETA: 46s
 49553408/221551911 [=====>........................] - ETA: 46s
 49750016/221551911 [=====>........................] - ETA: 46s
 49946624/221551911 [=====>........................] - ETA: 46s
 50143232/221551911 [=====>........................] - ETA: 46s
 50339840/221551911 [=====>........................] - ETA: 46s
 50536448/221551911 [=====>........................] - ETA: 46s
 50733056/221551911 [=====>........................] - ETA: 46s
 50929664/221551911 [=====>........................] - ETA: 46s
 51126272/221551911 [=====>........................] - ETA: 46s
 51322880/221551911 [=====>........................] - ETA: 46s
 51519488/221551911 [=====>........................] - ETA: 46s
 51716096/221551911 [======>.......................] - ETA: 46s
 51912704/221551911 [======>.......................] - ETA: 45s
 52109312/221551911 [======>.......................] - ETA: 45s
 52305920/221551911 [======>.......................] - ETA: 45s
 52502528/221551911 [======>.......................] - ETA: 45s
 52699136/221551911 [======>.......................] - ETA: 45s
 52895744/221551911 [======>.......................] - ETA: 45s
 53092352/221551911 [======>.......................] - ETA: 45s
 53288960/221551911 [======>.......................] - ETA: 45s
 53485568/221551911 [======>.......................] - ETA: 45s
 53682176/221551911 [======>.......................] - ETA: 45s
 53878784/221551911 [======>.......................] - ETA: 45s
 54075392/221551911 [======>.......................] - ETA: 45s
 54272000/221551911 [======>.......................] - ETA: 45s
 54468608/221551911 [======>.......................] - ETA: 45s
 54665216/221551911 [======>.......................] - ETA: 45s
 54861824/221551911 [======>.......................] - ETA: 45s
 55058432/221551911 [======>.......................] - ETA: 45s
 55255040/221551911 [======>.......................] - ETA: 45s
 55451648/221551911 [======>.......................] - ETA: 44s
 55648256/221551911 [======>.......................] - ETA: 44s
 55844864/221551911 [======>.......................] - ETA: 44s
 56041472/221551911 [======>.......................] - ETA: 44s
 56238080/221551911 [======>.......................] - ETA: 44s
 56434688/221551911 [======>.......................] - ETA: 44s
 56631296/221551911 [======>.......................] - ETA: 44s
 56827904/221551911 [======>.......................] - ETA: 44s
 57024512/221551911 [======>.......................] - ETA: 44s
 57221120/221551911 [======>.......................] - ETA: 44s
 57417728/221551911 [======>.......................] - ETA: 44s
 57614336/221551911 [======>.......................] - ETA: 44s
 57810944/221551911 [======>.......................] - ETA: 44s
 58007552/221551911 [======>.......................] - ETA: 44s
 58204160/221551911 [======>.......................] - ETA: 44s
 58400768/221551911 [======>.......................] - ETA: 44s
 58597376/221551911 [======>.......................] - ETA: 44s
 58793984/221551911 [======>.......................] - ETA: 44s
 58990592/221551911 [======>.......................] - ETA: 44s
 59187200/221551911 [=======>......................] - ETA: 43s
 59383808/221551911 [=======>......................] - ETA: 43s
 59580416/221551911 [=======>......................] - ETA: 43s
 59777024/221551911 [=======>......................] - ETA: 43s
 59973632/221551911 [=======>......................] - ETA: 43s
 60170240/221551911 [=======>......................] - ETA: 43s
 60366848/221551911 [=======>......................] - ETA: 43s
 60563456/221551911 [=======>......................] - ETA: 43s
 60760064/221551911 [=======>......................] - ETA: 43s
 60956672/221551911 [=======>......................] - ETA: 43s
 61153280/221551911 [=======>......................] - ETA: 43s
 61349888/221551911 [=======>......................] - ETA: 43s
 61546496/221551911 [=======>......................] - ETA: 43s
 61743104/221551911 [=======>......................] - ETA: 43s
 61939712/221551911 [=======>......................] - ETA: 43s
 62136320/221551911 [=======>......................] - ETA: 43s
 62332928/221551911 [=======>......................] - ETA: 43s
 62529536/221551911 [=======>......................] - ETA: 43s
 62726144/221551911 [=======>......................] - ETA: 42s
 62922752/221551911 [=======>......................] - ETA: 42s
 63119360/221551911 [=======>......................] - ETA: 42s
 63315968/221551911 [=======>......................] - ETA: 42s
 63512576/221551911 [=======>......................] - ETA: 42s
 63709184/221551911 [=======>......................] - ETA: 42s
 63905792/221551911 [=======>......................] - ETA: 42s
 64102400/221551911 [=======>......................] - ETA: 42s
 64299008/221551911 [=======>......................] - ETA: 42s
 64495616/221551911 [=======>......................] - ETA: 42s
 64692224/221551911 [=======>......................] - ETA: 42s
 64888832/221551911 [=======>......................] - ETA: 42s
 65085440/221551911 [=======>......................] - ETA: 42s
 65282048/221551911 [=======>......................] - ETA: 42s
 65478656/221551911 [=======>......................] - ETA: 42s
 65675264/221551911 [=======>......................] - ETA: 42s
 65871872/221551911 [=======>......................] - ETA: 42s
 66068480/221551911 [=======>......................] - ETA: 42s
 66265088/221551911 [=======>......................] - ETA: 42s
 66461696/221551911 [=======>......................] - ETA: 41s
 66658304/221551911 [========>.....................] - ETA: 41s
 66854912/221551911 [========>.....................] - ETA: 41s
 67051520/221551911 [========>.....................] - ETA: 41s
 67248128/221551911 [========>.....................] - ETA: 41s
 67444736/221551911 [========>.....................] - ETA: 41s
 67641344/221551911 [========>.....................] - ETA: 41s
 67837952/221551911 [========>.....................] - ETA: 41s
 68034560/221551911 [========>.....................] - ETA: 41s
 68231168/221551911 [========>.....................] - ETA: 41s
 68427776/221551911 [========>.....................] - ETA: 41s
 68624384/221551911 [========>.....................] - ETA: 41s
 68820992/221551911 [========>.....................] - ETA: 41s
 69017600/221551911 [========>.....................] - ETA: 41s
 69214208/221551911 [========>.....................] - ETA: 41s
 69410816/221551911 [========>.....................] - ETA: 41s
 69607424/221551911 [========>.....................] - ETA: 41s
 69804032/221551911 [========>.....................] - ETA: 41s
 70000640/221551911 [========>.....................] - ETA: 40s
 70197248/221551911 [========>.....................] - ETA: 40s
 70393856/221551911 [========>.....................] - ETA: 40s
 70590464/221551911 [========>.....................] - ETA: 40s
 70787072/221551911 [========>.....................] - ETA: 40s
 70983680/221551911 [========>.....................] - ETA: 40s
 71180288/221551911 [========>.....................] - ETA: 40s
 71376896/221551911 [========>.....................] - ETA: 40s
 71573504/221551911 [========>.....................] - ETA: 40s
 71770112/221551911 [========>.....................] - ETA: 40s
 71966720/221551911 [========>.....................] - ETA: 40s
 72163328/221551911 [========>.....................] - ETA: 40s
 72359936/221551911 [========>.....................] - ETA: 40s
 72556544/221551911 [========>.....................] - ETA: 40s
 72753152/221551911 [========>.....................] - ETA: 40s
 72949760/221551911 [========>.....................] - ETA: 40s
 73146368/221551911 [========>.....................] - ETA: 40s
 73342976/221551911 [========>.....................] - ETA: 40s
 73539584/221551911 [========>.....................] - ETA: 40s
 73736192/221551911 [========>.....................] - ETA: 39s
 73932800/221551911 [=========>....................] - ETA: 39s
 74129408/221551911 [=========>....................] - ETA: 39s
 74326016/221551911 [=========>....................] - ETA: 39s
 74522624/221551911 [=========>....................] - ETA: 39s
 74719232/221551911 [=========>....................] - ETA: 39s
 74915840/221551911 [=========>....................] - ETA: 39s
 75112448/221551911 [=========>....................] - ETA: 39s
 75309056/221551911 [=========>....................] - ETA: 39s
 75505664/221551911 [=========>....................] - ETA: 39s
 75702272/221551911 [=========>....................] - ETA: 39s
 75898880/221551911 [=========>....................] - ETA: 39s
 76095488/221551911 [=========>....................] - ETA: 39s
 76292096/221551911 [=========>....................] - ETA: 39s
 76488704/221551911 [=========>....................] - ETA: 39s
 76685312/221551911 [=========>....................] - ETA: 39s
 76881920/221551911 [=========>....................] - ETA: 39s
 77078528/221551911 [=========>....................] - ETA: 39s
 77275136/221551911 [=========>....................] - ETA: 39s
 77471744/221551911 [=========>....................] - ETA: 38s
 77668352/221551911 [=========>....................] - ETA: 38s
 77864960/221551911 [=========>....................] - ETA: 38s
 78061568/221551911 [=========>....................] - ETA: 38s
 78258176/221551911 [=========>....................] - ETA: 38s
 78454784/221551911 [=========>....................] - ETA: 38s
 78651392/221551911 [=========>....................] - ETA: 38s
 78848000/221551911 [=========>....................] - ETA: 38s
 79044608/221551911 [=========>....................] - ETA: 38s
 79241216/221551911 [=========>....................] - ETA: 38s
 79437824/221551911 [=========>....................] - ETA: 38s
 79634432/221551911 [=========>....................] - ETA: 38s
 79831040/221551911 [=========>....................] - ETA: 38s
 80027648/221551911 [=========>....................] - ETA: 38s
 80224256/221551911 [=========>....................] - ETA: 38s
 80420864/221551911 [=========>....................] - ETA: 38s
 80617472/221551911 [=========>....................] - ETA: 38s
 80814080/221551911 [=========>....................] - ETA: 38s
 81010688/221551911 [=========>....................] - ETA: 37s
 81207296/221551911 [=========>....................] - ETA: 37s
 81403904/221551911 [==========>...................] - ETA: 37s
 81600512/221551911 [==========>...................] - ETA: 37s
 81797120/221551911 [==========>...................] - ETA: 37s
 81993728/221551911 [==========>...................] - ETA: 37s
 82190336/221551911 [==========>...................] - ETA: 37s
 82386944/221551911 [==========>...................] - ETA: 37s
 82583552/221551911 [==========>...................] - ETA: 37s
 82780160/221551911 [==========>...................] - ETA: 37s
 82976768/221551911 [==========>...................] - ETA: 37s
 83173376/221551911 [==========>...................] - ETA: 37s
 83369984/221551911 [==========>...................] - ETA: 37s
 83566592/221551911 [==========>...................] - ETA: 37s
 83763200/221551911 [==========>...................] - ETA: 37s
 83959808/221551911 [==========>...................] - ETA: 37s
 84156416/221551911 [==========>...................] - ETA: 37s
 84353024/221551911 [==========>...................] - ETA: 37s
 84549632/221551911 [==========>...................] - ETA: 37s
 84746240/221551911 [==========>...................] - ETA: 36s
 84942848/221551911 [==========>...................] - ETA: 36s
 85139456/221551911 [==========>...................] - ETA: 36s
 85336064/221551911 [==========>...................] - ETA: 36s
 85532672/221551911 [==========>...................] - ETA: 36s
 85729280/221551911 [==========>...................] - ETA: 36s
 85925888/221551911 [==========>...................] - ETA: 36s
 86122496/221551911 [==========>...................] - ETA: 36s
 86319104/221551911 [==========>...................] - ETA: 36s
 86515712/221551911 [==========>...................] - ETA: 36s
 86712320/221551911 [==========>...................] - ETA: 36s
 86908928/221551911 [==========>...................] - ETA: 36s
 87105536/221551911 [==========>...................] - ETA: 36s
 87302144/221551911 [==========>...................] - ETA: 36s
 87498752/221551911 [==========>...................] - ETA: 36s
 87695360/221551911 [==========>...................] - ETA: 36s
 87891968/221551911 [==========>...................] - ETA: 36s
 88088576/221551911 [==========>...................] - ETA: 36s
 88285184/221551911 [==========>...................] - ETA: 36s
 88481792/221551911 [==========>...................] - ETA: 35s
 88678400/221551911 [===========>..................] - ETA: 35s
 88875008/221551911 [===========>..................] - ETA: 35s
 89071616/221551911 [===========>..................] - ETA: 35s
 89268224/221551911 [===========>..................] - ETA: 35s
 89464832/221551911 [===========>..................] - ETA: 35s
 89661440/221551911 [===========>..................] - ETA: 35s
 89858048/221551911 [===========>..................] - ETA: 35s
 90054656/221551911 [===========>..................] - ETA: 35s
 90251264/221551911 [===========>..................] - ETA: 35s
 90447872/221551911 [===========>..................] - ETA: 35s
 90644480/221551911 [===========>..................] - ETA: 35s
 90841088/221551911 [===========>..................] - ETA: 35s
 91037696/221551911 [===========>..................] - ETA: 35s
 91234304/221551911 [===========>..................] - ETA: 35s
 91430912/221551911 [===========>..................] - ETA: 35s
 91627520/221551911 [===========>..................] - ETA: 35s
 91824128/221551911 [===========>..................] - ETA: 35s
 92020736/221551911 [===========>..................] - ETA: 35s
 92217344/221551911 [===========>..................] - ETA: 34s
 92413952/221551911 [===========>..................] - ETA: 34s
 92610560/221551911 [===========>..................] - ETA: 34s
 92807168/221551911 [===========>..................] - ETA: 34s
 93003776/221551911 [===========>..................] - ETA: 34s
 93200384/221551911 [===========>..................] - ETA: 34s
 93396992/221551911 [===========>..................] - ETA: 34s
 93593600/221551911 [===========>..................] - ETA: 34s
 93790208/221551911 [===========>..................] - ETA: 34s
 93986816/221551911 [===========>..................] - ETA: 34s
 94183424/221551911 [===========>..................] - ETA: 34s
 94380032/221551911 [===========>..................] - ETA: 34s
 94576640/221551911 [===========>..................] - ETA: 34s
 94773248/221551911 [===========>..................] - ETA: 34s
 94969856/221551911 [===========>..................] - ETA: 34s
 95166464/221551911 [===========>..................] - ETA: 34s
 95363072/221551911 [===========>..................] - ETA: 34s
 95559680/221551911 [===========>..................] - ETA: 34s
 95756288/221551911 [===========>..................] - ETA: 33s
 95952896/221551911 [===========>..................] - ETA: 33s
 96149504/221551911 [============>.................] - ETA: 33s
 96346112/221551911 [============>.................] - ETA: 33s
 96542720/221551911 [============>.................] - ETA: 33s
 96739328/221551911 [============>.................] - ETA: 33s
 96935936/221551911 [============>.................] - ETA: 33s
 97132544/221551911 [============>.................] - ETA: 33s
 97329152/221551911 [============>.................] - ETA: 33s
 97525760/221551911 [============>.................] - ETA: 33s
 97722368/221551911 [============>.................] - ETA: 33s
 97918976/221551911 [============>.................] - ETA: 33s
 98115584/221551911 [============>.................] - ETA: 33s
 98312192/221551911 [============>.................] - ETA: 33s
 98508800/221551911 [============>.................] - ETA: 33s
 98705408/221551911 [============>.................] - ETA: 33s
 98902016/221551911 [============>.................] - ETA: 33s
 99098624/221551911 [============>.................] - ETA: 33s
 99295232/221551911 [============>.................] - ETA: 33s
 99491840/221551911 [============>.................] - ETA: 32s
 99688448/221551911 [============>.................] - ETA: 32s
 99885056/221551911 [============>.................] - ETA: 32s
100081664/221551911 [============>.................] - ETA: 32s
100278272/221551911 [============>.................] - ETA: 32s
100474880/221551911 [============>.................] - ETA: 32s
100671488/221551911 [============>.................] - ETA: 32s
100868096/221551911 [============>.................] - ETA: 32s
101064704/221551911 [============>.................] - ETA: 32s
101261312/221551911 [============>.................] - ETA: 32s
101457920/221551911 [============>.................] - ETA: 32s
101654528/221551911 [============>.................] - ETA: 32s
101851136/221551911 [============>.................] - ETA: 32s
102047744/221551911 [============>.................] - ETA: 32s
102244352/221551911 [============>.................] - ETA: 32s
102440960/221551911 [============>.................] - ETA: 32s
102637568/221551911 [============>.................] - ETA: 32s
102834176/221551911 [============>.................] - ETA: 32s
103030784/221551911 [============>.................] - ETA: 32s
103227392/221551911 [============>.................] - ETA: 31s
103424000/221551911 [=============>................] - ETA: 31s
103620608/221551911 [=============>................] - ETA: 31s
103817216/221551911 [=============>................] - ETA: 31s
104013824/221551911 [=============>................] - ETA: 31s
104210432/221551911 [=============>................] - ETA: 31s
104407040/221551911 [=============>................] - ETA: 31s
104603648/221551911 [=============>................] - ETA: 31s
104800256/221551911 [=============>................] - ETA: 31s
104996864/221551911 [=============>................] - ETA: 31s
105193472/221551911 [=============>................] - ETA: 31s
105390080/221551911 [=============>................] - ETA: 31s
105586688/221551911 [=============>................] - ETA: 31s
105783296/221551911 [=============>................] - ETA: 31s
105979904/221551911 [=============>................] - ETA: 31s
106176512/221551911 [=============>................] - ETA: 31s
106373120/221551911 [=============>................] - ETA: 31s
106569728/221551911 [=============>................] - ETA: 31s
106766336/221551911 [=============>................] - ETA: 31s
106962944/221551911 [=============>................] - ETA: 30s
107159552/221551911 [=============>................] - ETA: 30s
107356160/221551911 [=============>................] - ETA: 30s
107552768/221551911 [=============>................] - ETA: 30s
107749376/221551911 [=============>................] - ETA: 30s
107945984/221551911 [=============>................] - ETA: 30s
108142592/221551911 [=============>................] - ETA: 30s
108339200/221551911 [=============>................] - ETA: 30s
108535808/221551911 [=============>................] - ETA: 30s
108732416/221551911 [=============>................] - ETA: 30s
108929024/221551911 [=============>................] - ETA: 30s
109125632/221551911 [=============>................] - ETA: 30s
109322240/221551911 [=============>................] - ETA: 30s
109518848/221551911 [=============>................] - ETA: 30s
109715456/221551911 [=============>................] - ETA: 30s
109912064/221551911 [=============>................] - ETA: 30s
110108672/221551911 [=============>................] - ETA: 30s
110305280/221551911 [=============>................] - ETA: 30s
110501888/221551911 [=============>................] - ETA: 30s
110698496/221551911 [=============>................] - ETA: 29s
110895104/221551911 [==============>...............] - ETA: 29s
111091712/221551911 [==============>...............] - ETA: 29s
111288320/221551911 [==============>...............] - ETA: 29s
111484928/221551911 [==============>...............] - ETA: 29s
111681536/221551911 [==============>...............] - ETA: 29s
111878144/221551911 [==============>...............] - ETA: 29s
112074752/221551911 [==============>...............] - ETA: 29s
112271360/221551911 [==============>...............] - ETA: 29s
112467968/221551911 [==============>...............] - ETA: 29s
112664576/221551911 [==============>...............] - ETA: 29s
112861184/221551911 [==============>...............] - ETA: 29s
113057792/221551911 [==============>...............] - ETA: 29s
113254400/221551911 [==============>...............] - ETA: 29s
113451008/221551911 [==============>...............] - ETA: 29s
113647616/221551911 [==============>...............] - ETA: 29s
113844224/221551911 [==============>...............] - ETA: 29s
114040832/221551911 [==============>...............] - ETA: 29s
114237440/221551911 [==============>...............] - ETA: 28s
114434048/221551911 [==============>...............] - ETA: 28s
114630656/221551911 [==============>...............] - ETA: 28s
114827264/221551911 [==============>...............] - ETA: 28s
115023872/221551911 [==============>...............] - ETA: 28s
115220480/221551911 [==============>...............] - ETA: 28s
115417088/221551911 [==============>...............] - ETA: 28s
115613696/221551911 [==============>...............] - ETA: 28s
115810304/221551911 [==============>...............] - ETA: 28s
116006912/221551911 [==============>...............] - ETA: 28s
116203520/221551911 [==============>...............] - ETA: 28s
116400128/221551911 [==============>...............] - ETA: 28s
116596736/221551911 [==============>...............] - ETA: 28s
116793344/221551911 [==============>...............] - ETA: 28s
116989952/221551911 [==============>...............] - ETA: 28s
117186560/221551911 [==============>...............] - ETA: 28s
117383168/221551911 [==============>...............] - ETA: 28s
117579776/221551911 [==============>...............] - ETA: 28s
117776384/221551911 [==============>...............] - ETA: 28s
117972992/221551911 [==============>...............] - ETA: 27s
118169600/221551911 [===============>..............] - ETA: 27s
118366208/221551911 [===============>..............] - ETA: 27s
118562816/221551911 [===============>..............] - ETA: 27s
118759424/221551911 [===============>..............] - ETA: 27s
118956032/221551911 [===============>..............] - ETA: 27s
119152640/221551911 [===============>..............] - ETA: 27s
119349248/221551911 [===============>..............] - ETA: 27s
119545856/221551911 [===============>..............] - ETA: 27s
119742464/221551911 [===============>..............] - ETA: 27s
119939072/221551911 [===============>..............] - ETA: 27s
120135680/221551911 [===============>..............] - ETA: 27s
120332288/221551911 [===============>..............] - ETA: 27s
120528896/221551911 [===============>..............] - ETA: 27s
120725504/221551911 [===============>..............] - ETA: 27s
120922112/221551911 [===============>..............] - ETA: 27s
121118720/221551911 [===============>..............] - ETA: 27s
121315328/221551911 [===============>..............] - ETA: 27s
121511936/221551911 [===============>..............] - ETA: 27s
121708544/221551911 [===============>..............] - ETA: 26s
121905152/221551911 [===============>..............] - ETA: 26s
122101760/221551911 [===============>..............] - ETA: 26s
122298368/221551911 [===============>..............] - ETA: 26s
122494976/221551911 [===============>..............] - ETA: 26s
122691584/221551911 [===============>..............] - ETA: 26s
122888192/221551911 [===============>..............] - ETA: 26s
123084800/221551911 [===============>..............] - ETA: 26s
123281408/221551911 [===============>..............] - ETA: 26s
123478016/221551911 [===============>..............] - ETA: 26s
123674624/221551911 [===============>..............] - ETA: 26s
123871232/221551911 [===============>..............] - ETA: 26s
124067840/221551911 [===============>..............] - ETA: 26s
124264448/221551911 [===============>..............] - ETA: 26s
124461056/221551911 [===============>..............] - ETA: 26s
124657664/221551911 [===============>..............] - ETA: 26s
124854272/221551911 [===============>..............] - ETA: 26s
125050880/221551911 [===============>..............] - ETA: 26s
125247488/221551911 [===============>..............] - ETA: 26s
125444096/221551911 [===============>..............] - ETA: 25s
125640704/221551911 [================>.............] - ETA: 25s
125837312/221551911 [================>.............] - ETA: 25s
126033920/221551911 [================>.............] - ETA: 25s
126230528/221551911 [================>.............] - ETA: 25s
126427136/221551911 [================>.............] - ETA: 25s
126623744/221551911 [================>.............] - ETA: 25s
126820352/221551911 [================>.............] - ETA: 25s
127016960/221551911 [================>.............] - ETA: 25s
127213568/221551911 [================>.............] - ETA: 25s
127410176/221551911 [================>.............] - ETA: 25s
127606784/221551911 [================>.............] - ETA: 25s
127803392/221551911 [================>.............] - ETA: 25s
128000000/221551911 [================>.............] - ETA: 25s
128196608/221551911 [================>.............] - ETA: 25s
128393216/221551911 [================>.............] - ETA: 25s
128589824/221551911 [================>.............] - ETA: 25s
128786432/221551911 [================>.............] - ETA: 25s
128983040/221551911 [================>.............] - ETA: 25s
129179648/221551911 [================>.............] - ETA: 24s
129376256/221551911 [================>.............] - ETA: 24s
129572864/221551911 [================>.............] - ETA: 24s
129769472/221551911 [================>.............] - ETA: 24s
129966080/221551911 [================>.............] - ETA: 24s
130162688/221551911 [================>.............] - ETA: 24s
130359296/221551911 [================>.............] - ETA: 24s
130555904/221551911 [================>.............] - ETA: 24s
130752512/221551911 [================>.............] - ETA: 24s
130949120/221551911 [================>.............] - ETA: 24s
131145728/221551911 [================>.............] - ETA: 24s
131342336/221551911 [================>.............] - ETA: 24s
131538944/221551911 [================>.............] - ETA: 24s
131735552/221551911 [================>.............] - ETA: 24s
131932160/221551911 [================>.............] - ETA: 24s
132128768/221551911 [================>.............] - ETA: 24s
132325376/221551911 [================>.............] - ETA: 24s
132521984/221551911 [================>.............] - ETA: 24s
132718592/221551911 [================>.............] - ETA: 23s
132915200/221551911 [================>.............] - ETA: 23s
133111808/221551911 [=================>............] - ETA: 23s
133308416/221551911 [=================>............] - ETA: 23s
133505024/221551911 [=================>............] - ETA: 23s
133701632/221551911 [=================>............] - ETA: 23s
133898240/221551911 [=================>............] - ETA: 23s
134094848/221551911 [=================>............] - ETA: 23s
134291456/221551911 [=================>............] - ETA: 23s
134488064/221551911 [=================>............] - ETA: 23s
134684672/221551911 [=================>............] - ETA: 23s
134881280/221551911 [=================>............] - ETA: 23s
135077888/221551911 [=================>............] - ETA: 23s
135274496/221551911 [=================>............] - ETA: 23s
135471104/221551911 [=================>............] - ETA: 23s
135667712/221551911 [=================>............] - ETA: 23s
135864320/221551911 [=================>............] - ETA: 23s
136060928/221551911 [=================>............] - ETA: 23s
136257536/221551911 [=================>............] - ETA: 23s
136454144/221551911 [=================>............] - ETA: 22s
136650752/221551911 [=================>............] - ETA: 22s
136847360/221551911 [=================>............] - ETA: 22s
137043968/221551911 [=================>............] - ETA: 22s
137240576/221551911 [=================>............] - ETA: 22s
137437184/221551911 [=================>............] - ETA: 22s
137633792/221551911 [=================>............] - ETA: 22s
137830400/221551911 [=================>............] - ETA: 22s
138027008/221551911 [=================>............] - ETA: 22s
138223616/221551911 [=================>............] - ETA: 22s
138420224/221551911 [=================>............] - ETA: 22s
138616832/221551911 [=================>............] - ETA: 22s
138813440/221551911 [=================>............] - ETA: 22s
139010048/221551911 [=================>............] - ETA: 22s
139206656/221551911 [=================>............] - ETA: 22s
139403264/221551911 [=================>............] - ETA: 22s
139599872/221551911 [=================>............] - ETA: 22s
139796480/221551911 [=================>............] - ETA: 22s
139993088/221551911 [=================>............] - ETA: 22s
140189696/221551911 [=================>............] - ETA: 21s
140386304/221551911 [==================>...........] - ETA: 21s
140582912/221551911 [==================>...........] - ETA: 21s
140779520/221551911 [==================>...........] - ETA: 21s
140976128/221551911 [==================>...........] - ETA: 21s
141172736/221551911 [==================>...........] - ETA: 21s
141369344/221551911 [==================>...........] - ETA: 21s
141565952/221551911 [==================>...........] - ETA: 21s
141762560/221551911 [==================>...........] - ETA: 21s
141959168/221551911 [==================>...........] - ETA: 21s
142155776/221551911 [==================>...........] - ETA: 21s
142352384/221551911 [==================>...........] - ETA: 21s
142548992/221551911 [==================>...........] - ETA: 21s
142745600/221551911 [==================>...........] - ETA: 21s
142942208/221551911 [==================>...........] - ETA: 21s
143138816/221551911 [==================>...........] - ETA: 21s
143335424/221551911 [==================>...........] - ETA: 21s
143532032/221551911 [==================>...........] - ETA: 21s
143728640/221551911 [==================>...........] - ETA: 21s
143925248/221551911 [==================>...........] - ETA: 20s
144121856/221551911 [==================>...........] - ETA: 20s
144318464/221551911 [==================>...........] - ETA: 20s
144515072/221551911 [==================>...........] - ETA: 20s
144711680/221551911 [==================>...........] - ETA: 20s
144908288/221551911 [==================>...........] - ETA: 20s
145104896/221551911 [==================>...........] - ETA: 20s
145301504/221551911 [==================>...........] - ETA: 20s
145498112/221551911 [==================>...........] - ETA: 20s
145694720/221551911 [==================>...........] - ETA: 20s
145891328/221551911 [==================>...........] - ETA: 20s
146087936/221551911 [==================>...........] - ETA: 20s
146284544/221551911 [==================>...........] - ETA: 20s
146481152/221551911 [==================>...........] - ETA: 20s
146677760/221551911 [==================>...........] - ETA: 20s
146874368/221551911 [==================>...........] - ETA: 20s
147070976/221551911 [==================>...........] - ETA: 20s
147267584/221551911 [==================>...........] - ETA: 20s
147464192/221551911 [==================>...........] - ETA: 20s
147660800/221551911 [==================>...........] - ETA: 19s
147857408/221551911 [===================>..........] - ETA: 19s
148054016/221551911 [===================>..........] - ETA: 19s
148250624/221551911 [===================>..........] - ETA: 19s
148447232/221551911 [===================>..........] - ETA: 19s
148643840/221551911 [===================>..........] - ETA: 19s
148840448/221551911 [===================>..........] - ETA: 19s
149037056/221551911 [===================>..........] - ETA: 19s
149233664/221551911 [===================>..........] - ETA: 19s
149430272/221551911 [===================>..........] - ETA: 19s
149626880/221551911 [===================>..........] - ETA: 19s
149823488/221551911 [===================>..........] - ETA: 19s
150020096/221551911 [===================>..........] - ETA: 19s
150216704/221551911 [===================>..........] - ETA: 19s
150413312/221551911 [===================>..........] - ETA: 19s
150609920/221551911 [===================>..........] - ETA: 19s
150806528/221551911 [===================>..........] - ETA: 19s
151003136/221551911 [===================>..........] - ETA: 19s
151199744/221551911 [===================>..........] - ETA: 18s
151396352/221551911 [===================>..........] - ETA: 18s
151592960/221551911 [===================>..........] - ETA: 18s
151789568/221551911 [===================>..........] - ETA: 18s
151986176/221551911 [===================>..........] - ETA: 18s
152182784/221551911 [===================>..........] - ETA: 18s
152379392/221551911 [===================>..........] - ETA: 18s
152576000/221551911 [===================>..........] - ETA: 18s
152772608/221551911 [===================>..........] - ETA: 18s
152969216/221551911 [===================>..........] - ETA: 18s
153165824/221551911 [===================>..........] - ETA: 18s
153362432/221551911 [===================>..........] - ETA: 18s
153559040/221551911 [===================>..........] - ETA: 18s
153755648/221551911 [===================>..........] - ETA: 18s
153952256/221551911 [===================>..........] - ETA: 18s
154148864/221551911 [===================>..........] - ETA: 18s
154345472/221551911 [===================>..........] - ETA: 18s
154542080/221551911 [===================>..........] - ETA: 18s
154738688/221551911 [===================>..........] - ETA: 18s
154935296/221551911 [===================>..........] - ETA: 17s
155131904/221551911 [====================>.........] - ETA: 17s
155328512/221551911 [====================>.........] - ETA: 17s
155525120/221551911 [====================>.........] - ETA: 17s
155721728/221551911 [====================>.........] - ETA: 17s
155918336/221551911 [====================>.........] - ETA: 17s
156114944/221551911 [====================>.........] - ETA: 17s
156311552/221551911 [====================>.........] - ETA: 17s
156508160/221551911 [====================>.........] - ETA: 17s
156704768/221551911 [====================>.........] - ETA: 17s
156901376/221551911 [====================>.........] - ETA: 17s
157097984/221551911 [====================>.........] - ETA: 17s
157294592/221551911 [====================>.........] - ETA: 17s
157491200/221551911 [====================>.........] - ETA: 17s
157687808/221551911 [====================>.........] - ETA: 17s
157884416/221551911 [====================>.........] - ETA: 17s
158081024/221551911 [====================>.........] - ETA: 17s
158277632/221551911 [====================>.........] - ETA: 17s
158474240/221551911 [====================>.........] - ETA: 17s
158670848/221551911 [====================>.........] - ETA: 16s
158867456/221551911 [====================>.........] - ETA: 16s
159064064/221551911 [====================>.........] - ETA: 16s
159260672/221551911 [====================>.........] - ETA: 16s
159457280/221551911 [====================>.........] - ETA: 16s
159653888/221551911 [====================>.........] - ETA: 16s
159850496/221551911 [====================>.........] - ETA: 16s
160047104/221551911 [====================>.........] - ETA: 16s
160243712/221551911 [====================>.........] - ETA: 16s
160440320/221551911 [====================>.........] - ETA: 16s
160636928/221551911 [====================>.........] - ETA: 16s
160833536/221551911 [====================>.........] - ETA: 16s
161030144/221551911 [====================>.........] - ETA: 16s
161226752/221551911 [====================>.........] - ETA: 16s
161423360/221551911 [====================>.........] - ETA: 16s
161619968/221551911 [====================>.........] - ETA: 16s
161816576/221551911 [====================>.........] - ETA: 16s
162013184/221551911 [====================>.........] - ETA: 16s
162209792/221551911 [====================>.........] - ETA: 16s
162406400/221551911 [====================>.........] - ETA: 15s
162603008/221551911 [=====================>........] - ETA: 15s
162799616/221551911 [=====================>........] - ETA: 15s
162996224/221551911 [=====================>........] - ETA: 15s
163192832/221551911 [=====================>........] - ETA: 15s
163389440/221551911 [=====================>........] - ETA: 15s
163586048/221551911 [=====================>........] - ETA: 15s
163782656/221551911 [=====================>........] - ETA: 15s
163979264/221551911 [=====================>........] - ETA: 15s
164175872/221551911 [=====================>........] - ETA: 15s
164372480/221551911 [=====================>........] - ETA: 15s
164569088/221551911 [=====================>........] - ETA: 15s
164765696/221551911 [=====================>........] - ETA: 15s
164962304/221551911 [=====================>........] - ETA: 15s
165158912/221551911 [=====================>........] - ETA: 15s
165355520/221551911 [=====================>........] - ETA: 15s
165552128/221551911 [=====================>........] - ETA: 15s
165748736/221551911 [=====================>........] - ETA: 15s
165945344/221551911 [=====================>........] - ETA: 15s
166141952/221551911 [=====================>........] - ETA: 14s
166338560/221551911 [=====================>........] - ETA: 14s
166535168/221551911 [=====================>........] - ETA: 14s
166731776/221551911 [=====================>........] - ETA: 14s
166928384/221551911 [=====================>........] - ETA: 14s
167124992/221551911 [=====================>........] - ETA: 14s
167321600/221551911 [=====================>........] - ETA: 14s
167518208/221551911 [=====================>........] - ETA: 14s
167714816/221551911 [=====================>........] - ETA: 14s
167911424/221551911 [=====================>........] - ETA: 14s
168108032/221551911 [=====================>........] - ETA: 14s
168304640/221551911 [=====================>........] - ETA: 14s
168501248/221551911 [=====================>........] - ETA: 14s
168697856/221551911 [=====================>........] - ETA: 14s
168894464/221551911 [=====================>........] - ETA: 14s
169091072/221551911 [=====================>........] - ETA: 14s
169287680/221551911 [=====================>........] - ETA: 14s
169484288/221551911 [=====================>........] - ETA: 14s
169680896/221551911 [=====================>........] - ETA: 14s
169877504/221551911 [======================>.......] - ETA: 13s
170074112/221551911 [======================>.......] - ETA: 13s
170270720/221551911 [======================>.......] - ETA: 13s
170467328/221551911 [======================>.......] - ETA: 13s
170663936/221551911 [======================>.......] - ETA: 13s
170860544/221551911 [======================>.......] - ETA: 13s
171057152/221551911 [======================>.......] - ETA: 13s
171253760/221551911 [======================>.......] - ETA: 13s
171450368/221551911 [======================>.......] - ETA: 13s
171646976/221551911 [======================>.......] - ETA: 13s
171843584/221551911 [======================>.......] - ETA: 13s
172040192/221551911 [======================>.......] - ETA: 13s
172236800/221551911 [======================>.......] - ETA: 13s
172433408/221551911 [======================>.......] - ETA: 13s
172630016/221551911 [======================>.......] - ETA: 13s
172826624/221551911 [======================>.......] - ETA: 13s
173023232/221551911 [======================>.......] - ETA: 13s
173219840/221551911 [======================>.......] - ETA: 13s
173416448/221551911 [======================>.......] - ETA: 12s
173613056/221551911 [======================>.......] - ETA: 12s
173809664/221551911 [======================>.......] - ETA: 12s
174006272/221551911 [======================>.......] - ETA: 12s
174202880/221551911 [======================>.......] - ETA: 12s
174399488/221551911 [======================>.......] - ETA: 12s
174596096/221551911 [======================>.......] - ETA: 12s
174792704/221551911 [======================>.......] - ETA: 12s
174989312/221551911 [======================>.......] - ETA: 12s
175185920/221551911 [======================>.......] - ETA: 12s
175382528/221551911 [======================>.......] - ETA: 12s
175579136/221551911 [======================>.......] - ETA: 12s
175775744/221551911 [======================>.......] - ETA: 12s
175972352/221551911 [======================>.......] - ETA: 12s
176168960/221551911 [======================>.......] - ETA: 12s
176365568/221551911 [======================>.......] - ETA: 12s
176562176/221551911 [======================>.......] - ETA: 12s
176758784/221551911 [======================>.......] - ETA: 12s
176955392/221551911 [======================>.......] - ETA: 12s
177152000/221551911 [======================>.......] - ETA: 11s
177348608/221551911 [=======================>......] - ETA: 11s
177545216/221551911 [=======================>......] - ETA: 11s
177741824/221551911 [=======================>......] - ETA: 11s
177938432/221551911 [=======================>......] - ETA: 11s
178135040/221551911 [=======================>......] - ETA: 11s
178331648/221551911 [=======================>......] - ETA: 11s
178528256/221551911 [=======================>......] - ETA: 11s
178724864/221551911 [=======================>......] - ETA: 11s
178921472/221551911 [=======================>......] - ETA: 11s
179118080/221551911 [=======================>......] - ETA: 11s
179314688/221551911 [=======================>......] - ETA: 11s
179511296/221551911 [=======================>......] - ETA: 11s
179707904/221551911 [=======================>......] - ETA: 11s
179904512/221551911 [=======================>......] - ETA: 11s
180101120/221551911 [=======================>......] - ETA: 11s
180297728/221551911 [=======================>......] - ETA: 11s
180494336/221551911 [=======================>......] - ETA: 11s
180690944/221551911 [=======================>......] - ETA: 11s
180887552/221551911 [=======================>......] - ETA: 10s
181084160/221551911 [=======================>......] - ETA: 10s
181280768/221551911 [=======================>......] - ETA: 10s
181477376/221551911 [=======================>......] - ETA: 10s
181673984/221551911 [=======================>......] - ETA: 10s
181870592/221551911 [=======================>......] - ETA: 10s
182067200/221551911 [=======================>......] - ETA: 10s
182263808/221551911 [=======================>......] - ETA: 10s
182460416/221551911 [=======================>......] - ETA: 10s
182657024/221551911 [=======================>......] - ETA: 10s
182853632/221551911 [=======================>......] - ETA: 10s
183050240/221551911 [=======================>......] - ETA: 10s
183246848/221551911 [=======================>......] - ETA: 10s
183443456/221551911 [=======================>......] - ETA: 10s
183640064/221551911 [=======================>......] - ETA: 10s
183836672/221551911 [=======================>......] - ETA: 10s
184033280/221551911 [=======================>......] - ETA: 10s
184229888/221551911 [=======================>......] - ETA: 10s
184426496/221551911 [=======================>......] - ETA: 10s
184623104/221551911 [=======================>......] - ETA: 9s 
184819712/221551911 [========================>.....] - ETA: 9s
185016320/221551911 [========================>.....] - ETA: 9s
185212928/221551911 [========================>.....] - ETA: 9s
185409536/221551911 [========================>.....] - ETA: 9s
185606144/221551911 [========================>.....] - ETA: 9s
185802752/221551911 [========================>.....] - ETA: 9s
185999360/221551911 [========================>.....] - ETA: 9s
186195968/221551911 [========================>.....] - ETA: 9s
186392576/221551911 [========================>.....] - ETA: 9s
186589184/221551911 [========================>.....] - ETA: 9s
186785792/221551911 [========================>.....] - ETA: 9s
186982400/221551911 [========================>.....] - ETA: 9s
187179008/221551911 [========================>.....] - ETA: 9s
187375616/221551911 [========================>.....] - ETA: 9s
187572224/221551911 [========================>.....] - ETA: 9s
187768832/221551911 [========================>.....] - ETA: 9s
187965440/221551911 [========================>.....] - ETA: 9s
188162048/221551911 [========================>.....] - ETA: 9s
188358656/221551911 [========================>.....] - ETA: 8s
188555264/221551911 [========================>.....] - ETA: 8s
188751872/221551911 [========================>.....] - ETA: 8s
188948480/221551911 [========================>.....] - ETA: 8s
189145088/221551911 [========================>.....] - ETA: 8s
189341696/221551911 [========================>.....] - ETA: 8s
189538304/221551911 [========================>.....] - ETA: 8s
189734912/221551911 [========================>.....] - ETA: 8s
189931520/221551911 [========================>.....] - ETA: 8s
190128128/221551911 [========================>.....] - ETA: 8s
190324736/221551911 [========================>.....] - ETA: 8s
190521344/221551911 [========================>.....] - ETA: 8s
190717952/221551911 [========================>.....] - ETA: 8s
190914560/221551911 [========================>.....] - ETA: 8s
191111168/221551911 [========================>.....] - ETA: 8s
191307776/221551911 [========================>.....] - ETA: 8s
191504384/221551911 [========================>.....] - ETA: 8s
191700992/221551911 [========================>.....] - ETA: 8s
191897600/221551911 [========================>.....] - ETA: 8s
192094208/221551911 [=========================>....] - ETA: 7s
192290816/221551911 [=========================>....] - ETA: 7s
192487424/221551911 [=========================>....] - ETA: 7s
192684032/221551911 [=========================>....] - ETA: 7s
192880640/221551911 [=========================>....] - ETA: 7s
193077248/221551911 [=========================>....] - ETA: 7s
193273856/221551911 [=========================>....] - ETA: 7s
193470464/221551911 [=========================>....] - ETA: 7s
193667072/221551911 [=========================>....] - ETA: 7s
193863680/221551911 [=========================>....] - ETA: 7s
194060288/221551911 [=========================>....] - ETA: 7s
194256896/221551911 [=========================>....] - ETA: 7s
194453504/221551911 [=========================>....] - ETA: 7s
194650112/221551911 [=========================>....] - ETA: 7s
194846720/221551911 [=========================>....] - ETA: 7s
195043328/221551911 [=========================>....] - ETA: 7s
195239936/221551911 [=========================>....] - ETA: 7s
195436544/221551911 [=========================>....] - ETA: 7s
195633152/221551911 [=========================>....] - ETA: 6s
195829760/221551911 [=========================>....] - ETA: 6s
196026368/221551911 [=========================>....] - ETA: 6s
196222976/221551911 [=========================>....] - ETA: 6s
196419584/221551911 [=========================>....] - ETA: 6s
196616192/221551911 [=========================>....] - ETA: 6s
196812800/221551911 [=========================>....] - ETA: 6s
197009408/221551911 [=========================>....] - ETA: 6s
197206016/221551911 [=========================>....] - ETA: 6s
197402624/221551911 [=========================>....] - ETA: 6s
197599232/221551911 [=========================>....] - ETA: 6s
197795840/221551911 [=========================>....] - ETA: 6s
197992448/221551911 [=========================>....] - ETA: 6s
198189056/221551911 [=========================>....] - ETA: 6s
198385664/221551911 [=========================>....] - ETA: 6s
198582272/221551911 [=========================>....] - ETA: 6s
198778880/221551911 [=========================>....] - ETA: 6s
198975488/221551911 [=========================>....] - ETA: 6s
199172096/221551911 [=========================>....] - ETA: 6s
199368704/221551911 [=========================>....] - ETA: 5s
199565312/221551911 [==========================>...] - ETA: 5s
199761920/221551911 [==========================>...] - ETA: 5s
199958528/221551911 [==========================>...] - ETA: 5s
200155136/221551911 [==========================>...] - ETA: 5s
200351744/221551911 [==========================>...] - ETA: 5s
200548352/221551911 [==========================>...] - ETA: 5s
200744960/221551911 [==========================>...] - ETA: 5s
200941568/221551911 [==========================>...] - ETA: 5s
201138176/221551911 [==========================>...] - ETA: 5s
201334784/221551911 [==========================>...] - ETA: 5s
201531392/221551911 [==========================>...] - ETA: 5s
201728000/221551911 [==========================>...] - ETA: 5s
201924608/221551911 [==========================>...] - ETA: 5s
202121216/221551911 [==========================>...] - ETA: 5s
202317824/221551911 [==========================>...] - ETA: 5s
202514432/221551911 [==========================>...] - ETA: 5s
202711040/221551911 [==========================>...] - ETA: 5s
202907648/221551911 [==========================>...] - ETA: 5s
203104256/221551911 [==========================>...] - ETA: 4s
203300864/221551911 [==========================>...] - ETA: 4s
203497472/221551911 [==========================>...] - ETA: 4s
203694080/221551911 [==========================>...] - ETA: 4s
203890688/221551911 [==========================>...] - ETA: 4s
204087296/221551911 [==========================>...] - ETA: 4s
204283904/221551911 [==========================>...] - ETA: 4s
204480512/221551911 [==========================>...] - ETA: 4s
204677120/221551911 [==========================>...] - ETA: 4s
204873728/221551911 [==========================>...] - ETA: 4s
205070336/221551911 [==========================>...] - ETA: 4s
205266944/221551911 [==========================>...] - ETA: 4s
205463552/221551911 [==========================>...] - ETA: 4s
205660160/221551911 [==========================>...] - ETA: 4s
205856768/221551911 [==========================>...] - ETA: 4s
206053376/221551911 [==========================>...] - ETA: 4s
206249984/221551911 [==========================>...] - ETA: 4s
206446592/221551911 [==========================>...] - ETA: 4s
206643200/221551911 [==========================>...] - ETA: 4s
206839808/221551911 [===========================>..] - ETA: 3s
207036416/221551911 [===========================>..] - ETA: 3s
207233024/221551911 [===========================>..] - ETA: 3s
207429632/221551911 [===========================>..] - ETA: 3s
207626240/221551911 [===========================>..] - ETA: 3s
207822848/221551911 [===========================>..] - ETA: 3s
208019456/221551911 [===========================>..] - ETA: 3s
208216064/221551911 [===========================>..] - ETA: 3s
208412672/221551911 [===========================>..] - ETA: 3s
208609280/221551911 [===========================>..] - ETA: 3s
208805888/221551911 [===========================>..] - ETA: 3s
209002496/221551911 [===========================>..] - ETA: 3s
209199104/221551911 [===========================>..] - ETA: 3s
209395712/221551911 [===========================>..] - ETA: 3s
209592320/221551911 [===========================>..] - ETA: 3s
209788928/221551911 [===========================>..] - ETA: 3s
209985536/221551911 [===========================>..] - ETA: 3s
210182144/221551911 [===========================>..] - ETA: 3s
210378752/221551911 [===========================>..] - ETA: 3s
210575360/221551911 [===========================>..] - ETA: 2s
210771968/221551911 [===========================>..] - ETA: 2s
210968576/221551911 [===========================>..] - ETA: 2s
211165184/221551911 [===========================>..] - ETA: 2s
211361792/221551911 [===========================>..] - ETA: 2s
211558400/221551911 [===========================>..] - ETA: 2s
211755008/221551911 [===========================>..] - ETA: 2s
211951616/221551911 [===========================>..] - ETA: 2s
212148224/221551911 [===========================>..] - ETA: 2s
212344832/221551911 [===========================>..] - ETA: 2s
212541440/221551911 [===========================>..] - ETA: 2s
212738048/221551911 [===========================>..] - ETA: 2s
212934656/221551911 [===========================>..] - ETA: 2s
213131264/221551911 [===========================>..] - ETA: 2s
213327872/221551911 [===========================>..] - ETA: 2s
213524480/221551911 [===========================>..] - ETA: 2s
213721088/221551911 [===========================>..] - ETA: 2s
213917696/221551911 [===========================>..] - ETA: 2s
214114304/221551911 [===========================>..] - ETA: 2s
214310912/221551911 [============================>.] - ETA: 1s
214507520/221551911 [============================>.] - ETA: 1s
214704128/221551911 [============================>.] - ETA: 1s
214900736/221551911 [============================>.] - ETA: 1s
215097344/221551911 [============================>.] - ETA: 1s
215293952/221551911 [============================>.] - ETA: 1s
215490560/221551911 [============================>.] - ETA: 1s
215687168/221551911 [============================>.] - ETA: 1s
215883776/221551911 [============================>.] - ETA: 1s
216080384/221551911 [============================>.] - ETA: 1s
216276992/221551911 [============================>.] - ETA: 1s
216473600/221551911 [============================>.] - ETA: 1s
216670208/221551911 [============================>.] - ETA: 1s
216866816/221551911 [============================>.] - ETA: 1s
217063424/221551911 [============================>.] - ETA: 1s
217260032/221551911 [============================>.] - ETA: 1s
217456640/221551911 [============================>.] - ETA: 1s
217653248/221551911 [============================>.] - ETA: 1s
217849856/221551911 [============================>.] - ETA: 0s
218046464/221551911 [============================>.] - ETA: 0s
218243072/221551911 [============================>.] - ETA: 0s
218439680/221551911 [============================>.] - ETA: 0s
218636288/221551911 [============================>.] - ETA: 0s
218832896/221551911 [============================>.] - ETA: 0s
219029504/221551911 [============================>.] - ETA: 0s
219226112/221551911 [============================>.] - ETA: 0s
219422720/221551911 [============================>.] - ETA: 0s
219619328/221551911 [============================>.] - ETA: 0s
219815936/221551911 [============================>.] - ETA: 0s
220012544/221551911 [============================>.] - ETA: 0s
220209152/221551911 [============================>.] - ETA: 0s
220405760/221551911 [============================>.] - ETA: 0s
220602368/221551911 [============================>.] - ETA: 0s
220798976/221551911 [============================>.] - ETA: 0s
220995584/221551911 [============================>.] - ETA: 0s
221192192/221551911 [============================>.] - ETA: 0s
221388800/221551911 [============================>.] - ETA: 0s
221552640/221551911 [==============================] - 60s 0us/step
Loaded VOC2007 test data for car and person classes: 2500 images.

Anchors can also be computed easily using YOLO toolkit.

Note

The following code is given as an example. In a real use case scenario, anchors are computed on the training dataset.

from akida_models.detection.generate_anchors import generate_anchors

num_anchors = 5
grid_size = (7, 7)
anchors_example = generate_anchors(val_data, num_anchors, grid_size)

Out:

Average IOU for 5 anchors: 0.62
Anchors:  [[0.54732, 1.13831], [1.40199, 1.97749], [1.49667, 4.1528], [2.99261, 4.73019], [5.53286, 5.46107]]

3. Model architecture

The model zoo contains a YOLO model that is built upon the MobileNet architecture and 3 separable convolutional layers at the top for bounding box and class estimation followed by a final separable convolutional which is the detection layer. Note that for efficiency, the alpha parameter in MobileNet (network width or number of filter in each layer) is set to 0.5.

from akida_models import yolo_base

# Create a yolo model for 2 classes with 5 anchors and grid size of 7
classes = 2

model = yolo_base(input_shape=(224, 224, 3),
                  classes=classes,
                  nb_box=num_anchors,
                  alpha=0.5)
model.summary()

Out:

Model: "yolo_base"
_________________________________________________________________
Layer (type)                 Output Shape              Param #
=================================================================
input_27 (InputLayer)        [(None, 224, 224, 3)]     0
_________________________________________________________________
conv_0 (Conv2D)              (None, 112, 112, 16)      432
_________________________________________________________________
conv_0_BN (BatchNormalizatio (None, 112, 112, 16)      64
_________________________________________________________________
conv_0_relu (ReLU)           (None, 112, 112, 16)      0
_________________________________________________________________
separable_1 (SeparableConv2D (None, 112, 112, 32)      656
_________________________________________________________________
separable_1_BN (BatchNormali (None, 112, 112, 32)      128
_________________________________________________________________
separable_1_relu (ReLU)      (None, 112, 112, 32)      0
_________________________________________________________________
separable_2 (SeparableConv2D (None, 112, 112, 64)      2336
_________________________________________________________________
separable_2_maxpool (MaxPool (None, 56, 56, 64)        0
_________________________________________________________________
separable_2_BN (BatchNormali (None, 56, 56, 64)        256
_________________________________________________________________
separable_2_relu (ReLU)      (None, 56, 56, 64)        0
_________________________________________________________________
separable_3 (SeparableConv2D (None, 56, 56, 64)        4672
_________________________________________________________________
separable_3_BN (BatchNormali (None, 56, 56, 64)        256
_________________________________________________________________
separable_3_relu (ReLU)      (None, 56, 56, 64)        0
_________________________________________________________________
separable_4 (SeparableConv2D (None, 56, 56, 128)       8768
_________________________________________________________________
separable_4_maxpool (MaxPool (None, 28, 28, 128)       0
_________________________________________________________________
separable_4_BN (BatchNormali (None, 28, 28, 128)       512
_________________________________________________________________
separable_4_relu (ReLU)      (None, 28, 28, 128)       0
_________________________________________________________________
separable_5 (SeparableConv2D (None, 28, 28, 128)       17536
_________________________________________________________________
separable_5_BN (BatchNormali (None, 28, 28, 128)       512
_________________________________________________________________
separable_5_relu (ReLU)      (None, 28, 28, 128)       0
_________________________________________________________________
separable_6 (SeparableConv2D (None, 28, 28, 256)       33920
_________________________________________________________________
separable_6_maxpool (MaxPool (None, 14, 14, 256)       0
_________________________________________________________________
separable_6_BN (BatchNormali (None, 14, 14, 256)       1024
_________________________________________________________________
separable_6_relu (ReLU)      (None, 14, 14, 256)       0
_________________________________________________________________
separable_7 (SeparableConv2D (None, 14, 14, 256)       67840
_________________________________________________________________
separable_7_BN (BatchNormali (None, 14, 14, 256)       1024
_________________________________________________________________
separable_7_relu (ReLU)      (None, 14, 14, 256)       0
_________________________________________________________________
separable_8 (SeparableConv2D (None, 14, 14, 256)       67840
_________________________________________________________________
separable_8_BN (BatchNormali (None, 14, 14, 256)       1024
_________________________________________________________________
separable_8_relu (ReLU)      (None, 14, 14, 256)       0
_________________________________________________________________
separable_9 (SeparableConv2D (None, 14, 14, 256)       67840
_________________________________________________________________
separable_9_BN (BatchNormali (None, 14, 14, 256)       1024
_________________________________________________________________
separable_9_relu (ReLU)      (None, 14, 14, 256)       0
_________________________________________________________________
separable_10 (SeparableConv2 (None, 14, 14, 256)       67840
_________________________________________________________________
separable_10_BN (BatchNormal (None, 14, 14, 256)       1024
_________________________________________________________________
separable_10_relu (ReLU)     (None, 14, 14, 256)       0
_________________________________________________________________
separable_11 (SeparableConv2 (None, 14, 14, 256)       67840
_________________________________________________________________
separable_11_BN (BatchNormal (None, 14, 14, 256)       1024
_________________________________________________________________
separable_11_relu (ReLU)     (None, 14, 14, 256)       0
_________________________________________________________________
separable_12 (SeparableConv2 (None, 14, 14, 512)       133376
_________________________________________________________________
separable_12_maxpool (MaxPoo (None, 7, 7, 512)         0
_________________________________________________________________
separable_12_BN (BatchNormal (None, 7, 7, 512)         2048
_________________________________________________________________
separable_12_relu (ReLU)     (None, 7, 7, 512)         0
_________________________________________________________________
separable_13 (SeparableConv2 (None, 7, 7, 512)         266752
_________________________________________________________________
separable_13_BN (BatchNormal (None, 7, 7, 512)         2048
_________________________________________________________________
separable_13_relu (ReLU)     (None, 7, 7, 512)         0
_________________________________________________________________
1conv (SeparableConv2D)      (None, 7, 7, 1024)        528896
_________________________________________________________________
1conv_BN (BatchNormalization (None, 7, 7, 1024)        4096
_________________________________________________________________
1conv_relu (ReLU)            (None, 7, 7, 1024)        0
_________________________________________________________________
2conv (SeparableConv2D)      (None, 7, 7, 1024)        1057792
_________________________________________________________________
2conv_BN (BatchNormalization (None, 7, 7, 1024)        4096
_________________________________________________________________
2conv_relu (ReLU)            (None, 7, 7, 1024)        0
_________________________________________________________________
3conv (SeparableConv2D)      (None, 7, 7, 1024)        1057792
_________________________________________________________________
3conv_BN (BatchNormalization (None, 7, 7, 1024)        4096
_________________________________________________________________
3conv_relu (ReLU)            (None, 7, 7, 1024)        0
_________________________________________________________________
detection_layer (SeparableCo (None, 7, 7, 35)          45091
=================================================================
Total params: 3,521,475
Trainable params: 3,509,347
Non-trainable params: 12,128
_________________________________________________________________

The model output can be reshaped to a more natural shape of:

(grid_height, grid_width, anchors_box, 4 + 1 + num_classes)

where the “4 + 1” term represents the coordinates of the estimated bounding boxes (top left x, top left y, width and height) and a confidence score. In other words, the output channels are actually grouped by anchor boxes, and in each group one channel provides either a coordinate, a global confidence score or a class confidence score. This process is done automatically in the decode_output function.

from tensorflow.keras import Model
from tensorflow.keras.layers import Reshape

# Define a reshape output to be added to the YOLO model
output = Reshape((grid_size[1], grid_size[0], num_anchors, 4 + 1 + classes),
                 name="YOLO_output")(model.output)

# Build the complete model
full_model = Model(model.input, output)
full_model.output

Out:

<KerasTensor: shape=(None, 7, 7, 5, 7) dtype=float32 (created by layer 'YOLO_output')>

4. Training

As the YOLO model relies on Brainchip MobileNet/ImageNet network, it is possible to perform transfer learning from ImageNet pretrained weights when training a YOLO model. See the cats vs. dogs transfer learning example for a detail explanation on transfer learning principles.

When using transfer learning for YOLO training, we advise to proceed in several steps that include step-wise quantization:

  • instantiate the yolo_base model and load MobileNet/ImageNet pretrained float weights,

  • freeze the MobileNet layers and perform training,

  • unfreeze all layers, lower the learning rate and quantize the network (e.g to 8-bits weights and activations),

  • quantize to a lower bitwidth until reaching the target bitwidth and retrain.

Even if transfer learning should be the preferred way to train a YOLO model, it has been observed that for some datasets training all layers from scratch gives better results. That is the case for our YOLO WiderFace model to detect faces. In such a case, the training pipeline to follow is described in the typical training scenario.

5. Performance

The model zoo also contains an helper method that allows to create a YOLO model for VOC and load pretrained weights for the car and person detection task and the corresponding anchors. The anchors are used to interpret the model outputs.

The metric used to evaluate YOLO is the mean average precision (mAP) which is the percentage of correct prediction and is given for an intersection over union (IoU) ratio. Scores in this example are given for the standard IoU of 0.5 meaning that a detection is considered valid if the intersection over union ratio with its ground truth equivalent is above 0.5.

Note

A call to evaluate_map will preprocess the images, make the call to Model.predict and use decode_output before computing precision for all classes.

Reported performanced for all training steps are as follows:

Float

8-bit/8-bit

4-bit/4-bit

Global mAP

42.07 %

41.45 %

30.23 %

from timeit import default_timer as timer
from akida_models import yolo_voc_pretrained
from akida_models.detection.map_evaluation import MapEvaluation

# Load the pretrained model along with anchors
model_keras, anchors = yolo_voc_pretrained()

# Define the final reshape and build the model
output = Reshape((grid_size[1], grid_size[0], num_anchors, 4 + 1 + classes),
                 name="YOLO_output")(model_keras.output)
model_keras = Model(model_keras.input, output)

# Create the mAP evaluator object
num_images = 100

map_evaluator = MapEvaluation(model_keras, val_data[:num_images], labels,
                              anchors)

# Compute the scores for all validation images
start = timer()
mAP, average_precisions = map_evaluator.evaluate_map()
end = timer()

for label, average_precision in average_precisions.items():
    print(labels[label], '{:.4f}'.format(average_precision))
print('mAP: {:.4f}'.format(mAP))
print(f'Keras inference on {num_images} images took {end-start:.2f} s.\n')

Out:

Downloading data from http://data.brainchip.com/dataset-mirror/voc/voc_anchors.pkl

8192/126 [==============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================] - 0s 0us/step
Downloading data from http://data.brainchip.com/models/yolo/yolo_voc_iq8_wq4_aq4.h5

    8192/14126472 [..............................] - ETA: 28s
   65536/14126472 [..............................] - ETA: 14s
  204800/14126472 [..............................] - ETA: 8s 
  401408/14126472 [..............................] - ETA: 5s
  598016/14126472 [>.............................] - ETA: 5s
  794624/14126472 [>.............................] - ETA: 4s
  991232/14126472 [=>............................] - ETA: 4s
 1187840/14126472 [=>............................] - ETA: 4s
 1384448/14126472 [=>............................] - ETA: 4s
 1581056/14126472 [==>...........................] - ETA: 3s
 1777664/14126472 [==>...........................] - ETA: 3s
 1974272/14126472 [===>..........................] - ETA: 3s
 2170880/14126472 [===>..........................] - ETA: 3s
 2367488/14126472 [====>.........................] - ETA: 3s
 2564096/14126472 [====>.........................] - ETA: 3s
 2760704/14126472 [====>.........................] - ETA: 3s
 2957312/14126472 [=====>........................] - ETA: 3s
 3153920/14126472 [=====>........................] - ETA: 3s
 3350528/14126472 [======>.......................] - ETA: 3s
 3547136/14126472 [======>.......................] - ETA: 3s
 3743744/14126472 [======>.......................] - ETA: 3s
 3940352/14126472 [=======>......................] - ETA: 2s
 4136960/14126472 [=======>......................] - ETA: 2s
 4333568/14126472 [========>.....................] - ETA: 2s
 4530176/14126472 [========>.....................] - ETA: 2s
 4726784/14126472 [=========>....................] - ETA: 2s
 4923392/14126472 [=========>....................] - ETA: 2s
 5120000/14126472 [=========>....................] - ETA: 2s
 5316608/14126472 [==========>...................] - ETA: 2s
 5513216/14126472 [==========>...................] - ETA: 2s
 5709824/14126472 [===========>..................] - ETA: 2s
 5906432/14126472 [===========>..................] - ETA: 2s
 6103040/14126472 [===========>..................] - ETA: 2s
 6299648/14126472 [============>.................] - ETA: 2s
 6496256/14126472 [============>.................] - ETA: 2s
 6692864/14126472 [=============>................] - ETA: 2s
 6889472/14126472 [=============>................] - ETA: 2s
 7086080/14126472 [==============>...............] - ETA: 1s
 7282688/14126472 [==============>...............] - ETA: 1s
 7479296/14126472 [==============>...............] - ETA: 1s
 7675904/14126472 [===============>..............] - ETA: 1s
 7872512/14126472 [===============>..............] - ETA: 1s
 8069120/14126472 [================>.............] - ETA: 1s
 8265728/14126472 [================>.............] - ETA: 1s
 8462336/14126472 [================>.............] - ETA: 1s
 8658944/14126472 [=================>............] - ETA: 1s
 8855552/14126472 [=================>............] - ETA: 1s
 9052160/14126472 [==================>...........] - ETA: 1s
 9248768/14126472 [==================>...........] - ETA: 1s
 9445376/14126472 [===================>..........] - ETA: 1s
 9641984/14126472 [===================>..........] - ETA: 1s
 9838592/14126472 [===================>..........] - ETA: 1s
10035200/14126472 [====================>.........] - ETA: 1s
10231808/14126472 [====================>.........] - ETA: 1s
10428416/14126472 [=====================>........] - ETA: 1s
10625024/14126472 [=====================>........] - ETA: 0s
10821632/14126472 [=====================>........] - ETA: 0s
11018240/14126472 [======================>.......] - ETA: 0s
11214848/14126472 [======================>.......] - ETA: 0s
11411456/14126472 [=======================>......] - ETA: 0s
11608064/14126472 [=======================>......] - ETA: 0s
11804672/14126472 [========================>.....] - ETA: 0s
12001280/14126472 [========================>.....] - ETA: 0s
12197888/14126472 [========================>.....] - ETA: 0s
12394496/14126472 [=========================>....] - ETA: 0s
12591104/14126472 [=========================>....] - ETA: 0s
12787712/14126472 [==========================>...] - ETA: 0s
12984320/14126472 [==========================>...] - ETA: 0s
13049856/14126472 [==========================>...] - ETA: 0s
13246464/14126472 [===========================>..] - ETA: 0s
13443072/14126472 [===========================>..] - ETA: 0s
13639680/14126472 [===========================>..] - ETA: 0s
13836288/14126472 [============================>.] - ETA: 0s
14032896/14126472 [============================>.] - ETA: 0s
14131200/14126472 [==============================] - 4s 0us/step
car 0.2669
person 0.2876
mAP: 0.2773
Keras inference on 100 images took 4.11 s.

6. Conversion to Akida

6.1 Convert to Akida model

Check model compatibility before akida conversion

from cnn2snn import check_model_compatibility

compat = check_model_compatibility(model_keras, False)

Out:

The Keras quantized model is not compatible for a conversion to an Akida model:
 The Reshape layer YOLO_output can only be used to transform a tensor of shape (N,) to a tensor of shape (1, 1, N), and vice-versa. Receives input_shape (7, 7, 35) and output_shape (7, 7, 5, 7).

The last YOLO_output layer that was added for splitting channels into values for each box must be removed before akida conversion.

# Rebuild a model without the last layer
compatible_model = Model(model_keras.input, model_keras.layers[-2].output)

When converting to an Akida model, we just need to pass the Keras model and the input scaling that was used during training to cnn2snn.convert. In YOLO preprocess_image function, images are zero centered and normalized between [-1, 1] hence the scaling values.

from cnn2snn import convert

model_akida = convert(compatible_model, input_scaling=(127.5, 127.5))
model_akida.summary()

Out:

                 Model Summary
________________________________________________
Input shape    Output shape  Sequences  Layers
================================================
[224, 224, 3]  [7, 7, 35]    1          18
________________________________________________

                             SW/conv_0-detection_layer (Software)
_______________________________________________________________________________________________
Layer (type)                              Output shape    Kernel shape
===============================================================================================
conv_0 (InputConvolutional)               [112, 112, 16]  (3, 3, 3, 16)
_______________________________________________________________________________________________
separable_1 (SeparableConvolutional)      [112, 112, 32]  (3, 3, 16, 1), (1, 1, 16, 32)
_______________________________________________________________________________________________
separable_2 (SeparableConvolutional)      [56, 56, 64]    (3, 3, 32, 1), (1, 1, 32, 64)
_______________________________________________________________________________________________
separable_3 (SeparableConvolutional)      [56, 56, 64]    (3, 3, 64, 1), (1, 1, 64, 64)
_______________________________________________________________________________________________
separable_4 (SeparableConvolutional)      [28, 28, 128]   (3, 3, 64, 1), (1, 1, 64, 128)
_______________________________________________________________________________________________
separable_5 (SeparableConvolutional)      [28, 28, 128]   (3, 3, 128, 1), (1, 1, 128, 128)
_______________________________________________________________________________________________
separable_6 (SeparableConvolutional)      [14, 14, 256]   (3, 3, 128, 1), (1, 1, 128, 256)
_______________________________________________________________________________________________
separable_7 (SeparableConvolutional)      [14, 14, 256]   (3, 3, 256, 1), (1, 1, 256, 256)
_______________________________________________________________________________________________
separable_8 (SeparableConvolutional)      [14, 14, 256]   (3, 3, 256, 1), (1, 1, 256, 256)
_______________________________________________________________________________________________
separable_9 (SeparableConvolutional)      [14, 14, 256]   (3, 3, 256, 1), (1, 1, 256, 256)
_______________________________________________________________________________________________
separable_10 (SeparableConvolutional)     [14, 14, 256]   (3, 3, 256, 1), (1, 1, 256, 256)
_______________________________________________________________________________________________
separable_11 (SeparableConvolutional)     [14, 14, 256]   (3, 3, 256, 1), (1, 1, 256, 256)
_______________________________________________________________________________________________
separable_12 (SeparableConvolutional)     [7, 7, 512]     (3, 3, 256, 1), (1, 1, 256, 512)
_______________________________________________________________________________________________
separable_13 (SeparableConvolutional)     [7, 7, 512]     (3, 3, 512, 1), (1, 1, 512, 512)
_______________________________________________________________________________________________
1conv (SeparableConvolutional)            [7, 7, 1024]    (3, 3, 512, 1), (1, 1, 512, 1024)
_______________________________________________________________________________________________
2conv (SeparableConvolutional)            [7, 7, 1024]    (3, 3, 1024, 1), (1, 1, 1024, 1024)
_______________________________________________________________________________________________
3conv (SeparableConvolutional)            [7, 7, 1024]    (3, 3, 1024, 1), (1, 1, 1024, 1024)
_______________________________________________________________________________________________
detection_layer (SeparableConvolutional)  [7, 7, 35]      (3, 3, 1024, 1), (1, 1, 1024, 35)
_______________________________________________________________________________________________

6.1 Check performance

Akida model accuracy is tested on the first n images of the validation set.

The table below summarizes the expected results:

#Images

Keras mAP

Akida mAP

100

27.82 %

27.18 %

1000

30.65 %

30.83 %

2500

30.23 %

29.39 %

# Create the mAP evaluator object
map_evaluator_ak = MapEvaluation(model_akida,
                                 val_data[:num_images],
                                 labels,
                                 anchors,
                                 is_keras_model=False)

# Compute the scores for all validation images
start = timer()
mAP_ak, average_precisions_ak = map_evaluator_ak.evaluate_map()
end = timer()

for label, average_precision in average_precisions_ak.items():
    print(labels[label], '{:.4f}'.format(average_precision))
print('mAP: {:.4f}'.format(mAP_ak))
print(f'Akida inference on {num_images} images took {end-start:.2f} s.\n')

Out:

car 0.2552
person 0.2852
mAP: 0.2702
Akida inference on 100 images took 22.80 s.

6.2 Show predictions for a random image

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as patches

from akida_models.detection.processing import load_image, preprocess_image, decode_output

# Take a random test image
i = np.random.randint(len(val_data))

input_shape = model_akida.layers[0].input_dims

# Load the image
raw_image = load_image(val_data[i]['image_path'])

# Keep the original image size for later bounding boxes rescaling
raw_height, raw_width, _ = raw_image.shape

# Pre-process the image
image = preprocess_image(raw_image, input_shape, False)
input_image = image[np.newaxis, :].astype(np.uint8)

# Call evaluate on the image
pots = model_akida.evaluate(input_image)[0]

# Reshape the potentials to prepare for decoding
w, h, c = pots.shape
pots = pots.reshape((w, h, len(anchors), 4 + 1 + len(labels)))

# Akida potentials are transposed because they are given in (W,H) format while
# the decode_output API uses the Keras-style (H,W).
pots = pots.transpose((1, 0, 2, 3))

# Decode potentials into bounding boxes
raw_boxes = decode_output(pots, anchors, len(labels))

# Rescale boxes to the original image size
pred_boxes = np.array([[
    box.x1 * raw_width, box.y1 * raw_height, box.x2 * raw_width,
    box.y2 * raw_height,
    box.get_label(),
    box.get_score()
] for box in raw_boxes])

fig = plt.figure(
    num='VOC2012 car and person detection by Akida Execution Engine')
ax = fig.subplots(1)
img_plot = ax.imshow(np.zeros(raw_image.shape, dtype=np.uint8))
img_plot.set_data(raw_image)

for box in pred_boxes:
    rect = patches.Rectangle((box[0], box[1]),
                             box[2] - box[0],
                             box[3] - box[1],
                             linewidth=1,
                             edgecolor='r',
                             facecolor='none')
    ax.add_patch(rect)
    class_score = ax.text(box[0],
                          box[1] - 5,
                          f"{labels[int(box[4])]} - {box[5]:.2f}",
                          color='red')

plt.axis('off')
plt.show()
plot 6 voc yolo detection

Total running time of the script: ( 1 minutes 51.128 seconds)

Gallery generated by Sphinx-Gallery