Back to projects

PROJECT NOTES / FEDERATED LEARNING

Federated Learning
for Mask Recognition.

Starting from an existing mask recognition baseline, I helped build a Flower multi-client training simulation, then independently authored a paper exploring how client count and local training epochs affect accuracy and training time.

MY INVOLVEMENT
Major implementation, data preparation and independent paper authorship
CONTEXT
Group coursework → independent research paper
FOCUS
Python · PyTorch · Flower

From local training to global evaluation.

  1. 01

    Train locally

    Each client trains a lightweight CNN on its own data partition

  2. 02

    Aggregate on the server

    A FedAvg-based strategy combines updates and saves the global model and metrics

  3. 03

    Evaluate on held-out data

    Measure global-model loss and accuracy on images excluded from training

The group-stage mask recognition pipeline used local client processes to simulate distributed training, not a deployment across real devices.

01 / GROUP STAGE

Extending a mask recognition baseline into federated training.

The team started from an existing mask recognition project, using a lightweight PyTorch CNN to classify images as masked or unmasked. We used Flower to simulate distributed training locally. Each client trained on its own data partition and returned model parameters and metrics; the server aggregated updates through a custom FedAvg-based strategy, saved the global model and recorded training accuracy and loss.

The group-stage launcher ran one server and five client processes. After training, we evaluated the global model on a separate held-out test set, using cross-entropy loss to measure prediction error and classification accuracy to measure recognition performance. This was a local multi-process simulation, not a completed deployment across real devices.

The PPT’s CIFAR-10 non-IID experiments were a separate group-stage exploration of imbalanced data distributions and local training configurations. They are distinct from the mask recognition training records shown here and are not cited as mask recognition results.

Group-stage training record: Training Accuracy per Round, with aggregation Round on the horizontal axis and training Accuracy on the vertical axis; accuracy rises before levelling off.
Group-stage training record · Training accuracy over aggregation rounds. Source: group presentation, slide 10; not the later paper's configuration comparison. View original image
Group-stage training record: Training Loss per Round, with aggregation Round on the horizontal axis and training Loss on the vertical axis; loss drops before fluctuating at a lower level.
Group-stage training record · Training loss over aggregation rounds. Source: group presentation, slide 10; not an evaluation curve from the held-out test set. View original image

Original titles, axes and ticks are preserved. On narrow screens, swipe within each chart (or focus it and use the arrow keys), or open the original image to zoom in.

02 / MY CONTRIBUTION

Connecting data, training, evaluation and local prediction.

As recorded on the presentation’s Division of Work slide (slide 21), I collected and processed training and testing data, wrote the major implementation of the mask recognition federated pipeline and presented the distributed training implementation. These were my main contributions within a collaborative project, not a claim of sole ownership of the team’s work.

01

Data preparation and model

I collected and processed the training and testing data, organising masked and unmasked images. I implemented data loading and equal client partitions in dataset.py, and the lightweight CNN in model.py, preparing a consistent input pipeline for local training and held-out evaluation.

02

Client training and server aggregation

I wrote the major implementation of client.py and server.py. Flower’s NumPyClient loads local data, trains the model and returns parameters and metrics. The server uses a FedAvg-based strategy to aggregate updates, save the global model each round, record accuracy and loss, and generate curves when training finishes.

03

Experiment launching and evaluation

I implemented run_all.py to launch the server and multiple clients with distinct CLIENT_IDs, connecting the local simulation workflow. I also implemented evaluate_model.py to calculate cross-entropy loss and classification accuracy on an independent test set, checking recognition on unseen images.

04

Local prediction interface

I implemented the local graphical interface in predict_gui.py, loading the trained model so users could upload an image and see its mask classification.

Group-stage local prediction tool: the Mask Detection window shows a masked example image, the Prediction: With Mask result and the Upload Image button.
Group-stage local tool · The masked example image is predicted as With Mask. Source: group presentation, slide 12. View original image
Group-stage local prediction tool: the Mask Detection window shows an unmasked example image, the Prediction: Without Mask result and the Upload Image button.
Group-stage local tool · The unmasked example image is predicted as Without Mask. Source: group presentation, slide 12. View original image

03 / FOLLOW-UP PAPER

From a training pipeline to configuration trade-offs.

Building on the group project, I independently authored the paper Federated Learning on Mask recognition with its local simulation and optimization, studying combinations of client count and local training epochs. Local epochs refer to passes through a client’s data before aggregation, rather than the server’s aggregation rounds.

As described in the project README, the follow-up analysis uses a Pareto frontier to present trade-offs between accuracy and training time: configurations that cannot improve one objective without sacrificing the other, rather than simply ranking by maximum accuracy. It uses the Friedman test and Nemenyi comparisons to compare configurations. This page describes the methods without quoting optimal settings, significance claims or numerical results that lack an explicit source.

The journal page lists the paper as published on 23 October 2025, in STECEP, Volume 3, Issue 5, with Liukai Tang as the author. Publication status follows the journal page; the README’s “Under Review” label is an earlier record.

04 / PROJECT LINKS

Read the paper and explore the implementation.

The paper page provides publication details and access to the full text. The repository README documents the workflow, Pareto analysis and statistical testing scripts. Check the repository’s licence and usage instructions before using its contents.

Back home. Keep exploring.