Giter VIP home page Giter VIP logo

rpi4-google-coral's Introduction

RPi4-Google-Coral

Google Coral on the Raspberry Pi 4

Update 31/10/2019 It looks like Coral software is now updated at https://coral.withgoogle.com/docs/accelerator/get-started/ Follow the installatio there now, and consider this install script deprecated.

The example scripts I have provided still work however. Watch this space for more updated!

Video up on youtube https://youtu.be/T-VjYr7sZC4

Update 3 July 2019

I have written a live object detection script (see src/picam_TPU.py) This is similar to the scripts I used with the NCS2, but for the Coral TPU. It is a test script, so models and labels are hardcoded. I wanted to it be as close to the original scripts I wrote for the NCS in order to do a fair comparison.

So far, I am getting over 36FPS video and over 36FPS inferencing on a single TPU! I will do a proper test in the daylight. Room lights at night are not sufficient.

Screenshot

Update 4 July 2019

I have written another object detection script for video files (see src/video_TPU.py) Since we can push video through the loop as fast as we can, it is possible to get 70fps and still do reasonable inferencing!

Screenshot

Getting the Coral to work with the Pi 4

The Google Coral Edge TPU device can be made to work with the Raspberry Pi 4

As per the instructions at: https://coral.withgoogle.com/docs/accelerator/get-started/

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

REPLACE install.sh with the one I have in src

THEN run the script ;-)

Note, when you run the demos, instead of here: /usr/local/lib/python3.5/dist-packages/edgetpu/demo

you need to be here!: /usr/local/lib/python3.7/dist-packages/edgetpu/demo

This script does a number of things:

Added:

  elif [[ "${MODEL}" == "Raspberry Pi 4 Model B Rev"* ]]; then #edit for rpi4
    info "Recognized as Raspberry Pi 4."
    LIBEDGETPU_SUFFIX=arm32
    HOST_GNU_TYPE=arm-linux-gnueabihf

Fixed this (which caused the script to bomb with "Need To Be Root":

sudo udevadm control --reload-rules && udevadm trigger

to this:

sudo udevadm control --reload-rules && sudo udevadm trigger  #needed to put sudo in second half of command...

Finally as Raspian buster uses python 3.7 added:

if [[ "${MODEL}" == "Raspberry Pi 4 Model B Rev"* ]]; then #edit for rpi4
   info "Lib Fu."
   sudo cp /usr/local/lib/python3.7/dist-packages/edgetpu/swig/_edgetpu_cpp_wrapper.cpython-35m-arm-linux-gnueabihf.so /usr/local/lib/python3.7/dist-packages/edgetpu/swig/_edgetpu_cpp_wrapper.cpython-37m-arm-linux-gnueabihf.so
fi

Note, all this does is copy the python wrapper (compiled for python 3.5) and use 37 instead of 35 in the filename. Terrible undiscovered things may happen, or they may not, but it all seems to work for me!

All the examples supplied in the packages appear to work correctly.

rpi4-google-coral's People

Contributors

leswright1977 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.