Skip to content

nipunanisha/flarenet-phase3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

51 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Flarenet - Transformer Maintenance Record Keeper

Flarenet is a web-based system designed to manage and automate transformer inspections using thermal images. Users can record transformer details, upload baseline and maintenance thermal images, and tag images by environmental conditions such as sunny, cloudy, or rainy. The system includes automated anomaly detection using machine learning models to analyze thermal images and generate digital maintenance records.

Current Stage: Milestone 02 - Full-stack application with integrated ML inference for anomaly detection.

React Vite npm Java PostgreSQL Material UI Spring Boot Docker Node.js Python FastAPI PyTorch


Overview

Flarenet is a full-stack web application with a React frontend, Spring Boot backend, Python ML backend, and PostgreSQL database.

  • Frontend: Built with React, Vite, and Material UI for fast and responsive UI.
  • Backend: Spring Boot handles business logic, CRUD operations, and provides REST APIs.
  • ML Backend: Python FastAPI server for automated anomaly detection on thermal images using PyTorch models.
  • Database: PostgreSQL via Docker Compose stores transformers, inspections, thermal images, and analysis results.

This system demonstrates modern full-stack development with AI integration, including user authentication, CRUD operations, image upload/management, and ML-powered analysis.


Dependencies

Frontend

  • React, Vite, Material UI
  • Axios or fetch for API requests
  • Node.js and npm to run scripts

Backend

  • Java 17+, Spring Boot 3+
  • Spring Data JPA for database interactions
  • PostgreSQL via Docker Compose
  • Maven for dependency management

Python ML Backend

  • Python 3.8+
  • FastAPI, PyTorch
  • OpenCV, Pillow for image processing
  • Uvicorn for server

πŸš€ Local Setup

1. Clone the repository

git clone https://github.com/RavijaDul/FlareNet.git
cd FlareNet

2. Start Postgres with Docker

We use Docker to run Postgres with schema and seed data automatically.

docker compose down -v
docker compose up -d
  • Database: flarenet
  • User: flarenet
  • Password: flarenet
  • Port: 5432

Images will be available inside flarenet-backend/uploads/.

Note: The first time you run this, Postgres will execute init.sql and create all tables and seed data.

To explore the database(Optional)

docker exec -it flarenet-db psql -U flarenet -d flarenet

3. Run the JAVA Backend

Navigate to the backend folder and start the Spring Boot server:

cd flarenet-backend
mvn spring-boot:run

Electrical / Transformer Thermal Anomaly Detection – End‑to‑End Documentation

This repository provides an end‑to‑end workflow for detecting thermal anomalies (loose joints, wire overloads, localized hot spots) in transformer / electrical component images using a pretrained PatchCore model (Wide ResNet50 backbone) plus deterministic OpenCV post‑processing and rule‑based classification.


Overview

Transformer thermal anomaly detection system achieving strong precision/recall tradeoff while maintaining complete explainability of post‑processing logic.


Performance Metrics

Metric Value Description
AUROC 88.7% Area under ROC curve (image/region level)
F1-Score 91.6% Harmonic mean of precision & recall (fault classification)
Inference Accuracy 100% All faulty images flagged (no false negatives)
Processing Speed 1.77 FPS Average end‑to‑end throughput (Python, single GPU/CPU mix)

Expected (reference environment):

  • Training (1 epoch) β‰ˆ 20 minutes
  • Test batch run β‰ˆ 40 seconds
  • Reported stats (single validation set) β‰ˆ above table

Average performance baseline used: percentage threshold calibration anchored at 40% (see Calibration section) for internal acceptance testing The backend API will be available at http://localhost:8080/api.


4. Run the python backend

cd python-backend
python -m venv venv

venv\Scripts\activate   # Windows:
source venv/bin/activate    # macOS/Linux:

pip install -r requirements.txt
python model_weight.py
uvicorn app:app --host 0.0.0.0 --port 5000 --reload

5. Run the Frontend

Navigate to the frontend folder, install dependencies, and start the dev server:

cd frontend
npm install
npm run dev

The frontend will be available at http://localhost:5173.


πŸ—‚οΈ Project Structure

FlareNet/
β”œβ”€β”€ docker-compose.yml          # Docker Compose for Postgres DB
β”œβ”€β”€ flarenet-backend/
β”‚   β”œβ”€β”€ db/
β”‚   β”‚   └── init.sql            # Database schema + seed data
β”‚   β”œβ”€β”€ uploads/                # Images folder (mounted in Docker)
β”‚   β”œβ”€β”€ src/                    # Java backend code
β”‚   └── pom.xml                 # Maven build file
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/                    # React frontend code
β”‚   β”œβ”€β”€ package.json
β”‚   └── package-lock.json
β”œβ”€β”€ python-backend/
β”‚   β”œβ”€β”€ app.py                  # FastAPI server for ML inference
β”‚   β”œβ”€β”€ model_core.py           # ML model loading and inference logic
β”‚   β”œβ”€β”€ model_weight.py         # Script to download model weights
β”‚   β”œβ”€β”€ requirements.txt        # Python dependencies
β”‚   └── test_request.py         # Test script for API
└── README.md

βš™οΈ Notes for Teammates

  1. Images:
    All thermal images are stored in flarenet-backend/uploads/. This folder is mounted in Docker, so images are accessible to the backend.

  2. Database:

    • Tables: users, transformers, inspections, thermal_image, analysis_result
    • The database will be automatically created on first Docker run.
  3. Environment variables (optional): Customize DB credentials in docker-compose.yml. Backend application.yml should matches these credentials.

  4. Model Training and Inference: For Milestone 02, the Python backend includes inference capabilities. Model training and detailed inference testing are available in a separate repository (link to be provided later). The current setup uses pre-trained models for anomaly detection.


βœ… Quick Commands

# Start database
docker compose down -v
docker compose up -d

# Start backend
cd flarenet-backend
mvn spring-boot:run

# Start frontend
cd frontend
npm install
npm run dev



# Start python backend
# Go to backend folder
cd python-backend

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

# Install dependencies
pip install -r requirements.txt

# Optional: download model weights first
python model_weight.py

# Run the FastAPI server
uvicorn app:app --host 0.0.0.0 --port 5000 --reload

πŸ“Œ Additional Tips

  • To stop the DB: docker compose down
  • To reset the DB: delete pgdata volume or run docker compose down -v and docker compose up -d
  • Use Postgres GUI tools (like pgAdmin or DBeaver) to inspect the database if needed

⚠️ Limitations & Issues

  • Authentication & user roles missing – At this stage, the system does not include authentication, authorization, or multi-user role management. These features will be added in future phases.
  • Deployment not yet available – FlareNet currently runs only in a local development environment (Docker + local servers). A cloud deployment setup is not yet provided.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •