Skip to content
YiHungWONG edited this page Jul 31, 2024 · 3 revisions

Construction-Hazard-Detection

The Construction-Hazard-Detection repository provides a system for automatically detecting and monitoring safety hazards on construction sites using AI-powered object detection and real-time video analysis. It helps construction managers and safety officers identify potential risks and ensure compliance with safety regulations.

The core functionality of the system is built around the YOLOv8 object detection model, which is used to identify various objects and potential hazards in construction site video streams. The main components of the system include:

• Object detection and hazard identification: The DangerDetector class analyzes detected objects to identify potential hazards such as workers without safety gear, workers in controlled areas, or workers in close proximity to machinery. For more details on the hazard detection logic, see the Hazard Detection Logic section.

• Real-time video processing: The StreamCapture and LiveStreamDetector classes handle the capture and processing of video streams from construction sites. The system can process multiple streams simultaneously and adapt to varying internet speeds. More information can be found in the Real-Time Video Stream Processing section.

• Notification system: When hazards are detected, the system can send alerts through various messaging platforms including LINE, Facebook Messenger, Telegram, and WeChat. This functionality is implemented in separate notifier classes for each platform. The Notification System section provides more details on this feature.

• Web-based monitoring interface: A Flask-based web application allows users to view live video streams and detection results in real-time. The implementation details are covered in the Web-Based Monitoring Interface section.

The system also includes tools for data augmentation, model training, and evaluation:

• The /Construction-Hazard-Detection/examples/YOLOv8_data_augmentation directory contains scripts for applying various image augmentation techniques to enhance the training dataset.

• The /Construction-Hazard-Detection/examples/YOLOv8_train directory provides scripts for training, validating, and exporting YOLOv8 models.

• The /Construction-Hazard-Detection/examples/YOLOv8_evaluation directory contains tools for evaluating model performance using metrics such as Average Precision and mean Average Precision (mAP).

Key design choices in the implementation include:

  1. Modular architecture: The system is divided into separate components for video capture, object detection, hazard analysis, and notification, allowing for easy maintenance and extensibility.

  2. Flexibility in deployment: The system can be run in a Docker environment or a Python environment, with instructions provided for both setups.

  3. Configurable video streams: Users can specify details of video streams, including URL, image name, label, and machine learning model, through a YAML configuration file.

  4. Automated model management: The system includes functionality for downloading pre-trained models and periodically updating them to ensure the latest versions are used.

For developers looking to extend or customize the system, the /Construction-Hazard-Detection/examples/YOLOv8_server_api directory provides a Flask-based API for object detection, which can be integrated into other applications or services.

Clone this wiki locally