Machine Learning Applied Multi-Zone Safety Supervisor Assistant Camera System Project
Keyword: yolov8, esp now, python app, hardware design.
Building a smart surveillance camera system base on YOLO algorithm. Able to detect the presence of prohibited (weapon, lighter, liquid can, human....) and indispensable objects (protective gear, human who run machine....) in each area at a location (factory, construction site, work place...) for safety reasons. Sending notification to remote monitor unit via ESP NOW. Helps those who work as a safety supervisor to work more effectively.
YOLO (You Only Look Once) is a real-time object detection algorithm that identifies objects in images or video frames with high speed and accuracy. Unlike traditional methods that scan an image in multiple passes, YOLO processes the entire image in a single forward pass, making it very efficient.
It’s ideal for surveillance cameras due to its real-time detection speed and ability to track multiple objects efficiently.
Image Processor Unit Algorithm Diagram
ESP-NOW is a wireless communication protocol developed by Espressif for direct, low-power, peer-to-peer communication between devices, without the need for a Wi-Fi network. It uses the same 2.4GHz frequency as Wi-Fi but allows devices to send small packets of data to each other instantly, with minimal delay. It supports broadcasting to multiple devices and has a range similar to Wi-Fi.
Remote Monitor Unit Algorithm Diagram
Image Processing Unit
- Objects detection with custom dataset trained model
- Send notification via ESP NOW
Remote Monitor Unit
- Receive notification via ESP NOW
- Alert depend on setting
- Good looking UI using SquareLine Studio
- Notification history
- Expansion port
- Connection lost notification
Window PC App (ESP NOW UNIT needed)
- Whole system work right in Windows OS
- Control UI
- Display realtime video
- Select prohibited objects in each area
- Running with every PC
1. Use the package manager pip to install requirement libraries. Check if pip is installed, install if not.
pip --version
For YOLOv5
git clone https://github.com/ultralytics/yolov5
cd yolov5
pip install -r requirements.txt
For YOLOv8
git clone https://github.com/ultralytics/ultralytics
cd ultralytics
pip install -r requirements.txt
For YOLO training and Python programming
OpenCV for work with image data from camera. Pyserial for send data via USB port.
pip install opencv-python
pip install pyserial
Check if Pytorch is installed. Find the installation command suitable for your machine on the official Pytorch website if your machine does not have it installed.
import torch
print(torch.__version__) # Kiểm tra phiên bản
print(torch.cuda.is_available()) # Kiểm tra CUDA có khả dụng không
For Raspberry Pi
How to install YOLOv8 requirement on Raspberry Pi
How to run a program on startup for Raspberry Pi (make sure your Raspberry Pi is set up to run without a display.)
We've found some quick and effective video tutorials for you:
How to train YOLOv8 with custom dataset using your local PC
How to fix labelImg crashing while selecting create rect box
This is how these code work in our system design, you can do the way you want.
All variable names, comments in code and UI are now in Vietnamese. English language is being edited and will be updated soon.
System Design Diagram
Camera Unit
"Capture and process image" part - copy image_processor code to sd card of Raspberry Pi, make sure it is in the same folder as the YOLO weight file.
"Notification sender" part - load ESP32 dev board with alert_sender code, find MAC address of ESP32 with find MAC code
Remote Monitor Unit
ESP32 Custom Remote Monitor device - load with custom_remote_monitor code
or
M5StickCplus2 IOT device - load with m5stick_receiver code
These are how the hardware look when we are done. This prototype cost 80 USD in 2024.
📖 Testing
YOLO weight test:
System operation test:
System operation test with M5StickC Plus2:
M5StickC Plus2 firmware with Vietnamese language is available on M5 Burner App:
Ultralytics - YOLO
TheCodingBug - YOLO
Edje Electronics -YOLO
Freedomwebtech - Raspberry Pi
Sam Westby - Raspberry Pi
Big-Bratan - M5stick UI
If you have any questions or suggestions, feel free!!! Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.