All Projects → guichristmann → edge-tpu-tiny-yolo

guichristmann / edge-tpu-tiny-yolo

Licence: MIT license
Run Tiny YOLO-v3 on Google's Edge TPU USB Accelerator.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to edge-tpu-tiny-yolo

yolo3 tensorflow
yolo3 implement by tensorflow, including mobilenet_v1, mobilenet_v2
Stars: ✭ 48 (-48.94%)
Mutual labels:  yolov3, yolov3-tiny
go-darknet
Go bindings for Darknet (YOLO v4 / v3)
Stars: ✭ 56 (-40.43%)
Mutual labels:  yolov3, yolov3-tiny
yolov4 trt ros
YOLOv4 object detector using TensorRT engine
Stars: ✭ 89 (-5.32%)
Mutual labels:  yolov3, yolov3-tiny
Tensorflow Yolov4 Tflite
YOLOv4, YOLOv4-tiny, YOLOv3, YOLOv3-tiny Implemented in Tensorflow 2.0, Android. Convert YOLO v4 .weights tensorflow, tensorrt and tflite
Stars: ✭ 1,881 (+1901.06%)
Mutual labels:  yolov3, yolov3-tiny
Yolo person detect
person detect based on yolov3 with several Python scripts
Stars: ✭ 212 (+125.53%)
Mutual labels:  yolov3
Darknet face with landmark
加入关键点的darknet训练框架,轻量级的人脸检测,支持ncnn推理
Stars: ✭ 192 (+104.26%)
Mutual labels:  yolov3
Frcnn
Faster R-CNN / R-FCN 💡 C++ version based on Caffe
Stars: ✭ 183 (+94.68%)
Mutual labels:  yolov3
Bmw Yolov4 Inference Api Cpu
This is a repository for an nocode object detection inference API using the Yolov4 and Yolov3 Opencv.
Stars: ✭ 180 (+91.49%)
Mutual labels:  yolov3
deepstream tao apps
Sample apps to demonstrate how to deploy models trained with TAO on DeepStream
Stars: ✭ 274 (+191.49%)
Mutual labels:  yolov3
Deepstream Project
This is a highly separated deployment project based on Deepstream , including the full range of Yolo and continuously expanding deployment projects such as Ocr.
Stars: ✭ 120 (+27.66%)
Mutual labels:  yolov3
Caffe Yolov3 Windows
A windows caffe implementation of YOLO detection network
Stars: ✭ 210 (+123.4%)
Mutual labels:  yolov3
Yolov3 Object Detection With Opencv
This project implements a real-time image and video object detection classifier using pretrained yolov3 models.
Stars: ✭ 191 (+103.19%)
Mutual labels:  yolov3
Paddledetection
Object Detection toolkit based on PaddlePaddle. It supports object detection, instance segmentation, multiple object tracking and real-time multi-person keypoint detection.
Stars: ✭ 5,799 (+6069.15%)
Mutual labels:  yolov3
Orb Slam2 with semantic label
orb-slam2 with semantic label
Stars: ✭ 186 (+97.87%)
Mutual labels:  yolov3
pytorch YOLO OpenVINO demo
No description or website provided.
Stars: ✭ 73 (-22.34%)
Mutual labels:  yolov3
Yolov3 Tf2
YoloV3 Implemented in Tensorflow 2.0
Stars: ✭ 2,327 (+2375.53%)
Mutual labels:  yolov3
Yolov3 deepsort
Object tracking implemented with YOLOv3, Deep Sort and Tensorflow.
Stars: ✭ 205 (+118.09%)
Mutual labels:  yolov3
pose-estimation-3d-with-stereo-camera
This demo uses a deep neural network and two generic cameras to perform 3D pose estimation.
Stars: ✭ 40 (-57.45%)
Mutual labels:  yolov3
Yolov4 Custom Functions
A Wide Range of Custom Functions for YOLOv4, YOLOv4-tiny, YOLOv3, and YOLOv3-tiny Implemented in TensorFlow, TFLite, and TensorRT.
Stars: ✭ 199 (+111.7%)
Mutual labels:  yolov3
Pine
🌲 Aimbot powered by real-time object detection with neural networks, GPU accelerated with Nvidia. Optimized for use with CS:GO.
Stars: ✭ 202 (+114.89%)
Mutual labels:  yolov3

Edge TPU - Tiny YOLO v3

Demo

This repository contains the instructions and scripts to run the Tiny YOLO-v3 on Google's Edge TPU USB Accelerator. Edge TPU can only run full quantized TF-Lite models. If you already have a converted model, simply run inference.py with --quant and --edge_tpu to test it.

usage: Run TF-Lite YOLO-V3 Tiny inference. [-h] --model MODEL --anchors
                                       ANCHORS --classes CLASSES
                                       [-t THRESHOLD] [--edge_tpu]
                                       [--quant] [--cam] [--image IMAGE]
                                       [--video VIDEO]

optional arguments:
  -h, --help            show this help message and exit
  --model MODEL         Model to load.
  --anchors ANCHORS     Anchors file.
  --classes CLASSES     Classes (.names) file.
  -t THRESHOLD, --threshold THRESHOLD
                        Detection threshold.
  --edge_tpu            Whether to delegate to Edge TPU or run on CPU.
  --quant               Indicates whether the model is quantized.
  --cam                 Run inference on webcam.
  --image IMAGE         Run inference on image.
  --video VIDEO         Run inference on video.

Note: The inference code should be run on Tensorflow 1.15.0, even though the conversion below requires TF 2.0 nightly packages. I recommend using separate anaconda environments for inference and conversion.


Conversion guide

1 - Convert darknet .weights to Keras model

The network can be trained using either the original darknet implementation (https://github.com/pjreddie/darknet) or one of its forks (e.g. https://github.com/AlexeyAB/darknet).

Important note: The Edge TPU does not support the Leaky ReLU function, so it should be replaced by the regular ReLU. (https://coral.ai/docs/edgetpu/models-intro/#supported-operations)

The darknet weights can be converted to a Keras model using: https://github.com/qqwweee/keras-yolo3. However, this implementation doesn't support the regular ReLU function. Additionally, the TF-Lite conversion later also requires the input shape to be explicit (instead of None). So, I've made a fork with the (stupidly simple) required modifications here: https://github.com/guichristmann/keras-yolo3.

python convert.py tiny-yolo-cfg.cfg darknet-weights.weights keras-filename.h5

2 - Convert Keras to TF-Lite model with full integer quantization.

To run on Edge TPU, we need to convert the Keras model to TF-Lite and apply post-training full integer quantization. https://www.tensorflow.org/lite/performance/post_training_quantization.

python keras_to_tflite_quant.py keras-model.h5 output-filename.tflite

Note: The quantization of the RESIZE_NEAREST_NEIGHBOR op is only supported in Tensorflow 2.0 nightly packages as of now, so you need use that version for thconversion.

pip install tf-nightly

3 - Compile with Edge TPU compiler

Install the Edge TPU library and compiler: https://coral.ai/docs/edgetpu/compiler/.

Run the compiler on the TF-Lite quantized model:

edgetpu_compiler quantized.tflite

If everything is correct you should get a log with every op mapped to Edge TPU:

Edge TPU Compiler version 2.0.267685300
Input: quantized.tflite
Output: quantized_edgetpu.tflite
Operator                       Count      Status
RESIZE_NEAREST_NEIGHBOR        1          Mapped to Edge TPU
MAX_POOL_2D                    6          Mapped to Edge TPU
CONCATENATION                  1          Mapped to Edge TPU
QUANTIZE                       4          Mapped to Edge TPU
CONV_2D                        13         Mapped to Edge TPU

This model can be run on Edge TPU with inference.py script.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].