Skip to content

ORION2809/aquaculture_ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Aquaculture AI 🐟

An intelligent aquaculture farm management system powered by machine learning.

Features

  • Water Quality Engine (WQE): Analyze, classify, and predict water quality
  • Anomaly Detection: Detect sensor failures and unusual patterns
  • Time-Series Prediction: Forecast pH, DO, temperature, and ammonia
  • Actionable Recommendations: Get expert-system recommendations
  • REST API: Deploy as a service

Quick Start

Installation

# Clone or navigate to the project
cd aquaculture_ai

# Create virtual environment
python -m venv venv
source venv/bin/activate  # Linux/Mac
# or
.\venv\Scripts\activate  # Windows

# Install dependencies
pip install -r requirements.txt

Basic Usage

from src.engines.water_quality import WaterQualityEngine

# Initialize engine
engine = WaterQualityEngine()

# Generate synthetic data and train all models
results = engine.train_all(n_synthetic=5000)

# Analyze current water quality
analysis = engine.analyze({
    "pH": 7.5,
    "DO": 5.2,
    "temperature": 28.5,
    "ammonia": 0.3
})

print(f"WQI Score: {analysis['wqi_score']}")
print(f"Quality: {analysis['status']['quality_class']}")
print(f"Stress Level: {analysis['status']['stress_level']}")
print(f"Alerts: {len(analysis['alerts'])}")
print(f"Recommendations: {analysis['recommendations']}")

Run API Server

from src.engines.water_quality import WaterQualityEngine
from src.api.endpoints import run_server

# Initialize and train engine
engine = WaterQualityEngine()
engine.train_all()

# Start API server
run_server(host="0.0.0.0", port=8000, engine=engine)

Then access:

Project Structure

aquaculture_ai/
├── src/
│   ├── config.py              # Configuration & thresholds
│   ├── data/
│   │   ├── loader.py          # Data loading
│   │   ├── cleaner.py         # Data cleaning
│   │   ├── preprocessor.py    # Feature engineering
│   │   └── schema.py          # Data schema validation
│   ├── engines/
│   │   └── water_quality.py   # Main Water Quality Engine
│   ├── models/
│   │   ├── classifier.py      # XGBoost classifier
│   │   ├── lstm_predictor.py  # LSTM time-series
│   │   └── anomaly_detector.py # Isolation Forest
│   ├── utils/
│   │   ├── metrics.py         # Evaluation metrics
│   │   ├── visualization.py   # Plotting
│   │   └── alerts.py          # Alert system
│   └── api/
│       └── endpoints.py       # FastAPI endpoints
├── notebooks/                  # Training notebooks
├── data/                       # Data storage
├── saved_models/              # Trained models
└── tests/                     # Unit tests

Water Quality Engine

The WQE provides three main models:

1. Classifier

Classifies water quality into categories:

  • Excellent (WQI > 85)
  • Good (WQI 70-85)
  • Moderate (WQI 55-70)
  • Poor (WQI 40-55)
  • Dangerous (WQI < 40)

2. LSTM Predictor

Predicts next 6-24 hours of:

  • pH
  • Dissolved Oxygen (DO)
  • Temperature
  • Ammonia

3. Anomaly Detector

Detects:

  • Sensor failures
  • Sudden spikes
  • Unusual patterns

Configuration

Key thresholds in config.py:

Parameter Safe Range Optimal
pH 6.0 - 9.0 7.5
DO 4.0+ mg/L 6.0 mg/L
Temperature 24-32°C 26-30°C
Ammonia < 0.5 mg/L < 0.02 mg/L

API Endpoints

Endpoint Method Description
/health GET Health check
/analyze POST Analyze water quality
/predict POST Predict future values
/train POST Train models
/alerts GET Get active alerts
/thresholds GET Get thresholds

Future Engines

This project is designed to support additional engines:

  • Growth Prediction Engine
  • Survival Risk Engine
  • Feeding Efficiency Engine
  • Disease & Medicine Engine
  • Yield Prediction Engine
  • Root Cause & Recommendation Engine

License

MIT License

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors