Smart aquaculture AI backend built with FastAPI β enabling fish counting, disease detection, biomass estimation, and more. Designed for real-world farm automation with modular service architecture and AI integration.
# π FIRMATECH-BACKEND-AI
Smart aquaculture AI backend built with **FastAPI** β enabling fish counting, disease detection, biomass estimation, and more. Designed for real-world farm automation with modular service architecture and AI integration.
---
## π Table of Contents
* Features
* Architecture
* AI Models & Evaluation
* Endpoints Overview
* Project Structure
* Getting Started
* Environment Setup
* Future Work
* License
---
## β
Features
| Module | Description |
| -------------------- | -------------------------------------------------------------------- |
| π₯ Fish Counting | Real-time video-based fish counting using YOLOv8 + Centroid Tracking |
| βοΈ Weight Estimation | Biomass calculation via length-based prediction formula |
| π©Ί Disease Detection | Classify fish sickness from image (e.g., Aeromonas, Tilapia Virus) |
| π§ͺ Farm Monitoring | Generate natural language reports from sensor data using Gemini API |
| π½οΈ Food Prediction | *(Planned)* Predict fish feeding needs based on AI heuristics |
---
## π§± Architecture
```
FastAPI
πΌ Routers (API Endpoints)
πΌ Controllers (Logic Handlers)
πΌ Modules (Pydantic Schemas)
πΌ Services (Roboflow / Agent)
πΌ Utils (Tracking, Math utils)
```
> Uses **Roboflow** for AI inference and **Gemini Pro** for report generation.
---
## π AI Models & Evaluation
### π€ 1. Fish Detection & Counting (YOLOv8)
* **Model**: Custom YOLOv8m (Roboflow)
* **Input**: Video frames
* **Output**: Bounding boxes of detected fish
* **Post-processing**: `CentroidTracker` avoids double counting
### 𧬠2. Disease Classification
* **Model**: Roboflow classification model
* **Classes**:
* `Healthy-Fish`
* `Tilapia Lake Virus`
* `Bacterial Aeromonas Disease`
* `Streptococcus`
* `null` (uncertain)
```json
{
"isSick": true,
"sicknessType": "Streptococcus"
}
```
### βοΈ 3. Weight Prediction
* **Formula**:
```
Weight (g) = 0.0196 Γ Length(cm)^ β¦