GenHAR: Generalizing Cross-domain Human Activity Recognition for Last-mile Delivery

Zhiqing Hong, Zelong Li, Xiubin Fan, Guang Yang, Baoshen Guo, Haotian Wang, Tian He, Desheng Zhang

TL;DR

GenHAR introduces a highly efficient domain generalization framework for Human Activity Recognition (HAR) that operates entirely in the frequency domain. By leveraging sensor-wise self-attention and selective masking on pure amplitude features, it achieves state-of-the-art cross-domain accuracy while cutting overall FLOPs by 6.4x, making it perfectly suited for large-scale deployment on resource-constrained mobile edge devices.

What Problem Does This Paper Address?

Deep learning models for Human Activity Recognition (HAR) using Inertial Measurement Units (IMUs) perform exceptionally well when training and testing data come from the same distribution. However, in real-world applications like last-mile delivery, models face severe performance drops due to distribution shifts—differences in user behavior, body types, device models, or sensor placements.

Performance degradation in cross-domain HAR

While domain adaptation techniques can mitigate this, they require data from the target domain during training, which is often expensive or impossible to collect beforehand. Domain generalization aims to train a model using only source domain data so that it can generalize to unseen target domains. However, existing methods are computationally heavy and fail to exploit the unique properties of IMU data, making them impractical for real-time deployment on low-resource edge devices like smartwatches and handheld scanners.

Methods

GenHAR tackles these challenges through a novel frequency-space Transformer architecture that focuses on learning domain-invariant representations:

Overall framework of GenHAR
  1. Frequency Generation: Raw time-series IMU data is transformed into the frequency domain using the Fast Fourier Transform (FFT). Crucially, GenHAR discards the phase information and extracts only the amplitude spectrum, which is highly stable across domains.
  2. Sensor-wise Self-Attention: Traditional Transformers compute self-attention along the temporal or frequency sequence length ($O(T^2)$ complexity). GenHAR flips this approach: it treats the entire frequency sequence of a single sensor channel as a single token and computes attention across channels ($O(M^2)$ complexity, where the number of channels $M \ll T$). This captures robust, physical correlations between different axes of the accelerometer and gyroscope.
  3. Selective Masking: To further optimize efficiency and accuracy, GenHAR masks out unhelpful cross-sensor correlations (e.g., between the X-axis of the accelerometer and the Y-axis of the gyroscope) that lack a direct physical connection. This reduces matrix multiplications in the attention map by 33.3%.

Datasets

The authors evaluated GenHAR on four widely used public benchmarks for cross-domain HAR:

  • UCI
  • Shoaib
  • Motion
  • HHAR

Each dataset represents a distinct domain with variations in users, devices, and environments. The model was evaluated using a leave-one-domain-out cross-dataset setup to rigorously test generalization.

Key Insights and Ideas

  • Amplitude is the Secret to Invariance: Phase information is highly sensitive to random noise and device orientation, causing massive distribution shifts. Amplitude, however, remains remarkably consistent across different domains. The authors show that the Earth Mover's Distance (EMD) between domains is 44 times smaller for amplitude than for phase.
Amplitude features show significantly lower domain shift compared to phase features
  • Channel Correlations Trump Sequence Patterns: In cross-domain settings, the exact temporal sequence pattern changes drastically from person to person. However, the physical correlation between sensor channels (e.g., how the X and Y axes move together during walking) remains invariant.
  • Flipping Attention Slashes Complexity: By performing attention across channels ($M=6$) instead of time steps ($T=120$), GenHAR reduces the self-attention computational complexity by a staggering 43.2 times, turning the traditionally heavy Transformer into an ultra-lightweight edge model.

Key Results

  • State-of-the-Art Accuracy: GenHAR achieves an average cross-domain accuracy of 81.42%, outperforming the best baseline (UniHAR) by 9.97%.
  • Massive Efficiency Gains: Compared to top baselines, GenHAR reduces overall Floating Point Operations (FLOPs) by 6.4x (52k vs 333k+), maintaining a tiny parameter footprint of just 25k.
  • Real-World Scale Deployment: The framework was successfully deployed in production at JD Logistics, running on the mobile Personal Digital Assistants (PDAs) of 9,985 delivery couriers across 4 cities. In a single month, it processed 2.15 billion real-time activities (including 1.84 billion still, 215 million walking, and 54.8 million upstairs/downstairs movements) to help understand courier workloads and improve map address mining.

Limitations and Future Work

  • High-Frequency Overhead: While highly efficient, the model currently processes the full frequency spectrum. The authors note that cutting off uninformative high-frequency components could reduce the input length and shrink the parameter size even further.
  • Task Expansion: Future work includes extending GenHAR to other real-time mobile sensing tasks such as anomaly detection and hand gesture recognition.
  • Further Compression: The authors plan to explore model quantization and parameter sharing to drive down edge resource consumption even lower.

Summary updated

BibTeX
@inproceedings{hong2026genhar,
  author = {Zhiqing Hong and Zelong Li and Xiubin Fan and Guang Yang and Baoshen Guo and Haotian Wang and Tian He and Desheng Zhang},
  title = {{GenHAR: Generalizing Cross-domain Human Activity Recognition for Last-mile Delivery}},
  booktitle = {ACM SIGKDD Conference on Knowledge Discovery and Data Mining},
  year = {2026},
  doi = {10.1145/3770854.3783921},
}

Loading related content...

Figure