Skip to content

KrithikaTP/Flyer-COP

Repository files navigation

Flyer-Cop

Table of Contents

About The Project

Traffic Police have a greater responsibility in order to maintain the public traffic control, medical emergency as well as security.

It's a hectic task for the police to manage all these together as the current system is based on one-size-fits-all approach.

No automation involved to assist the police.

Medical emergency vehicles are not given prior attention for signal management.

No traffic analysis is made for traffic management.

Solution

Flyer Cop – AI / IOT enabled Drone to assist traffic police. There are several features incorporated to benefit the cop, as well as the public. The drone is connected with Raspberry Pi B+ along with a 8MP camera. The drone was tested within a certain limted height, so as to ensure internet connectivity (connected to Mobile Hotsopt). The drone performs real time object detection (Azure Object Detection) on roads to detect and manipulate the vehicles, people, signals and a lot more. The detected data is then transfered to PowerBi Dashboard for analysis. Different ways of graph interpretation is done for visualizing and managing the traffic.

Also, social distance violators are detected and regions of high crowding are notified to police to handle social distancing. Drones have the capability to fly far off the roads and can detect any emergency vehicles (Ambulance detection on Custom Vision) are heading. This information is notified immediately to the cop for immediate signal management. Hence, the roads of the ambulances get cleared very quickly. In some situations such as natural calamities or any disasters, people get caught in some risky regions such as low lying hilly areas, deeply dug bore wells, etc. Hence, the drone works 70-80% accurate for human detection under low light, foggy areas, sandy regions where humans cannot travel easily. This ensures that the drone can also handle rescue operations. Flyer-Cop also detects if any unknown person(Face recognition) has entered any restricted areas such as government buildings, research or scientific campus, etc. If any unknown person is detected, then immediately a notification is sent to take immediate actions.

Built With

  • Azure IOT Hub – to get input from Drone
  • Azure Logic App – to send email Notifications
  • Azure Custom Vision – to perform custom object detection model (ambulance)
  • Azure Computer Vision – to detect objects on road
  • Azure Face – to detect unknown person
  • Azure Service Bus – to link IOT hub and Logic App
  • Azure Power BI Embedded – Graphical analysis

Set Up the Azure Backend

1) Register Raspberry Pi with Azure IOT Hub

Go through this link to register the raspberry pi How to register a new device in IOT Hub

2) Training the model using Azure Custom Vision

Create a new Azure Cognitive Service in the Azure Portal and go to the Quick Start(in navigation pane) and click Custom Vision Portal. This will take you to the Azure Custom Vision Portal.

Take some random images of 'ambulances'(min 15) from the internet and train it in the Custom Vison Potal as mentioned in the below link.

Train a model in Custom Vision

It takes few minutes to train the model. Once the model is trained , go to the performance menu and publish the model.

3) Create Service Bus and Azure Logic App

The drone's purpose is not only to monitor and keep sending data. It also has to send immediate notifications or alerts whenever needed. Refer the link to setup the azure logic app IoT remote monitoring and notifications with Azure Logic Apps connecting your IoT hub and mailbox

Change the query in adding the route as follows

unknownPersonDetected = "true"

4) Create resource for Power Bi,Face and Computer Vision

Go to the azure portal and tap on 'Create New resource' and select Computer Vision and tap on 'Create'. Follow the same steps for Azure Face and Power Bi.

Hardware Module Setup

A drone which has the capability to fly upto 50 Feet and 2.4 Ghz transmission mode. Also the drone having the capacity to carry 100-150(Raspberry Pi) g of weight. Adapter required to support power for raspberry pi. Fix the drone with raspberry Pi.

Connect the V2 Camera in the Camera port of Raspberry Pi as shown below

How to Run Flyer Cop

Prerequisite

  • Clone the Repository.
  • Install the following packages in Raspberry Pi.
  • Launch the terminal and install.
pip install -r requirements.txt

Set your AZURE Credentials

  • Open the ambulance.py file and change the following details from your Custom Vision Portal.
ENDPOINT = "<YOUR ENDPOINT>"
training_key = "<YOUR TRAINING KEY>"
prediction_key = "<YOUR PREDICTION KEY>"
prediction_resource_id = "<YOUR RESOURCE ID>"
project_id = '<YOUR PROJECT ID>'
publish_iteration_name = "<YOUR MODEL NAME>"
  • Open the human.py and objectDetection.py file and change the following details from your Azure Portal for Cmputer Vision.
subscription_key = "<YOUR SUBSCRIPTION KEY>"
endpoint = "<YOUR ENDPOINT>"
client = Client("<YOUR AUTHORIZATION ID>", "YOUR AUTH TOKEN")
  • Open the identifyFace.py file and change the following details from your Azure Portal for Azure Face.
KEY = "<YOUR KEY>"
ENDPOINT = "<YOUR ENDPOINT>"
  • Open the iotHub.py file and change the following details from your Azure Portal for IotHub.
CONNECTION_STRING = "<YOUR IOTHUB CONNECTION STRING>"
  • Open the powerBi.py file and change the following details from your Power Bi Portal.
REST_API_URL = "YOUR POWERBI API URL"
  • Open the sendSMS.py file and change the following details as per the twillo agent.
client = Client("<YOUR AUTHORIZATION ID>", "YOUR AUTH TOKEN")

How to execute

Once everything is set, go to the terminal of your laptop do the following operation.

ssh <YOUR RASPBERRY PI IP ADDRESS>

Once done move to the directory where the code files are present and execute as follows:

  • To execute traffic analysis.
python smartTrafficAnalysis.py
  • To execute ambulance detection.
python smartAmbulanceDetector.py
  • To execute Human Rescue.
python smartHumanRescue,py
  • To execute unknown person detection.
python smartSecurity.py

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages