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

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_8 (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:

<tf.Tensor 'YOLO_output/Identity:0' shape=(None, 7, 7, 5, 7) dtype=float32>

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.99 %

42.13 %

35.54 %

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/14122408 [..............................] - ETA: 31s
   73728/14122408 [..............................] - ETA: 14s
  204800/14122408 [..............................] - ETA: 9s 
  401408/14122408 [..............................] - ETA: 6s
  598016/14122408 [>.............................] - ETA: 5s
  794624/14122408 [>.............................] - ETA: 5s
  991232/14122408 [=>............................] - ETA: 4s
 1187840/14122408 [=>............................] - ETA: 4s
 1384448/14122408 [=>............................] - ETA: 4s
 1581056/14122408 [==>...........................] - ETA: 4s
 1777664/14122408 [==>...........................] - ETA: 4s
 1974272/14122408 [===>..........................] - ETA: 4s
 2170880/14122408 [===>..........................] - ETA: 4s
 2367488/14122408 [====>.........................] - ETA: 3s
 2564096/14122408 [====>.........................] - ETA: 3s
 2760704/14122408 [====>.........................] - ETA: 3s
 2957312/14122408 [=====>........................] - ETA: 3s
 3153920/14122408 [=====>........................] - ETA: 3s
 3350528/14122408 [======>.......................] - ETA: 3s
 3547136/14122408 [======>.......................] - ETA: 3s
 3743744/14122408 [======>.......................] - ETA: 3s
 3940352/14122408 [=======>......................] - ETA: 3s
 4136960/14122408 [=======>......................] - ETA: 3s
 4333568/14122408 [========>.....................] - ETA: 3s
 4530176/14122408 [========>.....................] - ETA: 3s
 4726784/14122408 [=========>....................] - ETA: 3s
 4923392/14122408 [=========>....................] - ETA: 2s
 5120000/14122408 [=========>....................] - ETA: 2s
 5316608/14122408 [==========>...................] - ETA: 2s
 5513216/14122408 [==========>...................] - ETA: 2s
 5709824/14122408 [===========>..................] - ETA: 2s
 5906432/14122408 [===========>..................] - ETA: 2s
 6103040/14122408 [===========>..................] - ETA: 2s
 6299648/14122408 [============>.................] - ETA: 2s
 6496256/14122408 [============>.................] - ETA: 2s
 6692864/14122408 [=============>................] - ETA: 2s
 6889472/14122408 [=============>................] - ETA: 2s
 7086080/14122408 [==============>...............] - ETA: 2s
 7282688/14122408 [==============>...............] - ETA: 2s
 7479296/14122408 [==============>...............] - ETA: 2s
 7675904/14122408 [===============>..............] - ETA: 2s
 7872512/14122408 [===============>..............] - ETA: 1s
 8069120/14122408 [================>.............] - ETA: 1s
 8265728/14122408 [================>.............] - ETA: 1s
 8462336/14122408 [================>.............] - ETA: 1s
 8658944/14122408 [=================>............] - ETA: 1s
 8855552/14122408 [=================>............] - ETA: 1s
 9052160/14122408 [==================>...........] - ETA: 1s
 9248768/14122408 [==================>...........] - ETA: 1s
 9445376/14122408 [===================>..........] - ETA: 1s
 9641984/14122408 [===================>..........] - ETA: 1s
 9838592/14122408 [===================>..........] - ETA: 1s
10035200/14122408 [====================>.........] - ETA: 1s
10231808/14122408 [====================>.........] - ETA: 1s
10428416/14122408 [=====================>........] - ETA: 1s
10625024/14122408 [=====================>........] - ETA: 1s
10821632/14122408 [=====================>........] - ETA: 1s
11018240/14122408 [======================>.......] - ETA: 0s
11214848/14122408 [======================>.......] - ETA: 0s
11411456/14122408 [=======================>......] - ETA: 0s
11608064/14122408 [=======================>......] - ETA: 0s
11804672/14122408 [========================>.....] - ETA: 0s
12001280/14122408 [========================>.....] - ETA: 0s
12197888/14122408 [========================>.....] - ETA: 0s
12394496/14122408 [=========================>....] - ETA: 0s
12591104/14122408 [=========================>....] - ETA: 0s
12787712/14122408 [==========================>...] - ETA: 0s
12984320/14122408 [==========================>...] - ETA: 0s
13180928/14122408 [===========================>..] - ETA: 0s
13377536/14122408 [===========================>..] - ETA: 0s
13574144/14122408 [===========================>..] - ETA: 0s
13770752/14122408 [============================>.] - ETA: 0s
13967360/14122408 [============================>.] - ETA: 0s
14123008/14122408 [==============================] - 4s 0us/step
car 0.3496
person 0.3020
mAP: 0.3258
Keras inference on 100 images took 3.28 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
_______________________________________________________________________________________________
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)
_______________________________________________________________________________________________
Input shape: 224, 224, 3
Backend type: Software - 1.8.10

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

26.70 %

29.87 %

1000

32.95 %

33.47 %

2500

35.54 %

31.65 %

# 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.4114
person 0.3006
mAP: 0.3560
Akida inference on 100 images took 19.23 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 44.800 seconds)

Gallery generated by Sphinx-Gallery