This repository provides an implementation of an AI camera system that utilizes the YOLOv8 model for detecting whether a person in an uploaded image is wearing a helmet or not. This AI camera system is built using Python and several popular libraries for computer vision and deep learning.
The AI camera implementation in this repository aims to automate the process of detecting whether a person in an image is wearing a helmet or not. It utilizes the YOLOv8 model, a state-of-the-art object detection algorithm, which is known for its accuracy and efficiency.
The YOLOv8 model is trained on a custom dataset that consists of images with annotated bounding boxes around the helmets. During inference, the model analyzes the uploaded image and predicts the presence of helmets by drawing bounding boxes around the detected regions.
To set up the AI camera implementation locally, follow these steps:
- Clone this repository to your local machine.
- Ensure that you have Python 3.6 or higher installed.
- Install the required dependencies by running the following command in the repository's root directory:
pip install -r requirements.txt- Download the pre-trained weights for the YOLOv8 model by visiting the official YOLO website or a compatible repository. Place the weights file in the
model_weightsdirectory.
To use the AI camera system, follow these steps:
- Start the web application by running the following command:
python app.py- Open a web browser and visit
http://localhost:5000. - Upload an image using the provided interface.
- Click the "Detect" button to process the image and display the detected bounding boxes around any detected helmets.
- The result will be displayed on the web page, showing whether the person in the image is wearing a helmet or not.
If you wish to train the YOLOv8 model on a custom dataset or fine-tune the existing weights, follow these steps:
- Prepare a dataset of images containing annotations for helmet bounding boxes.
- Split the dataset into training and validation sets.
- Modify the configuration file (
yolov8.cfg) to suit your dataset and training preferences. - Run the training script:
python main.py- Monitor the training progress and adjust hyperparameters as needed.
- Once the training is complete, the final weights will be saved in the
runs/detect/results/weights/best.ptdirectory.
The AI camera implementation is licensed under the MIT License. Feel free to modify and use the code according to your requirements.
Please note that while the AI camera system aims to detect whether a person is wearing a helmet or not, it may not provide perfect accuracy in all scenarios. It is important to exercise caution and rely on multiple safety measures when assessing helmet usage.
For more information, refer to the documentation and comments within the codebase. If you encounter any issues or have suggestions for improvements, please open an issue in the repository.


