Skip to content

AceofStades/Forest-Fire

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

164 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Forest-Fire Prediction & Simulation Platform

Project Status License Python Next.js FastAPI

A cutting-edge full-stack application for real-time forest fire prediction, 3D simulation, and safe path planning using Deep Learning.

FeaturesArchitectureGetting StartedContributing


Overview

Forest-Fire is an integrated platform designed to assist in wildfire management and prevention. By leveraging satellite data, deep learning (U-Net), and pathfinding algorithms (D* Lite), this tool provides actionable insights into fire spread and safe evacuation routes.

The system consists of a robust FastAPI backend that serves predictions from a PyTorch-based model, and a modern Next.js frontend that visualizes data in 2D, offers simulation controls, and provides an interactive dashboard for decision-makers.

📚 Research & Architecture: Read the comprehensive project documentation, including dataset engineering and model architectures, in the docs/project_overview.md file.

Key Features

  • Deep Learning Predictions: Utilizes a U-Net architecture to predict fire spread probability based on environmental factors (temperature, humidity, wind, rain).
  • Geospatial Simulation Engine: An interactive react-leaflet mapping interface allowing users to view dynamic Cellular Automata spreading atop real-world geographic bounds (Uttarakhand).
  • Safe Path Planning: Implements the D* Lite algorithm to calculate dynamic safe paths for rescue teams or evacuation based on real-time AI probabilities.
  • Historical Validation: Side-by-side temporal playbacks comparing the model's predicted 48-hour fire spread against actual historical MODIS satellite sequences.
  • Data Upload Portal: An interface for government or organizations to upload raw .nc, .tiff, or .geojson disaster snapshots for instant AI inference and routing.
  • AI Assistant: Integrated chat interface for querying system data and insights.

Architecture

The project follows a modern microservices-like architecture:

graph TD
    User[User] -->|Interacts| Client[Next.js Frontend]
    Client -->|HTTP/JSON| API[FastAPI Server]
    
    subgraph "Backend Services"
        API -->|Inference| Model[PyTorch U-Net]
        API -->|Pathfinding| Algo[D* Lite]
        API -->|Data| Store[Artifacts/Cache]
    end
    
    subgraph "Data Processing"
        Raw[Satellite/Weather Data] -->|Preprocessing| Model
    end
Loading

Tech Stack

Frontend
  • Framework: Next.js 15
  • Language: TypeScript
  • Styling: Tailwind CSS, Shadcn UI
  • Visualization: React Three Fiber, Recharts, Leaflet
  • State/Network: Axios, React Hook Form
Backend & Server
  • Framework: FastAPI
  • Server: Uvicorn
  • Language: Python 3.10+
  • Validation: Pydantic
Machine Learning
  • Deep Learning: PyTorch, TensorFlow (Legacy)
  • Architecture: U-Net (Custom implementation)
  • Data Processing: NumPy, Pandas, Scikit-learn
  • Pathfinding: D* Lite Algorithm

Project Structure

/
├── Frontend/           # Next.js Web Application
│   ├── app/            # App Router pages (Dashboard, Simulation, etc.)
│   ├── components/     # Reusable UI components (Three.js scenes, Charts)
│   └── ...
├── Server/             # FastAPI Backend
│   ├── app/
│   │   ├── main.py     # API Entry point
│   │   ├── d_star_lite.py # Pathfinding logic
│   │   └── ...
│   └── ...
├── Model/              # ML Research & Training
│   ├── src/            # Model definitions (UNet)
│   ├── weights/        # Trained model checkpoints
│   ├── dataset/        # Training data
│   └── ...
└── ...

Getting Started

Follow these instructions to set up the project locally.

Prerequisites

  • Node.js (v18+ recommended)
  • Python (v3.10+)
  • Git

1. Clone the Repository

git clone https://github.com/AceofStades/Forest-Fire.git
cd Forest-Fire

2. Backend Setup (FastAPI)

Navigate to the Server directory, create a virtual environment, and install dependencies.

cd Server

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Run the server
uvicorn app.main:app --reload --port 8000

The API will be available at http://localhost:8000.

3. Frontend Setup (Next.js)

Open a new terminal, navigate to the Frontend directory.

cd Frontend

# Install dependencies
npm install  # or pnpm install / yarn install

# Run the development server
npm run dev

The application will be running at http://localhost:3000.

4. ML Model Setup (Optional)

If you wish to retrain the model or explore the datasets:

cd Model
pip install -r requirements.txt
# Check src/ for model definitions and train.py for training scripts

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Credits

This project is brought to you by:

License

Distributed under the MIT License. See LICENSE for more information.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors