This project utilizes Yolov7 for detecting safety compliance in industrial environments. The solution is designed to be deployed using AWS services and can be integrated into a CI/CD pipeline with GitHub Actions.
- Data
- Yolov7 GitHub Repository
- Yolov7 Tutorial
- Project Workflow
- Configuration Files
- Git Commands
- AWS Configurations
- How to Run
- AWS CI/CD Deployment with GitHub Actions
- Environment Variables
[Link to dataset]
[Link to Yolov7 GitHub repository]
[Link to Yolov7 tutorial]
The project follows a structured workflow, divided into the following components:
- constants: Define project constants.
- config_entity: Configuration management.
- artifact_entity: Manage artifacts.
- components: Core components of the project.
- pipeline: Workflow pipeline.
- app.py: Main application file.
To commit and push changes to the repository:
git add .
git commit -m "Updated"
git push origin main
- AWS CLI Download: AWS CLI Installation Guide
To configure AWS:
aws configure
Set up the environment and run the application:
conda create -n safety python=3.8 -y
conda activate safety
pip install -r requirements.txt
python app.py
Create an IAM user with the following access permissions:
- EC2 Access: Virtual machine management.
- ECR: Elastic Container Registry to store your Docker images.
- Build a Docker image of the source code.
- Push the Docker image to ECR.
- Launch an EC2 instance.
- Pull the Docker image from ECR in the EC2 instance.
- Launch the Docker image in the EC2 instance.
- AmazonEC2ContainerRegistryFullAccess
- AmazonEC2FullAccess
Create an ECR repository to store/save the Docker image.
- Save the URI:
Open the EC2 instance and install Docker:
# Optional
sudo apt-get update -y
sudo apt-get upgrade
# Required
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker ubuntu
newgrp docker
Navigate to Settings > Actions > Runner > New Self-Hosted Runner
in GitHub, choose the OS, and run the commands provided.
Add the following secrets to GitHub:
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_REGION = us-east-1
AWS_ECR_LOGIN_URI = demo>> 566373416292.dkr.ecr.ap-south-1.amazonaws.com
ECR_REPOSITORY_NAME = simple-app
For local replication, it's recommended to store all secret keys in a .env
file:
AWS_ACCESS_KEY_ID=<your-access-key-id>
AWS_SECRET_ACCESS_KEY=<your-secret-access-key>
AWS_REGION=us-east-1
AWS_ECR_LOGIN_URI=566373416292.dkr.ecr.ap-south-1.amazonaws.com
ECR_REPOSITORY_NAME=simple-app
Ensure that your .env
file is listed in the .gitignore
to prevent it from being tracked by Git.