• Stars
    star
    346
  • Rank 121,710 (Top 3 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created over 5 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Small code snippets that show how to stream camera images to a Coral device.

Edge TPU simple camera examples

This repo contains a collection of examples that use camera streams together with the TensorFlow Lite API with a Coral device such as the USB Accelerator or Dev Board.

Installation

  1. First, be sure you have completed the setup instructions for your Coral device. If it's been a while, repeat to be sure you have the latest software.

    Importantly, you should have the latest TensorFlow Lite runtime installed (as per the Python quickstart).

  2. Clone this Git repo onto your computer:

    mkdir google-coral && cd google-coral
    
    git clone https://github.com/google-coral/examples-camera.git --depth 1
    
  3. Download the models:

    cd examples-camera
    
    sh download_models.sh
    

    These canned models will be downloaded and extracted to a new folder all_models.

Further requirements may be needed by the different camera libraries, check the README file for the respective subfolder.

Contents

  • Gstreamer Python examples using gstreamer to obtain camera images. These examples work on Linux using a webcam, Raspberry Pi with the Raspicam and on the Coral DevBoard using the Coral camera. For the former two you will also need a Coral USB Accelerator to run the models.
  • Raspicam Python example using picamera. This is only intended for Raspberry Pi and will require a Coral USB Accelerator. Use install_requirements.sh to make sure all the dependencies are present.
  • PyGame Python example using pygame to obtain camera frames. Use install_requirements.sh to make sure all the dependencies are present.
  • OpenCV Python example using OpenCV to obtain camera frames. Use install_requirements.sh to make sure all the dependencies are present.
  • NativeApp C++ example using gstreamer to obtain camera frames. See README in the nativeapp directory on how to compile for the Coral DevBoard.

Canned models

For all the demos in this repository you can change the model and the labels file by using the flags flags --model and --labels. Be sure to use the models labeled _edgetpu, as those are compiled for the accelerator - otherwise the model will run on the CPU and be much slower.

For classification you need to select one of the classification models and its corresponding labels file:

inception_v1_224_quant_edgetpu.tflite, imagenet_labels.txt
inception_v2_224_quant_edgetpu.tflite, imagenet_labels.txt
inception_v3_299_quant_edgetpu.tflite, imagenet_labels.txt
inception_v4_299_quant_edgetpu.tflite, imagenet_labels.txt
mobilenet_v1_1.0_224_quant_edgetpu.tflite, imagenet_labels.txt
mobilenet_v2_1.0_224_quant_edgetpu.tflite, imagenet_labels.txt

mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite, inat_bird_labels.txt
mobilenet_v2_1.0_224_inat_insect_quant_edgetpu.tflite, inat_insect_labels.txt
mobilenet_v2_1.0_224_inat_plant_quant_edgetpu.tflite, inat_plant_labels.txt

For detection you need to select one of the SSD detection models and its corresponding labels file:

mobilenet_ssd_v1_coco_quant_postprocess_edgetpu.tflite, coco_labels.txt
mobilenet_ssd_v2_coco_quant_postprocess_edgetpu.tflite, coco_labels.txt
mobilenet_ssd_v2_face_quant_postprocess_edgetpu.tflite, coco_labels.txt

More Repositories

1

project-posenet

Human Pose Detection on EdgeTPU
Python
544
star
2

edgetpu

Coral issue tracker (and legacy Edge TPU API source)
C++
411
star
3

pycoral

Python API for ML inferencing and transfer-learning on Coral devices
Python
336
star
4

project-bodypix

BodyPix model demo application for Google Coral
Python
272
star
5

tflite

Examples using TensorFlow Lite API to run inference on Coral devices
Python
180
star
6

tutorials

Colab/Jupyter tutorials about training TensorFlow models for Edge TPU, and other tutorials
Jupyter Notebook
171
star
7

libedgetpu

Source code for the userspace level runtime driver for Coral.ai devices.
C++
170
star
8

project-keyword-spotter

Audio Keyphrase Detector
Python
133
star
9

example-object-tracker

Python
104
star
10

coralmicro

Source code for Coral Dev Board Micro
C++
95
star
11

edgetpu-platforms

EdgeTPU support for other platforms, specifically Raspberry Pi Zero
Shell
75
star
12

libcoral

C++ API for ML inferencing and transfer-learning on Coral devices
C++
72
star
13

project-teachable-sorter

Python
48
star
14

test_data

Trained and compiled TF Lite models, and other testing data for Coral devices
Starlark
43
star
15

project-birdfeeder

Python
38
star
16

webcoral

JavaScript
33
star
17

project-banana-robo

Python
29
star
18

project-teachable

Example Project: Teachable Machine
Python
26
star
19

electricals

Electrical designs for coral.ai projects
HTML
26
star
20

crosstool

Starlark
19
star
21

example-multiple-edgetpus

C++
14
star
22

project-cloud-monitor

Python
12
star
23

demo-manufacturing

C++
11
star
24

aiy-maker-kit

Simple Python API for ML inferencing with TF Lite and Coral Edge TPU
Python
9
star
25

imprinting-training

Imprinting training scripts of tensorflow.
Python
9
star
26

aiy-maker-kit-tools

Build scripts to create RPI OS system image for AIY Maker Kit
Python
6
star
27

mechanicals

Reference mechanical designs for coral.ai projects
5
star
28

py-repo

Python
4
star
29

demo-multi-video-stream

Demo showcasing processing multiple videostreams in parallel on system with 8 EdgeTPUs
C++
3
star
30

coralmicro-out-of-tree-sample

C++
2
star
31

coralmicro-littlefs-fuse

C
1
star