Skip to content

sruRaj07/arrhythmia-Detection-Federatted-Learning

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Arrythmia-Detection: Federated Learning with MIT-BIH Dataset

alt text

Overview

Arrythmia-Detection is a federated learning system built using Flower (flwr) for arrhythmia detection on the MIT-BIH dataset. The project demonstrates privacy-preserving distributed model training, where multiple clients collaboratively train a model without sharing raw data.

Architecture

  • Server (server.py)

    • Orchestrates federated learning rounds.
    • Aggregates model updates and evaluation metrics from clients.
    • Uses the FedAvg strategy for model aggregation.
    • Configurable for number of rounds and client requirements.
    • Handles logging and suppresses unnecessary warnings.
  • Clients (client1.py, client2.py, client_base.py)

    • Each client trains locally on its own data.
    • Inherit shared logic from client_base.py.
    • Perform local training, evaluation, and send updates/metrics to the server.
  • Data Preparation (prep_mitbih.py)

    • Prepares and preprocesses the MIT-BIH arrhythmia dataset for client consumption.

Communication Flows

  • Server ↔ Clients

    • Server sends global model and training instructions to clients.
    • Clients send model updates and evaluation metrics to the server.
    • Heartbeat/status signals for monitoring client availability.
  • Data Provisioning

    • Clients load and preprocess data using prep_mitbih.py.

Deployment

  • The server and clients can be deployed on cloud services, on-premises machines, or containers.
  • Secure communication (SSL/TLS) is recommended for production.
  • Logging and monitoring are integrated for system health and debugging.

File Structure

Arrythmia-Detection/
│
├── server.py           # Federated server logic and orchestration
├── client_base.py      # Base class for client logic
├── client1.py          # Client 1 implementation
├── client2.py          # Client 2 implementation
├── prep_mitbih.py      # Data preparation for MIT-BIH dataset

Getting Started

Prerequisites

  • Python 3.7+
  • Flower (pip install flwr)
  • Required ML/DL libraries (e.g., TensorFlow, PyTorch, NumPy, etc.)
  • MIT-BIH Arrhythmia dataset

Installation

  1. Clone the repository:

    git clone <your-repo-url>
    cd Arrythmia-Detection
  2. Install dependencies:

    pip install flwr
    # Add other dependencies as needed

Usage

1. Prepare Data

Run prep_mitbih.py to preprocess the MIT-BIH dataset for clients.

2. Start the Server

python server.py
  • The server listens on 0.0.0.0:8000 by default.

3. Start Clients

In separate terminals, start each client:

python client1.py
python client2.py
  • Each client loads its data, trains locally, and communicates with the server.

Customization

  • Modify client_base.py to change client logic or add new clients.
  • Adjust server parameters (e.g., number of rounds) in server.py.
  • Update data preprocessing steps in prep_mitbih.py as needed.

Monitoring & Logging

  • The server and clients use Python's logging module for event tracking.
  • Consider integrating external monitoring tools for production deployments.

Security

  • For production, enable SSL/TLS for secure communication.
  • Implement authentication for client-server connections if needed.

References

License

Specify your license here (e.g., MIT, Apache 2.0).

About

A repository to introduce different modern framework to detect arrythmia heart disease using federated learning frameworks .

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages