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)^ …