Skip to content

Latest commit

 

History

History
45 lines (38 loc) · 2.14 KB

File metadata and controls

45 lines (38 loc) · 2.14 KB

MLAI-community-labs

Labs that explain complex ML/AI ideas simply with code.

Training a ML box detector

Using Azure custom vision and cognitive service, we are training a model to detect boxes, once a box is detected it will notify the user along with an image showing where the box is.

Requirements

In a Nutshell

  • Install all the required modules from requirements.txt pip install -r requirements.txt
  • Add all the following required variables in a .env file
CONNECTION_STRING = Storage connection string from Azure storage
SOURCE = 'usb' or path to any .mp4 file
TIME_DELAY = Specifies frame capture interval in seconds
MANUAL_MODE = Set 0 for auto and 1 for manual mode
PREDICTION_KEY = Azure cognitive service key
PROJECT_ID = Custom vision project id
TWILIO_ACCOUNT_SID = Account SID from twilio
TWILIO_AUTH_TOKEN = Auth Toekn from twilio
TWILIO_PHONE_NUMBER = Twilio phone number
ACCOUNT_NAME = Azure account name
BLOB_ACCOUNT_KEY = Storage account key
ENDPOINT_CUSTOM_VISION = Azure custom vision endpoint
SERPAPI_API_KEY = Serpapi API key for scraping tool.
  • SOURCE can be direct video stream from as a RTSP stream, or from a .mp4 video file.
  • TIME_DELAY sets the time threshold to capture frames from the video.
  • MANUAL_MODE You can choose from two modes, manual(1) or auto(0).
  • Finally, py edge_to_blob.py

In the code we are using this service to send the user a notification about a box is detected at their doorstep, you can refer to this code sample to see how you can implement your custom SMS service using Twilio API. (https://www.twilio.com/docs/sms/quickstart/python).

Quick tutorial

box_detector.mp4