  Human activity recognition (HAR) with wearables is promising research that
can be widely adopted in many smart healthcare applications. In recent years,
the deep learning-based HAR models have achieved impressive recognition
performance. However, most HAR algorithms are susceptible to the multi-class
windows problem that is essential yet rarely exploited. In this paper, we
propose to relieve this challenging problem by introducing the segmentation
technology into HAR, yielding joint activity segmentation and recognition.
Especially, we introduce the Multi-Stage Temporal Convolutional Network
(MS-TCN) architecture for sample-level activity prediction to joint segment and
recognize the activity sequence. Furthermore, to enhance the robustness of HAR
against the inter-class similarity and intra-class heterogeneity, a multi-level
contrastive loss, containing the sample-level and segment-level contrast, has
been proposed to learn a well-structured embedding space for better activity
segmentation and recognition performance. Finally, with comprehensive
experiments, we verify the effectiveness of the proposed method on two public
HAR datasets, achieving significant improvements in the various evaluation
metrics.
