Capstone-RSD/rsd-yolov5-model is a Python machine learning application that utilizes the YOLOv5 model for road surface deterioration detection, Apache Kafka for event streaming, and Neo4j for establishing relationships between the location of the damages and the damage captured. The application is designed to be deployed on Kubernetes and can be developed using Docker containers.
The repository contains the following components:
-
YOLOv5 Model: The core component of the application, the YOLOv5 model, is included in the repository. This model is trained to detect and classify various road damages.
-
devcontainer.json: The repository includes a
devcontainer.json
file for development with docker containers. Can also be used in GitHub Codespaces. -
Training Script: The repository provides a Python notebook for training and generating the model for performing inferencing on new images using the trained YOLOv5 model. This script takes input images, performs its classification, and generates predictions with bounding boxes and class labels.
The project relies on both Apache Kafka, Firebase Storage, Pytorch, and Neo4j. We recommend the following links on getting started with the following tools:
- Confluent - What is apache Kafka
- Neo4j - Getting Started
- Generate Firebase Private key and download into the src
- Install PyTorch Locally
We welcome contributions to enhance the capabilities of the road surface detection and classification system. If you are interested in contributing, please follow these steps:
- Fork the repository.
- Create a new branch from the
main
branch for your changes. - Make your modifications, ensuring clear and concise commit messages.
- Push your changes to your fork.
- Create a pull request from your branch to the
dev
branch of this repository.
To get started with the development of the road surface detection and classification system, follow these steps:
-
Ensure the prequesities have been applied before proceeding
-
Clone this repository:
git clone https://github.com/Capstone-RSD/rsd-yolov5-model.git cd rsd-yolov5-model
-
Install the required dependencies:
pip install torch torchvision torchaudio # if pytorch isn't present see https://pytorch.org/get-started/locally/ for more details pip install -r requirements-dev.txt
-
Run the application:
python src/rss_consumer.py -b <host[:port]> # Kafka Bootstrap server URL -t <topic_name> # Kafka topic name -g <consumer_group> # kafka Consumer group name --cluster_key <API_KEY> --cluster_secret <API_SECRET> --neo4j_db_username <db_username> --neo4j_db_password <db_password> --neo4j_db_uri <neo4j+s://...>
-
Using an
.env
file: You can save some of these arguments as environment variables rather than passing them as arguments into the programCLUSTER_API_KEY=CLUSTER_API_KEY123 CLUSTER_API_SECRET=CLUSTER_API_SECRET123 NEO4J_DB_URI=neo4j+s://... NEO4J_DB_USERNAME=db_username NEO4J_DB_PASSWORD=db_password
Start developing and modifying the YOLOv5 model according to your requirements. Note: you may also use docker along with vscode devcontainers to setup your environment. See Developing inside a Container for more details.
To deploy the road surface detection and classification system on Kubernetes, follow the instructions below:
-
Clone the repo into your GCP Cloud Editor and change your directory to the
rsd-yolov5-model
directory. -
Build the Docker image:
docker build -t rsd-yolov5-model .
-
Push the Docker image to a container registry of your choice.
-
Deploy the application on Kubernetes using the provided deployment manifest.
kubectl apply -f rsd-yolov5.yaml
Please note that you may need to update the deployment instructions and modify the provided rsd-yolov5.yaml manifest to match your specific deployment requirements. This includes the application secrets and keys.
This project is licensed under the MIT License - see the LICENSE file for details.