Code Monkey home page Code Monkey logo

raspicam_vision_lite's Introduction

RasPiCam Vision Lite

RasPiCam Vision Lite is a minimalistic and lightweight Flask web app that serves on Raspberry Pi and streams live video from its camera module at high frame rates while doing on-device image classification asynchronously with TensorFlow Lite models.

๐Ÿ“Overview

  • RasPiCam Vision Lite allows you to efficiently serve and switch over multiple TensorFlow Lite models for image classification with just a few clicks.

  • It takes advantage of concurrency and multiprocessing and shifts the computational heavy lifting of inference into dedicated subprocesses and threads, independent of video streaming feed, which to a large extent spares you the annoyance of choppy/stuttering frames when they're processed synchronously.

  • You get more things done with a simple, beautiful and flat design. Because why not? (Click on the preview below for a demo video)

demo

๐Ÿ“Usage

  1. Open a terminal, SSH into your Raspberry Pi and clone the repository.

  2. (Optional) To use models other than the defaults that come with this repository, you can still download and use some other offically released hosted models as this project does. Alternatively, train your own custom TensorFlow Lite (optimally quantized) models either via transfer learning or from scratch, and then place them along with labels inside models/ simply as the rest of them:

    .
    โ””โ”€ models
       โ””โ”€โ”€ {your-model-version}
           โ”œโ”€โ”€ {your-model-version}.tflite
           โ””โ”€โ”€ labels.txt
    
  3. Start a Flask web server by running python3 main.py under the repository root.

  4. Open a browser and access the IP address distributed to Raspberry Pi in your local network with default port 5000 (e.g. 192.168.0.104:5000) . You'll be greeted by the web interface as shown above.

  5. Go select one of the models from the dropdown list, and press the SERVE button to watch video live streaming as the serving model does inferencing in the background. Try selecting a different model and serve it again.

  6. Shut down the server safely when you're done by clicking SHUTDOWN.

๐Ÿ“How It Works

demo

๐Ÿ“Dependencies

Following setups are fully tested. Some variations could also work, but no guarantee.

Hardwares

  • Raspberry Pi 3 Model B+, 4 Model B
  • Pi Camera Module V2

Softwares

  • Raspbian 9+
  • Python 3.5+
  • TensorFlow 2.0
  • OpenCV 4.1
  • Flask 1.1.0+
  • Picamera 1.13
  • Chrome, Safari

๐Ÿ“License

MIT

raspicam_vision_lite's People

Contributors

jingw222 avatar

Watchers

James Cloos 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.