|
|
--- |
|
|
title: Fish Disease Detection AI |
|
|
emoji: π |
|
|
colorFrom: blue |
|
|
colorTo: green |
|
|
sdk: gradio |
|
|
sdk_version: 5.7.1 |
|
|
app_file: app.py |
|
|
pinned: false |
|
|
license: mit |
|
|
tags: |
|
|
- computer-vision |
|
|
- deep-learning |
|
|
- vgg16 |
|
|
- fish-disease |
|
|
- grad-cam |
|
|
- explainable-ai |
|
|
- medical-imaging |
|
|
--- |
|
|
|
|
|
# π Fish Disease Detection AI |
|
|
|
|
|
[](https://www.python.org/downloads/) |
|
|
[](https://pytorch.org/) |
|
|
[](https://gradio.app/) |
|
|
[](LICENSE) |
|
|
|
|
|
**AI-powered fish disease detection system combining VGG16 CNN, Grad-CAM explainability, and Gemini AI for comprehensive diagnosis and treatment recommendations.** |
|
|
|
|
|
--- |
|
|
|
|
|
## π― Key Features |
|
|
|
|
|
### π **High Accuracy** |
|
|
- **98.65% test accuracy** on 8 fish disease classes |
|
|
- Trained on **5,000+ annotated images** |
|
|
- Robust to various image conditions |
|
|
|
|
|
### π¬ **Explainable AI** |
|
|
- **Grad-CAM heatmap visualization** shows exactly where the model is looking |
|
|
- Highlights disease-relevant areas (lesions, discoloration, abnormalities) |
|
|
- Builds trust through transparency |
|
|
|
|
|
### π€ **AI-Powered Treatment** |
|
|
- **Google Gemini 2.0** generates disease-specific treatment protocols |
|
|
- Immediate actions, medication recommendations, and preventive measures |
|
|
- Expected recovery rates and timelines |
|
|
|
|
|
### β‘ **Real-Time Performance** |
|
|
- **~2-3 second inference** on GPU |
|
|
- Supports batch processing |
|
|
- Web-based interface accessible anywhere |
|
|
|
|
|
--- |
|
|
|
|
|
## π¦ Detected Diseases |
|
|
|
|
|
| Disease | Description | Severity | |
|
|
|---------|-------------|----------| |
|
|
| **Aeromoniasis** | Bacterial infection causing hemorrhaging | High | |
|
|
| **Bacterial Gill Disease** | Respiratory issues, gill damage | High | |
|
|
| **Bacterial Red Disease** | External lesions and ulcers | Medium | |
|
|
| **EUS** | Epizootic Ulcerative Syndrome | Critical | |
|
|
| **Healthy Fish** | No disease detected | None | |
|
|
| **Parasitic Diseases** | External/internal parasites | Medium | |
|
|
| **Saprolegniasis Fungal** | Fungal infection (cotton-like growth) | Medium | |
|
|
| **Viral White Tail** | Viral infection affecting tail | High | |
|
|
|
|
|
--- |
|
|
|
|
|
## π How to Use |
|
|
|
|
|
### 1οΈβ£ **Upload Image** |
|
|
Upload a clear, well-lit photo of your fish (JPG/PNG, max 10MB) |
|
|
|
|
|
### 2οΈβ£ **Analyze** |
|
|
Click "Analyze Fish" button for instant diagnosis |
|
|
|
|
|
### 3οΈβ£ **Review Results** |
|
|
- **Disease prediction** with confidence score |
|
|
- **Probability breakdown** for all 8 diseases |
|
|
- **Grad-CAM heatmap** showing model focus areas |
|
|
- **AI treatment recommendations** with detailed protocols |
|
|
|
|
|
--- |
|
|
|
|
|
## π Model Architecture |
|
|
|
|
|
Input Image (224Γ224 RGB) |
|
|
β |
|
|
VGG16 Backbone (Pretrained on ImageNet) |
|
|
β |
|
|
Feature Extraction (4096-dim) |
|
|
β |
|
|
Custom Classification Head |
|
|
β |
|
|
8-Class Softmax Output |
|
|
β |
|
|
Grad-CAM Activation Mapping |
|
|
|
|
|
|
|
|
**Technical Specifications:** |
|
|
- **Base Model:** VGG16 (transfer learning) |
|
|
- **Input Size:** 224Γ224 pixels |
|
|
- **Normalization:** ImageNet mean/std |
|
|
- **Framework:** PyTorch 2.5.1 |
|
|
- **Device:** CUDA/CPU compatible |
|
|
|
|
|
--- |
|
|
|
|
|
## π Performance Metrics |
|
|
|
|
|
| Metric | Score | |
|
|
|--------|-------| |
|
|
| **Test Accuracy** | 98.65% | |
|
|
| **Precision (avg)** | 98.2% | |
|
|
| **Recall (avg)** | 98.1% | |
|
|
| **F1-Score (avg)** | 98.15% | |
|
|
| **Training Samples** | 5,000+ | |
|
|
| **Validation Samples** | 1,000+ | |
|
|
| **Test Samples** | 500+ | |
|
|
|
|
|
--- |
|
|
|
|
|
## π― Confidence Thresholds |
|
|
|
|
|
The system uses a **70% confidence threshold** for reliable diagnoses: |
|
|
|
|
|
- **β₯ 80%** - π’ High confidence (Very reliable) |
|
|
- **70-79%** - π‘ Good confidence (Reliable) |
|
|
- **< 70%** - π΄ Low confidence (Requires verification) |
|
|
|
|
|
When confidence is below 70%, the system: |
|
|
- Shows top 3 disease candidates |
|
|
- Provides general guidelines |
|
|
- Recommends professional consultation |
|
|
|
|
|
--- |
|
|
|
|
|
## π¬ Grad-CAM Visualization |
|
|
|
|
|
**Understanding the Heatmap:** |
|
|
|
|
|
- π΄ **Red areas** - High importance (disease symptoms, lesions) |
|
|
- π‘ **Yellow areas** - Moderate importance |
|
|
- π’ **Green/Blue areas** - Low importance |
|
|
|
|
|
The heatmap proves the model focuses on actual pathological features, not spurious correlations. |
|
|
|
|
|
--- |
|
|
|
|
|
## π οΈ Technical Details |
|
|
|
|
|
### Dependencies |
|
|
|
|
|
torch==2.5.1 |
|
|
torchvision==0.20.1 |
|
|
gradio==5.7.1 |
|
|
google-generativeai==0.8.3 |
|
|
pillow==11.0.0 |
|
|
opencv-python-headless==4.10.0.84 |
|
|
numpy==1.26.4 |
|
|
python-dotenv==1.0.0 |
|
|
|
|
|
|
|
|
### Environment Setup |
|
|
This application requires a **Gemini API key** for treatment recommendations. Set it as an environment variable: |
|
|
|
|
|
GEMINI_API_KEY=your_api_key_here |
|
|
|
|
|
--- |
|
|
|
|
|
## β οΈ Medical Disclaimer |
|
|
|
|
|
**This is an AI diagnostic tool for preliminary screening only.** |
|
|
|
|
|
### β
Use For: |
|
|
- Initial disease screening |
|
|
- Educational purposes |
|
|
- Research and development |
|
|
- Aquaculture monitoring |
|
|
|
|
|
### β Do NOT Use For: |
|
|
- Definitive medical diagnosis |
|
|
- Treatment without professional consultation |
|
|
- Emergency veterinary decisions |
|
|
|
|
|
**Always consult a qualified aquaculture veterinarian for:** |
|
|
- Professional diagnosis confirmation |
|
|
- Treatment plan approval |
|
|
- Medication dosage recommendations |
|
|
- Emergency health situations |
|
|
|
|
|
--- |
|
|
|
|
|
## π Research & Citation |
|
|
|
|
|
This project is part of research on AI-assisted aquaculture diagnostics and explainable deep learning. |
|
|
|
|
|
**BibTeX Citation:** |
|
|
|
|
|
@software{fish_disease_detection_2025, |
|
|
author = {Justin Mathais}, |
|
|
title = {Fish Disease Detection AI: VGG16 with Grad-CAM Explainability}, |
|
|
year = {2025}, |
|
|
url = {https://github.com/YOUR_USERNAME/fish-disease-detection} |
|
|
} |
|
|
|
|
|
--- |
|
|
|
|
|
## π§ Contact & Support |
|
|
|
|
|
- **Author:** Your Name |
|
|
- **Email:** [email protected] |
|
|
- **GitHub:** [github.com/mathaisjustin](https://github.com/mathaisjustin) |
|
|
- **Issues:** [Report bugs or suggest features](https://github.com/mathaisjustin/fish-disease-detection/issues) |
|
|
|
|
|
--- |
|
|
|
|
|
## π License |
|
|
|
|
|
This project is licensed under the **MIT License** - see [LICENSE](LICENSE) file for details. |
|
|
|
|
|
--- |
|
|
|
|
|
## π Acknowledgments |
|
|
|
|
|
- **VGG16 Architecture:** Simonyan & Zisserman ([Paper](https://arxiv.org/abs/1409.1556)) |
|
|
- **Grad-CAM:** Selvaraju et al. ([Paper](https://arxiv.org/abs/1610.02391)) |
|
|
- **Google Gemini AI:** Treatment recommendation generation |
|
|
- **PyTorch Community:** Deep learning framework |
|
|
- **Gradio:** Web interface framework |
|
|
|
|
|
--- |
|
|
|
|
|
## π Star History |
|
|
|
|
|
If this project helped you, please consider giving it a β on [GitHub](https://github.com/YOUR_USERNAME/fish-disease-detection)! |
|
|
|
|
|
--- |
|
|
|
|
|
**Made with β€οΈ for aquaculture health** |
|
|
|