A lightweight federated learning platform built on Raspberry Pi, supporting distributed model training, centralized aggregation, real-time device monitoring, and a web-based management dashboard.
- Federated Averaging (FedAvg)
- Distributed training on multiple Raspberry Pi nodes
- Automatic client reconnection
- Real-time CPU, memory and temperature monitoring
- Web dashboard based on Streamlit
- Flask RESTful backend
- Training control (Start / Pause / Resume)
- Dynamic training round extension
- CSV export of training metrics
- Heterogeneous client support
- NumPy implementation
- PyTorch implementation
+----------------------+
| Streamlit Dashboard |
+----------+-----------+
|
REST API
|
+------+------+
| Flask Server |
+------+------+
|
Federated Learning Server
|
+----------------+----------------+
| |
Raspberry Pi 1 Raspberry Pi 2
(NumPy Client) (PyTorch Client)
| |
Local Training Local Training
+---------------+-----------------+
|
Federated Averaging
.
├── server.py # Federated learning server
├── dashboard.py # Streamlit dashboard
├── protocol.py # Communication protocol
├── client_pi1.py # NumPy client
├── client_pi2.py # PyTorch client
├── mnist_data/
│ ├── X_train.npy
│ └── y_train.npy
└── README.md
Python 3.10+
Install dependencies
pip install flask
pip install streamlit
pip install numpy
pip install pandas
pip install matplotlib
pip install torch
pip install psutilpython server.pystreamlit run dashboard.pypython client_pi1.pypython client_pi2.pyThe dashboard provides
- Device connection status
- CPU utilization
- Memory utilization
- CPU temperature
- Current training round
- Global loss
- Global accuracy
- Training control
- CSV export
- Clients connect to the server.
- The server distributes the global model.
- Clients perform local training.
- Local parameters are uploaded.
- The server performs FedAvg aggregation.
- Updated global parameters are broadcast.
- Repeat until the specified number of rounds is completed.
- Python
- Flask
- Streamlit
- NumPy
- PyTorch
- Socket Programming
- Multithreading
- Federated Learning (FedAvg)
- Raspberry Pi
- Secure Aggregation
- Differential Privacy
- Asynchronous Federated Learning
- Client Selection
- CNN / Transformer models
- MQTT communication
- Docker deployment
MIT License