/TPU-MobilenetSSD

Edge TPU Accelerator / Multi-TPU + MobileNet-SSD v2 + Python + Async + LattePandaAlpha/RaspberryPi3/LaptopPC

Primary LanguagePythonMIT LicenseMIT

TPU-MobilenetSSD

Environment

  1. LattePanda Alpha (Ubuntu16.04) / RaspberryPi3 (Raspbian) / LaptopPC (Ubuntu16.04)
  2. Edge TPU Accelerator (Supports multi-TPU)
  3. USB Camera (Playstationeye)

My articles

1.I tested the operating speed of MobileNet-SSD v2 using Google Edge TPU Accelerator with RaspberryPi3 (USB2.0) and LaptopPC (USB3.1) (MS-COCO)

2.Structure visualization of Tensorflow Lite model files (.tflite)

3.I wanted to speed up the operation of the Edge TPU Accelerator as little as possible, so I tried to generate a .tflite of MobileNetv2-SSDLite (Pascal VOC) and compile it into a TPU model. Part 1

4.Since I wanted to speed up the operation of the Edge TPU Accelerator as little as possible, I transferred and learned MobileNetv2-SSD / MobileNetv1-SSD + MS-COCO with Pascal VOC and generated .tflite. Docker Part 2

5.Since we wanted to speed up the operation of the Edge TPU Accelerator as little as possible, I transferred and learned MS-COCO with Pascal VOC and generated .tflite, Google Colaboratory [GPU]. Part 3

6.Edge TPU Accelerator + custom model MobileNetv2-SSDLite .tflite generation 【Success】 Docker compilation Part.4

7.[150 FPS ++] Connect three Coral Edge TPU accelerators to infer parallelism and get ultra-fast object detection inference performance ーTo the extreme of useless high performanceー

LattePanda Alpha Core m3 + USB 3.0 + Google Edge TPU Accelerator + MobileNet-SSD v2 + Async mode

320x240
about 80 - 90 FPS
https://youtu.be/LERXuDXn0kY

01

LattePanda Alpha Core m3 + USB 3.0 + Google Edge TPU Accelerator + MobileNet-SSD v2 + Async mode

640x480
about 60 - 80 FPS
https://youtu.be/OFEQHCQ5MsM

02

Core i7 + USB 3.0 + Google Edge TPU Accelerator / Multi-TPUs x3 + MobileNet-SSD v2 + Async mode

320x240
about 150 FPS++
https://youtu.be/_qE9kmk8gUA

03 04

Environment construction procedure

$ curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add-
$ echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" | sudo tee /etc/apt/sources.list.d/coral-edgetpu.list
$ sudo apt-get update
$ sudo apt-get upgrade edgetpu
$ wget https://dl.google.com/coral/edgetpu_api/edgetpu_api_latest.tar.gz -O edgetpu_api.tar.gz --trust-server-names
$ tar xzf edgetpu_api.tar.gz
$ cd edgetpu_api
$ bash ./install.sh

Usage

MobileNet-SSD-TPU-async.py -> USB camera animation and inference are asynchronous (The frame is slightly off.)
MobileNet-SSD-TPU-sync.py -> USB camera animation and inference are synchronous (The frame does not shift greatly.)

If you use USB3.0 USBHub and connect multiple TPUs, it automatically detects multiple TPUs and processes inferences in parallel at high speed.

$ git clone https://github.com/PINTO0309/TPU-MobilenetSSD.git
$ cd TPU-MobilenetSSD
$ python3 MobileNet-SSD-TPU-async.py
usage: MobileNet-SSD-TPU-async.py [-h] [--model MODEL] [--label LABEL]
                                  [--usbcamno USBCAMNO]

optional arguments:
  -h, --help           show this help message and exit
  --model MODEL        Path of the detection model.
  --label LABEL        Path of the labels file.
  --usbcamno USBCAMNO  USB Camera number.

Reference