Giter Club home page Giter Club logo

custom-vision-service-iot-edge-raspberry-pi's Introduction

services platforms author
iot-edge, custom-vision-service, iot-hub
python
ebertrams

Custom Vision + Azure IoT Edge on a Raspberry Pi 3

This is a sample showing how to deploy a Custom Vision model to a Raspberry Pi 3 device running Azure IoT Edge. It can also be deployed on an x64 machine. It has been ported to the newer IoT Edge GA bits.

Check out this video to see this demo in action and understand how it was built:

Custom Vision On Raspberry Pi Video

This solution is made of 3 modules:

  • Camera capture - this module captures the video stream from a USB camera, sends the frames for analysis to the custom vision module and shares the output of this analysis to the edgeHub. This module is written in python and uses OpenCV to read the video feed.
  • Custom vision - it is a web service over HTTP running locally that takes in images and classifies them based on a custom model built via the Custom Vision website. This module has been exported from the Custom Vision website and slightly modified to run on a ARM architecture. You can modify it by updating the model.pb and label.txt files to update the model.
  • SenseHat display - this module gets messages from the edgeHub and blinks the raspberry Pi's senseHat according to the tags specified in the inputs messages. This module is written in python and requires a SenseHat to work.

Prerequisites

Hardware

You can run this solution on either of the following hardware:

Services

Check out the animation below to see how a IoT Edge deployment works. You can also get more details through this tutorial to see how a IoT Edge deployment works. You must have the following services set up to use this sample:

  • Azure IoT Hub: This is your Cloud gateway which is needed to manage your IoT Edge devices. All deployments to Edge devices are made through an IoT Hub. You can use the free sku for this sample.
  • Azure Container Registry: This is where you host your containers (e.g. IoT Edge modules). Deployment manifests refer to this container registry for the IoT Edge devices to download their images.You can use the free sku for this sample.

IoT Edge deployment workflow

Tooling

You need the following dev tools to do IoT Edge development in general, to make this sample run and edit it:

  • Visual Studio Code: IoT Edge development environment. Download it from here.
  • Visual Studio Code: Azure IoT Edge Extension: An extension that connects to your IoT Hub and lets you manage your IoT Devices and IoT Edge Devices right from VS Code. A must-have for IoT Edge development. Download it from here. Once installed, connect it to your IoT Hub.

To learn more about this development environment, check out this tutorial and this video:

Visual Studio Code Extension Video

Get started

On a Raspberry Pi 3

  1. Clone this sample
  2. Update the .env file with the values for your container registry and make sure that your docker engine has access to it
  3. Build the entire solution by right-clicking on the deployment.template.json file and select Build IoT Edge Solution
  4. Deploy the solution to your device by right-clicking on the config/deployment.json file, select Create Deployment for IoT Edge device and choose your targeted device
  5. Monitor the messages being sent to the Cloud by right-clicking on yoru device from the VS Code IoT Edge extenstion and select Start Monitoring D2C Message

On an x64 PC

  1. Clone this sample
  2. Update the .env file with the values for your container registry and make sure that your docker engine has access to it
  3. Rename the deployment.template.json file into deployment.template.RPI.json
  4. Rename the deployment.template.test-amd64.json file into deployment.template.json
  5. Build the entire solution by right-clicking on the deployment.template.json file and select Build IoT Edge Solution
  6. Deploy the solution to your device by right-clicking on the config/deployment.json file, select Create Deployment for IoT Edge device and choose your targeted device
  7. Monitor the messages being sent to the Cloud by right-clicking on yoru device from the VS Code IoT Edge extenstion and select Start Monitoring D2C Message

Going further

Update the AI model

Download your own custom vision model from the custom vision service. You just need to replace the ImageClassifierService/app/model.pb and ImageClassifierService/app/labels.txt provided by the export feature of Custom Vision.

Update the configuration of the camera capture module

Explore the various configuration options of the camera module availabel here, to score your ai model against a camera feed vs a video clip, to resize your images, to see logs, etc.

custom-vision-service-iot-edge-raspberry-pi's People

Contributors

emmanuel-bv avatar microsoftopensource avatar msftgits 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.