Giter Club home page Giter Club logo

blind-vision-helper's Introduction

TensorFlow Lite Python object detection example with Raspberry Pi

Set up the Raspberry Pi

sudo sh setup.sh

Run the detector

python3 detect.py --model efficientdet_lite0.tflite

You should see the camera feed appear on the monitor attached to your Raspberry Pi. Put some objects in front of the camera, like a coffee mug or keyboard, and you'll see boxes drawn around those that the model recognizes, including the label and score for each. It also prints the number of frames per second (FPS) at the top-left corner of the screen. As the pipeline contains some processes other than model inference, including visualizing the detection results, you can expect a higher FPS if your inference pipeline runs in headless mode without visualization.

For more information about executing inferences with TensorFlow Lite, read TensorFlow Lite inference.

Speed up model inference (optional)

If you want to significantly speed up the inference time, you can attach an Coral USB Acceleratorโ€”a USB accessory that adds the Edge TPU ML accelerator to any Linux-based system.

If you have a Coral USB Accelerator, you can run the sample with it enabled:

  1. First, be sure you have completed the USB Accelerator setup instructions.

  2. Run the object detection script using the EdgeTPU TFLite model and enable the EdgeTPU option. Be noted that the EdgeTPU requires a specific TFLite model that is different from the one used above.

python3 detect.py \
  --enableEdgeTPU
  --model efficientdet_lite0_edgetpu.tflite

You should see significantly faster inference speeds.

For more information about creating and running TensorFlow Lite models with Coral devices, read TensorFlow models on the Edge TPU.

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.