Welcome to the ultimate guide on the AI-driven tool designed to enhance safety on construction sites! Utilizing the powerful YOLOv8 model for object detection, this system identifies potential hazards, ensuring that construction sites remain safe for workers. Below, we will walk you through the usage of this innovative tool, providing clear instructions and troubleshooting tips to help you get started.
Contents
Usage
Before diving into the tool, you will need to configure the system by specifying video streams and other parameters in a YAML file. Here’s a breakdown of how to get this done:
Configuration Example
Your configuration file, configuration.yaml
, should look like this:
# This is a list of video configurations
- video_url: rtsp:example1.com/stream
image_name: cam1
label: label1
model_key: yolov8n
line_token: token1
run_local: True
- video_url: rtsp:example2.com/stream
image_name: cam2
label: label2
model_key: yolov8n
line_token: token2
run_local: True
This configuration file includes a list of properties for each video stream, which are:
- video_url: The URL of the live video stream (RTSP, YouTube, etc.).
- image_name: A name assigned to the camera image.
- label: The label for the video stream.
- model_key: The key identifier for the YOLOv8 model.
- line_token: The token for sending notifications via LINE.
- run_local: A boolean to indicate if detection should run locally.
Launching the System
You can run the hazard detection system using either Docker or Python:
Usage for Docker
- Clone the repository:
- Navigate to the cloned directory:
- Build and run the services using Docker Compose:
- Run the application with your configuration file:
- To stop the services, run:
git clone https://github.com/yihong1120/Construction-Hazard-Detection.git
cd Construction-Hazard-Detection
docker-compose up --build
docker-compose run main-application python main.py --config path/in/container/configuration.yaml
docker-compose down
Usage for Python
- Clone the repository:
- Navigate to the cloned directory:
- Install required packages:
- Install and start the MySQL service (if needed):
- Start user management API:
- Run object detection API:
- Run the main application with your configuration file:
- Start the streaming web service:
git clone https://github.com/yihong1120/Construction-Hazard-Detection.git
cd Construction-Hazard-Detection
pip install -r requirements.txt
sudo apt install mysql-server
sudo systemctl start mysql.service
gunicorn -w 1 -b 0.0.0.0:8000 examples.User-Management.app:user-managements-app
gunicorn -w 1 -b 0.0.0.0:8001 examples.Model-Server.app:app
python3 main.py --config path/to/your/configuration.yaml
gunicorn -w 1 -k eventlet -b 127.0.0.1:8002 examples.Stream-Web.app:streaming-web-app
Additional Information
Access system logs within the Docker container for debugging purposes. Also, output images with detections will be saved to the specified output path, and notifications will be sent via the LINE messaging API if hazards are detected.
Dataset Information
The AI model has been trained with a comprehensive dataset sourced from the Construction Site Safety Image Dataset. This dataset has been enriched with additional annotations, allowing it to identify various construction site hazards effectively.
Contributing
We welcome contributions! To make a difference, you’ll need to fork the repository, make your changes, and then submit a pull request with a clear description of the enhancements made.
Development Roadmap
Here’s our development roadmap so that you can stay in the loop:
- Data collection and preprocessing – ✔️
- Training YOLOv8 model with construction site data – ✔️
- Developing post-processing techniques for enhanced accuracy – ✔️
- Implementing real-time analysis and alert system – ✔️
- Testing and validation in simulated environments – ✔️
- Deployment in actual construction sites for field testing – ✔️
- Ongoing maintenance and updates based on user feedback – ✔️
License
This project is licensed under the AGPL-3.0 License.
Troubleshooting
If you encounter issues during setup or execution, consider these troubleshooting tips:
- Check your YAML configuration file for any syntax errors.
- Ensure that your Docker and Python environments are correctly set up.
- Consult the logs generated in your Docker container for insights.
- Check the URLs in your video configurations to confirm they are both accessible and valid.
For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.
At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.