An end-to-end deep learning project for automated detection of Coccidiosis disease in chickens using Convolutional Neural Networks (CNN) with VGG16 architecture. Deployed on AWS with CI/CD pipeline using GitHub Actions and DVC for ML pipeline management.
- Overview
- Features
- Tech Stack
- Project Architecture
- Dataset
- Model Performance
- Installation
- Usage
- DVC Pipeline
- AWS Deployment
- Project Structure
- Results
- Contributing
- License
- Contact
This project implements an automated chicken disease classification system using deep learning to identify Coccidiosis - a deadly disease affecting poultry farms worldwide. The system uses transfer learning with VGG16 architecture and achieves 90%+ accuracy in disease detection.
Coccidiosis causes significant economic losses in poultry farming. Early detection is crucial but requires expert veterinarians. This AI-powered solution enables farmers to:
- โ Detect disease early through fecal image analysis
- โ Reduce veterinary costs
- โ Prevent disease spread
- โ Improve flock health management
- ๐ฌ High Accuracy: 90%+ accuracy in disease classification
- ๐ Fast Inference: Real-time predictions in < 2 seconds
- ๐ Web Interface: User-friendly Flask web application
- ๐ Model Tracking: MLOps with DVC for experiment tracking
- โ๏ธ Cloud Deployment: Production-ready AWS deployment
- ๐ CI/CD Pipeline: Automated deployment with GitHub Actions
- ๐ Model Monitoring: TensorBoard integration for training visualization
- ๐ณ Containerized: Docker support for easy deployment
- Python 3.10 - Programming language
- TensorFlow 2.x - Deep learning framework
- Keras - High-level neural networks API
- VGG16 - Pre-trained CNN architecture
- DVC - Data version control and ML pipeline management
- MLflow - Experiment tracking (optional)
- TensorBoard - Training visualization
- Flask - Web application framework
- HTML/CSS/JavaScript - Frontend
- Docker - Containerization
- AWS EC2 - Cloud hosting
- AWS ECR - Container registry
- GitHub Actions - CI/CD automation
- NumPy - Numerical computing
- Pandas - Data manipulation
- Pillow - Image processing
- OpenCV - Computer vision
โโโโโโโโโโโโโโโโโโโ
โ Input Image โ
โโโโโโโโโโฌโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโ
โ Preprocessing โ
โ (Resize, Scale) โ
โโโโโโโโโโฌโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโ
โ VGG16 Base โ
โ (Pretrained) โ
โโโโโโโโโโฌโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโ
โ Custom Layers โ
โ (Dense + Softmax)โ
โโโโโโโโโโฌโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโ
โ Prediction โ
โ Coccidiosis/ โ
โ Healthy โ
โโโโโโโโโโโโโโโโโโโ
- Total Images: 390 images
- Classes: 2 (Coccidiosis, Healthy)
- Image Size: 224x224x3 (RGB)
- Data Split:
- Training: 80% (312 images)
- Validation: 20% (78 images)
Applied augmentation techniques:
- Rotation (40 degrees)
- Horizontal flip
- Width/Height shift (20%)
- Shear transformation (20%)
- Zoom (20%)
- Final Training Accuracy: 95%
- Final Validation Accuracy: 92%
- Training Loss: 0.12
- Validation Loss: 0.15
- Training Time: ~10-15 minutes (with GPU)
Architecture: VGG16 (Transfer Learning)
Optimizer: Adam
Learning Rate: 0.0001
Batch Size: 16
Epochs: 20
Loss Function: Categorical Crossentropy- Python 3.10+
- Git
- Virtual environment tool (venv/conda)
- AWS account (for deployment)
- Clone the repository
git clone https://github.com/Priyrajsinh/End-To-End-Deep-Learning-Project-Using-MLOPS-DVC-Pipeline.git
cd End-To-End-Deep-Learning-Project-Using-MLOPS-DVC-Pipeline- Create virtual environment
python -m venv venv- Activate virtual environment
# Windows
venv\Scripts\activate
# Linux/Mac
source venv/bin/activate- Install dependencies
pip install -r requirements.txt- Install package in development mode
pip install -e .python main.pydvc repro- Start the Flask app
python app.py- Open browser and navigate to
http://localhost:8080
- Upload chicken fecal image and get prediction
import requests
import base64
# Read and encode image
with open("test_image.jpg", "rb") as f:
image_data = base64.b64encode(f.read()).decode()
# Make prediction request
response = requests.post(
"http://localhost:8080/predict",
json={"image": image_data}
)
print(response.json())
# Output: [{"image": "Coccidiosis"}] or [{"image": "Healthy"}]# View pipeline
dvc dag +--------------------+
| data_ingestion |
+--------------------+
*
*
+--------------------+
| prepare_base_model |
+--------------------+
*
*
+--------------------+
| training |
+--------------------+
*
*
+--------------------+
| evaluation |
+--------------------+
# Run data ingestion
dvc repro data_ingestion
# Run training only
dvc repro training
# Run evaluation
dvc repro evaluation# Show metrics
dvc metrics show
# Compare experiments
dvc metrics diff- AWS Account
- IAM User with EC2 and ECR permissions
- GitHub repository
GitHub (Code Push)
โ
GitHub Actions (CI/CD)
โ
Build Docker Image
โ
Push to AWS ECR
โ
Deploy to EC2 Instance
โ
Application Running on Port 8080
Permissions Required:
- AmazonEC2ContainerRegistryFullAccess
- AmazonEC2FullAccessRepository Name: chicken-disease
Region: us-east-1Instance Type: t2.medium (recommended) or t2.micro
OS: Ubuntu 24.04 LTS
Security Groups:
- SSH (22)
- HTTP (80)
- Custom TCP (8080)Navigate to: Repository โ Settings โ Secrets โ Actions
Add these secrets:
AWS_ACCESS_KEY_ID=<your_access_key>
AWS_SECRET_ACCESS_KEY=<your_secret_key>
AWS_REGION=us-east-1
AWS_ECR_LOGIN_URI=<your_ecr_uri>
ECR_REPOSITORY_NAME=chicken-disease
Follow GitHub's instructions to setup EC2 as self-hosted runner.
git add .
git commit -m "Deploy to AWS"
git push origin mainGitHub Actions will automatically:
- โ Build Docker image
- โ Push to ECR
- โ Deploy to EC2
- โ Start application
http://<EC2_PUBLIC_IP>:8080
End-To-End-Deep-Learning-Project/
โ
โโโ .github/
โ โโโ workflows/
โ โโโ main.yaml # GitHub Actions CI/CD pipeline
โ
โโโ artifacts/ # Generated artifacts (not in Git)
โ โโโ data_ingestion/
โ โโโ prepare_base_model/
โ โโโ training/
โ โโโ prepare_callbacks/
โ
โโโ config/
โ โโโ config.yaml # Configuration file
โ
โโโ research/ # Jupyter notebooks for experiments
โ โโโ 01_data_ingestion.ipynb
โ โโโ 02_prepare_base_model.ipynb
โ โโโ 03_prepare_callbacks.ipynb
โ โโโ 04_training.ipynb
โ โโโ 05_model_evaluation.ipynb
โ
โโโ src/CnnClassifier/
โ โโโ components/ # Core components
โ โ โโโ data_ingestion.py
โ โ โโโ prepare_base_model.py
โ โ โโโ prepare_callbacks.py
โ โ โโโ training.py
โ โ โโโ evaluation.py
โ โ
โ โโโ config/ # Configuration management
โ โ โโโ configuration.py
โ โ
โ โโโ entity/ # Data classes
โ โ โโโ config_entity.py
โ โ
โ โโโ pipeline/ # ML pipelines
โ โ โโโ stage_01_data_ingestion.py
โ โ โโโ stage_02_prepare_base_model.py
โ โ โโโ stage_03_training.py
โ โ โโโ stage_04_evaluation.py
โ โ โโโ predict.py
โ โ
โ โโโ utils/ # Utility functions
โ โ โโโ common.py
โ โ
โ โโโ constants/ # Constants
โ โ โโโ __init__.py
โ โ
โ โโโ __init__.py
โ
โโโ templates/ # HTML templates
โ โโโ index.html
โ
โโโ app.py # Flask application
โโโ main.py # Main training script
โโโ dvc.yaml # DVC pipeline definition
โโโ params.yaml # Model hyperparameters
โโโ requirements.txt # Python dependencies
โโโ setup.py # Package setup
โโโ Dockerfile # Docker configuration
โโโ .gitignore
โโโ .dvcignore
โโโ LICENSE
โโโ README.md
{
"loss": 0.15,
"accuracy": 0.92
}| Input Image | Predicted Class | Confidence | Actual Class |
|---|---|---|---|
| Image 1 | Coccidiosis | 95% | Coccidiosis โ |
| Image 2 | Healthy | 98% | Healthy โ |
| Image 3 | Coccidiosis | 92% | Coccidiosis โ |
| Image 4 | Healthy | 94% | Healthy โ |
AUGMENTATION: True
IMAGE_SIZE: [224, 224, 3]
BATCH_SIZE: 16
INCLUDE_TOP: False
EPOCHS: 20
CLASSES: 2
WEIGHTS: imagenet
LEARNING_RATE: 0.0001To modify training parameters, edit params.yaml and run:
dvc reprodocker build -t chicken-disease-app .docker run -p 8080:8080 chicken-disease-appversion: '3.8'
services:
app:
build: .
ports:
- "8080:8080"
environment:
- FLASK_ENV=productionGET /
Returns: HTML page
GET/POST /train
Description: Triggers model training
Returns: "Training done successfully!"
POST /predict
Content-Type: application/json
Request Body:
{
"image": "<base64_encoded_image>"
}
Response:
{
"image": "Coccidiosis" | "Healthy"
}
pytest tests/curl -X POST http://localhost:8080/predict \
-H "Content-Type: application/json" \
-d '{"image": "<base64_image>"}'- Image Classification with PyTorch
- Object Detection with YOLO
- Medical Image Analysis with CNNs
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a new branch (
git checkout -b feature/improvement) - Make changes and commit (
git commit -am 'Add new feature') - Push to branch (
git push origin feature/improvement) - Create Pull Request
- Follow PEP 8 style guide
- Add unit tests for new features
- Update documentation
- Ensure all tests pass
- Training requires GPU for optimal performance
- Large model size (~500MB) may cause slow initial load
- Web interface may timeout on slow connections
Issue: Model not loading
# Solution: Reinstall dependencies
pip install -r requirements.txt --force-reinstallIssue: Port 8080 already in use
# Solution: Use different port
python app.py --port 8081- Add more disease classes (Salmonella, Newcastle disease)
- Implement model quantization for mobile deployment
- Add batch prediction capability
- Create mobile application (iOS/Android)
- Add real-time video feed analysis
- Implement model versioning
- Add A/B testing framework
- Create REST API with FastAPI
- Add authentication and user management
- Implement monitoring and alerting
This project is licensed under the MIT License - see the LICENSE file for details.
MIT License
Copyright (c) 2026 Priyrajsinh
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
Priyrajsinh
- GitHub: @Priyrajsinh
- LinkedIn: [https://www.linkedin.com/in/priyrajsinh-parmar-b0a1a7243/]
- Email: [priyrajsinh03@gmail.com]
- Portfolio: [Soon]
- Krish Naik - For the amazing tutorial and project inspiration
- TensorFlow Team - For the excellent deep learning framework
- VGG Team - For the VGG16 architecture
- DVC Team - For ML pipeline management tools
- AWS - For cloud infrastructure
- Open Source Community - For various libraries and tools
For questions, suggestions, or collaboration opportunities:
- ๐ง Email: priyrajsinh03@gmail.com
- ๐ฌ GitHub Issues: Create an issue
If you found this project helpful, please give it a โญ!
Last Updated: February 2026