Skip to content

Repo with a sample application developed in Python for Raspberry Pi that uses Azure Custom Vision and Azure IoT Edge

Notifications You must be signed in to change notification settings

pradorodriguez/azureiotpyvision

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Welcome to this Github Repo azureiotpyvision

In this repo you will find a Python code that can used in your Raspberry Pi to build an Intelligent Vision solution with Azure IoT and Azure Custom Vision Cognitive Services to send telemetry to Azure Iothub

Along with the python code, in this repo you will find the Hardware settings and the Azure Components been used to successfully execute the application. At this point, this is no a step by step guide, the main point is for you to get and understand the Python code used to develop the solution.

Guide information

Reference architecture

Architecture

Hardware - Vision components

Local Environment requirements

Azure requirements

Environment set up - You might use the following links in case you want to recreate the solution

Application Code

Python Libraries

Application Notes

  • The application must run inside the Raspberry Pi
  • The Raspberry Pi must install previous Python Libraries
  • The Raspberry Pi must have Python3

Application main functions and methods

  • Main Function:

    • Camera Initialization.
    • Temperature Sensor Initialization.
    • Connection establishment to Azure Iothub.
    • Calls multiple method to capture image in case the environment method is above 32 Celsius.
    • It sends a JSON object with the temperature and custom vision information to Azure IoThub.
  • CaptureImage Function:

    • Takes a picture using the camera.
  • CustomVisionQuery Function:

    • Sends the picture taken by the CaptureImage function to the Custom Vision Container in Iotedge (this IoT Edge is reacheable using a private IP).
    • Saves the JSON response from the Custom Vision container to a variable.
  • DetectedObjects Function:

    • Creates an image with lines around each detected object from the Custom Vision container with a probability above 70%.
    • The position of the lines are determined by bounding box coordinates from the Custom Vision Container.
    • With the detect object coordinates, it creates a new image with lines around each detected object.
    • The image is saved locally in the Raspberry Pi.
  • MergeVisionTemperature Function:

    • Creates a Dictonary variable IF temperature is higher than 32Celsius and Custom Vision Probability result is higher than 70%.
    • The Dictonary variable is used to create a JSON object

If you have any question, suggestion or comment about this repo or code, feel free to post it in this discussion section. I will make sure to address all your concerns.

About

Repo with a sample application developed in Python for Raspberry Pi that uses Azure Custom Vision and Azure IoT Edge

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages