Label-free exercise cardiopulmonary data pre-training method and system based on contrast learning

By performing multi-granularity segmentation of cardiopulmonary activity signals and cross-granularity comparative learning driven by the continuity of motion state, the problem of insufficient feature utilization in pre-training of unlabeled cardiopulmonary data is solved, thereby improving the analytical accuracy and convergence speed of the model.

CN123183048APending Publication Date: 2026-11-27SICHUAN WEILIAN BIOTECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611391701.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-09
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

Existing technologies struggle to effectively utilize the multi-level dynamic features of cardiopulmonary data under label-free conditions, and are unable to construct positive and negative samples under the constraint of continuous motion state, resulting in poor pre-training effects of cardiopulmonary data.

Method used

By dividing cardiopulmonary activity signals into fine-grained and coarse-grained segments according to different time granularities, and combining positive and negative samples with motion state description sequences, sample groups are constructed using the continuity of motion states. Furthermore, a segment association encoding network is trained through cross-granularity comparison learning to generate pre-trained network weights.

Benefits of technology

It enables multi-level spatiotemporal feature representation of cardiopulmonary data under label-free conditions, improving the model convergence speed and analysis accuracy of downstream tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123183048A_ABST
    Figure CN123183048A_ABST
Patent Text Reader

Abstract

The application provides a kind of pre-training method and system of no-label exercise cardiopulmonary data based on contrast learning, it is related to exercise health monitoring and machine learning technical field, obtains no-label exercise cardiopulmonary data set;Heart-lung activity signal sequence is divided into fragments according to different time granularity, generate the multi-time granularity dynamic fragment set containing fine-grained first main fragment unit and its first neighborhood fragment unit set and coarse-grained second main fragment unit and its second neighborhood fragment unit set;Based on exercise state description sequence, first main fragment unit and second main fragment unit are respectively paired with positive and negative samples, generate first and second contrast learning sample groups, and alternately input fragment association relationship coding network for cross-granularity contrast learning training, obtain pre-training fragment association relationship coding network, provide initialization network weight parameters for downstream cardiopulmonary data analysis task, significantly improve the model convergence speed and analysis accuracy of downstream task under the condition of limited labeled data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of sports health monitoring and machine learning technology, and more specifically, to a method and system for pre-training unlabeled cardiopulmonary exercise data based on contrastive learning. Background Technology

[0002] Cardiopulmonary activity signal sequences (such as electrocardiogram signals, respiratory airflow signals, and blood oxygen saturation signals) and motion state description sequences (such as motion type, intensity level, and speed changes) collected by wearable sensors and other devices contain rich physiological and motion-related information. However, because the annotation of cardiopulmonary data requires the participation of professional medical personnel for interpretation, the annotation cost is extremely high, and it is extremely difficult to obtain large-scale labeled datasets. Therefore, data representation pre-training under unlabeled conditions has become a major research direction in this field.

[0003] In existing technologies, pre-training methods for unlabeled cardiopulmonary data mainly fall into the following categories: The first category is self-supervised contrastive learning methods based on single temporal granularity segments. These methods extract segments of cardiopulmonary signals into fixed-length windows and construct positive and negative sample pairs for contrastive training based on temporal proximity or data augmentation. However, they operate only at a single granularity, ignoring the multi-level dynamic features of cardiopulmonary activity signals at different time scales, such as the difference between heart rate cycle changes within a short time window and movement phase transitions within a long time window. The second category is supervised pre-training methods based on motion state labels. These methods rely on manually labeled motion state categories to classify and train cardiopulmonary segments, but they are not applicable in unlabeled scenarios and do not establish a mechanism for constructing positive and negative samples under the constraint of continuity of the same motion state. The third category is pre-training methods based on multi-scale feature fusion. These methods extract multi-scale features through multi-resolution convolution or attention mechanisms, but they do not explicitly construct the correlation between segments of different granularities within the contrastive learning framework, nor do they utilize the continuity information of the motion state description sequence to guide positive and negative sample pairing. Summary of the Invention

[0004] In view of the aforementioned problems, and in conjunction with the first aspect of the present invention, embodiments of the present invention provide a method for pre-training label-free cardiopulmonary exercise data based on contrastive learning, the method comprising: Acquire an unlabeled cardiopulmonary exercise dataset, which includes cardiopulmonary activity signal sequences and exercise state description sequences synchronously recorded in multiple consecutive acquisition cycles; The cardiopulmonary activity signal sequence is segmented according to different time granularities to generate a multi-time granularity dynamic segment set. The multi-time granularity dynamic segment set includes a first main segment unit extracted by a fine-grained time window and its corresponding first neighboring segment unit set, and a second main segment unit extracted by a coarse-grained time window and its corresponding second neighboring segment unit set. Based on the motion state description sequence, the first main segment unit is subjected to positive and negative sample pairing processing to generate a first contrast learning sample group. The first contrast learning sample group includes a first positive sample pairing set that is continuous with the motion state of the first main segment unit and a first negative sample pairing set that is not continuous with the motion state of the first main segment unit. Based on the motion state description sequence, the second main segment unit is subjected to positive and negative sample pairing processing to generate a second contrast learning sample group. The second contrast learning sample group includes a second positive sample pairing set that is continuous with the motion state of the second main segment unit and a second negative sample pairing set that is not continuous with the motion state of the second main segment unit. The first and second contrastive learning sample groups are alternately input into the segment association encoding network for cross-granularity contrastive learning training to obtain a pre-trained segment association encoding network. The pre-trained segment association encoding network is used to provide initial network weight parameters for downstream cardiopulmonary data analysis tasks.

[0005] Furthermore, embodiments of the present invention also provide a label-free cardiopulmonary exercise data pre-training system based on contrastive learning, comprising: A processor; a machine-readable storage medium for storing machine-executable instructions of the processor; wherein the processor is configured to perform the above-described label-free cardiopulmonary exercise data pre-training method based on contrastive learning by executing the machine-executable instructions.

[0006] Based on the above, by acquiring an unlabeled cardiopulmonary activity (CPE) dataset containing synchronously recorded CPE signal sequences and motion state description sequences, and then segmenting the CPE signal sequences according to different time granularities, a multi-time-granularity dynamic segment set is generated. This set includes a fine-grained first main segment unit and its first neighboring segment unit set, and a coarse-grained second main segment unit and its second neighboring segment unit set. This allows the network to simultaneously perceive instantaneous physiological fluctuations on a short timescale and the evolutionary features of motion stages on a long timescale. Furthermore, based on the motion state description sequences, positive and negative sample pairing is performed on the first and second main segment units respectively. The continuity and consistency of motion states are used as the criteria for constructing positive samples, and the discontinuity and consistency of motion states are used as the criteria for constructing negative samples. This generates a first contrastive learning sample group and a second contrastive learning sample group, ensuring that the supervision signal for contrastive learning originates entirely from the motion state of the data itself. The system achieves continuity without manual labeling, and the construction of positive and negative samples simultaneously covers both fine-grained and coarse-grained levels, ensuring that the feature discrimination ability at different time scales is trained in a targeted manner. Furthermore, two sets of comparative learning samples are alternately input into the segment association encoding network for cross-granular comparative learning training. Through the alternating training mechanism, the network dynamically switches its learning focus between fine-grained and coarse-grained levels, enabling the segment association encoding network to simultaneously learn the intrinsic correlation mapping between local instantaneous features and global stage features. The final result is a pre-trained segment association encoding network that can provide high-quality initialization of network weight parameters for downstream cardiopulmonary data analysis tasks. Under completely unlabeled conditions, it can achieve effective pre-training representation of multi-level spatiotemporal features of cardiopulmonary signals through multi-granular dynamic fragmentation and cross-granular comparative learning driven by the continuity of motion state, significantly improving the model convergence speed and analysis accuracy of downstream tasks under limited labeled data conditions. Attached Figure Description

[0007] Figure 1 This is a schematic diagram of the execution flow of the label-free cardiopulmonary exercise data pre-training method based on contrastive learning provided in an embodiment of the present invention.

[0008] Figure 2 This is a schematic diagram of the multi-time-granularity segmentation and positive-negative sample pairing scenario of exercise cardiopulmonary signals provided in the embodiments of this application.

[0009] Figure 3 This is a schematic diagram of the application scenario of cross-granularity comparative learning training and downstream task fine-tuning provided in the embodiments of this application.

[0010] Figure 4 This is a schematic diagram of a multi-band decomposition, phase sensing, and structure enhancement contrast learning scenario provided in an embodiment of this application. Detailed Implementation

[0011] Figure 1This is a flowchart illustrating a label-free cardiopulmonary exercise data pre-training method based on contrastive learning, provided in one embodiment of the present invention. In exercise physiological monitoring and health assessment scenarios, wearable devices continuously collect massive amounts of cardiopulmonary activity signals. However, manually labeling these signals requires professional physicians to interpret them segment by segment, resulting in extremely high labeling costs. This embodiment uses cardiopulmonary exercise data collected by a smart bracelet as an application scenario. The smart bracelet has a built-in photoplethysmography (PPG) sensor and an accelerometer. The PPG sensor continuously collects heart rate and blood oxygen saturation signals at a preset sampling frequency, while the accelerometer simultaneously collects triaxial motion acceleration and angular velocity signals. After time alignment, the above multimodal signals constitute a cardiopulmonary activity signal sequence and a motion state description sequence. The motion state description sequence is automatically classified into four categories—resting state, low-intensity exercise state, moderate-intensity exercise state, and high-intensity exercise state—based on the acceleration signal using a motion state classification algorithm.

[0012] Prior to implementing this technical solution, explicit authorization from users regarding the collection and use of their physiological signal data was obtained. The authorization process was completed by selecting the "agree" option in the privacy agreement of the smart bracelet's accompanying mobile application. The privacy agreement clearly states the scope of data collection, its purpose, and privacy protection clauses. All information involving users' personal identification is anonymized on the device. The data uploaded to the cloud only contains anonymized physiological signal sequences and motion status tags, and does not contain any identifying information that can be associated with a specific user's personal identity.

[0013] Step S110: Obtain a label-free cardiopulmonary exercise dataset, which includes cardiopulmonary activity signal sequences and exercise state description sequences synchronously recorded in multiple consecutive acquisition cycles.

[0014] In this embodiment, the tagless cardiopulmonary exercise dataset originates from raw physiological signal data collected by a large population wearing smart bracelets during daily activities. The cardiopulmonary activity signal sequence data structure is a two-dimensional numerical matrix. The number of rows in the matrix represents the total number of sampling points in a continuous acquisition cycle, and the number of columns represents the number of physiological signal channels, including heart rate, blood oxygen saturation, and respiratory rate channels. Each channel stores the measured value of the corresponding physiological parameter at each sampling time point. The matrix elements are dimensionless normalized physiological parameter values, and normalization is performed using independent maximum-minimum value normalization for each channel. The value range of each channel is mapped to the interval 0 to 1. The exercise state description sequence data structure is a one-dimensional integer sequence with a sequence length equal to the total number of sampling points in the cardiopulmonary activity signal sequence. Each element in the sequence takes an integer code from 1 to 4, where 1 represents the resting state, 2 represents low-intensity exercise, 3 represents medium-intensity exercise, and 4 represents high-intensity exercise. The exercise state description sequence and the cardiopulmonary activity signal sequence correspond one-to-one in terms of time index.

[0015] Step S120: The cardiopulmonary activity signal sequence is segmented according to different time granularities to generate a multi-time granularity dynamic segment set. The multi-time granularity dynamic segment set includes a first main segment unit extracted by a fine-grained time window and its corresponding first neighboring segment unit set, and a second main segment unit extracted by a coarse-grained time window and its corresponding second neighboring segment unit set.

[0016] Step S121: Perform fine-grained sliding window truncation processing on the cardiopulmonary activity signal sequence, and continuously truncate the cardiopulmonary activity signal sequence without overlap using fine-grained time window length and fine-grained sliding step size to generate a set of fine-grained segment sequences.

[0017] In this embodiment, the fine-grained time window length Wf corresponds to a second-level physiological signal analysis window, and the fine-grained sliding step size Sf is equal to the fine-grained time window length to achieve non-overlapping truncation. The fine-grained sliding window truncation process starts from the initial sampling point of the cardiopulmonary activity signal sequence, truncating a segment of length Wf sampling points each time. After truncating, the window slides backward by Sf sampling points to continue truncating until the entire sequence is covered. Each truncated fine-grained segment is a two-dimensional matrix with dimensions [Wf, C], where C is the number of physiological signal channels. All fine-grained segments are arranged in the order of truncation to generate a set of fine-grained segment sequences.

[0018] Step S122: Select a fine-grained segment sequentially from the fine-grained segment sequence set as the first main segment unit, and combine multiple fine-grained segments in the fine-grained segment sequence set that are located in a preset neighborhood range before the first main segment unit and multiple fine-grained segments that are located in a preset neighborhood range after the first main segment unit into the first neighborhood segment unit set.

[0019] In this embodiment, the selection method is to sequentially select each fine-grained fragment as the first master fragment unit according to the order of the fine-grained fragment sequence set. For the currently selected first master fragment unit P1(i), its index position in the fine-grained fragment sequence set is i. The preset neighborhood range parameter Nf defines the number of neighborhood fragments. Then, the first neighborhood fragment unit set consists of all fine-grained fragments within the index intervals [i-Nf, i-1] and [i+1, i+Nf]. If the neighborhood range exceeds the sequence boundary, only fragments within the valid range are selected. The first neighborhood fragment unit set contains a maximum of 2×Nf fine-grained fragments.

[0020] Step S123: Perform coarse-grained sliding window truncation processing on the cardiopulmonary activity signal sequence, and continuously truncate the cardiopulmonary activity signal sequence without overlap with the coarse-grained time window length and coarse-grained sliding step size to generate a set of coarse-grained segment sequences.

[0021] In this embodiment, the coarse-grained time window length Wc is greater than the fine-grained time window length Wf, corresponding to a longer physiological signal analysis window. The coarse-grained sliding step size Sc is equal to the coarse-grained time window length. The coarse-grained sliding window truncation process is the same as the fine-grained truncation method, and each truncated coarse-grained segment is a two-dimensional matrix with dimensions [Wc, C]. All coarse-grained segments are arranged in the order of truncation to generate a coarse-grained segment sequence set.

[0022] Step S124: Select a coarse-grained segment sequentially from the coarse-grained segment sequence set as the second main segment unit, and combine multiple coarse-grained segments in the coarse-grained segment sequence set located within a preset neighborhood range before the second main segment unit and multiple coarse-grained segments in the coarse-grained segment sequence set located within a preset neighborhood range after the second main segment unit to form the second neighborhood segment unit set.

[0023] In this embodiment, the selection method is the same as in step S122. For the currently selected second main segment unit P2(j), its index position in the coarse-grained segment sequence set is j. The preset neighborhood range parameter Nc defines the number of neighborhood segments. Then, the second neighborhood segment unit set consists of all coarse-grained segments within the index intervals [j-Nc, j-1] and [j+1, j+Nc], containing a maximum of 2×Nc coarse-grained segments.

[0024] Step S125: Perform time index association binding processing on the first main segment unit, the first neighboring segment unit set, the second main segment unit, and the second neighboring segment unit set to establish a mapping table of correspondence between fine-grained segments and coarse-grained segments in the time dimension.

[0025] In this embodiment, the time index association binding process establishes a mapping relationship based on the time start position of each segment in the original cardiopulmonary activity signal sequence. The data structure of the time correspondence mapping table is a two-dimensional mapping table. The rows of the mapping table correspond to the fine-grained segment index, and the columns correspond to the coarse-grained segment index. The mapping table elements take values ​​of 1 or 0. A value of 1 indicates that the time interval of the fine-grained segment corresponding to the row overlaps with the time interval of the coarse-grained segment corresponding to the column, and a value of 0 indicates that there is no overlap.

[0026] Step S126: Pair the first main segment unit and the second main segment unit with time correspondence according to the correspondence mapping table to generate a cross-granularity segment pairing group set.

[0027] In this embodiment, for the first main segment unit P1(i) with index i, all coarse-grained segments that have a time overlap relationship with P1(i) are queried in the correspondence mapping table. The coarse-grained segment with the largest overlap time ratio is selected from these coarse-grained segments as the paired second main segment unit P2(j) of P1(i). (P1(i), P2(j)) is added to the cross-granularity segment pairing group set as a cross-granularity segment pairing group.

[0028] Step S127: Integrate and encapsulate the cross-granularity fragment pairing set, the first neighborhood fragment unit set, and the second neighborhood fragment unit set to generate the multi-time granularity dynamic fragment set.

[0029] In this embodiment, the integrated encapsulation process organizes the above three sets as three components of a multi-temporal granularity dynamic fragment set in a structured manner. The data structure of the multi-temporal granularity dynamic fragment set includes the following fields: a cross-granularity pairing group list, storing the cross-granularity fragment pairing group set; a fine-grained neighborhood mapping dictionary, using the first master fragment unit index as the key, storing the corresponding first neighborhood fragment unit set; and a coarse-grained neighborhood mapping dictionary, using the second master fragment unit index as the key, storing the corresponding second neighborhood fragment unit set.

[0030] like Figure 2 As shown, during the generation of a multi-time-granularity dynamic segment set, the original cardiopulmonary activity signal exhibits periodic fluctuations along the acquisition time axis. To establish a multi-scale physiological feature representation, the signal sequence is first input into two parallel processing branches: fine-grained sliding window truncation and coarse-grained sliding window truncation. At the fine-grained level, the waveform is segmented into a first main segment unit using a shorter fine-grained time window, and fine-grained segments are extracted from its immediate vicinity to form a first neighborhood segment unit set, as shown by the fine-grained sample cards above the waveform in the figure. At the coarse-grained level, a wider coarse-grained time window is used to capture more macroscopic motion phase features, generating a second main segment unit and a second neighborhood segment unit set. The dashed arrows from the waveform to the card set in the figure indicate the positional relationship of the truncation operation. Subsequently, a time index association binding operation is performed on the main segments to align the fine-grained and coarse-grained segments on the time axis, forming a multi-time-granularity dynamic segment set composed of cross-granularity segment pairing groups and the first and second neighborhood segment unit sets.

[0031] Step S130: Based on the motion state description sequence, perform positive and negative sample pairing processing on the first main segment unit to generate a first contrast learning sample group. The first contrast learning sample group includes a first positive sample pairing set that is continuous with the motion state of the first main segment unit and a first negative sample pairing set that is not continuous with the motion state of the first main segment unit.

[0032] Step S131: Extract the first motion state label corresponding to the first main segment unit in time index from the motion state description sequence, and extract multiple neighborhood motion state labels corresponding to each neighborhood segment unit in the first neighborhood segment unit set in time index from the motion state description sequence.

[0033] In this embodiment, the first motion state label ST1 is extracted as follows: the time index interval of the first main segment unit in the original cardiopulmonary activity signal sequence is obtained, the motion state labels of each sampling point within the time index interval are extracted in the motion state description sequence, and the motion state label with the highest frequency is taken as the first motion state label. The neighborhood motion state label is extracted as follows: for each neighborhood segment unit in the first neighborhood segment unit set, the main motion state label within the corresponding time index interval is extracted in the motion state description sequence in the same way.

[0034] Step S132: Perform state consistency comparison processing between the first motion state label and each of the neighboring motion state labels, filter out the neighboring segment units with consistent state labels and consecutively adjacent time indices to form the first positive sample pairing set, perform state consistency comparison processing between the first motion state label and each of the neighboring motion state labels, filter out the neighboring segment units with inconsistent state labels or time index intervals exceeding a preset interval threshold to form the first negative sample pairing set.

[0035] In this embodiment, the state consistency comparison process compares whether the first motion state label ST1 is equal to each neighboring motion state label STn. The selection criteria for the first positive sample pairing set are: ST1 equals STn, and the time index of the neighboring segment unit is adjacent to the time index of the first main segment unit. The selection criteria for the first negative sample pairing set are: ST1 is not equal to STn, or the time index interval is greater than a preset interval threshold Gapth.

[0036] Step S133: Perform positive pairing relationship construction processing on the first main segment unit and each positive sample segment unit in the first positive sample pairing set to generate a first positive sample data pair with a positive relationship identifier; perform negative pairing relationship construction processing on the first main segment unit and each negative sample segment unit in the first negative sample pairing set to generate a first negative sample data pair with a negative relationship identifier.

[0037] In this embodiment, the data structure of the first positive sample data pair is a triple (Anchor, Positive, Label), where Anchor is the first main segment unit P1(i), Positive is the positive sample segment unit, and Label has a value of 1 to indicate a positive sample relationship. The data structure of the first negative sample data pair is a triple (Anchor, Negative, Label), where Anchor is the first main segment unit P1(i), Negative is the negative sample segment unit, and Label has a value of 0 to indicate a negative sample relationship.

[0038] Step S134: Merge and combine the first positive sample data pair and the first negative sample data pair to generate the first contrastive learning sample group.

[0039] In this embodiment, the merging and combining process puts the first set of positive sample data pairs and the first set of negative sample data pairs into the same list, and randomly shuffles the data pairs in the list to generate the first contrastive learning sample group GP1.

[0040] Step S140: Based on the motion state description sequence, perform positive and negative sample pairing processing on the second main segment unit to generate a second contrast learning sample group. The second contrast learning sample group includes a second positive sample pairing set that is continuous with the motion state of the second main segment unit and a second negative sample pairing set that is not continuous with the motion state of the second main segment unit.

[0041] Step S141: Extract the second motion state label corresponding to the second main segment unit in time index from the motion state description sequence, and extract multiple neighborhood motion state labels corresponding to each neighborhood segment unit in the second neighborhood segment unit set in time index from the motion state description sequence.

[0042] In this embodiment, the extraction method for the second motion state label ST2 is the same as that for ST1 in step S131, the difference being the coverage area of ​​the second main segment unit corresponding to the time index interval. The extraction method for the neighborhood motion state label is similar.

[0043] Step S142: Perform state consistency comparison processing between the second motion state label and each of the neighboring motion state labels, filter out the neighboring segment units with consistent state labels and consecutively adjacent time indices to form the second positive sample pairing set, perform state consistency comparison processing between the second motion state label and each of the neighboring motion state labels, filter out the neighboring segment units with inconsistent state labels or time index intervals exceeding a preset interval threshold to form the second negative sample pairing set.

[0044] In this embodiment, the screening conditions for the second positive sample pairing set and the second negative sample pairing set are the same as in step S132, and are respectively applied to the second master fragment unit and its neighboring fragment units at the coarse-grained level.

[0045] Step S143: Perform positive pairing relationship construction processing on the second main segment unit and each positive sample segment unit in the second positive sample pairing set to generate a second positive sample data pair with a positive relationship identifier; perform negative pairing relationship construction processing on the second main segment unit and each negative sample segment unit in the second negative sample pairing set to generate a second negative sample data pair with a negative relationship identifier.

[0046] In this embodiment, the data structure of the second positive sample data pair and the second negative sample data pair is the same as in step S133, and the Anchor is replaced by the second main segment unit P2(j).

[0047] Step S144: Merge and combine the second positive sample data pair and the second negative sample data pair to generate the second contrastive learning sample group.

[0048] In this embodiment, the process of generating the second contrastive learning sample group GP2 is the same as step S134.

[0049] like Figure 2 As shown, the motion state description sequence recorded synchronously during signal acquisition is fully utilized when constructing the positive and negative sample pairing sets. The figure uses color blocks with different textures such as "stationary," "jogging," and "sprinting" to represent the distribution of motion state labels on the time axis. During the pairing process, the extracted segment cards are used as the basic objects, employing positive and negative sample pairing logic. If the motion state label of the first main segment unit is consistent with that of its neighboring segment units and their time indices are consecutively adjacent, it is assigned to the first positive sample pairing set and given a positive relationship identifier; if the motion state labels are inconsistent or the time interval exceeds a preset threshold, it is assigned to the first negative sample pairing set and given a negative relationship identifier. Figure 2 Solid borders in the diagram represent positive samples, and dashed borders represent negative samples. Similarly, coarse-grained segments also undergo this pairing operation to generate a second set of positive sample pairs and a second set of negative sample pairs, which are ultimately merged to form the first and second contrastive learning sample sets used for training.

[0050] Step S150: The first contrastive learning sample group and the second contrastive learning sample group are alternately input into the segment association relationship encoding network for cross-granularity contrastive learning training to obtain a pre-trained segment association relationship encoding network. The pre-trained segment association relationship encoding network is used to provide initial network weight parameters for downstream cardiopulmonary data analysis tasks.

[0051] Step S151: Construct the segment association coding network, which includes a fine-grained feature coding branch and a coarse-grained feature coding branch. The fine-grained feature coding branch is used to extract local feature representations of fine-grained segment signals, and the coarse-grained feature coding branch is used to extract global feature representations of coarse-grained segment signals.

[0052] In this embodiment, the fragment association coding network adopts a dual-branch structure. The fine-grained feature coding branch consists of three stacked one-dimensional temporal convolutional layers. The first layer has a kernel size of Kf1, a stride of 1, and D1 output channels; the second layer has a kernel size of Kf2, a stride of 1, and D2 output channels; and the third layer has a kernel size of Kf3, a stride of 1, and D3 output channels. Each convolutional layer is followed by a batch normalization layer and a ReLU activation function. The third convolutional layer is followed by a global average pooling layer, outputting a fine-grained feature vector Vfine with a dimension of D3. The coarse-grained feature coding branch adopts the same stacked convolutional layer structure as the fine-grained branch. Its kernel sizes Kc1, Kc2, and Kc3 are proportional to the kernel sizes of the fine-grained branch, and the ratio of Kc to Kf is equal to the ratio of Wc to Wf. It outputs a coarse-grained feature vector Vcoarse, also with a dimension of D3. The output dimension of the last layer of both branches is kept consistent so that subsequent joint comparison and training can be carried out.

[0053] Step S152: Input the first main segment unit and the first positive sample segment unit in the first positive sample data pair into the fine-grained feature encoding branch respectively, and generate the first main segment fine-grained feature vector and the first positive sample fine-grained feature vector through multi-layer temporal convolution processing.

[0054] In this embodiment, the input dimension of the first main segment unit P1(i) is [1, Wf, C]. After three layers of convolution and global average pooling in the fine-grained feature encoding branch, it outputs the first main segment fine-grained feature vector Fanchor1 with dimension [D3]. The first positive sample segment unit Ppos1 is processed through the same path and outputs the first positive sample fine-grained feature vector Fpos1 with dimension [D3]. Each fine-grained segment is independently propagated forward through the fine-grained feature encoding branch, and all segments share the same set of network weight parameters.

[0055] Step S153: Input the first negative sample segment unit in the first negative sample data pair into the fine-grained feature encoding branch, and generate the first negative sample fine-grained feature vector through multi-layer temporal convolution processing.

[0056] In this embodiment, the first negative sample fragment unit Pneg1 is processed by the fine-grained feature encoding branch to output the first negative sample fine-grained feature vector Fneg1, with a dimension of [D3]. The processing flow is the same as step S152.

[0057] Step S154: Input the second main segment unit and the second positive sample segment unit in the second positive sample data pair into the coarse-grained feature encoding branch respectively, and generate the second main segment coarse-grained feature vector and the second positive sample coarse-grained feature vector through multi-layer temporal convolution processing.

[0058] In this embodiment, the input dimension of the second main segment unit P2(j) is [1, Wc, C]. After three layers of convolution and global average pooling in the coarse-grained feature encoding branch, it outputs the second main segment coarse-grained feature vector Ganchor2 with dimension [D3]. The second positive sample segment unit Ppos2 is processed through the same path and outputs the second positive sample coarse-grained feature vector Gpos2 with dimension [D3].

[0059] Step S155: Input the second negative sample segment unit in the second negative sample data pair into the coarse-grained feature encoding branch, and generate the second negative sample coarse-grained feature vector through multi-layer temporal convolution processing.

[0060] In this embodiment, the second negative sample fragment unit Pneg2 is processed by the coarse-grained feature encoding branch to output the second negative sample coarse-grained feature vector Gneg2, with a dimension of [D3].

[0061] Step S156: Calculate the fine-grained positive similarity between the fine-grained feature vector of the first main segment and the fine-grained feature vector of the first positive sample, calculate the fine-grained negative similarity between the fine-grained feature vector of the first main segment and the fine-grained feature vector of the first negative sample, and construct a fine-grained contrast loss function based on the fine-grained positive similarity and the fine-grained negative similarity.

[0062] In this embodiment, similarity is calculated using cosine similarity: Sim(A, B) = (A·B) / (||A|| × ||B||). Fine-grained positive similarity is Sposfine = Sim(Fanchor1, Fpos1), and fine-grained negative similarity is Snegfine = Sim(Fanchor1, Fneg1). The fine-grained contrast loss function adopts the InfoNCE loss function form: Lfine = -log(exp(Sposfine / τfine) / [exp(Sposfine / τfine) + Σexp(Snegfine / τfine)]), where τfine is the temperature coefficient of the fine-grained contrast loss, and the summation term covers all negative samples corresponding to the first main segment unit.

[0063] Step S157: Calculate the coarse-grained positive similarity between the coarse-grained feature vector of the second main segment and the coarse-grained feature vector of the second positive sample, calculate the coarse-grained negative similarity between the coarse-grained feature vector of the second main segment and the coarse-grained feature vector of the second negative sample, and construct a coarse-grained contrastive loss function based on the coarse-grained positive similarity and the coarse-grained negative similarity.

[0064] In this embodiment, the coarse-grained positive similarity Sposcoarse = Sim(Ganchor2, Gpos2), and the coarse-grained negative similarity Snegcoarse = Sim(Ganchor2, Gneg2). The coarse-grained contrast loss function Lcoarse = -log(exp(Sposcoarse / τcoarse) / [exp(Sposcoarse / τcoarse)+Σexp(Snegcoarse / τcoarse)]), where τcoarse is the temperature coefficient of the coarse-grained contrast loss.

[0065] Step S158: Perform numerical normalization on the fine-grained contrastive loss function and the coarse-grained contrastive loss function respectively. Perform weighted fusion on the normalized loss functions to generate a cross-granularity joint contrastive loss function. Based on the cross-granularity joint contrastive loss function, perform synchronous update on the network weight parameters of the fine-grained feature encoding branch and the coarse-grained feature encoding branch. After multiple rounds of iterative training, the pre-trained segment association relationship encoding network is obtained.

[0066] In this embodiment, numerical normalization is performed using mean-standard-deviation normalization. The mean μfine and μcoarse, and the standard deviations σfine and σcoarse are calculated for Lfine and Lcoarse within the training batch, respectively. After normalization, Lfine_norm = (Lfine - μfine) / σfine, and Lcoarse_norm = (Lcoarse - μcoarse) / σcoarse. The weighted fusion is calculated as: Ljoint = λ × Lfine_norm + (1 - λ) × Lcoarse_norm, where λ is the fusion weight coefficient. The synchronous update process uses the Adam optimizer, with Ljoint as the optimization objective, to calculate the gradients of the fine-grained feature encoding branch network weight parameter θfine and the coarse-grained feature encoding branch network weight parameter θcoarse, and updates the parameters according to the learning rate η. After a preset number of iterations T, the final θfine and θcoarse are saved as the network weight parameters of the pre-trained segment association encoding network.

[0067] like Figure 3As shown, the segment association encoding network adopts a dual-branch architecture, processing features in parallel through fine-grained and coarse-grained feature encoding branches. In the diagram, the dense texture on the left represents the fine-grained branch, and the sparse texture on the right represents the coarse-grained branch. During training, the first main segment unit and its positive and negative samples undergo multi-layer temporal convolution to generate fine-grained feature vectors; simultaneously, the second main segment unit and its positive and negative samples undergo coarse-grained branch processing to generate coarse-grained feature vectors. A fine-grained contrastive loss function is derived through fine-grained positive / negative similarity calculation, and a coarse-grained contrastive loss function is derived through coarse-grained positive / negative similarity calculation. The convergence node in the diagram illustrates the numerical normalization and weighted fusion of the two loss functions, generating a cross-granularity joint contrastive loss function. Based on this, the weight parameters of the two encoding branches are updated synchronously. After multiple iterations, the pre-trained segment association encoding network is obtained.

[0068] Step S210: After obtaining the pre-trained segment association encoding network, obtain the target dataset of the downstream cardiopulmonary data analysis task with label annotation. The target dataset contains the cardiopulmonary activity signal sequence to be analyzed and the corresponding analysis task label.

[0069] In this embodiment, the downstream cardiopulmonary data analysis task is a cardiopulmonary endurance level classification task. The analysis task label is a cardiopulmonary endurance level labeled by a professional physician, with values ​​ranging from 1 to 4. The ratio of the target dataset's data size to the unlabeled dataset's data size in the pre-training phase is approximately 1:10.

[0070] Step S211: Load the network weight parameters of the fine-grained feature encoding branch and the coarse-grained feature encoding branch of the pre-trained segment association encoding network as the initial network weight parameters into the target task analysis network. The target task analysis network connects a task-specific output layer after the fine-grained feature encoding branch and the coarse-grained feature encoding branch.

[0071] In this embodiment, the target task analysis network reuses the two-branch structure of the pre-trained segment association encoding network, adding a feature concatenation layer and a task-specific output layer after the two branches. The task-specific output layer consists of two fully connected layers. The first fully connected layer has an input dimension of 2×D3 and an output dimension of D4, followed by a ReLU activation function and a Dropout regularization layer. The second fully connected layer has an input dimension of D4 and an output dimension of 4, followed by a Softmax activation function, outputting the probability distribution of the four cardiorespiratory endurance levels.

[0072] Step S212: Input the cardiopulmonary activity signal sequence to be analyzed into the target task analysis network loaded with the initial network weight parameters, extract the fine-grained feature vector to be analyzed through the fine-grained feature encoding branch, and extract the coarse-grained feature vector to be analyzed through the coarse-grained feature encoding branch.

[0073] In this embodiment, the cardiopulmonary activity signal sequence to be analyzed is first segmented according to step S120 to obtain fine-grained segments and coarse-grained segments. Each segment is sent to the corresponding feature encoding branch. The fine-grained feature encoding branch outputs the fine-grained feature vector to be analyzed, and the coarse-grained feature encoding branch outputs the coarse-grained feature vector to be analyzed.

[0074] Step S213: Perform feature concatenation processing on the fine-grained feature vector to be analyzed and the coarse-grained feature vector to be analyzed to generate a fused feature vector. Input the fused feature vector into the task-specific output layer and generate the task prediction output result through fully connected mapping processing.

[0075] In this embodiment, the feature concatenation process joins the two feature vectors end-to-end along the feature dimension, resulting in a fused feature vector with a dimension of 2×D3. The fused feature vector is then passed through two fully connected layers of the task-specific output layer, and finally, the Softmax layer outputs the predicted probabilities for the four categories.

[0076] Step S214: Calculate the task-specific loss function based on the task prediction output and the analysis task label, and fine-tune and update all network weight parameters of the target task analysis network through backpropagation to obtain the fine-tuned target task analysis network adapted to the downstream cardiopulmonary data analysis task.

[0077] In this embodiment, the task-specific loss function is the cross-entropy loss function, which calculates the cross-entropy between the predicted probability distribution and the one-hot encoding of the true labels. Backpropagation uses the Adam optimizer with a learning rate set to one-tenth of the learning rate during the pre-training phase, performing end-to-end fine-tuning updates on all network weight parameters of the target task analysis network.

[0078] like Figure 3 As shown, in the downstream task fine-tuning stage, the target task analysis network receives the weight parameters from the pre-training stage and initializes the fine-grained and coarse-grained feature encoding branches using a "load pre-trained weights → freeze / fine-tune" strategy. When the cardiopulmonary activity signal sequence to be analyzed is input into the network, it outputs the fine-grained and coarse-grained feature vectors to be analyzed through the fine-grained and coarse-grained feature encoding branches, respectively. These features are fused into a fused feature vector in the feature concatenation process, and then input into the task-specific output layer for fully connected mapping to generate the task prediction output result. The right side of the figure clearly indicates the correspondence between the task prediction output result and the analysis task label, and calculates the task-specific loss function accordingly. It is then fine-tuned and updated through backpropagation to finally obtain the fine-tuned target task analysis network adapted to the downstream task.

[0079] Step S310: Construct a target momentum coding network with the same structure as the segment association coding network, wherein the initial network weight parameters of the target momentum coding network are completely consistent with the initial network weight parameters of the segment association coding network.

[0080] In this embodiment, the target momentum encoding network is denoted as NetM, and its network structure is exactly the same as that of the segment association encoding network NetE, including fine-grained feature encoding branches and coarse-grained feature encoding branches. During the training initialization phase, all network weight parameters of NetE are copied to NetM, so that the initial network weight parameters of the two are completely identical.

[0081] Step S311: Apply signal perturbation processing to the first main segment unit in the multi-time granularity dynamic segment set to generate a first enhanced main segment unit. The signal perturbation processing includes a local amplitude scaling operation on the first main segment unit and a local timing reversal operation on the first main segment unit.

[0082] In this embodiment, the local amplitude scaling operation randomly selects a continuous sub-interval within the first main segment unit, multiplies the amplitude of the cardiopulmonary activity signal within this sub-interval by a scaling factor r, where r is uniformly sampled from a preset range [1-α, 1+α], and α is the amplitude perturbation parameter. The local time reversal operation randomly selects a continuous sub-interval within the first main segment unit, and arranges the signal sampling points within this sub-interval in reverse chronological order. The two operations can be applied superimposed.

[0083] Step S312: Apply the signal perturbation processing to the second main segment unit in the multi-time granularity dynamic segment set to generate the second enhanced main segment unit.

[0084] In this embodiment, the same signal perturbation processing operation as step S311 is applied to the second main segment unit to generate the second enhanced main segment unit.

[0085] Step S313: Input the first main segment unit into the segment association coding network, and generate the first original fine-grained feature vector through the fine-grained feature coding branch of the segment association coding network.

[0086] In this embodiment, the first main segment unit is input to the fine-grained feature encoding branch of NetE, and outputs the first original fine-grained feature vector Forig1 after forward propagation.

[0087] Step S314: Input the first enhanced master segment unit into the target momentum coding network, and generate the first enhanced fine-grained feature vector through the fine-grained feature coding branch of the target momentum coding network.

[0088] In this embodiment, the first enhanced master segment unit is input into the fine-grained feature encoding branch of NetM. NetM does not participate in gradient backpropagation, but only performs forward inference and outputs the first enhanced fine-grained feature vector Faug1.

[0089] Step S315: Input the second main segment unit into the segment association coding network, and generate the second original coarse-grained feature vector through the coarse-grained feature coding branch of the segment association coding network.

[0090] In this embodiment, the second main segment unit inputs the coarse-grained feature encoding branch of NetE and outputs the second original coarse-grained feature vector Gorig2.

[0091] Step S316: Input the second enhanced master segment unit into the target momentum coding network, and generate the second enhanced coarse-grained feature vector through the coarse-grained feature coding branch of the target momentum coding network.

[0092] In this embodiment, the second enhanced main segment unit is input to the coarse-grained feature encoding branch of NetM and outputs the second enhanced coarse-grained feature vector Gaug2.

[0093] Step S317: Calculate the fine-grained invariance comparison loss between the first original fine-grained feature vector and the first enhanced fine-grained feature vector, and calculate the coarse-grained invariance comparison loss between the second original coarse-grained feature vector and the second enhanced coarse-grained feature vector.

[0094] In this embodiment, the fine-grained invariant contrast loss Linv_fine is calculated using negative cosine similarity: Linv_fine = -Sim(Forig1, Faug1). The coarse-grained invariant contrast loss Linv_coarse = -Sim(Gorig2, Gaug2).

[0095] Step S318: The fine-grained invariant contrastive loss and the coarse-grained invariant contrastive loss are fused to generate a signal invariance preservation loss function. After each round of contrastive learning training iteration, momentum-weighted update processing is performed based on the current network weight parameters of the target momentum encoding network and the current network weight parameters of the segment association encoding network to generate updated network weight parameters of the target momentum encoding network.

[0096] In this embodiment, the signal invariance preservation loss function is Linv = Linv_fine + Linv_coarse. The momentum weighted update processing is calculated as follows: θM = m × θM + (1-m) × θE, where θM is the network weight parameter of the target momentum encoding network, θE is the network weight parameter of the segment association encoding network, and m is the momentum update coefficient, with m taking a value close to 1.

[0097] like Figure 3 As shown, during the training process of the target momentum encoding network, a target momentum encoding network with the exact same structure as the main network is constructed. The bottom signal perturbation processing branch illustrates the generation process of augmented data: the original fragment is input to the main network, while the augmented fragment, after "signal perturbation" processing (including local amplitude scaling and local temporal reversal operations), is input to the target momentum encoding network. The main network outputs the original feature vector, and the momentum network outputs the augmented feature vector. Fine-grained invariant contrastive loss and coarse-grained invariant contrastive loss are calculated separately and fused into a signal invariant preservation loss function. Through momentum-weighted updates, the parameters of the target momentum encoding network gradually and smoothly align with the main network, thereby supporting the learning stability of the main network.

[0098] Step S320: Extract the spectral distribution information of the cardiopulmonary activity signal sequence in the frequency domain from the unlabeled cardiopulmonary exercise dataset. The spectral distribution information includes energy distribution sequences in different frequency bands.

[0099] In this embodiment, the spectral distribution information is extracted as follows: a short-time Fourier transform is applied to each physiological signal channel of the cardiopulmonary activity signal sequence, using a Hanning window as the window function. The window length and the number of Fourier transform points are preset values, and the overlap ratio of adjacent windows is a preset ratio. The amplitude spectrum output by the short-time Fourier transform is divided into B frequency bands, and the average energy within each frequency band is calculated to generate an energy distribution sequence.

[0100] Step S321: Based on the spectral distribution information, perform frequency band decomposition processing on the cardiopulmonary activity signal sequence to generate multiple frequency band-limited narrowband signal component sequences. Perform the segmentation processing operation according to different time granularities on each of the narrowband signal component sequences to generate a set of narrowband multi-time granular dynamic segments corresponding to each narrowband signal component sequence.

[0101] In this embodiment, the frequency band decomposition process employs a frequency domain decomposition method based on ideal bandpass filters. A corresponding ideal bandpass filter is constructed for each frequency band. The cardiopulmonary activity signal sequence is passed through each bandpass filter, outputting the narrowband signal component sequence corresponding to each frequency band. For each narrowband signal component sequence, segmentation processing is performed according to step S120 to generate a corresponding set of narrowband multi-temporal-granular dynamic segments.

[0102] Step S322: Perform the operation of pairing positive and negative samples for the first main segment unit based on the motion state description sequence for each of the narrowband multi-temporal granularity dynamic segment sets, and generate a narrowband first contrast learning sample group corresponding to each narrowband signal component sequence.

[0103] In this embodiment, positive and negative sample pairing is performed on each set of narrowband multi-time-granularity dynamic segments in accordance with step S130 to generate the corresponding narrowband first contrastive learning sample group.

[0104] Step S323: Perform the operation of pairing positive and negative samples for the second main segment unit based on the motion state description sequence for each of the narrowband multi-temporal granularity dynamic segment sets, and generate a narrowband second contrast learning sample group corresponding to each narrowband signal component sequence.

[0105] In this embodiment, positive and negative sample pairing is performed on each set of narrowband multi-time granular dynamic segments in accordance with step S140 to generate the corresponding narrowband second contrastive learning sample group.

[0106] Step S324: Construct a set of frequency band specific segment association coding networks, wherein the set of frequency band specific segment association coding networks contains a frequency band specific coding network corresponding one-to-one with each of the narrowband signal component sequences.

[0107] In this embodiment, an independent segment association coding network is constructed for each frequency band. The network structure is the same as the network structure constructed in step S151, and the networks of each frequency band do not share network weight parameters.

[0108] Step S325: Alternately input each of the narrowband first contrastive learning sample groups and the corresponding narrowband second contrastive learning sample groups into the corresponding frequency band specific coding network for contrastive learning training to obtain multiple frequency band specific pre-trained coding networks. Perform cross-frequency band fusion processing on the network weight parameters of the multiple frequency band specific pre-trained coding networks to generate fused pre-trained coding network weight parameters. The fused pre-trained coding network weight parameters are used to initialize the network weight parameters of the downstream cardiopulmonary data analysis task.

[0109] In this embodiment, the frequency band-specific coding networks are subjected to comparative learning training in step S150. The cross-band fusion processing calculates the element-wise mean of the network weight parameters at the same level of each frequency band-specific pre-trained coding network to generate the weight parameters of the fused pre-trained coding network.

[0110] like Figure 4As shown, in the multi-band processing of cardiopulmonary activity signal sequences, the original signal undergoes band decomposition. The waveform sub-graphs in the figure respectively illustrate three independent narrowband signal component sequences: high-frequency band, mid-frequency band, and low-frequency band. Each narrowband signal component generates a corresponding set of narrowband multi-temporal-granular dynamic segments according to the aforementioned steps, and constructs a first narrowband contrastive learning sample set and a second narrowband contrastive learning sample set. The figure uses vertically stacked coding network modules to represent the set of band-specific coding networks, with each band having an independent coding network for contrastive learning training. After training, multiple band-specific pre-trained coding networks undergo cross-band fusion processing to generate fused pre-trained coding network weight parameters for unified initialization in downstream tasks.

[0111] Step S330: Extract motion state transition time nodes from the motion state description sequence. The motion state transition time nodes are the time index positions where the motion state labels in the motion state description sequence change.

[0112] In this embodiment, the method for extracting motion state transition time nodes is as follows: traverse the motion state description sequence, compare the motion state labels of adjacent time indices, and if the label value changes, record the time index position as the motion state transition time node.

[0113] Step S331: Extract the pre-transition segment and the post-transition segment of cardiopulmonary activity before and after the transition time node of the movement state, respectively. Combine the pre-transition segment and the post-transition segment of cardiopulmonary activity into a movement state transition segment pair, and assign a state transition relationship label to the movement state transition segment pair. The state transition relationship label is used to identify the state transition type from the original movement state to the target movement state.

[0114] In this embodiment, the segmentation method is to use the motion state transition time node as the boundary, extracting a cardiopulmonary activity signal segment of length Ltrans forward as the pre-transition segment of cardiopulmonary activity, and extracting a segment of the same length backward as the post-transition segment of cardiopulmonary activity. The encoding method of the state transition relationship label is to combine the original motion state label and the target motion state label for encoding. Let the number of motion state categories be S, then the total number of state transition relationship labels is S×S.

[0115] Step S332: Perform fine-grained sliding window truncation processing on the pre-transition segment of cardiopulmonary activity in the motion state transition segment pairing to generate a set of fine-grained segment sequences before the transition; perform fine-grained sliding window truncation processing on the post-transition segment of cardiopulmonary activity in the motion state transition segment pairing to generate a set of fine-grained segment sequences after the transition.

[0116] In this embodiment, the fine-grained sliding window truncation process adopts the same method as described in step S121, and truncates the pre-transition segment and the post-transition segment of cardiopulmonary activity respectively.

[0117] Step S333: Pair the fine-grained segments with the closest time indices in the pre-transition fine-grained segment sequence set with the fine-grained segments in the post-transition fine-grained segment sequence set to form transition boundary fine-grained segments, and pair the remaining fine-grained segments with far-fetched time indices with non-transition boundary fine-grained segments.

[0118] In this embodiment, the criterion for determining the closest time index is that the absolute value of the difference between the time indices of the pre-transition segment and the post-transition segment is the smallest. Pairings that meet this condition are considered fine-grained segment pairings at the transition boundary, while pairings that do not meet this condition are considered fine-grained segment pairings at non-transition boundary.

[0119] Step S334: Construct a set of positive state transition samples based on the fine-grained fragment pairing of the transition boundary, and construct a set of negative state transition samples based on the fine-grained fragment pairing of the non-transition boundary.

[0120] In this embodiment, fine-grained segment pairings at the transition boundary are marked as positive sample relationships and added to the positive sample pairing set for state transitions. Fine-grained segment pairings at non-transition boundaries are marked as negative sample relationships and added to the negative sample pairing set for state transitions.

[0121] Step S335: Input the positive state transition sample pairing set and the negative state transition sample pairing set into the state transition discriminant network for state transition pattern learning processing. The state transition discriminant network includes a bidirectional long short-term memory module and a fully connected classification module.

[0122] In this embodiment, the bidirectional long short-term memory module includes a forward LSTM layer and a backward LSTM layer, both with Hlstm hidden units. The outputs of the forward and backward layers are concatenated at each time step to obtain a hidden feature sequence of dimension 2×Hlstm. The fully connected classification module consists of two fully connected layers. The first layer maps the hidden features of the bidirectional long short-term memory module at the last time step to a vector of dimension Dfc, and the second layer maps the vector of dimension Dfc to the output of the state transition class number.

[0123] Step S336: The bidirectional long short-term memory module performs bidirectional temporal feature extraction on the input fine-grained segment pairing to generate a bidirectional temporal dependency feature vector. The bidirectional temporal dependency feature vector is then input into the fully connected classification module for state transition type prediction. The state transition type prediction result is output. Based on the state transition type prediction result and the state transition relationship label, the state transition classification loss function is calculated. The network weight parameters of the state transition discriminant network are updated through backpropagation to obtain the pre-trained state transition discriminant network.

[0124] In this embodiment, the input fine-grained fragment pairing concatenates the two fragments along the time dimension and then feeds them into the bidirectional long short-term memory module. The state transition classification loss function adopts the cross-entropy loss function. The backpropagation process uses the Adam optimizer to update the network weight parameters.

[0125] like Figure 4 As shown, during the training process of the state transition discriminant network, state transition time nodes are located from the motion state description sequence. The figure illustrates the division of phase position labels during systole, diastole, and systole using vertical dashed lines and a magnified view. Based on these phase position labels, a phase-aware positive sample pairing set is constructed, forming a phase-aware contrastive learning sample group. Simultaneously, segments before and after the state transition time node are extracted for cardiopulmonary activity transition and after the transition, respectively, and state transition relationship labels are assigned to them. Subsequently, a fine-grained sliding window is used to extract and expand the contrastive learning sample group, generating fine-grained segment pairings of transition boundaries, which is then input into the state transition discriminant network. The figure clearly illustrates the cascaded structure of the bidirectional long short-term memory module and the fully connected classification module, used to extract bidirectional temporal dependency features and predict the state transition type.

[0126] For example, in step S340: multi-order differential processing is performed on the cardiopulmonary activity signal sequence in the unlabeled cardiopulmonary exercise dataset to generate a time-series differential signal sequence that reflects the rate of signal change. The time-series differential signal sequence is normalized so that its numerical distribution range matches the original cardiopulmonary activity signal sequence. The processed time-series differential signal sequence and the original cardiopulmonary activity signal sequence are then aligned and spliced ​​point by point on the time index to generate a dual-channel enhanced signal sequence. The first channel of the dual-channel enhanced signal sequence is the original signal intensity channel, and the second channel of the dual-channel enhanced signal sequence is the normalized signal change rate channel.

[0127] In this embodiment, multi-order difference processing includes first-order difference and second-order difference. The first-order difference sequence is D1(t) = X(t+1) - X(t), and the second-order difference sequence is D2(t) = D1(t+1) - D1(t), where X(t) is the sampled value of the cardiopulmonary activity signal sequence at time index t. The temporal difference signal sequence is formed by splicing the first-order difference sequence and the second-order difference sequence. The normalization process uses maximum-minimum value normalization to map the numerical distribution range of the temporal difference signal sequence to the same interval as the original cardiopulmonary activity signal sequence. The point-by-point alignment splicing process is performed along the channel dimension, and the generated dual-channel enhanced signal sequence has a dimension of [T, C+2], where T is the total number of sampling points, C is the number of original physiological signal channels, and 2 represents the newly added first-order difference channel and second-order difference channel.

[0128] Step S341: The dual-channel enhanced signal sequence is segmented according to the different time granularities to generate an enhanced multi-time granularity dynamic segment set.

[0129] In this embodiment, the dual-channel enhanced signal sequence is divided into fine-grained and coarse-grained segments in the same manner as in step S120. The resulting enhanced multi-temporal granular dynamic segment set is consistent with the multi-temporal granular dynamic segment set generated in step S127 in terms of data structure, except that the number of channels in each segment is increased.

[0130] Step S342: Based on the motion state description sequence, perform positive and negative sample pairing processing on the enhanced first main segment unit in the enhanced multi-temporal granularity dynamic segment set to generate an enhanced first contrastive learning sample group; based on the motion state description sequence, perform positive and negative sample pairing processing on the enhanced second main segment unit in the enhanced multi-temporal granularity dynamic segment set to generate an enhanced second contrastive learning sample group.

[0131] In this embodiment, the generation methods of the enhanced first contrastive learning sample group and the enhanced second contrastive learning sample group are the same as those of steps S130 and S140, respectively, and the processing object is replaced by the enhanced master segment unit in the enhanced multi-temporal granular dynamic segment set.

[0132] Step S343: Construct a dual-channel segment association coding network, wherein the number of input layer channels of the dual-channel segment association coding network is consistent with the number of channels of the dual-channel enhanced signal sequence.

[0133] In this embodiment, the overall structure of the dual-channel segment association coding network is the same as that of the segment association coding network constructed in step S151. The difference is that the number of input channels of the first convolutional layer of the fine-grained feature coding branch and the coarse-grained feature coding branch is set to C+2, which matches the number of channels of the dual-channel enhanced signal sequence.

[0134] Step S344: The enhanced first contrastive learning sample group and the enhanced second contrastive learning sample group are alternately input into the dual-channel segment association coding network for cross-granularity contrastive learning training to obtain a pre-trained dual-channel segment association coding network. The dual-channel input layer network weight parameters of the pre-trained dual-channel segment association coding network are subjected to channel separation processing to extract the network weight parameters corresponding to the signal change rate channel.

[0135] In this embodiment, the cross-granularity contrastive learning training process is the same as step S150. The channel separation process splits the convolutional kernel of the first convolutional layer of the dual-channel segment association coding network along the input channel dimension, and extracts the convolutional kernel weight parameter Wdiff of the corresponding signal change rate channel (i.e., the first-order difference channel and the second-order difference channel).

[0136] Step S345: The network weight parameters corresponding to the signal change rate channel are used as initial network weight parameters and loaded into the downstream cardiopulmonary data analysis task network for signal mutation detection.

[0137] In this embodiment, the signal change detection task network initializes the weight parameters of the corresponding signal change rate channel in its first convolutional layer with the extracted Wdiff, while the weight parameters of the remaining networks are randomly initialized. This initialization method allows the downstream task network to inherit the signal change pattern knowledge learned in the pre-training stage.

[0138] like Figure 4 As shown, in the construction of the signal local neighborhood structure graph, the local neighborhood topology is represented by an undirected graph consisting of nodes and edges. The system applies graph structure perturbation processing to the original structure graph, including deleting some edges and occluding some nodes, to generate a perturbed signal local neighborhood structure graph. The original graph and the perturbed graph are respectively input into a graph isomorphic encoding network, and graph convolution operations are used to generate feature vectors of the original graph structure and the perturbed graph structure. The graph shows the calculation of the graph structure contrast loss function with the convergence node diagram. This graph structure contrast loss is optimized synchronously with the contrast loss of the main network through joint optimization processing, thereby learning the invariant feature representation of the signal local neighborhood structure.

[0139] Step S350: Construct a fragment context memory storage structure, which is used to store the historical hidden layer feature representations generated by the fragment association encoding network for historical input fragment units during the training process.

[0140] In this embodiment, the fragment context memory storage structure is a fixed-capacity queue data structure with a queue capacity of M. Each element in the queue is a feature vector, arranged in chronological order of enqueue time. The queue is initially empty and gradually filled as training progresses.

[0141] Step S351: Perform cross-temporal similarity retrieval processing on the current hidden layer feature representation of the first main segment obtained by inputting the segment association coding network into the first main segment unit and the historical hidden layer feature representation stored in the segment context memory storage structure to obtain a cross-temporal similar segment feature set. Construct a cross-temporal positive sample pairing set based on the cross-temporal similar segment feature set and the current hidden layer feature representation of the first main segment. Construct a cross-temporal negative sample pairing set based on the remaining historical hidden layer feature representations in the cross-temporal similar segment feature set whose similarity is lower than a preset similarity threshold.

[0142] In this embodiment, the current hidden layer feature representation H1 of the first main segment is taken as the vector obtained by flattening the feature map before the global average pooling layer in the fine-grained feature encoding branch of the segment association encoding network. The cross-temporal similarity retrieval process calculates the cosine similarity Sim(H1, Hm) between H1 and each historical hidden layer feature representation Hm in the segment context memory storage structure. The Kpos historical hidden layer feature representations with the highest similarity are selected and added to the cross-temporal positive sample pairing set. Kneg vectors with similarity below a preset similarity threshold Sth are randomly selected from the remaining historical hidden layer feature representations and added to the cross-temporal negative sample pairing set.

[0143] Step S352: Add the cross-time positive sample pairing set and the cross-time negative sample pairing set to the first contrastive learning sample group to generate an extended first contrastive learning sample group containing cross-time dimensions.

[0144] In this embodiment, the data structure of the extended first contrastive learning sample group is generated by merging the first contrastive learning sample group GP1 generated in step S134 with the cross-time positive sample pairing set and the cross-time negative sample pairing set, and then randomly shuffling their order.

[0145] Step S353: Perform cross-temporal similarity retrieval processing on the current hidden layer feature representation of the second main segment obtained by inputting the segment association encoding network into the second main segment unit and the historical hidden layer feature representation stored in the segment context memory storage structure to obtain a cross-temporal coarse-grained similar segment feature set. Based on the cross-temporal coarse-grained similar segment feature set and the current hidden layer feature representation of the second main segment, construct a coarse-grained cross-temporal positive sample pairing set. Based on the remaining historical hidden layer feature representations in the cross-temporal coarse-grained similar segment feature set whose similarity is lower than a preset similarity threshold, construct a coarse-grained cross-temporal negative sample pairing set.

[0146] In this embodiment, the current hidden layer feature representation H2 of the second main segment is the vector obtained by flattening the feature map before the global average pooling layer in the coarse-grained feature encoding branch of the segment association encoding network. The construction method of the coarse-grained cross-time positive sample pairing set and the coarse-grained cross-time negative sample pairing set is the same as in step S351.

[0147] Step S354: Add the coarse-grained cross-time positive sample pairing set and the coarse-grained cross-time negative sample pairing set to the second contrastive learning sample group to generate an extended second contrastive learning sample group containing cross-time dimensions.

[0148] In this embodiment, the method for generating the extended second contrastive learning sample group is the same as in step S352.

[0149] Step S355: The extended first contrastive learning sample group and the extended second contrastive learning sample group are alternately input into the segment association encoding network for cross-granularity contrastive learning training with memory enhancement. After each round of contrastive learning training iteration, the current hidden layer feature representation of the first main segment and the current hidden layer feature representation of the second main segment are stored in the segment context memory storage structure according to the first-in-first-out rule, and the set of historical hidden layer feature representations stored in the segment context memory storage structure is updated.

[0150] In this embodiment, the contrastive loss function for cross-granularity contrastive learning training with memory enhancement is based on the cross-granularity joint contrastive loss function in step S158, with the addition of a cross-temporal dimension contrastive loss term. The cross-temporal dimension contrastive loss term also adopts the InfoNCE loss function form, and its temperature coefficient remains consistent with the same-granularity contrastive loss. The first-in-first-out (FIFO) rule applies when the number of hidden feature representations stored in the fragment context memory storage structure reaches the capacity limit M; newly enqueued feature vectors push the feature vectors at the head of the queue out of the queue.

[0151] like Figure 4 As shown, a segment context memory storage structure is maintained during training to store historical hidden layer feature representations. This storage structure is illustrated by the bottom container in the diagram. When processing the current segment, its feature vector is compared with the historical feature vectors in the storage structure using cross-time similarity retrieval. Based on the similarity, a cross-time positive sample pairing set and a cross-time negative sample pairing set are selected and expanded into the current contrastive learning sample group. Solid arrows in the diagram indicate the current features being stored in the storage structure, while dashed arrows indicate the historical feature retrieval process. After training, the historical feature representations in the storage structure are updated according to a first-in, first-out (FIFO) rule, achieving dynamic maintenance of long-term memory.

[0152] Step S360: Perform periodic subsequence segmentation processing on the cardiopulmonary activity signal sequence to generate multiple periodic segment units with complete physiological activity cycles. Perform internal phase division processing on each periodic segment unit, divide each periodic segment unit into multiple phase sub-segments according to the phase stage of the physiological activity cycle, and assign a phase position label to each phase sub-segment unit.

[0153] In this embodiment, the periodic subsequence segmentation process employs a periodic detection algorithm based on the autocorrelation function. The autocorrelation function is calculated for each channel of the cardiopulmonary activity signal sequence. The delay corresponding to the first peak of the autocorrelation function is taken as the physiological activity cycle length of that channel, and the median of all channel cycle lengths is taken as the unified cycle length Tcycle. The cardiopulmonary activity signal sequence is then segmented into non-overlapping periodic segments according to the cycle length Tcycle. Internal phase partitioning divides each periodic segment into multiple phase intervals in an equal-division manner. Each phase interval corresponds to a phase position label, which is an integer code ranging from 1 to P, where P is the total number of phase intervals.

[0154] Step S361: Construct contrastive learning constraints based on phase position labels, wherein the contrastive learning constraints based on phase position labels require that the main fragment units with the same phase position labels and the positive sample fragment units in the positive sample pairing set are consistent in phase position labels.

[0155] In this embodiment, the contrastive learning constraint based on phase position labels is as follows: when selecting positive samples, in addition to satisfying the conditions of consistent motion state labels and consecutively adjacent time indices in step S132, it is also necessary to additionally satisfy that the phase position label of the positive sample segment unit is the same as the phase position label of the main segment unit.

[0156] Step S362: Extract the corresponding phase position label from the first main segment unit in the multi-time granularity dynamic segment set, use the phase position label as an additional constraint for positive sample screening, and generate a phase-aware first positive sample pairing set. Extract the corresponding phase position label from the second main segment unit in the multi-time granularity dynamic segment set, use the phase position label as an additional constraint for positive sample screening, and generate a phase-aware second positive sample pairing set.

[0157] In this embodiment, the phase position label of the first main segment unit is determined as follows: based on the time index interval of the first main segment unit in the original cardiopulmonary activity signal sequence, the phase interval into which the interval falls is determined, and the corresponding phase position label is extracted. An additional constraint condition, the phase position label consistency condition, is superimposed on the screening condition in step S132, and the selected positive samples form the first phase-aware positive sample pairing set. The generation method for the second phase-aware positive sample pairing set is similar.

[0158] Step S363: Construct a phase-aware first contrastive learning sample group based on the phase-aware first positive sample pairing set and the first negative sample pairing set, and construct a phase-aware second contrastive learning sample group based on the phase-aware second positive sample pairing set and the second negative sample pairing set.

[0159] In this embodiment, the first phase-aware contrastive learning sample group is constructed by merging the first phase-aware positive sample pairing set and the first negative sample pairing set. The second phase-aware contrastive learning sample group is constructed in the same way. The negative sample pairing set remains unchanged, while only the positive sample pairing set is filtered by the phase constraint condition.

[0160] Step S364: The phase-aware first contrastive learning sample group and the phase-aware second contrastive learning sample group are alternately input into the segment association coding network for phase-aware cross-granularity contrastive learning training. In each iteration of the contrastive learning training, the phase position label information is injected into the intermediate layer feature map of the feature coding branch in the segment association coding network. The feature coding branch is guided to focus on the key physiological activity cycle patterns corresponding to the phase position labels through feature modulation processing.

[0161] In this embodiment, conditional batch normalization is used for feature modulation processing. Phase position labels are mapped to phase embedding vectors through an embedding layer. The dimension of the phase embedding vectors is the same as the number of channels in the intermediate layer feature map. The conditional batch normalization layer performs scaling and translation operations on the intermediate layer feature map based on the phase embedding vectors: Feature_out = γ(phase) × Feature_in + β(phase), where γ(phase) and β(phase) are the scaling and translation vectors generated from the phase embedding vectors through a fully connected layer. This operation enables the feature encoding branch to adaptively adjust the distribution of the intermediate layer feature map according to the phase position labels.

[0162] Step S370: Perform local neighborhood relationship modeling on the sampling points of adjacent time indices in the cardiopulmonary activity signal sequence to generate a signal local neighborhood structure graph. The nodes of the signal local neighborhood structure graph correspond to the sampling points in the cardiopulmonary activity signal sequence, and the edges of the signal local neighborhood structure graph correspond to the signal change relationship between adjacent sampling points.

[0163] In this embodiment, the signal local neighborhood structure graph uses the sampling points covered by the first main segment unit as the node set. Edges are constructed using a K-nearest neighbor graph approach. For each node, the absolute value of the difference between its signal value and the signal values ​​of the other nodes is calculated. The K nodes with the smallest absolute difference are selected as its nearest neighbors, and undirected edges are established. The edge weight is a negative exponential function of the absolute value of the signal change between adjacent sampling points, with weight Wuv = exp(-|X(u) - X(v)|).

[0164] Step S371: Perform graph structure perturbation processing on the signal local neighborhood structure graph to generate a perturbed signal local neighborhood structure graph. The graph structure perturbation processing includes randomly deleting some edges in the signal local neighborhood structure graph and randomly occluding some nodes in the signal local neighborhood structure graph.

[0165] In this embodiment, the random edge deletion operation randomly selects edges in the local neighborhood structure graph of the signal and deletes them using a preset edge deletion probability Pe. The random node occlusion operation randomly selects nodes using a preset node occlusion probability Pn and replaces their signal values ​​with zero vectors. The two operations can be performed in combination.

[0166] Step S372: Input the signal local neighborhood structure map and the perturbation signal local neighborhood structure map into the graph isomorphic coding network respectively, and generate the original graph structure feature vector and the perturbation graph structure feature vector through graph convolution operation.

[0167] In this embodiment, the graph isomorphic coding network adopts a graph isomorphic network, which includes three graph isomorphic convolutional layers. The calculation method of each graph isomorphic convolutional layer is: H(l+1)=MLP((1+ε)×H(l)+Σ{Agg(H(l), u)|u∈N(v)}), where H(l) is the node feature matrix of the l-th layer, N(v) is the set of neighboring nodes of node v, Agg is the summation aggregation function, ε is a learnable parameter, and MLP is a multilayer perceptron. The output of the three graph isomorphic convolutional layers is followed by a global summation pooling layer to aggregate the node features into a graph structure feature vector with dimension Dg.

[0168] Step S373: Construct a graph structure contrast loss function, which is calculated based on the similarity difference between the original graph structure feature vector and the perturbed graph structure feature vector.

[0169] In this embodiment, the graph structure contrast loss function is Lgraph=-log(exp(Sim(Gorig,Gpert) / τg) / [exp(Sim(Gorig,Gpert) / τg)+Σexp(Sim(Gorig,Gneg) / τg)]), where Gorig is the original graph structure feature vector, Gpert is the perturbed graph structure feature vector, Gneg is the graph structure feature vector of other samples as negative samples, and τg is the graph structure contrast loss temperature coefficient.

[0170] Step S374: Construct a corresponding first signal local neighborhood structure diagram for the first main segment unit in the multi-time granularity dynamic segment set, and construct corresponding positive sample signal local neighborhood structure diagrams and negative sample signal local neighborhood structure diagrams for the first positive sample segment unit and the first negative sample segment unit corresponding to the first main segment unit, respectively.

[0171] In this embodiment, for each segment unit that needs to construct a graph structure, its corresponding signal local neighborhood structure graph is constructed in accordance with step S370.

[0172] Step S375: Extract the first graph structure feature vector of the local neighborhood structure graph of the first signal, the positive sample graph structure feature vector of the local neighborhood structure graph of the positive sample signal, and the negative sample graph structure feature vector of the local neighborhood structure graph of the negative sample signal through the graph isomorphic coding network.

[0173] In this embodiment, the three graph structure feature vectors are all obtained through forward propagation of a graph isomorphic coding network, and the network weight parameters are shared among the graph structures.

[0174] Step S376: Introduce the first graph structure feature vector, the positive sample graph structure feature vector, and the negative sample graph structure feature vector into the contrastive learning process of the first contrastive learning sample group to generate a graph structure-enhanced first contrastive learning sample group.

[0175] In this embodiment, the graph structure-enhanced first contrastive learning sample group adds a corresponding segment's graph structure feature vector to each sample pair based on the original contrastive learning sample group. When calculating the contrastive loss, the graph structure feature vector and the signal feature vector are concatenated along the feature dimension, and the concatenated fused vector is used for similarity calculation, enabling contrastive learning to consider both the temporal features and graph structure features of the signal simultaneously.

[0176] Step S377: Jointly optimize the graph structure contrast loss function and the contrast loss function trained by the segment association coding network, so that the segment association coding network learns the invariant feature representation of the local neighborhood structure of the signal synchronously during the training process.

[0177] In this embodiment, the joint loss function for joint optimization is Ltotal = Ljoint + η × Lgraph, where Ljoint is the cross-granularity joint contrastive loss function in step S158, and η is the graph structure loss weight coefficient. The network weight parameters of the segment association coding network and the graph isomorphism coding network are updated synchronously through the Adam optimizer.

[0178] Step S380: Perform cross-granularity mutual information estimation processing on the first and second main segment units at different time granularity levels in the multi-time granularity dynamic segment set, and construct a mutual information maximization objective function.

[0179] In this embodiment, the mutual information maximization objective function is constructed based on a variational estimate of the lower bound of mutual information. Let the joint distribution of the fine-grained and coarse-grained feature vectors be P(F, G), and the product of the marginal distributions be P(F) × P(G). Then, the mutual information I(F, G) = KL(P(F, G)||P(F) × P(G)). This provides an approximate lower bound estimate for the mutual information maximization objective function Lmi = -I(F, G).

[0180] Step S381: The mutual information lower bound is estimated using a mutual information estimation network on the fine-grained feature vectors of the first main segment extracted by the fine-grained feature encoding branch of the segment association coding network and the coarse-grained feature vectors of the second main segment extracted by the coarse-grained feature encoding branch of the segment association coding network. This generates a mutual information estimate, which is then used as the optimization objective of the mutual information maximization objective function. Gradient ascent optimization is performed on the mutual information maximization objective function during the training of the segment association coding network. During the alternating input training of the first and second contrastive learning sample groups, the mutual information maximization objective function is calculated synchronously, and its gradient is scaled. The normalized gradient is then fused with the gradient of the contrastive loss function trained by the segment association coding network.

[0181] In this embodiment, the mutual information estimation network employs a Jensen-Shannon divergence-based mutual information estimator. The mutual information estimation network includes a discriminator network consisting of two fully connected layers. The input is a concatenated vector of a pair (fine-grained feature vector, coarse-grained feature vector), and the output is a scalar score. The lower bound estimate of mutual information is MI_est = E[log(D(F, G))] - E[log(1-D(F0, G))], where F0 is the feature vector of F after random shuffling within a batch. Gradient ascent optimization calculates the gradient of the mutual information maximization objective function Lmi = -MI_est and updates the parameters along the gradient direction. Scale normalization divides the gradient of Lmi by its L2 norm to ensure it aligns with the gradient scale of the contrastive loss function. Gradient fusion combines the normalized gradient with the gradient of the contrastive loss function linearly according to the weight coefficients and updates the network weight parameters accordingly.

[0182] Step S382: Perform cross-granularity mutual information estimation processing on each first positive sample segment unit and its corresponding second main segment unit in the first positive sample pairing set to generate a positive sample cross-granularity mutual information constraint term; perform cross-granularity mutual information estimation processing on each first negative sample segment unit and its corresponding second main segment unit in the first negative sample pairing set to generate a negative sample cross-granularity mutual information constraint term.

[0183] In this embodiment, the positive sample cross-granularity mutual information constraint term MI1 calculates the estimated mutual information between the fine-grained feature vector of the first positive sample segment unit and the coarse-grained feature vector of the paired second main segment unit. The negative sample cross-granularity mutual information constraint term MI2 calculates the estimated mutual information between the fine-grained feature vector of the first negative sample segment unit and the coarse-grained feature vector of the paired second main segment unit.

[0184] Step S383: Introduce the positive sample cross-granularity mutual information constraint term and the negative sample cross-granularity mutual information constraint term as regularization terms into the mutual information maximization objective function to construct a constrained mutual information maximization objective function.

[0185] In this embodiment, the constrained mutual information maximization objective function is Lmi1 = Lmi + μ × (MI1 - MI2), where μ is the regularization coefficient. This regularization term encourages greater cross-granularity mutual information for positive sample pairs and smaller cross-granularity mutual information for negative sample pairs, ensuring that the mutual information estimation aligns with the sample relationships learned through contrastive learning.

[0186] Step S384: In each training iteration of the segment association encoding network, the contrastive learning training step based on the first contrastive learning sample group and the second contrastive learning sample group and the cross-granularity mutual information optimization step based on the constrained mutual information maximization objective function are executed alternately. Through joint optimization processing, the fine-grained feature vector and the coarse-grained feature vector output by the segment association encoding network after training maintain cross-granularity semantic consistency in the latent space.

[0187] In this embodiment, the alternating execution method is as follows: first, a forward and backward propagation step of the contrastive learning training step is performed to update the network weight parameters of the segment association encoding network; then, a forward and backward propagation step of the cross-granularity mutual information optimization step is performed to update the network weight parameters of the segment association encoding network and the mutual information estimation network. These two steps are iterated alternately until training converges. Cross-granularity semantic consistency refers to the fact that the fine-grained and coarse-grained feature vectors of the same cross-granularity segment pairing group are close to each other in the latent space, while the feature vectors of different pairing groups are far apart.

[0188] Step S390: Perform intra-segment temporal dependency modeling processing on the first main segment unit and the second main segment unit respectively to generate intra-segment temporal dependency feature maps, wherein the intra-segment temporal dependency feature maps characterize the distribution of temporal correlation strength between sampling points within the segment unit.

[0189] In this embodiment, the self-attention mechanism is used for modeling temporal dependencies within a segment. For a segment unit X, the dimension is [W, C], where W is the window length. The query matrix Q = X × Wq, the key matrix K = X × Wk, and the value matrix V = X × Wv are calculated, where Wq, Wk, and Wv are learnable projection matrices. The temporal dependency feature map A = softmax((Q × K^T) / d^0.5), where d is the projection dimension, and softmax is calculated along the row direction. The dimension of A is [W, W], and the element A(i, j) represents the temporal association strength between the i-th sampling point and the j-th sampling point within the segment.

[0190] Step S391: Construct a segment internal structure invariance contrast learning task based on the segment internal temporal dependency feature map, and extract the corresponding perturbed segment internal temporal dependency feature map of the perturbed first main segment unit generated after applying local temporal perturbation processing.

[0191] In this embodiment, the local temporal perturbation processing adopts the same operation as step S311. The temporal dependency feature map Apert inside the perturbation segment is extracted from the first main segment unit of the perturbation in the manner of step S390.

[0192] Step S392: Perform point-by-point comparison between the internal temporal dependency feature map of the first main segment unit and the internal temporal dependency feature map of the perturbed first main segment unit to generate a segment internal structure consistency loss function. Extract the corresponding internal temporal dependency feature map of the positive sample segment and the internal temporal dependency feature map of the negative sample segment for each first positive sample segment unit in the first positive sample pairing set and each first negative sample segment unit in the first negative sample pairing set.

[0193] In this embodiment, the mean squared error between the original feature map Aorig and the perturbed feature map Apert is calculated through point-by-point comparison. The fragment internal structural consistency loss function is Lself=MSE(Aorig, Apert)=||Aorig-Apert||² / W². The extraction methods for the temporal dependency feature map Apos inside positive sample fragments and the temporal dependency feature map Aneg inside negative sample fragments are the same as those for Aorig.

[0194] Step S393: Maximize the similarity between the intra-segment temporal dependency feature map of the first main segment unit and the intra-segment temporal dependency feature map of the positive sample segment, and minimize the similarity between the intra-segment temporal dependency feature map of the first main segment unit and the intra-segment temporal dependency feature map of the negative sample segment to generate an inter-segment structural comparison loss function.

[0195] In this embodiment, the cosine similarity between Aorig and Apos is calculated using the similarity maximization process, and the cosine similarity between Aorig and Aneg is calculated using the similarity minimization process. The inter-segment structural contrast loss function is Lcross=-log(exp(Sim(Aorig, Apos) / τstr) / [exp(Sim(Aorig, Apos) / τstr)+Σexp(Sim(Aorig, Aneg) / τstr)]), where τstr is the structural contrast loss temperature coefficient.

[0196] Step S394: Normalize the intra-segment structural consistency loss function and the inter-segment structural contrast loss function respectively; fuse the normalized loss functions to generate a segment structure-aware contrast loss function; adaptively weight and combine the segment structure-aware contrast loss function with the contrast loss function of the first contrast learning sample group to generate a structure-aware enhanced first contrast loss function; adaptively weight and combine the segment structure-aware contrast loss function with the contrast loss function of the second contrast learning sample group to generate a structure-aware enhanced second contrast loss function.

[0197] In this embodiment, the normalization process uses the same mean-standard-deviation normalization as in step S158. The segment structure-aware contrastive loss function is Lstr = Lself_norm + Lcross_norm. The adaptive weighted combination processing learning method is as follows: the structure-aware enhancement first contrastive loss function is L1_struct = Lcontrast1 + ω1 × Lstr, where Lcontrast1 is the contrastive loss function of the first contrastive learning sample group, and ω1 is the adaptive weight, which is obtained by activating the learnable network parameters using the sigmoid function.

[0198] Step S395: Based on the structure-aware enhanced first contrastive loss function and the structure-aware enhanced second contrastive loss function, the segment association encoding network is subjected to structure-aware cross-granularity contrastive learning training. After the structure-aware cross-granularity contrastive learning training is completed, the feature vector output by the segment association encoding network simultaneously retains the semantic invariance between signal segments and the temporal structure invariance within the signal segments.

[0199] In this embodiment, the training process for structure-aware cross-granularity contrastive learning is the same as step S150, except that the loss functions are replaced by the structure-aware enhanced first contrastive loss function and the structure-aware enhanced second contrastive loss function, respectively. After training, the fine-grained feature vectors and coarse-grained feature vectors output by the segment association encoding network simultaneously satisfy the following two properties: semantic invariance between signal segments, i.e., segment feature vectors under the same motion state are close to each other in the latent space, while segment feature vectors under different motion states are far apart; and temporal structure invariance within signal segments, i.e., the temporal dependencies between sampling points within a segment are maintained during feature extraction.

[0200] In an exemplary embodiment, a label-free cardiopulmonary exercise data pre-training system based on contrastive learning is provided. This system can be a terminal, server, etc., and its internal structure includes a processor, memory, input / output interface, communication interface, display unit, and input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interface. The processor provides computational and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The input / output interface is used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, near-field communication, or other technologies. When the computer program is executed by the processor, it implements a label-free cardiopulmonary exercise data pre-training method based on contrastive learning. The display unit is used to form a visually visible image and can be a display screen, projection device, or virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device can be a touch layer covering the display screen, or a button, trackball, or touchpad set on the shell of a labelless cardiopulmonary data pre-training system based on contrastive learning, or an external keyboard, touchpad, or mouse, etc.

[0201] It should be noted that, in order to simplify the description of the present invention and thus help to understand one or more embodiments of the invention, multiple features may sometimes be grouped into one embodiment, drawing or description thereof in the foregoing description of the embodiments of the present invention.

Claims

1. A label-free cardiopulmonary exercise data pre-training method based on contrastive learning, characterized in that, The method includes: Acquire an unlabeled cardiopulmonary exercise dataset, which includes cardiopulmonary activity signal sequences and exercise state description sequences synchronously recorded in multiple consecutive acquisition cycles; The cardiopulmonary activity signal sequence is segmented according to different time granularities to generate a multi-time granularity dynamic segment set. The multi-time granularity dynamic segment set includes a first main segment unit extracted by a fine-grained time window and its corresponding first neighboring segment unit set, and a second main segment unit extracted by a coarse-grained time window and its corresponding second neighboring segment unit set. Based on the motion state description sequence, the first main segment unit is subjected to positive and negative sample pairing processing to generate a first contrast learning sample group. The first contrast learning sample group includes a first positive sample pairing set that is continuous with the motion state of the first main segment unit and a first negative sample pairing set that is not continuous with the motion state of the first main segment unit. Based on the motion state description sequence, the second main segment unit is subjected to positive and negative sample pairing processing to generate a second contrast learning sample group. The second contrast learning sample group includes a second positive sample pairing set that is continuous with the motion state of the second main segment unit and a second negative sample pairing set that is not continuous with the motion state of the second main segment unit. The first and second contrastive learning sample groups are alternately input into the segment association encoding network for cross-granularity contrastive learning training to obtain a pre-trained segment association encoding network. The pre-trained segment association encoding network is used to provide initial network weight parameters for downstream cardiopulmonary data analysis tasks.

2. The method for pre-training label-free cardiopulmonary exercise data based on contrastive learning according to claim 1, characterized in that, The step of segmenting the cardiopulmonary activity signal sequence according to different time granularities to generate a multi-time granularity dynamic segment set includes: The cardiopulmonary activity signal sequence is subjected to fine-grained sliding window truncation processing. The cardiopulmonary activity signal sequence is continuously truncated without overlap using fine-grained time window length and fine-grained sliding step size to generate a set of fine-grained segment sequences. One fine-grained segment is sequentially selected from the set of fine-grained segment sequences as the first main segment unit, and multiple fine-grained segments in the set of fine-grained segment sequences located in a preset neighborhood range before the first main segment unit and multiple fine-grained segments located in a preset neighborhood range after the first main segment unit are combined to form the first neighborhood segment unit set. The cardiopulmonary activity signal sequence is subjected to coarse-grained sliding window truncation processing. The cardiopulmonary activity signal sequence is continuously truncated without overlap using the coarse-grained time window length and the coarse-grained sliding step size to generate a set of coarse-grained segment sequences. One coarse-grained segment is sequentially selected from the coarse-grained segment sequence set as the second main segment unit, and multiple coarse-grained segments in the coarse-grained segment sequence set located within a preset neighborhood range before the second main segment unit and multiple coarse-grained segments in the coarse-grained segment sequence set located within a preset neighborhood range after the second main segment unit are combined to form the second neighborhood segment unit set. The first main segment unit, the first neighboring segment unit set, the second main segment unit, and the second neighboring segment unit set are subjected to time index association binding processing to establish a mapping table of correspondence between fine-grained segments and coarse-grained segments in the time dimension; According to the correspondence mapping table, the first main segment unit and the second main segment unit with time correspondence are paired and combined to generate a cross-granularity segment pairing group set. The cross-granularity fragment pairing set, the first neighborhood fragment unit set, and the second neighborhood fragment unit set are integrated and encapsulated to generate the multi-time granularity dynamic fragment set.

3. The method for pre-training label-free cardiopulmonary exercise data based on contrastive learning according to claim 1, characterized in that, The step of performing positive and negative sample pairing processing on the first main segment unit based on the motion state description sequence to generate a first contrastive learning sample group includes: Extract the first motion state label corresponding to the first main segment unit in time index from the motion state description sequence, and extract multiple neighborhood motion state labels corresponding to each neighborhood segment unit in the first neighborhood segment unit set in time index from the motion state description sequence; The first motion state label is compared with each of the neighboring motion state labels to form a state consistency comparison process. Neighboring segment units with consistent state labels and consecutively adjacent time indices are selected to form the first positive sample pairing set. The first motion state label is compared with each of the neighboring motion state labels to form a state consistency comparison process. Neighboring segment units with inconsistent state labels or time index intervals exceeding a preset interval threshold are selected to form the first negative sample pairing set. A positive pairing relationship is constructed between the first main segment unit and each positive sample segment unit in the first positive sample pairing set to generate a first positive sample data pair with a positive relationship identifier. A negative pairing relationship is constructed between the first main segment unit and each negative sample segment unit in the first negative sample pairing set to generate a first negative sample data pair with a negative relationship identifier. The first positive sample data pair and the first negative sample data pair are merged and combined to generate the first contrastive learning sample group.

4. The method for pre-training label-free cardiopulmonary exercise data based on contrastive learning according to claim 1, characterized in that, The step of performing positive and negative sample pairing processing on the second main segment unit based on the motion state description sequence to generate a second contrastive learning sample group includes: Extract the second motion state label corresponding to the second main segment unit in time index from the motion state description sequence, and extract multiple neighborhood motion state labels corresponding to each neighborhood segment unit in the second neighborhood segment unit set in time index from the motion state description sequence; The second motion state label is compared with each of the neighboring motion state labels to form a state consistency comparison. Neighboring segment units with consistent state labels and consecutively adjacent time indices are selected to form the second positive sample pairing set. The second motion state label is compared with each of the neighboring motion state labels to form a state consistency comparison. Neighboring segment units with inconsistent state labels or time index intervals exceeding a preset interval threshold are selected to form the second negative sample pairing set. A positive pairing relationship is constructed between the second main segment unit and each positive sample segment unit in the second positive sample pairing set to generate a second positive sample data pair with a positive relationship identifier. A negative pairing relationship is constructed between the second main segment unit and each negative sample segment unit in the second negative sample pairing set to generate a second negative sample data pair with a negative relationship identifier. The second positive sample data pair and the second negative sample data pair are merged and combined to generate the second contrastive learning sample group.

5. The method for pre-training label-free cardiopulmonary exercise data based on contrastive learning according to claim 3, characterized in that, The step of alternately inputting the first contrastive learning sample group and the second contrastive learning sample group into the segment association relationship encoding network for cross-granularity contrastive learning training to obtain a pre-trained segment association relationship encoding network includes: The segment association relationship coding network is constructed, which includes a fine-grained feature coding branch and a coarse-grained feature coding branch. The fine-grained feature coding branch is used to extract local feature representations of fine-grained segment signals, and the coarse-grained feature coding branch is used to extract global feature representations of coarse-grained segment signals. The first main segment unit and the first positive sample segment unit in the first positive sample data pair are respectively input into the fine-grained feature encoding branch, and the first main segment fine-grained feature vector and the first positive sample fine-grained feature vector are generated through multi-layer temporal convolution processing. The first negative sample segment unit in the first negative sample data pair is input into the fine-grained feature encoding branch, and the first negative sample fine-grained feature vector is generated through multi-layer temporal convolution processing. The second main segment unit and the second positive sample segment unit in the second positive sample data pair are respectively input into the coarse-grained feature encoding branch, and the second main segment coarse-grained feature vector and the second positive sample coarse-grained feature vector are generated through multi-layer temporal convolution processing. The second negative sample fragment unit in the second negative sample data pair is input into the coarse-grained feature encoding branch, and the second negative sample coarse-grained feature vector is generated through multi-layer temporal convolution processing. Calculate the fine-grained positive similarity between the fine-grained feature vector of the first main segment and the fine-grained feature vector of the first positive sample, calculate the fine-grained negative similarity between the fine-grained feature vector of the first main segment and the fine-grained feature vector of the first negative sample, and construct a fine-grained contrast loss function based on the fine-grained positive similarity and the fine-grained negative similarity. Calculate the coarse-grained positive similarity between the coarse-grained feature vector of the second main segment and the coarse-grained feature vector of the second positive sample, calculate the coarse-grained negative similarity between the coarse-grained feature vector of the second main segment and the coarse-grained feature vector of the second negative sample, and construct a coarse-grained contrastive loss function based on the coarse-grained positive similarity and the coarse-grained negative similarity. The fine-grained contrastive loss function and the coarse-grained contrastive loss function are numerically normalized respectively. The normalized loss functions are then weighted and fused to generate a cross-grained joint contrastive loss function. Based on the cross-grained joint contrastive loss function, the network weight parameters of the fine-grained feature encoding branch and the coarse-grained feature encoding branch are synchronously updated. After multiple rounds of iterative training, the pre-trained segment association relationship encoding network is obtained.

6. The method for pre-training label-free cardiopulmonary exercise data based on contrastive learning according to claim 1, characterized in that, The method further includes: After obtaining the pre-trained segment association encoding network, the target dataset for downstream cardiopulmonary data analysis tasks with labels is obtained. The target dataset contains the cardiopulmonary activity signal sequences to be analyzed and the corresponding analysis task labels. The network weight parameters of the fine-grained feature encoding branch and the coarse-grained feature encoding branch of the pre-trained segment association encoding network are loaded as the initial network weight parameters into the target task analysis network. The target task analysis network is connected to a task-specific output layer after the fine-grained feature encoding branch and the coarse-grained feature encoding branch. The cardiopulmonary activity signal sequence to be analyzed is input into the target task analysis network loaded with the initial network weight parameters. The fine-grained feature vector to be analyzed is extracted through the fine-grained feature encoding branch, and the coarse-grained feature vector to be analyzed is extracted through the coarse-grained feature encoding branch. The fine-grained feature vector to be analyzed and the coarse-grained feature vector to be analyzed are concatenated to generate a fused feature vector. The fused feature vector is then input into the task-specific output layer, and the task prediction output result is generated through fully connected mapping. Based on the task prediction output and the analysis task label, a task-specific loss function is calculated. Then, the network weight parameters of the target task analysis network are fine-tuned and updated through backpropagation to obtain a fine-tuned target task analysis network adapted to the downstream cardiopulmonary data analysis task.

7. The method for pre-training label-free cardiopulmonary exercise data based on contrastive learning according to claim 1, characterized in that, The method further includes: Construct a target momentum coding network with the exact same structure as the segment association coding network, wherein the initial network weight parameters of the target momentum coding network are exactly the same as the initial network weight parameters of the segment association coding network; A signal perturbation process is applied to the first main segment unit in the multi-time-granularity dynamic segment set to generate a first enhanced main segment unit. The signal perturbation process includes a local amplitude scaling operation on the first main segment unit and a local timing reversal operation on the first main segment unit. The signal perturbation process is applied to the second main segment unit in the multi-time-granularity dynamic segment set to generate a second enhanced main segment unit; The first main segment unit is input into the segment association coding network, and the first original fine-grained feature vector is generated through the fine-grained feature coding branch of the segment association coding network. The first enhanced main segment unit is input into the target momentum coding network, and the first enhanced fine-grained feature vector is generated through the fine-grained feature coding branch of the target momentum coding network. The second main segment unit is input into the segment association coding network, and a second original coarse-grained feature vector is generated through the coarse-grained feature coding branch of the segment association coding network. The second enhanced main segment unit is input into the target momentum coding network, and the second enhanced coarse-grained feature vector is generated through the coarse-grained feature coding branch of the target momentum coding network. Calculate the fine-grained invariance comparison loss between the first original fine-grained feature vector and the first enhanced fine-grained feature vector, and calculate the coarse-grained invariance comparison loss between the second original coarse-grained feature vector and the second enhanced coarse-grained feature vector; The fine-grained invariant contrastive loss is fused with the coarse-grained invariant contrastive loss to generate a signal invariance preservation loss function. After each round of contrastive learning training iteration, momentum-weighted update processing is performed based on the current network weight parameters of the target momentum encoding network and the current network weight parameters of the segment association encoding network to generate updated network weight parameters of the target momentum encoding network.

8. The method for pre-training label-free cardiopulmonary exercise data based on contrastive learning according to claim 1, characterized in that, The method further includes: The spectral distribution information of the cardiopulmonary activity signal sequence in the frequency domain is extracted from the unlabeled cardiopulmonary exercise dataset, and the spectral distribution information includes energy distribution sequences in different frequency bands; Based on the spectral distribution information, the cardiopulmonary activity signal sequence is decomposed into frequency bands to generate multiple frequency band-limited narrowband signal component sequences. The segmentation operation according to different time granularities is performed on each of the narrowband signal component sequences to generate a set of narrowband multi-time granular dynamic segments corresponding to each narrowband signal component sequence. For each of the narrowband multi-temporal granular dynamic segment sets, the operation of pairing positive and negative samples for the first main segment unit based on the motion state description sequence is performed to generate a narrowband first contrast learning sample group corresponding to each narrowband signal component sequence; For each of the narrowband multi-temporal granular dynamic segment sets, the operation of pairing positive and negative samples for the second main segment unit based on the motion state description sequence is performed to generate a narrowband second contrast learning sample group corresponding to each narrowband signal component sequence; Construct a set of frequency band specific segment association coding networks, wherein the set of frequency band specific segment association coding networks includes a frequency band specific coding network that corresponds one-to-one with each of the narrowband signal component sequences; Each narrowband first contrastive learning sample group and the corresponding narrowband second contrastive learning sample group are alternately input into the corresponding frequency band-specific coding network for contrastive learning training to obtain multiple frequency band-specific pre-trained coding networks. The network weight parameters of the multiple frequency band-specific pre-trained coding networks are then fused across frequency bands to generate fused pre-trained coding network weight parameters. These fused pre-trained coding network weight parameters are used to initialize the network weight parameters for downstream cardiopulmonary data analysis tasks.

9. The method for pre-training label-free cardiopulmonary exercise data based on contrastive learning according to claim 1, characterized in that, The method further includes: Extract motion state transition time nodes from the motion state description sequence, where the motion state transition time node is the time index position where the motion state label in the motion state description sequence changes; Before and after the motion state transition time point, the segments before and after the cardiopulmonary activity transition are respectively extracted. The segments before and after the cardiopulmonary activity transition are combined into motion state transition segments and assigned a state transition relationship label to the motion state transition segments. The state transition relationship label is used to identify the state transition type from the original motion state to the target motion state. Fine-grained sliding window truncation processing is performed on the pre-transition segment of cardiopulmonary activity in the pairing of motion state transition segments to generate a set of fine-grained segment sequences before the transition; fine-grained sliding window truncation processing is performed on the post-transition segment of cardiopulmonary activity in the pairing of motion state transition segments to generate a set of fine-grained segment sequences after the transition. The fine-grained fragment sequence set before the transition and the fine-grained fragment sequence set after the transition are paired with the fine-grained fragments with the closest time indices to form a transition boundary fine-grained fragment pairing, and the remaining fine-grained fragments with far different time indices are paired with non-transition boundary fine-grained fragment pairs. A set of positive state transition samples is constructed based on the fine-grained fragment pairing of the transition boundary, and a set of negative state transition samples is constructed based on the fine-grained fragment pairing of the non-transition boundary. The positive state transition sample pairing set and the negative state transition sample pairing set are input into the state transition discrimination network for state transition pattern learning processing. The state transition discrimination network includes a bidirectional long short-term memory module and a fully connected classification module. The bidirectional long short-term memory module performs bidirectional temporal feature extraction on the input fine-grained segment pairings to generate a bidirectional temporal dependency feature vector. This bidirectional temporal dependency feature vector is then input into the fully connected classification module for state transition type prediction, outputting the state transition type prediction result. Based on the state transition type prediction result and the state transition relationship label, a state transition classification loss function is calculated. The network weight parameters of the state transition discriminant network are updated through backpropagation to obtain the pre-trained state transition discriminant network.

10. A label-free cardiopulmonary exercise data pre-training system based on contrastive learning, characterized in that, include: processor; A machine-readable storage medium for storing machine-executable instructions of the processor; The processor is configured to execute the label-free cardiopulmonary exercise data pre-training method based on contrastive learning as described in any one of claims 1 to 9 by executing the machine-executable instructions.