CDFL: Efficient Federated Human Activity Recognition Using Contrastive Learning and Deep Clustering

Ensieh Khazaei, Alireza Esmaeilzehi, Bilal Taha, Dimitrios Hatzinakos

Human Activity Recognition (HAR) is the backbone of everything from smart home automation to healthcare monitoring. However, training these models usually requires a trade-off: either you centralize sensitive user images on a server (risking privacy) or you use Federated Learning (FL), which often struggles with "client drift"—where local models become too specialized to their specific users and fail to form a cohesive global model.

A new paper from researchers at the University of Toronto introduces CDFL (Contrastive Deep Clustering Federated Learning), a framework that manages to improve accuracy by up to 10% while slashing bandwidth usage by 64%.

TL;DR

CDFL is a federated learning framework for image-based activity recognition that overcomes data heterogeneity by sending a tiny, privacy-preserved subset of "representative" images to the server. By combining contrastive learning with deep clustering, it achieves state-of-the-art accuracy and converges up to 10x faster than traditional federated approaches.

What Problem Does This Paper Address?

Standard Federated Learning (like the classic FedAvg algorithm) assumes that data is distributed somewhat evenly across clients. In the real world, this is rarely true. This is known as Non-IID (Independent and Identically Distributed) data. For example, one user might only have photos of "running," while another only has "sitting."

When local models train on such skewed data, they "drift" away from the global objective. Furthermore, image-based HAR is communication-heavy; sending large model weights back and forth is slow and expensive. Existing solutions often sacrifice privacy or struggle to scale. CDFL aims to fix the drift, protect privacy, and reduce the "bandwidth tax."

Methods

The authors propose a multi-layered approach to synchronize local and global learning:

  1. Privacy-Preserving Face Masking: Before any data is processed, the system uses the RetinaFace model to detect faces and applies a pixelization operation. This ensures that while the activity is visible, the identity is protected.
  2. Dual-Model Local Training: Each client maintains two models:
  3. A Personalized Model trained on original images for maximum local accuracy.
  4. A Local Model trained on pixelated images.
  5. The Secret Sauce: They use Contrastive Learning and Knowledge Distillation to force the Local Model’s feature representations to match the Personalized Model’s. This ensures the model learns the "essence" of the activity even from degraded, pixelated images.
  6. Deep Clustering for Image Selection: Instead of sending all data (which is impossible in FL) or no data (which causes drift), clients use K-means clustering on their feature space. They select only the $m$ images closest to each cluster centroid—the most "representative" samples—to send to the server.
  7. Server-Side Fine-Tuning: The server aggregates weights from only the top-performing clients (Client Selection) and then fine-tunes the global model using the small pool of privacy-preserved images collected from all clients. This "anchors" the global model and prevents it from drifting.

Datasets

The framework was evaluated on three widely recognized image-based HAR benchmarks:

  • Stanford40: 40 categories of human actions (9,532 images).
  • PPMI (People Playing Musical Instruments): 12 classes of people interacting with instruments (4,800 images).
  • VOC2012: 10 classes of actions (3,744 images).

The researchers used a Dirichlet distribution to simulate varying levels of data heterogeneity (Non-IIDness) among clients.

Key Insights and Ideas

  • A Little Data Goes a Long Way: The most striking insight is that the server doesn't need all the data to fix global drift. A tiny, carefully selected subset of representative, pixelated images is enough to "remind" the global model what various activities look like across the entire population.
  • Contrastive Alignment is Key: By using contrastive loss, the authors bridge the gap between high-quality private images and low-quality sharable images. This allows the global model to benefit from the "knowledge" of the private data without ever seeing it.
  • Strategic Exclusion: Unlike standard FL which tries to include every client, CDFL ranks clients by validation performance. Excluding "stragglers" or poorly performing clients actually speeds up convergence and improves the final model quality.

Key Results

CDFL consistently outperformed state-of-the-art baselines like FedProx, MOON, and FedDyn:

  • Accuracy Boost: CDFL showed an improvement of up to 9.8% over MOON on the VOC2012 dataset.
  • Convergence Speed: In many scenarios, CDFL reached target accuracy 10x faster than baselines. For instance, on Stanford40 with 100 clients, CDFL needed only 6 rounds to hit the target, while others needed 50+.
  • Bandwidth Efficiency: By selecting only the most effective clients and using a small data subset, the framework reduced communication overhead by approximately 64% in large-scale scenarios.

Limitations and Future Work

While CDFL is a significant step forward, the authors note a few areas for growth:

  • Image Quality: The impact of naturally degraded images (low light, motion blur) on the efficacy of the deep clustering selection hasn't been fully explored.
  • Multimodal HAR: The current work is strictly image-based. The authors suggest that a robust FL framework for multimodal HAR (combining video, audio, and inertial sensors like accelerometers) is the next logical step.
  • Extreme Heterogeneity: While it handles Non-IID data well, testing against even more "adversarial" data distributions remains a future goal.

Summary updated

BibTeX
@article{khazaei2024cdfl,
  author = {Ensieh Khazaei and Alireza Esmaeilzehi and Bilal Taha and Dimitrios Hatzinakos},
  title = {{CDFL: Efficient Federated Human Activity Recognition Using Contrastive Learning and Deep Clustering}},
  journal = {IEEE Sensors Journal},
  year = {2024},
  doi = {10.1109/jsen.2024.3464416},
}
Figure