Solution by TEAM ALIEN submitted as part of MLDA Deep Learning Week Hackathon 2021
We were primarily motivated by how old people may often get lost. In one local story, an old man passed away unnoticed and his body was only found days after his family notified the authorities. This brought up anxiety amongst some of the locals who believe in an urban and developed city like ours, we could do better for these individuals.
Based on this, we were motivated to develop a solution to ensure that the safety of such old folks are assured, all whilst maintaining their privacy and any other ethical concerns.
The system detects when a person enters a location and keeps track of how many people remain at the location, if an individual has remained in there for a long time, the system will sound an alarm and drop a message to the management of the place
For our model, we utilised the capabilities of an existing object detection library to suit to our context. We edited a few lines to capture when the target has enter/ is leaving the scene and then adapted it with a raspberry pi. The raspberry pi informs the relevant user whether the target is within sight through the use of a telegram bot, and also LED and buzzer.
This repository contains a tracking algorithm to detect when a person has entered This repository is based off https://github.com/mikel-brostrom/Yolov5_DeepSort_Pytorch. It contains a two-stage-tracker. The detections generated by YOLOv5, a family of object detection architectures and models pretrained on the COCO dataset, are passed to a Deep Sort algorithm which tracks the objects. It can track any object that the Yolov5 model was trained to detect.
Key files
Tracker.py processes the video feed and detects when a person has entered or left the video frame.
rpiinterface.py is meant to be run on our Raspberry Pi based hardware that sounds a video and audio alarm, and sends out telegram alerts when tracker.py detects that the person has entered the room but has not left for a set duration.
- Clone the repository recursively:
git clone --recurse-submodules https://github.com/lynx360/Yolov5_DeepSort_Pytorch
If you already cloned and forgot to use --recurse-submodules you can run git submodule update --init
- Make sure that you fulfill all the requirements: Python 3.8 or later with all [requirements.txt]) dependencies installed, including torch>=1.7. To install, run:
pip install -r requirements.txt
- Download the YOLOv5 weights from https://drive.google.com/file/d/1gglIwqxaH2iTvy6lZlXuAcMpd_U0GCUb/view to yolov5/weights/crowdhuman_yolov5m.pt
Tracking can be run using the following script
python track.py --source (videoname) --yolo_weights yolov5/weights/crowdhuman_yolov5m.pt --show-vid