Drinking action recognition method and electronic device

By acquiring motion data from the cup end and the reference end, and using common motion events for time alignment and motion decoupling, the problem of misjudgment due to clock drift and low data quality in drinking action recognition is solved, achieving high-precision and robust drinking action recognition.

CN123179293APending Publication Date: 2026-11-27HEFEI IFLYTEK TOYCLOUD TECH
View PDF 0 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing technologies for drinking action recognition suffer from false relative motion differences and misjudgments due to low data quality caused by the inconsistency between the clock source of the cup-end device and the human body reference terminal, making it difficult to meet the requirements of high-precision and high-robustness behavior recognition.

Method used

By acquiring motion data from the cup end and the reference end, time alignment is performed using common motion events to separate the common motion components of both ends and the relative operational motion components of the cup body. Drinking action recognition is performed when the confidence level and time uncertainty meet the conditions, avoiding misjudgments caused by clock drift and low data quality.

Benefits of technology

It significantly improves the accuracy and robustness of drinking action recognition, prevents interference from false action signals caused by clock drift and poor data quality, and ensures reliable recognition in different usage scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123179293A_ABST
    Figure CN123179293A_ABST
Patent Text Reader

Abstract

The application discloses a drinking action recognition method and an electronic device, and relates to the technical field of intelligent wear and Internet of Things. The method comprises the following steps: acquiring cup end and reference end motion data with timestamps; detecting a common action event and determining a plurality of candidate time alignment results and a confidence level; aligning data according to each candidate result and performing motion decoupling to obtain a common motion component and a cup relative operation motion component; determining a time alignment uncertainty degree according to the component differences; and determining a recognition result only when the confidence level and the time alignment uncertainty degree meet the conditions. The application can effectively solve the problems of false relative motion caused by double-end asynchronous clocks and forced judgment of low-quality data, and improve the recognition robustness.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of smart wearable and Internet of Things technology, and more specifically, to a drinking action recognition method and electronic device. Background Technology

[0002] With the popularization of health monitoring concepts and the rapid development of wearable devices, the refined collection and analysis of users' daily behavioral data has become a crucial aspect of health management. Among these, drinking water, as a fundamental activity for maintaining human physiological functions, directly impacts a user's health status through its frequency, posture, and habits. Currently, the industry commonly employs a technical solution that integrates motion sensors (such as accelerometers and gyroscopes) into water containers or user-worn devices. This involves collecting motion data of the device in three-dimensional space to infer the user's drinking behavior. Such solutions typically rely on filtering, feature extraction, and thresholding of the raw sensor signals to map specific tilt angles, angular velocity changes, or acceleration peaks into actions such as lifting the cup or drinking, thereby statistically analyzing water intake or assessing drinking habits.

[0003] However, in practical applications, since the cup-side device and the human reference terminal often lack a unified clock source, direct data comparison based on their respective timestamps can easily introduce spurious differences in relative motion due to clock drift. Furthermore, when data quality is low or time synchronization uncertainty is high, existing solutions still tend to output definitive conclusions, leading to misjudgments of non-drinking actions or significant deviations in recognizing genuine drinking actions, making it difficult to meet the requirements for high-precision and high-robustness behavior recognition. Summary of the Invention

[0004] In view of the above problems, this application is proposed to provide a drinking action recognition method and electronic device to improve the accuracy of drinking action recognition results. The specific solution is as follows:

[0005] Firstly, a method for recognizing drinking actions is provided, including:

[0006] Acquire cup-end motion data and reference end motion data, wherein the cup-end motion data and the reference end motion data each have their own timestamp, and the reference end is a terminal device associated with the user of the water cup;

[0007] Detect common motion events from the cup end motion data and the reference end motion data, and determine one or more sets of candidate time alignment results and the confidence level of each set of candidate time alignment results based on the common motion events;

[0008] According to the candidate time alignment results of each group, the cup end motion data and the reference end motion data are time aligned to obtain the aligned double-end motion data of each group.

[0009] Motion decoupling is performed on the aligned double-end motion data of each group to obtain the common motion component of the double ends and the relative operation motion component of the cup body under the corresponding group;

[0010] Based on the differences between the relative operational motion components of the cup body in each group, the degree of time-related uncertainty in the current action judgment is determined;

[0011] Only when the degree of confidence and the degree of time uncertainty meet the preset judgment conditions, the drinking action recognition result is determined based on the relative operational motion components of the cup in each group.

[0012] In a second aspect, an electronic device is provided, comprising: a memory and a processor;

[0013] The memory is used to store programs;

[0014] The processor is used to execute the program to implement the various steps of the drinking action recognition method as described in the first aspect.

[0015] By employing the aforementioned technical solution, this application acquires cup-end motion data and reference-end motion data, each with its own timestamp. Based on detected common motion events, it determines multiple sets of candidate time alignment results and their reliability. These candidate results are then used to perform time alignment and motion decoupling on the two-end data, separating the common motion components of both ends and the relative operational motion components of the cup. Furthermore, the degree of time synchronization uncertainty is quantified by calculating the differences between each set of relative operational motion components of the cup. The final drinking action recognition is only performed when both the reliability and the time synchronization uncertainty simultaneously meet preset judgment conditions. This mechanism enables the system to explicitly model and handle time alignment uncertainties caused by asynchronous device clocks, avoiding misjudgments caused by imposing a single alignment result on all scenarios. It also prevents the forced output of unreliable recognition conclusions when data quality is low or the time synchronization relationship is ambiguous. This effectively solves the technical problems caused by the asynchronous clock at both ends, such as false relative motion, forced uniqueness of multiple reasonable alignment results, and forced judgment of low-quality data. It avoids the interference of false action signals caused by clock drift on the recognition accuracy and significantly improves the robustness, accuracy and reliability of drinking action recognition in different usage scenarios. Attached Figure Description

[0016] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of this application. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:

[0017] Figure 1 This is a schematic flowchart of a drinking action recognition method provided in an embodiment of this application;

[0018] Figure 2 This is a schematic diagram of the structure of the inference stage of a motion decoupling model provided in an embodiment of this application;

[0019] Figure 3 This is a schematic diagram of the structure of a motion decoupling model during the training phase, provided in an embodiment of this application.

[0020] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0021] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0022] It is understood that before using the technical solutions disclosed in the various embodiments of this application, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this application in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.

[0023] The drinking action recognition method provided in this application embodiment can be executed by a processing device with data processing capabilities. The processing device can be a water cup, a reference terminal, or a third-party device such as a mobile phone, tablet computer, server, or cloud server that is communicatively connected to both the water cup and the reference terminal.

[0024] The reference end is a terminal device associated with the user of the water cup, such as a smartwatch, smart bracelet, mobile phone, or school badge. A motion sensor on the water cup is used to detect motion data at the cup end, and a motion sensor on the reference end is used to detect motion data at the reference end. When the processing device executes the drinking action recognition method provided in this application embodiment, it needs to acquire the cup end motion data and the reference end motion data.

[0025] In some embodiments, the processing device is a water cup. The water cup may include a motion sensor, a communication module, and a processor. The motion sensor is used to detect motion data at the end of the cup; the communication module is used to communicate with a reference end to receive motion data from the reference end; and the processor is used to execute the drinking action recognition method provided in this embodiment. In this embodiment, the motion data at the end of the cup is detected by the water cup itself, and the motion data at the reference end is received by the water cup from the reference end.

[0026] In other embodiments, the processing device is a reference end. The reference end may include a motion sensor, a communication module, and a processor. The motion sensor is used to detect motion data of the reference end; the communication module is used to communicate with the water cup to receive cup-end motion data sent by the water cup; the processor is used to execute the drinking action recognition method provided in the embodiments of this application. In this embodiment, the motion data of the reference end is detected by the reference end itself, and the cup-end motion data is received by the reference end from the water cup.

[0027] In some embodiments, the processing device is a third-party device, such as a mobile phone, tablet, server, or cloud server, that is communicatively connected to both the water cup and the reference end. The third-party device receives motion data from the water cup and motion data from the reference end, and then executes the drinking action recognition method provided in this application. In this embodiment, the drinking action recognition result can be output by the third-party device, or it can be sent by the third-party device to the water cup and / or the reference end for output, display, or prompting.

[0028] It should be noted that the embodiments of this application do not limit the drinking action recognition method to be fully executed by the same device. In some embodiments, the drinking action recognition method can also be executed collaboratively by a water cup, a reference end, and / or a third-party device. For example, at least some of the steps of detecting common action events, determining candidate time alignment results, time alignment processing, motion decoupling, determining the degree of time synchronization uncertainty, and determining the drinking action recognition result can be executed separately by different devices among the water cup, the reference end, and / or the third-party device. The drinking action recognition result can be output locally on the executing device or sent to other devices for output, display, or prompting.

[0029] The above-described application entities are merely examples of embodiments of this application and do not constitute a limitation on the entities that can execute this application. Those skilled in the art can select a water cup, a reference device, a third-party device, or a combination thereof to execute the drinking action recognition method provided in the embodiments of this application, based on the actual product form, communication connection method, and distribution of computing resources.

[0030] This application provides a method for recognizing drinking actions, referring to... Figure 1 The method for recognizing drinking actions specifically includes the following steps:

[0031] Step S100: Obtain cup-end motion data and reference end motion data. The cup-end motion data and reference end motion data each have their own timestamps. The reference end is the terminal device associated with the user of the water cup.

[0032] The cup-end motion data refers to the cup's motion data detected by a motion sensor mounted on the cup; the reference-end motion data refers to the user's motion data detected by a terminal device associated with the user of the cup (i.e., the reference end). The reference end can be, for example, a portable electronic device such as a smartwatch, smart bracelet, badge, or mobile phone. The acquisition process includes reading raw motion data such as three-axis acceleration and three-axis angular velocity from the embedded sensor inside the cup and the sensor interface of the reference end, respectively, and recording the timestamps generated by their respective local clocks.

[0033] By acquiring time-stamped dual-end data, a data source containing a time reference is established to capture the correlation between cup operations and user body movements in the time dimension, forming a time-stamped motion data sequence, providing input conditions for subsequent detection of common action events and time alignment.

[0034] Step S110: Detect common motion events from the cup end motion data and the reference end motion data, and determine one or more sets of candidate time alignment results and the credibility of each set of candidate time alignment results based on the common motion events.

[0035] A common action event can refer to the same physical event that can be observed by both the cup end and the reference end and can serve as a time anchor, such as picking up the cup, bringing the cup close to the user, or putting the cup back. This step is used to resolve the problem of clock asynchrony between the two devices by finding a physical synchronization anchor to estimate the time deviation.

[0036] Based on candidate event pairings, the time offset and / or clock rate ratio at both ends are estimated, resulting in one or more candidate time alignment results. Since multiple similar actions or noise interference may exist in real-world scenarios, this estimation may produce multiple reasonable solutions. Simultaneously, the reliability of each candidate time alignment result can be calculated based on factors such as waveform similarity of the candidate event pairings, time fitting residuals, and the number of candidate event pairings. The reliability level is used to quantify the reliability of that set of time alignment results. This yields a candidate set containing multiple possible solutions and their reliability scores, preserving the uncertainty information of time alignment and avoiding error accumulation caused by forcing a single result.

[0037] Step S120: According to the candidate time alignment results of each group, perform time alignment processing on the cup end motion data and the reference end motion data to obtain the aligned double-end motion data of each group.

[0038] Specifically, the cup-end motion data and the reference-end motion data can be mapped to the same time axis according to the time mapping relationship defined by the time alignment results of each group of candidates.

[0039] To address the timing discrepancy between the cup-end and reference-end due to independent clock sources, the time mapping parameters contained in each group of candidate time alignment results are first read. This time mapping relationship characterizes the functional correspondence between the cup-end timestamp and the reference-end timestamp. Based on this mapping relationship, the discrete data sequences originally sampled separately based on the cup-end local clock and the reference-end local clock are uniformly projected onto a global reference time axis. This global reference time axis can be selected as the cup-end time axis, the reference-end time axis, or a defined standard logical time axis. Through the above coordinate transformation, a logical time point correspondence is established between two data streams that were originally misaligned in physical time. For example, when the time mapping relationship indicates the reference-end time... With the time of the cup Satisfy linear relationship Then, the projection position of the reference end data point on the cup end time axis is calculated according to the formula, thereby establishing the basis for temporal alignment between data points and providing a unified spatiotemporal reference for subsequent joint analysis.

[0040] Furthermore, interpolation and / or resampling are performed on the mapped two-end motion data to obtain the aligned two-end motion data corresponding to each group of candidate time alignment results.

[0041] After completing the time coordinate mapping, given that the original sampling time and the target time axis scale often do not coincide, direct mapping may lead to sparse and uneven distribution or missing data points. Therefore, interpolation and resampling operations need to be performed on the mapped data to generate a regularized and time-synchronized two-end data sequence. This processing yields aligned two-end motion data corresponding to each group of candidate time alignment results. This data is strictly aligned in the time dimension, enabling the subsequent motion decoupling model to index the data from both ends at the same time, ensuring the accuracy of feature extraction and joint computation.

[0042] By establishing a time mapping relationship and performing interpolation resampling, asynchronous discrete motion data is transformed into a time-aligned standardized sequence, eliminating the computational error caused by the difference between the two clock ends, and providing a high-quality data foundation for precise motion decoupling based on two-end collaboration.

[0043] Step S130: Perform motion decoupling on the aligned double-end motion data of each group to obtain the common motion component of the double ends and the relative operation motion component of the cup body under the corresponding group.

[0044] Motion decoupling refers to decomposing observed motion into motion jointly perceived by both ends (such as walking, turning, and other whole-body movements, i.e., shared motion components) and motion generated only by the cup body relative to the reference end (such as lifting or tilting the cup, i.e., relative operational motion components). This step aims to separate the relative operational motion components of the cup body that reflect the actual intention to drink. Specifically, each set of aligned motion data from both ends can be input into the same motion decoupling model. This model is configured to encode the cup-end motion data and the reference end motion data separately to extract high-dimensional temporal features, and extract the shared motion components from both ends based on these features; subsequently, components that can be explained by the shared motion components are removed from the cup-end temporal features to obtain the relative operational motion components of the cup body.

[0045] Step S140: Determine the degree of time-accuracy uncertainty of the current action judgment based on the differences between the relative operational motion components of the cups in each group.

[0046] The degree of time-alignment uncertainty is used to characterize the instability of action judgment conclusions caused by the ambiguity of time alignment results, aiming to quantify the impact of different candidate time alignment results on the final recognition result. The determination process includes, for example, the following: First, normalizing the relative operational motion components of the cup in each group according to a uniform scale to obtain the normalized operational motion features corresponding to each group; second, determining the weight of each group according to the confidence level corresponding to each group, for example, using the normalized confidence level as the weight coefficient; finally, calculating the degree of dispersion of the normalized operational motion features corresponding to each group around the weighted mean, and determining the degree of time-alignment uncertainty based on the degree of dispersion.

[0047] If the relative motion components of the cups corresponding to different candidates differ significantly, the dispersion is high, indicating that the time alignment error will significantly affect the action recognition conclusion, and the time uncertainty increases accordingly. Conversely, if the results of each candidate tend to be consistent, the time uncertainty is low. In this way, the uncertainty implicit in the time alignment process is made explicit into a calculable index, and a quantitative evaluation result of the reliability of the action judgment is obtained.

[0048] Step S150: Only when the confidence level and time uncertainty meet the preset judgment conditions, the drinking action recognition result is determined based on the relative operational motion components of the cup in each group.

[0049] In this step, the final drinking action recognition result is output only when the time alignment result is reliable and the conclusion is robust, avoiding misjudgments in low-quality data or ambiguous scenarios. The preset judgment conditions include dual constraints on credibility and time alignment uncertainty: the credibility must be higher than a preset trust threshold to measure the absolute reliability of the time alignment result; the time alignment uncertainty must be lower than a preset uncertainty threshold to measure the consistency of the conclusion. Subsequent recognition logic is triggered only when both conditions are simultaneously met.

[0050] When determining the drinking action recognition result, the weight of each group can be determined based on the credibility of the candidate time alignment results, and a weighted fusion method can be used to process the cup relative operation motion components under each group. For example, the cup relative operation motion components under each group are fused according to their respective weights to obtain the fused cup relative operation motion components; then, the fused cup relative operation motion components are compared with the user's personal drinking action reference in the corresponding usage scenario to obtain the degree of deviation of the drinking action, and then the drinking action recognition result is determined based on the degree of deviation of the drinking action.

[0051] This dual-condition gating mechanism effectively filters out unreliable results caused by clock synchronization failure or poor data quality, significantly improving the accuracy and robustness of drinking action recognition.

[0052] This embodiment acquires timestamped dual-end motion data, performs soft time alignment using common action events, and retains multiple candidate results. Then, it independently decouples each set of results to separate common motion from relative operational motion. Based on the differences in the relative operational motion components of the cup under different candidate solutions, it quantifies the degree of time-synchronization uncertainty and constructs a dual-judgment gating system based on the degree of confidence. This strategy ensures that the recognition result is output only when the time alignment is reliable and the conclusion is robust, thus effectively solving the problem of false relative motion caused by asynchronous clocks at both ends and the problem of forcing multiple reasonable alignment results to be unique, achieving accurate recognition of drinking actions.

[0053] In some embodiments of this application, the drinking action recognition method may further include:

[0054] If the confidence level and / or time uncertainty do not meet the preset judgment conditions, an "unable to judge" message will be output.

[0055] Specifically, when the reliability level is lower than a preset reliability threshold, or the time uncertainty exceeds a preset uncertainty upper limit, it indicates a serious time synchronization error, insufficient data quality, or multiple contradictory alignment interpretations between the currently acquired cup-end motion data and the reference-end motion data. This results in the inability to accurately determine the relative operational motion components of the cup or obtain reliable drinking action recognition results. In this case, to avoid outputting erroneous action prompts that mislead the user, a rejection mechanism is triggered, immediately generating and outputting an "unrecognizable" message. This "unrecognizable" message can be, for example, a specific status code, a prompt, or a system log record, clearly indicating that a valid drinking action evaluation could not be completed within the current period, thereby ensuring the rigor and reliability of the system output.

[0056] In some embodiments of this application, an optional implementation for detecting common motion events from cup end motion data and reference end motion data is described, specifically including:

[0057] S1. Detect candidate motion events from the motion data at the cup end and the motion data at the reference end, respectively.

[0058] In the raw sensor data streams acquired at both the cup end and the reference end, significant motion segments that can serve as time anchors are independently identified. By analyzing the data from both ends, time periods where the motion exceeds a preset noise threshold and persists for a certain duration are extracted and marked as candidate motion events. This detection process is executed independently and in parallel at both the cup end and the reference end, without relying on clock synchronization at either end.

[0059] Optionally, the cup-end motion data and the reference-end motion data may each include triaxial acceleration and triaxial angular velocity detected by the motion sensor. The process of detecting candidate motion events then includes:

[0060] S11. Calculate the angular velocity modulus based on the triaxial angular velocity, calculate the acceleration modulus based on the triaxial acceleration, and / or extract the waveform envelope.

[0061] The inertial measurement unit (IMU) at the end of the smart water bottle and the IMU sensor at the reference end (such as a smartwatch) collect triaxial acceleration and triaxial angular velocity as raw sensor data, respectively. Considering the potential differences in spatial orientation between the water bottle and the reference terminal, directly comparing data along a specific axis lacks physical consistency. Therefore, modulus calculation is used to transform the multidimensional vector data into a rotationally invariant scalar sequence to eliminate the influence of coordinate system differences on feature detection.

[0062] For the triaxial angular velocity data collected at any given time , and Calculate its angular velocity modulus The calculation process can be formally represented as:

[0063]

[0064] In the formula, The angular velocity modulus at time t is expressed in radians per second or degrees per second. , , These represent the angular velocity components of rotation around the X, Y, and Z axes at time t, respectively. Similarly, for triaxial acceleration data, to accurately reflect changes in motion, the influence of gravitational acceleration components must first be removed to obtain the dynamic acceleration components. , , Then the acceleration modulus was calculated. The calculation process for the acceleration modulus can be formally represented as follows:

[0065]

[0066] In the formula, This represents the dynamic acceleration modulus at time t, expressed in meters per second squared. The above modulus calculation method transforms complex rigid body motion into a scalar sequence characterizing the intensity of motion, facilitating subsequent standardized threshold determination.

[0067] Furthermore, for specific types of drinking actions such as rapid tilting or impacts from placing a water cup, simple modulus length may not be sufficient to capture transient characteristics. In such cases, waveform envelope can be extracted. The waveform envelope represents the contour of the signal amplitude changing over time, which can smooth high-frequency noise and highlight low-frequency trends.

[0068] By calculating the angular velocity modulus, acceleration modulus, or waveform envelope, a feature sequence that is sensitive to both rotational and translational motions and has directional robustness was constructed, laying a data foundation for accurate identification of motion events in high-noise environments.

[0069] S12. When the angular velocity magnitude, acceleration magnitude, or waveform envelope exceeds the noise threshold and continues for a preset time, record the candidate motion event and its start and end times, as well as at least one of the peak time, duration, and normalized waveform.

[0070] The system filters physically meaningful motion segments from continuously acquired sensor stream data, while eliminating random noise and minor jitter interference. The noise threshold is determined based on the statistical characteristics of the sensor output signal when the device is stationary or in a stable state. For example, the mean and standard deviation of the angular velocity modulus during a stationary period are calculated, and the mean plus three times the standard deviation is set as the noise threshold. A preset time is used to distinguish between brief high-frequency noise pulses (such as micro-vibrations) and genuine body movements (such as holding a cup or tilting the head back). This preset time can be set to, for example, 0.1 seconds, 0.2 seconds, or longer, depending on the minimum duration characteristic of the movement type.

[0071] The system monitors the angular velocity magnitude, acceleration magnitude, or waveform envelope calculated in the preceding steps in real time. When any eigenvalue exceeds a preset noise threshold, timing logic is activated. If the eigenvalue remains above the noise threshold for a preset period, a valid candidate motion event is detected, and the event's metadata is recorded. The recorded metadata specifically includes: start and end times, i.e., the moment the eigenvalue first exceeds the threshold. and the moment when it finally falls below the threshold Peak time refers to the moment when the characteristic value reaches its maximum value within the start and end time range. Duration, i.e. and The time difference between events; and the normalized waveform, which is the sequence after amplitude normalization of the original signal sequence within the event time window. Saving the normalized waveform can eliminate the amplitude influence caused by differences in the intensity of the action in subsequent processing, thus focusing on waveform shape similarity matching.

[0072] S2. Based on at least one of the waveform similarity, duration and occurrence order between the candidate motion events detected at both ends, establish candidate event pairings, and each candidate event pairing is regarded as a candidate common action event.

[0073] The waveform is a time-series signal of the running data within the time window corresponding to the candidate motion event, including at least one of the angular velocity magnitude sequence, acceleration magnitude sequence, and waveform envelope.

[0074] Based on the candidate motion events detected at both ends, candidate event pairings are established using dimensions such as waveform similarity, duration, and order of occurrence. The aim is to determine which independent candidate motion events at the cup end and the reference end actually correspond to the same physical action. This step achieves soft time synchronization by accurately matching co-originating events under asynchronous clock conditions through multi-dimensional constraints.

[0075] Based on the above metrics, a dynamic programming algorithm with skip event penalties or other optimization strategies are used to find one or more event pairings with the lowest total matching cost or the highest overall score. Each pairing that meets the waveform similarity requirements, duration compatibility, and occurrence order is identified as a candidate event pairing and output as a candidate common action event. Through this multi-feature fusion pairing mechanism, common actions such as picking up a cup, walking, or turning can be accurately identified in complex two-end motion data, providing reliable event-level anchors for subsequent accurate time alignment. This process not only solves the time alignment problem caused by clock drift but also greatly improves the robustness of action recognition under multiple scenes and poses.

[0076] This application provides an optional implementation of step S2 above, which establishes candidate event pairings, specifically including:

[0077] S21. For each candidate motion event at the cup end, search for candidate motion events at the reference end within the allowed time offset range.

[0078] The allowed time offset range refers to the maximum time search window set when searching for corresponding reference end matching events for candidate motion events at the cup end. This range can be a boundary interval jointly determined by physical factors such as the initial handshake time difference and communication delay between the cup and the reference terminal when establishing a connection. During system initialization or connection establishment, the time deviation between the two ends is roughly estimated by exchanging timestamp messages. This deviation value is then added to a preset error margin (e.g., ±2 seconds or ±5 seconds, depending on the synchronization accuracy requirements) to determine the start and end positions of the search window. For each candidate motion event detected in the cup end data, only candidate motion events within the allowed time offset range in the reference end data are traversed and matched; events outside this range are directly excluded. This limiting strategy significantly reduces the computational load and effectively filters out pseudo-matching events that are physically impossible to correspond to due to excessively large time spans, thereby improving the efficiency and accuracy of pairing search.

[0079] S22. Interpolate the waveforms of the candidate motion events at both ends to the same length and normalize the amplitude to calculate the shape similarity.

[0080] Because the cup-end sensor and the reference-end sensor may use different sampling frequencies, and the duration of signals generated by the same action on different devices may vary, directly comparing the original sequences cannot provide an effective similarity measure. Waveform interpolation refers to using mathematical interpolation algorithms (such as linear interpolation, cubic spline interpolation, etc.) to resample and stretch or compress the original signal sequences within the cup-end event window (such as the angular velocity magnitude sequence) and the original signal sequences within the reference-end event window to a uniform preset length (e.g., uniformly resampled to 64 or 128 data points). After interpolation, the waveforms at both ends have a geometric basis for point-by-point alignment in the time dimension. Subsequently, amplitude normalization can refer to numerical scaling of the interpolated waveform data at both ends, for example, dividing the values ​​in each sequence by the maximum value or root mean square value of the sequence, mapping them to the standard range of [0,1] or [-1,1], thereby eliminating the absolute intensity differences caused by differences in sensor sensitivity and vibration transmission attenuation due to different installation positions.

[0081] After completing the above preprocessing, shape similarity is calculated. Shape similarity measures the degree of geometrical agreement between two waveform sequences that have been normalized in length and amplitude, focusing on the undulation trend of the waveforms rather than their absolute size. In this embodiment, cosine similarity can be used as the calculation metric, the core logic of which is to calculate the cosine value of the angle between two normalized vectors. This calculation process can be formally represented as:

[0082]

[0083] In the formula, This represents the waveform vector after interpolation and normalization of candidate motion events at the cup end. This represents the waveform vector after interpolation and normalization of candidate motion events at the reference end, with the symbol... This represents the vector dot product operation. and and represent the Euclidean norm of the vector (i.e., the length of the vector). The value ranges from 0 to 1. The closer the value is to 1, the more similar the shapes of the waveforms at both ends are, that is, the more consistent the dynamic patterns of motion they reflect.

[0084] S23. When the shape similarity meets the preset similarity condition, and at least one of the following conditions is met: the event order is consistent, the events are not reused, and the difference in duration between the two candidate motion events is less than the preset duration threshold, a candidate event pairing is established.

[0085] To ensure that the established candidate event pairings are logically and physically reasonable, multi-dimensional hard constraints are introduced. The preset similarity condition can refer to a pre-defined minimum threshold for determining the degree of waveform shape matching; for example, the similarity threshold can be set to 0.85 or 0.9. Only when the shape similarity calculated in step S22 exceeds this preset similarity condition is the two events considered to have a basic possibility of being paired.

[0086] Based on this, further verify at least one of the following logical and physical consistency conditions:

[0087] First, the order of events must be consistent. This requires that the chronological order of events in the candidate pairing set must remain the same on both the cup end and the reference end along the timeline. For example, if event A at the cup end occurs before event B, then its paired reference end event A' must also occur before reference end event B'. This constraint eliminates invalid pairings due to time reversal or causal logical errors.

[0088] Second, events are not reused; that is, a one-to-one matching principle is followed. Each candidate motion event at the cup end can only be paired with one candidate motion event at the reference end, and vice versa. Once an event has been included in a pair, it is removed from the subsequent matching pool to prevent mapping confusion caused by duplicate matching.

[0089] Third, the duration difference between the two candidate motion events is less than a preset duration threshold. The duration difference can be the absolute value of the difference between the start and end times of the event at the cup end and the start and end times of the event at the reference end. The preset duration threshold is an allowable range of difference based on the device sampling rate and measurement error; for example, it can be set to 50 milliseconds or 100 milliseconds. This condition ensures that the two matched events are compatible in terms of the physical property of duration, avoiding the incorrect association of a short, sharp event with a long-period, flat event.

[0090] When the aforementioned shape similarity determination and at least one additional condition are simultaneously satisfied, the correspondence between the candidate motion events is formally established, forming a candidate event pair, which serves as the basis for subsequent time alignment parameter estimation. Through this rigorous screening mechanism, spurious associations caused by noise interference, coincidence, or measurement errors can be eliminated in complex real-world motion scenarios, retaining high-confidence spatiotemporal alignment anchors.

[0091] In some embodiments of this application, an optional implementation is provided for determining one or more sets of candidate time alignment results and the credibility level corresponding to each set of candidate time alignment results based on common action events, as described in the foregoing embodiments. This process may include:

[0092] S1. Estimate the time offset and / or clock rate ratio at both ends based on each candidate event pair to obtain one or more sets of candidate time alignment results.

[0093] By establishing a time mapping function between the cup end and the reference end, candidate motion events recorded independently at both ends are associated with a unified time axis. Since the cup end motion data and the reference end motion data are sampled using their respective hardware clocks, the timestamps of the same physical event appearing in the data streams at both ends exhibit a fixed deviation and drift over time. To eliminate this asynchrony, a linear clock model is used for fitting, and the reference end timestamp... With cup timestamp The relationship is modeled as follows:

[0094]

[0095] in, This represents a fixed time offset between the two ends. Indicates the clock rate ratio. When When the value of deviates from 1, it indicates that there is a relative rate drift between the two clocks.

[0096] In estimating parameters and During the process, the peak time point or center time point in each candidate event pair is used as the observation sample. For each set of candidate event pairs, it contains... Valid matching event pairs To improve estimation accuracy and reduce the impact of outliers, the optimal parameters are solved using the weighted least squares method, and an objective function is constructed to minimize the time fitting error:

[0097]

[0098] In the formula, For the first The weights of each event pair are positively correlated with the waveform similarity between the event pairs. That is, the more similar the waveforms of the event pairs, the higher the reliability of the fitting process, thereby guiding the model to converge toward a high-quality match.

[0099] In real-world scenarios, repetitive gait or swaying movements may exist, leading to multiple reasonable candidate event pairing schemes. Instead of forcing the retention of only a single optimal solution, all parameter combinations that meet preset screening criteria (such as sufficient time span and fitting residuals below a threshold) are retained as candidate time alignment results. For example, for a data segment containing three common action events, if two different pairing interpretations exist, the corresponding... and This yields two sets of candidate time alignment results. This multi-candidate fitting mechanism can effectively address temporal ambiguity in complex motion scenarios and avoid systematic biases introduced by forced single-point fitting.

[0100] S2. Determine the credibility of each candidate time alignment result based on at least one of the following: waveform similarity of candidate event pairings, time fitting residual, and number of candidate event pairings.

[0101] The candidate time alignment results generated in the previous step are quantitatively evaluated to select high-quality mapping relationships. The reliability is determined by comprehensively considering three dimensions: event quality, fitting accuracy, and statistical robustness, avoiding misjudgments caused by the failure of a single indicator.

[0102] Waveform similarity reflects the morphological consistency of motion signals at both ends and is the basis for determining whether two events belong to the same physical action. In this embodiment, waveform similarity... The cosine similarity between the normalized angular velocity magnitude vectors is obtained by calculating:

[0103]

[0104] in, and These are the angular velocity magnitude sequences within the candidate event windows at the cup end and the reference end, respectively. The value ranges from 0 to 1; a value closer to 1 indicates a better match in the geometry of the waveforms at both ends, suggesting that the candidate event pairing is less affected by noise and has higher reliability.

[0105] The time-fit residual characterizes the clock model's ability to interpret actual observation data. For the th Group candidate time alignment results, time fitting residuals Calculated using weighted root mean square error:

[0106]

[0107] In the formula, and For the first Estimated parameters of candidate groups, This represents the number of candidate event pairs included in the group. A smaller residual value means that most event pairs in the group conform well to the linear clock assumption, while a larger residual value indicates possible mismatch or clock jitter.

[0108] Number of candidate event pairs This reflects the confidence level of the statistical results. When the fitting accuracy is similar, the more event pairs involved in the calculation, the less the calculation results are affected by random errors, and the more robust the conclusions, according to the law of large numbers. Time alignment results derived from only a few events have a high degree of randomness, and therefore their reliability should be reduced.

[0109] Based on the above indicators, the first Credibility of Group Candidate Time Alignment Results It can be calculated using the following formula:

[0110]

[0111] In the formula, The average waveform similarity of this group of candidates. For time-fitted residuals, The number of candidate event pairs. The tolerance scale parameter for time error can be set according to the actual sampling frequency and noise level; for example, it can be set to 0.1 seconds or calibrated according to the specific application scenario. This scoring model uses waveform similarity as a basic factor, uses an exponential function to penalize the fitting residual, and normalizes it through a pairwise quantity term, thus obtaining an index that comprehensively reflects the reliability of time alignment.

[0112] The method in this embodiment introduces waveform similarity, time fitting residual and candidate event pairing as evaluation dimensions. It can evaluate the candidate time alignment results from three levels: waveform matching, model fitting error and sample statistics, and provide a reliable time alignment basis for the subsequent action recognition process.

[0113] In some embodiments of this application, an optional implementation of the aforementioned step S130, which involves motion decoupling of each group of aligned dual-end motion data, is described. Specifically:

[0114] Each set of aligned bi-end motion data is input into the same motion decoupling model.

[0115] The motion data of the cup end and the motion data of the reference end are encoded by the motion decoupling model to obtain the temporal features of the cup end and the reference end. The common motion component of both ends is extracted based on the temporal features of the cup end and the temporal features of the reference end. The components that can be explained by the common motion component of both ends are removed from the temporal features of the cup end to obtain the relative operation motion component of the cup body.

[0116] The motion decoupling model can be a trained two-branch temporal neural network that has the ability to implicitly learn the motion coupling rules between the cup end and the reference end.

[0117] The input data of the motion decoupling model encompasses the motion data of the cup end within the same time window and the time-aligned motion data of the reference end. The temporal features of the cup end and the reference end are high-dimensional abstract representations extracted from the original data by the motion decoupling model through encoding branches, characterizing the dynamic change patterns and potential semantic information of the motion signal in time. The encoding branches can employ an architecture combining a one-dimensional convolutional neural network (1D-CNN) with a gated recurrent unit (GRU). Input features include angular velocity magnitude, dynamic acceleration magnitude, gravity direction change, and short-window band energy. Taking a sampling frequency of 100Hz and a time window of 2 seconds as an example, each end of the data contains 200 time points. The data is first processed through two one-dimensional convolutional layers for local feature extraction, then connected to a GRU layer to capture temporal dependencies, finally outputting a fixed-dimensional feature vector, denoted as... (Cup-end timing characteristics) and (Reference timing characteristics). Through deep encoding, the model can filter out high-frequency noise and align data deviations caused by differences in installation direction or sensor axis to a unified feature space.

[0118] The dual-end co-motion component refers to the feature components that exist simultaneously in the data from both the cup end and the reference end, primarily reflecting the user's overall body movement (such as walking, turning, or swaying while riding in a vehicle). Within the motion decoupling model, a co-motion layer is used to extract the dual-end co-motion component; this layer receives the temporal features from the cup end. Timing characteristics of the reference end As input, output the joint motion features of both ends. .

[0119] The model learns to maximize after training. and Consistency information within. When the reference end is worn in a relatively stable position (e.g., fixed to the torso or the non-cup-holding wrist), This primarily addresses the overall displacement and posture changes of the body. Even when the reference end is worn on the hand holding the cup, the model can extract the synchronous fundamental frequency motion (such as the periodic undulations during walking) from both ends through statistical learning. This extraction process is not a simple subtraction or averaging, but rather uses a nonlinear mapping learned by a neural network to effectively handle the complexity caused by different installation orientations or response characteristics at both ends. The extraction of common motion components ensures that subsequent steps, when analyzing the cup's movements, will not misinterpret the overall swaying of the body as abnormal arm movements.

[0120] Furthermore, the model removes components that can be explained by the common motion of both ends from the temporal features of the cup ends, thus obtaining the relative operational motion components of the cup body.

[0121] The relative operational motion component of the cup can refer to the features generated purely by the arm's manipulation of the cup, excluding the influence of overall body movement, including actions such as lifting, tilting, shaking, and placing the cup back. This step is crucial in the decoupling process, achieved through subtraction operations in the feature space. The final obtained relative operational motion component of the cup... It can more accurately represent the specificity of this drinking action, providing an accurate data basis for subsequent calculation of the degree of action deviation and determination of the drinking action recognition result.

[0122] The method in this embodiment transforms dual-end motion data into feature components with clear physical meaning through a motion decoupling model. The extraction of common motion components eliminates background interference, while the separation of the cup's relative operational motion components focuses on specific operational details. This decoupling mechanism ensures that drinking action recognition maintains high robustness under different usage scenarios.

[0123] This application embodiment further provides an optional structure for the motion decoupling model, referring to... Figure 2 As shown, the motion decoupling model uses a two-branch temporal neural network, which includes a cup-end encoder, a reference-end encoder, a common motion layer, and an operational motion layer.

[0124] Among them, the cup end encoder Configuration for using input cup end motion data Generate corresponding cup-end time series features Reference encoder Configuration for using input reference end motion data Generate the corresponding reference timing features The common motion layer is based on the aforementioned cup-end temporal characteristics. Timing characteristics of the reference end Extract and generate the dual-end co-motion component The operational motion layer then processes the residual portion of the temporal features at the cup end that cannot be explained by the common motion component at both ends, thereby generating the operational motion component relative to the cup body. .

[0125] This dual-branch temporal neural network employs a dual-path parallel architecture to process heterogeneous sensor data from the cup end and the reference end, respectively. By performing information interaction and residual separation in the deep feature space, it effectively decouples the overall body motion from specific arm operations. This architecture, through shared parameter constraints or feature space projection mechanisms, forces the network to classify highly correlated parts of the data from both ends as common motion, while classifying parts existing only at the cup end and unexplainable by common motion representation as operational motion. This structural design ensures physical interpretability at the model level: the common motion components at both ends correspond to the user's overall activity state (such as walking, standing up, etc.), while the cup-relative operational motion components purely reflect the fine manipulation of the arm relative to the body (such as lifting the cup, tilting, shaking).

[0126] The cup-end encoder can consist of an input preprocessing layer, a feature extraction layer, and a temporal aggregation layer, responsible for mapping the raw cup-end motion data into high-dimensional temporal abstract features. The input preprocessing layer receives the time-aligned cup-end motion data, which typically includes triaxial angular velocity, triaxial acceleration, and the derived angular velocity and dynamic acceleration magnitudes. The feature extraction layer employs a one-dimensional convolutional neural network (1D-CNN), using multiple convolutional kernels of different sizes to perform a sliding scan in the temporal dimension to capture short-term motion abrupt changes and local waveform features, such as instantaneous changes in cup-lifting acceleration or peak rotational angular velocity. The temporal aggregation layer, connected after the feature extraction layer, can use recurrent neural networks such as gated recurrent units (GRUs) or long short-term memory (LSTM) networks to perform temporal modeling on the local feature sequences output by the convolutional layers, integrating long-term dependencies, and thus outputting a fixed-dimensional temporal feature vector for the cup end. The temporal features at the cup end serve as a high-level semantic representation of the original motion data in the latent space, containing key temporal dynamic information required to complete action recognition.

[0127] The reference-end encoder has a similar network topology to the cup-end encoder, used to extract temporal features from the reference-end motion data. Its input is the reference-end motion data after mapping and interpolation, which is strictly aligned with the cup-end motion data on the time axis. The reference-end encoder also undergoes feature extraction and temporal aggregation processes, ultimately outputting reference-end temporal features. Given that the wearing position (e.g., wrist, torso) and sensor mounting orientation of the reference-end device may differ significantly from those of the cup-end, the reference-end encoder, during training, not only performs feature extraction but also learns to eliminate interference from these non-motion factors, making the output reference-end temporal features semantically comparable to those of the cup-end. For example, for the same walking motion, although the triaxial acceleration values ​​of the cup-end and reference-end are drastically different, after processing by their respective encoders, their representations in the feature space should have high similarity, so that subsequent common motion layers can accurately identify that they belong to the same physical event.

[0128] The co-motion layer is tasked with extracting shared information from the temporal features of both ends. This layer receives temporal features from both the cup end and the reference end as input. Through operations such as attention mechanisms, concatenated fully connected mapping, or bilinear fusion, it calculates the correlation between the two and generates a co-motion component. This co-motion component, as a low-dimensional latent variable, represents the synchronously changing motion patterns in the cup end and reference end data, such as the inertial swaying when a user gets up, walks, or rides in a vehicle. This component aims to maximize the explanation of the commonalities between the two ends of the data. By forcing the model to learn this shared representation, the co-motion layer acts as background removal, stripping away the complex signal changes caused by the user's overall activity, laying the foundation for subsequent extraction of pure cup-body operational motion.

[0129] The operational motion layer utilizes residual learning principles to extract the common motion component between the two ends from the temporal features of the cup ends, thereby obtaining the relative operational motion component of the cup body. This layer takes the temporal features of the cup ends as input and the common motion component between the two ends as constraints. Through feature subtraction or adversarial generation, it calculates the residual portion of the temporal features of the cup ends that cannot be explained by the common motion component between the two ends. This residual-based learning method ensures... It only includes unique motion patterns that appear at the cup end but not at the reference end, namely specific movements of the cup relative to the user's body. This effectively avoids misinterpreting overall body movement as cup movement, significantly improving the accuracy and robustness of drinking action recognition in dynamic environments.

[0130] The parameters of each of the above network layers are optimized through joint training to achieve precise motion decoupling.

[0131] like Figure 3The diagram shown is a structural schematic of the training phase of a motion decoupling model provided in an embodiment of this application.

[0132] The motion decoupling model also includes a cup-end reconstruction layer and a reference-end reconstruction layer during the training phase. The cup-end reconstruction layer is used to reconstruct the feature representation of the cup-end motion data based on the common motion components of both ends and the relative operational motion components of the cup body, thus obtaining the cup-end reconstruction features.

[0133] The reference end reconstruction layer is used to reconstruct the feature representation of the reference end motion data based on the common motion components of both ends, thus obtaining the reference end reconstruction features.

[0134] The motion decoupling model is obtained through joint training, and the loss function of joint training includes at least two of the following:

[0135] (1) Cup end reconstruction loss is the mean square error between the cup end reconstruction features and the cup end reconstruction target features. The cup end reconstruction target features are the feature representations of the cup end motion data.

[0136] The cup-end reconstruction loss constrains the approximation between the reconstructed cup-end features and the target cup-end features. The target cup-end features originate from the high-level feature vector of the input cup-end motion data after encoder processing. This loss term can use mean squared error as a metric, and its calculation logic is as follows:

[0137]

[0138] In the formula, Indicates the first Cup-end reconstruction features of each sample This represents the corresponding cup-end reconstruction target feature. This represents the batch size. Minimizing this loss term ensures that the combination of the common motion components at both ends and the relative operational motion components of the cup effectively preserves the key information of the original cup end motion data, preventing information collapse during feature extraction.

[0139] (2) Reference end reconstruction loss is the mean square error between the reference end reconstruction features and the reference end reconstruction target features. The reference end reconstruction target features are the feature representation of the reference end motion data.

[0140] The reference end reconstruction loss constrains the approximation between the reconstructed features of the reference end and the reconstructed target features of the reference end, where the reconstructed target features are derived from the feature representation of the input reference end motion data. This loss term is also constructed based on the mean squared error.

[0141]

[0142] In the formula, Indicates the first Reconstructed features of the reference end of each sample, This represents the corresponding target feature reconstructed from the reference end. This loss condition forces that the common motion components of both ends must contain sufficient information to reconstruct the motion state of the reference end, thereby ensuring that the extracted common components truly reflect the shared physical motion laws of both ends.

[0143] (3) Motion decoupling loss, used to reduce the repetitive expression between the common motion component at both ends and the relative operational motion component of the cup.

[0144] The motion decoupling loss aims to promote independence between the common motion components at both ends and the relative operational motion components of the cup body, while suppressing redundant representations between them. To achieve this, a constraint is imposed by minimizing the Frobenius norm of the cross-correlation matrix between the two feature vectors. For features within the same batch, the decoupling loss is calculated as follows:

[0145]

[0146] In the formula, Indicates the first The common motion component at both ends of each sample, Indicates the first The relative operational motion component of the cup in each sample, and Let represent the mean vectors within the batch. By optimizing this loss term, the model is guided to learn non-redundant feature representations, such that the common motion component focuses on capturing the overall motion of the environment or body, while the cup-relative operational motion component focuses on capturing the independent operational details of the cup relative to the reference end.

[0147] (4) Action contrast loss, used to make the relative motion components of the cup corresponding to the same drinking action approach each other, and to make the relative motion components of the cup corresponding to different drinking actions move away from each other.

[0148] Action contrastive loss is used to enhance the model's ability to distinguish different drinking action patterns. Its core mechanism lies in bringing similar action features closer together while distancing dissimilar action features. It can be implemented using strategies based on triplet loss or contrastive loss. Taking contrastive loss as an example, its formal expression is:

[0149]

[0150] In the formula, and This represents the relative operational motion component of the cups in two samples; As a label, when two samples belong to the same action Otherwise ; The preset interval parameter controls the minimum distance between different categories of features. Under this constraint, the relative motion components of the cup exhibit clustering characteristics according to action category in the feature space, thereby improving the accuracy and robustness of subsequent action recognition.

[0151] (5) Context classification loss, used to reduce the ability to predict the usage context based on the relative operational motion components of the cup.

[0152] Contextual classification loss aims to weaken the predictive power of the cup's relative operational motion components regarding the usage context (such as cup type, hand holding the cup, and liquid volume), thereby eliminating the interference of non-action factors on feature representation. This loss is typically implemented using an adversarial training mechanism: a contextual classifier is introduced at the feature extraction stage, which attempts to classify the context based on the usage context (such as cup type, hand holding the cup, and liquid volume). The context classification loss predicts context labels, while the feature extractor hinders the classifier's predictions through a gradient inversion layer. This can be defined as the cross-entropy loss between the predicted context category and the true context label. During training, the context classifier aims to minimize... To improve prediction accuracy, the operation of the motion encoder is achieved by minimizing the inclusion of Total loss of the item ( To counteract the strength coefficient), forced Context-related information is removed. This adversarial optimization allows the extracted cup-body relative motion components to focus more on the dynamic characteristics of the action itself, rather than depending on specific external environmental configurations.

[0153] The joint training process employs a multi-task collaborative optimization strategy to synchronously adjust model parameters to balance multiple learning objectives. The joint loss function guiding this process consists of a weighted average of multiple components, the weights of which can be determined through validation set tuning. These components include cup-end reconstruction loss, reference end reconstruction loss, motion decoupling loss, action contrast loss, and context classification loss.

[0154] The above losses are weighted and summed to form the overall objective function for joint training:

[0155]

[0156] In the formula, , , , These are preset weighting coefficients used to balance the contribution of each loss term.

[0157] By introducing reconstruction losses for the cup end and the reference end, the model retains signal reconstruction capabilities while extracting abstract features, providing a physical-level fidelity constraint for the decoupling process. The motion decoupling loss establishes the orthogonality of the feature space from a statistical perspective, avoiding confusion between motion information from different causes. The action contrast loss directly optimizes the decision boundary for action classification through relative distance constraints between samples. The context classification loss utilizes adversarial learning to actively suppress the model's dependence on irrelevant contextual features. The synergistic effect of these multi-dimensional losses enables the trained motion decoupling model to output feature representations with both clear physical meaning and high recognition accuracy, laying a solid data foundation for subsequent uncertainty calculation based on difference analysis and drinking action recognition.

[0158] The embodiments of this application also introduce training data for the motion decoupling model.

[0159] The motion decoupling model can be trained using data collected from the same user under different cup types, different hand holding the cup, different liquid volumes, different reference end installation orientations, and different activity states. The training data includes at least one drinking action segment from stable drinking, tilting, continuous deflection, and shaking, as well as at least one non-drinking segment from washing, pouring water, and playing. In the training data, samples from the same user, the same action pattern, and different usage scenarios form positive sample pairs, and samples from different action patterns form negative sample pairs.

[0160] To extract essential drinking action features independent of cup type, hand holding the cup, liquid volume, and user activity state, and to improve the model's robustness in complex application scenarios, a training dataset encompassing multi-dimensional differences was constructed. The data acquisition process involved setting multiple variable combinations for the same user to simulate real-world usage scenarios. Specifically, the user was controlled to operate different types of cups (e.g., drinking cups, straw cups, or cups made of different materials), alternately use their left or right hand to hold the cup, adjust the liquid volume inside the cup (e.g., half-full, full, or empty), change the installation position and orientation of the reference terminal (e.g., inside the wrist, outside the wrist, or in the chest pocket), and perform corresponding actions under different body activity states (e.g., standing still, walking slowly, or turning around). Through these multi-dimensional scenario combinations, sensor data sequences containing various external interference factors were collected.

[0161] In terms of action category coverage, the training data includes both typical drinking action segments and non-drinking interference segments. Drinking action segments cover at least one of stable drinking, tilting, continuous deflection, and shaking; non-drinking segments cover at least one of washing, pouring water, and playing. Introducing non-drinking segments such as washing, pouring water, and playing as negative sample sources aims to enable the model to learn the boundary differences in kinematic features between drinking actions and non-drinking operations, thereby effectively suppressing false triggers caused by non-drinking scenarios during the inference stage and improving the accuracy of action recognition.

[0162] Based on the collected multi-contextual data, positive and negative sample pairs are constructed according to the consistency and differences in action patterns to drive the model for comparative learning. Positive sample pairs consist of samples from the same user with the same action pattern but in different usage contexts. For example, pairing two stable drinking action segments performed by the same user using a straight-drinking cup and a straw cup respectively. This pairing forces the model to ignore the influence of environmental variables such as cup shape and hand holding the cup during training, mapping the same action to adjacent positions in the feature space, thereby achieving feature decoupling. Negative sample pairs consist of samples with different action patterns, such as pairing a stable drinking segment with a playing segment, or a tilting segment with a washing segment. The constraints of negative sample pairs encourage different types of actions to move away from each other in the feature space, enhancing the separability of various action features. Through joint optimization of positive and negative sample pairs, the motion decoupling model can extract the cup-related relative operational motion components with high generalization ability, ensuring accurate identification of the target drinking action even when faced with specific, unseen contextual combinations.

[0163] In some embodiments of this application, an optional implementation of step S140 described above, which determines the degree of time-synchronization uncertainty of the current action judgment based on the differences between the relative operational motion components of the cups in each group, is described, specifically including the following steps:

[0164] S1. Normalize the relative operational motion components of the cup in each group according to a uniform scale to obtain the normalized operational motion characteristics of each group.

[0165] To eliminate the differences in dimensions and numerical scales among the relative operational motion components of the cups generated by different time alignment results, and to construct a comparable standardized data space, normalization processing needs to be performed on each group of features. The relative operational motion components of the cups in each group are high-dimensional feature vectors output by the motion decoupling model. These vectors often have significantly different numerical ranges across different feature dimensions. If subsequent distance calculations or dispersion statistics are performed directly, the larger numerical dimensions will dominate, leading to distortion in the determination of time-series uncertainty. Therefore, a unified scale is introduced to normalize the operational motion components of each group.

[0166] This process can be formally represented as:

[0167]

[0168] in, Indicates the first The relative operational motion component of the cup body under the candidate time alignment results in the first group Original values ​​in each dimension; Indicates the first A pre-determined uniform scale parameter for each dimension, such as the standard deviation or median absolute deviation of that dimension on the training set; To prevent small positive numbers from being divided by zero; This represents the normalized operational motion characteristics.

[0169] The above normalization operation ensures that the difference calculation between different candidates is performed in a unified metric space, avoiding the bias introduced by the inconsistency of the original feature dimensions.

[0170] S2. Determine the weight of each group based on the credibility level of each group.

[0171] Based on the reliability of each group of candidate time alignment results, corresponding decision weights are assigned, giving more reliable time alignment results greater weight in the calculation of time uncertainty. The reliability of each group is a score calculated in previous steps based on indicators such as waveform similarity of candidate event pairings, time fitting residuals, and the number of candidate event pairings. This score objectively reflects the degree of agreement between the time alignment result and the actual physical time mapping. By converting reliability into weights, the interference of low-quality candidates can be suppressed when quantifying time uncertainty, highlighting the consistent opinions of high-quality candidates.

[0172] The weight determination process could, for example, be: for the first... The weights of the group candidate time alignment results Its credibility Proportional. A specific calculation formula could be, for example:

[0173]

[0174] in, This represents the sum of the confidence levels of all candidate time alignment results involved in the calculation. Through this normalization process, the sum of the weights of all candidates is 1, forming a standard probability distribution or set of weighted coefficients.

[0175] S3. Determine the degree of dispersion of the normalized operation motion characteristics of each group around the weighted mean, and determine the degree of time uncertainty based on the degree of dispersion.

[0176] By quantifying the statistical dispersion characteristics among the normalized operational motion features of each group, an objective index of time-alignment uncertainty is obtained. The dispersion of the normalized operational motion features around the weighted mean directly characterizes the consistency of the action features derived under different time alignment assumptions. When all candidate time alignment results point to similar action features, the normalized operational motion features will cluster closely around the weighted mean, with low dispersion, indicating that the action judgment is less affected by time alignment errors and the result is relatively robust. Conversely, when different candidates cause significant divergence in action features, the feature points will be far from the weighted mean, with high dispersion, indicating that the action judgment heavily depends on the specific time alignment selection and has significant uncertainty, which should trigger a rejection or warning mechanism.

[0177] The calculation process for this weighted dispersion can be, for example, as follows: First, calculate the weighted mean vector of all normalized motion features. ,in Then, the sum of squared weighted Euclidean distances between each eigenvector and the weighted mean vector is calculated and used as a measure of the degree of dispersion. This process can be formalized as follows:

[0178]

[0179] in, This represents the total dimension of the motion features in the normalization operation. This refers to the calculated degree of time uncertainty. The index is calculated using the above formula. It is a non-negative value, and its magnitude is positively correlated with the degree of time uncertainty. Finally, the calculated degree of dispersion... The determination of the timing uncertainty in this action judgment provides a crucial quantitative basis for subsequent judgments on whether preset judgment conditions are met. For example, it can be used to... The time-alignment uncertainty is compared with a preset uncertainty threshold. If the time-alignment uncertainty exceeds the threshold, the time-alignment uncertainty is determined to be too high, and the drinking action recognition result is rejected, thus effectively avoiding erroneous recognition caused by time alignment error.

[0180] In some embodiments of this application, the aforementioned step S150 is described as an optional implementation method in which the drinking action recognition result is determined based on the relative operational motion components of the cup in each group only when the confidence level and the time uncertainty meet the preset judgment conditions.

[0181] Specifically, when the credibility and time uncertainty meet the preset judgment conditions, the weight of each group is determined according to the credibility of each group of candidate time alignment results.

[0182] This weight is used to quantify the contribution ratio of different candidate time alignment results in the final decision. As described in the previous embodiment, if the first... The credibility of the candidate group is Then its corresponding weight It can be represented as .

[0183] Based on this, the drinking action recognition result can be determined using any of the following methods:

[0184] Method 1:

[0185] S11. According to the weight of each group, the relative operation motion components of the cup body under each group are fused to obtain the fused relative operation motion components of the cup body.

[0186] Based on the weights determined above For each group, the relative motion component vector of the cup body is... A weighted summation is performed. Specifically, the relative operational motion components of the fused cup body are... Through formula The calculation yielded the results. This weighted fusion not only preserves the feature details of high-confidence candidates but also suppresses noise interference in low-confidence candidates, making the fused features more reflective of the actual drinking action.

[0187] S12. Compare the fused cup body relative operational motion components with the user's personal drinking action reference in the corresponding usage scenario to obtain the degree of deviation of the drinking action.

[0188] Personal drinking action references are drinking action baselines established by users under specific usage scenarios. These baselines are statistical models built during the user's initial use or calibration phase, based on multiple valid drinking data collections, and tailored to different usage scenarios (such as cup type, hand holding the cup, stationary or walking posture). These models include the central location and normal fluctuation range of the operational motion components. The fused features... Mapping this action onto the feature space of the reference model, the distance between it and the reference center is calculated. This distance reflects the degree of deviation of the action from personal habits. For example, the degree of deviation in the action of drinking water. It can be obtained by calculating the Mahalanobis distance or Euclidean distance between the fused features and the reference center vector. The larger the value, the more obvious the deviation of the action from personal habits, such as drinking too quickly, difficulty swallowing, or abnormal posture.

[0189] S13. Determine the drinking action recognition result based on the degree of deviation of the drinking action.

[0190] The drinking action recognition result is used to characterize whether the current drinking action is normal or has reached an abnormal level requiring a prompt. The calculated deviation degree of the drinking action is compared with a preset deviation threshold. If the deviation degree exceeds the preset threshold, the drinking action is determined to be abnormal, and a corresponding prompt signal is generated; if it does not exceed the threshold, it is determined to be a normal drinking action. In addition, to improve robustness, a continuous judgment mechanism can be introduced, for example, only outputting an abnormal prompt when the deviation degree of the drinking action exceeds the threshold in multiple consecutive time windows, in order to filter out instantaneous interference signals.

[0191] Method 2:

[0192] S21. Compare the relative operational motion components of the cup in each group with the user's personal drinking action reference in the corresponding usage scenario to obtain the degree of deviation of the drinking action for each group.

[0193] This step provides an alternative fusion path to Method 1, namely, evaluation at the decision layer before feature fusion. The cup-like relative operational motion components obtained from each set of candidate alignment results are then... Each individual's drinking action was compared with a reference drinking action in the corresponding context to calculate the degree of deviation from the reference drinking action. This comparative approach can intuitively demonstrate the differences in action evaluation under different alignment assumptions, making it easier to identify, before fusion, whether a candidate leads to a fundamental conflict in the conclusions, thus providing a basis for subsequent quality control.

[0194] S22. According to the weight of each group, the deviation degree of drinking action corresponding to each group is merged to obtain the merged deviation degree of drinking action.

[0195] The combined deviation from the drinking action is a comprehensive quantification of the independent evaluation results of each group. Based on the credibility of each candidate group, corresponding weights are assigned to the independent deviations obtained in step S21. Perform a weighted summation. A specific calculation formula could be, for example: Compared to directly fusing feature vectors, this method weights the data in the decision space, which avoids the distortion that may be caused by nonlinear fusion in the feature space. Furthermore, when the deviations of each group are significantly different, weighted fusion can smooth out the influence of extreme values, making the final judgment result more robust.

[0196] S23. Determine the drinking action recognition result based on the degree of deviation of the fused drinking action.

[0197] Through the two optional fusion methods described above, the embodiments of this application can flexibly address different data quality and application scenario requirements. Method one, by fusing at the feature level, can fully utilize the correlation between features and is suitable for situations requiring high time synchronization accuracy. Method two, by fusing at the decision level, can effectively shield the interference of a single anomalous feature on the overall judgment and is suitable for complex environments with high time synchronization uncertainty. Both methods use a weighted approach based on trustworthiness as their core mechanism, ensuring the decisive role of high-quality data sources in the final identification.

[0198] In some embodiments of this application, an alternative implementation is described for the aforementioned step S150, whereby the drinking action recognition result is determined based on the relative operational motion components of the cup in each group only when the confidence level and the time uncertainty meet preset judgment conditions. Specifically:

[0199] Only when the credibility and time uncertainty meet the preset judgment conditions, and a drinking confirmation signal is obtained, is the drinking action recognition result determined based on the relative operational motion components of the cup in each group.

[0200] The drinking confirmation signal includes at least one of the following: cup rim contact, spout contact, actual flow, and drinking status machine output.

[0201] This embodiment further introduces physical confirmation of drinking status as the final effective condition, constructing a comprehensive criterion combining kinematic rationality and behavioral authenticity. The drinking confirmation signal is not simply a result of motion pattern judgment, but rather physical evidence characterizing that the liquid beverage has actually entered the user's mouth or is being consumed. This mechanism aims to remove action segments such as washing, pouring, filling, or simply playing with the cup, which produce significant motion characteristics but do not involve actual drinking, from the final drinking action recognition process. Even if the motion data from both ends exhibits high consistency and low uncertainty, if a valid drinking confirmation signal is not obtained, the drinking action recognition result is rejected or the action is deemed invalid, thereby avoiding false alarms.

[0202] The specific forms of drinking confirmation signals include at least one of the following: rim contact, spout contact, actual outflow, and drinking status machine output. Rim contact signals can be detected by capacitive proximity sensors, pressure sensors, or infrared proximity switches located on the edge of the cup or the inside of the lid; the rim contact signal is triggered when the sensor detects the approach or touch of human skin (such as lips or cheeks) or a specific contact object. Spout contact signals are suitable for cups equipped with straws or spouts, and are identified by a pressure sensor array or photoelectric obstruction sensor at the spout, recognizing the user's lips enveloping and adhering to the spout. Actual outflow signals confirm that liquid has indeed left the cup; detection methods include weighing sensor detection based on changes in the weight of the liquid inside the cup, fluid flux detection based on a flow meter, or inference of the outflow state based on liquid sloshing characteristics and tilt angle detected by an accelerometer.

[0203] The drinking state machine output is a logical judgment result based on multi-source information fusion. The construction process is as follows: a state machine model is preset, whose state nodes include at least static, picked up, tilted, reflux, and put down; the model input includes the cup tip tilt angle, angular velocity magnitude, and the aforementioned contact and outflow signals; through preset state transition rules (e.g., transitioning from static to picked up, and subsequently the tilt angle is greater than a threshold, and an outflow signal exists, then entering the drinking state), the drinking state machine output signal is output when a specific condition sequence is met. The above four types of signals can be used individually or in combination. For example, a drinking confirmation signal is only confirmed when cup contact and actual outflow occur simultaneously, to improve anti-interference capabilities. When any one or more of the above signals are triggered, a drinking confirmation signal is determined, thereby unlocking the process of determining the drinking action recognition result based on the relative operational motion components of the cup in each group.

[0204] By introducing a drinking confirmation signal as a hard physical constraint, it is possible to effectively distinguish between simulated drinking actions and real drinking behaviors, solving the technical problem that relying solely on motion sensors cannot accurately identify interfering actions such as washing and pouring water, and ensuring the authenticity and reliability of drinking action recognition results at the physiological and behavioral levels.

[0205] In some embodiments of this application, the drinking action recognition result may include information such as normal drinking, abnormal drinking, and the degree of deviation of the drinking action. Based on this, the drinking action recognition method of this application may further include the following steps:

[0206] When the deviation of the drinking action continuously meets the prompt condition, an action prompt is output. The continuous meeting of the prompt condition includes the deviation of the drinking action of a preset number of valid windows exceeding the deviation threshold.

[0207] The deviation degree of drinking action characterizes the quantitative difference between the relative operational movement of the cup during the current effective drinking process and the user's personal drinking action reference in a specific usage context (e.g., drinking cup + right hand + stillness). To filter out transient anomalies caused by random noise or brief postural disturbances, the prompt condition is set as a continuous constraint rather than a single trigger. When the deviation degree of drinking action exceeds the deviation threshold within a consecutive preset number of valid windows, it is determined that the continuous prompt condition is met and an action prompt is triggered. For example, setting the preset number to 3 means that the prompt operation is only executed when the deviation score of 3 consecutive valid windows is greater than the threshold. The deviation threshold can be determined based on the normal variation range of personal reference data in the corresponding usage context, for example, selecting the 95th percentile value of historical data as the initial candidate threshold to adapt to individual differences.

[0208] An effective window is an analysis window that simultaneously meets the following conditions: the drinking confirmation signal is valid, the reliability and timing uncertainty meet the preset judgment conditions, and the data quality of the cup end motion data and the reference end motion data is qualified.

[0209] First, a valid drinking confirmation signal serves as the physical layer, ensuring that a substantial drinking action (such as contact with the cup rim or actual flow) has indeed occurred at the current window, thus ruling out simple hand handling or washing actions. Second, the reliability and time synchronization uncertainty meet preset judgment conditions, serving as logical layer constraints to ensure that the data involved in the calculation is based on reliable time alignment, thereby eliminating spurious differences caused by time synchronization errors. Finally, the quality of both the cup-end motion data and the reference-end motion data is qualified, serving as a signal layer constraint to eliminate invalid data segments due to sensor saturation, severe packet loss, or signal anomalies. Through these three layers of filtering, it is ensured that every sample included in the continuous statistically valid data truly reflects the user's actual drinking action under reliable time synchronization conditions.

[0210] The continuous counting is interrupted when a non-drinking window cannot be identified, and non-drinking windows are not accumulated as abnormal or normal.

[0211] To prevent invalid states from contaminating historical statistics and leading to false or missed alerts, an interruption mechanism is introduced to handle invalid windows. When an undeterminable window is detected (e.g., unreliable time synchronization, conflicting candidate results, or insufficient personal reference) or a non-drinking window (e.g., washing, pouring water, or carrying status), the current continuous counting process is immediately interrupted, and the counter is reset to zero. Subsequent continuous counting must be re-accumulated. During this process, these interrupted windows are neither accumulated as anomalies (i.e., not used as a basis for deviating from the threshold count) nor as normal (i.e., not used as a basis for reducing sensitivity). Only continuous, high-quality sequences of valid drinking events can trigger alerts. Any invalid interludes will break this chain, thus preventing intermittent false alarms from accumulating into persistent anomalies, or intermittent normalities from masking single anomalies.

[0212] This application also provides an electronic device in its embodiments. (See reference...) Figure 4 The diagram illustrates a structural schematic suitable for implementing the electronic device in the embodiments of this application. The electronic device in the embodiments of this application may include, but is not limited to, fixed terminals such as smart water bottles, terminal devices associated with the user of the water bottle (e.g., smartwatches, smart bracelets, mobile phones, school badges), and other third-party electronic devices. Figure 4 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0213] like Figure 4 As shown, the electronic device may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 1, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 2 or a program loaded from a storage device 8 into a random access memory (RAM) 3, to implement the drinking action recognition method of the foregoing embodiments of this application. When the electronic device is powered on, the RAM 3 also stores various programs and data required for the operation of the electronic device. The processing unit 1, ROM 2, and RAM 3 are interconnected via a bus 4. An input / output (I / O) interface 5 is also connected to the bus 4.

[0214] Typically, the following devices can be connected to I / O interface 5: input devices 6 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 7 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 8 including, for example, memory cards, hard drives, etc.; and communication devices 9. Communication device 9 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 4 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown. More or fewer devices may be implemented or have instead.

[0215] This application also provides a computer program product, including computer-readable instructions, which, when executed on an electronic device, cause the electronic device to implement any of the drinking action recognition methods provided in this application.

[0216] This application also provides a computer-readable storage medium that carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any of the drinking action recognition methods provided in this application.

[0217] It should also be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. In addition, in the device embodiment drawings provided in this application, the connection relationship between modules indicates that they have a communication connection, which can be implemented as one or more communication buses or signal lines.

[0218] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware, or it can be implemented by special-purpose hardware including application-specific integrated circuits, special-purpose CPUs, special-purpose memory, special-purpose components, etc. Generally, any function performed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be diverse, such as analog circuits, digital circuits, or special-purpose circuits. However, for this application, software program implementation is more often the preferred implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a computer floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk, or optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, training equipment, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0219] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product.

[0220] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, training device, or data center to another website, computer, training device, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives (SSDs)).

[0221] The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can be referred to each other.

Claims

1. A method for recognizing drinking actions, characterized in that, include: Acquire cup-end motion data and reference end motion data, wherein the cup-end motion data and the reference end motion data each have their own timestamp, and the reference end is a terminal device associated with the user of the water cup; Detect common motion events from the cup end motion data and the reference end motion data, and determine one or more sets of candidate time alignment results and the confidence level of each set of candidate time alignment results based on the common motion events; According to the candidate time alignment results of each group, the cup end motion data and the reference end motion data are time aligned to obtain the aligned double-end motion data of each group. Motion decoupling is performed on the aligned double-end motion data of each group to obtain the common motion component of the double ends and the relative operation motion component of the cup body under the corresponding group; Based on the differences between the relative operational motion components of the cup body in each group, the degree of time-related uncertainty in the current action judgment is determined; Only when the degree of confidence and the degree of time uncertainty meet the preset judgment conditions, the drinking action recognition result is determined based on the relative operational motion components of the cup in each group.

2. The method according to claim 1, characterized in that, The process of detecting common motion events from the cup end motion data and the reference end motion data includes: Candidate motion events are detected from the cup end motion data and the reference end motion data, respectively; Based on at least one of the waveform similarity, duration and occurrence order between the candidate motion events detected at both ends, candidate event pairings are established, and each candidate event pairing is regarded as a candidate common motion event. The waveform is a time-series signal of the running data within the time window corresponding to the candidate motion event, including at least one of the following: angular velocity magnitude sequence, acceleration magnitude sequence, and waveform envelope.

3. The method according to claim 2, characterized in that, The cup end motion data and the reference end motion data each include triaxial acceleration and triaxial angular velocity detected by the motion sensor; The process of detecting candidate motion events includes: Calculate the angular velocity modulus based on the triaxial angular velocities, calculate the acceleration modulus based on the triaxial accelerations, and / or extract the waveform envelope; When the angular velocity modulus, the acceleration modulus, or the waveform envelope exceeds the noise threshold and continues for a preset time, record the candidate motion event and its start and end times, as well as at least one of the peak time, duration, and normalized waveform.

4. The method according to claim 2, characterized in that, The process of determining one or more sets of candidate time alignment results and the confidence level of each set of candidate time alignment results based on the aforementioned common action events includes: Based on the estimated time offset and / or clock rate ratio at both ends of each candidate event pair, one or more sets of candidate time alignment results are obtained. The credibility of each candidate time alignment result is determined based on at least one of the waveform similarity, time fitting residual, and number of candidate event pairs.

5. The method according to claim 2, characterized in that, The process of establishing candidate event pairings includes: For each candidate motion event at the cup end, search for candidate motion events at the reference end within the allowed time offset range; Interpolate the waveforms of the two candidate motion events to the same length and normalize their amplitudes to calculate the shape similarity. Candidate event pairing is established when the shape similarity meets the preset similarity condition, and at least one of the following conditions is met: the event order is consistent, the events are not reused, and the difference in duration between the two candidate motion events is less than the preset duration threshold.

6. The method according to claim 1, characterized in that, The process of performing time alignment processing on the cup-end motion data and the reference-end motion data according to the candidate time alignment results of each group, to obtain the aligned bilateral motion data of each group, includes: According to the time mapping relationship defined by the candidate time alignment results of each group, the cup end motion data and the reference end motion data are mapped to the same time axis; Interpolate and / or resample the mapped two-end motion data to obtain the aligned two-end motion data corresponding to each group of candidate time alignment results.

7. The method according to claim 1, characterized in that, The process of decoupling the motion data of each aligned pair of ends to obtain the common motion components of the pairs of ends and the relative operational motion components of the cup body under the corresponding group includes: Each set of aligned dual-end motion data is input into the same motion decoupling model, which encodes the cup-end motion data and the reference-end motion data respectively to obtain the cup-end temporal features and the reference-end temporal features. The common motion components of both ends are extracted based on the temporal characteristics of the cup end and the temporal characteristics of the reference end; The components that can be explained by the common motion of both ends are removed from the timing features of the cup ends to obtain the relative operational motion components of the cup body.

8. The method according to claim 7, characterized in that, The motion decoupling model is a two-branch temporal neural network, which includes a cup-end encoder, a reference-end encoder, a common motion layer, and an operational motion layer. The cup-end encoder is used to generate cup-end timing features based on cup-end motion data, and the reference-end encoder is used to generate reference-end timing features based on reference-end motion data. The common motion layer is used to generate dual-end common motion components based on the timing characteristics of the cup end and the timing characteristics of the reference end; The operational motion layer is used to generate a relative operational motion component of the cup body based on the components in the cup end temporal characteristics that cannot be explained by the common motion component of both ends.

9. The method according to claim 8, characterized in that, The motion decoupling model also includes a cup-end reconstruction layer and a reference-end reconstruction layer during the training phase; The cup-end reconstruction layer is used to reconstruct the feature representation of the cup-end motion data based on the common motion components of the two ends and the relative operational motion components of the cup body, thereby obtaining cup-end reconstruction features. The reference end reconstruction layer is used to reconstruct the feature representation of the reference end motion data based on the common motion components of the two ends, and obtain the reference end reconstruction features. The motion decoupling model is obtained through joint training, and the loss function of joint training includes at least two of the following: The cup-end reconstruction loss is the mean square error between the cup-end reconstruction features and the cup-end reconstruction target features, where the cup-end reconstruction target features are the feature representations of the cup-end motion data. The reference end reconstruction loss is the mean square error between the reference end reconstruction features and the reference end reconstruction target features, where the reference end reconstruction target features are the feature representations of the reference end motion data. Motion decoupling loss is used to reduce the redundant expression between the common motion component at both ends and the relative operational motion component of the cup body; Motion contrast loss is used to bring the relative motion components of the cup corresponding to the same drinking action closer to each other, and to make the relative motion components of the cup corresponding to different drinking actions farther apart. Context classification loss is used to reduce the ability to predict the usage context based on the relative operational motion components of the cup.

10. The method according to claim 7, characterized in that, The motion decoupling model is trained using data collected by the same user under different cup types, different cup-holding hands, different liquid volumes, different reference end installation orientations, and different activity states. The training data includes at least one drinking action segment from stable drinking, tilting, continuous deflection and shaking, and at least one non-drinking segment from washing, pouring water and playing. In the training data, samples from the same user, with the same action pattern but different usage scenarios form positive sample pairs, and samples from different action patterns form negative sample pairs.

11. The method according to claim 1, characterized in that, The process of determining the degree of time-related uncertainty in the current action judgment based on the differences between the relative operational motion components of the cup body in each group includes: The relative operational motion components of the cup body under each group are normalized according to a unified scale to obtain the normalized operational motion characteristics corresponding to each group. The weights for each group are determined based on the degree of credibility described for each group. Determine the degree of dispersion of the normalized operational motion characteristics of each group around the weighted mean, and determine the degree of time uncertainty based on the degree of dispersion.

12. The method according to claim 1, characterized in that, The process of determining the drinking action recognition result based on the relative operational motion components of the cup in each group, only when the confidence level and the time uncertainty meet preset judgment conditions, includes: When the credibility level and the time alignment uncertainty meet the preset judgment conditions, the weight of each group is determined according to the credibility level corresponding to each group of candidate time alignment results; The drinking action recognition result can be determined using any of the following methods: Method 1: According to the weights of each group, the relative operation motion components of the cup body under each group are fused to obtain the fused relative operation motion components of the cup body; the fused relative operation motion components of the cup body are compared with the user's personal drinking action reference in the corresponding usage scenario to obtain the degree of deviation of the drinking action; the drinking action recognition result is determined based on the degree of deviation of the drinking action. Method 2: Compare the relative motion components of the cup in each group with the user's personal drinking action reference in the corresponding usage scenario to obtain the degree of deviation of the drinking action for each group; according to the weight of each group, fuse the degree of deviation of the drinking action for each group to obtain the fused degree of deviation of the drinking action; determine the drinking action recognition result based on the fused degree of deviation of the drinking action.

13. The method according to claim 1, characterized in that, Also includes: When the degree of confidence and / or the degree of time uncertainty do not meet the preset judgment conditions, an "unable to judge" message is output.

14. The method according to claim 1, characterized in that, The process of determining the drinking action recognition result based on the relative operational motion components of the cup in each group, only when the confidence level and the time uncertainty meet preset judgment conditions, includes: Only when the degree of confidence and the degree of time uncertainty meet the preset judgment conditions, and a drinking confirmation signal is obtained, is the drinking action recognition result determined according to the relative operational motion component of the cup in each group. The drinking confirmation signal includes at least one of the following: cup rim contact, spout contact, actual flow, and drinking status machine output.

15. The method according to claim 14, characterized in that, The drinking action recognition result includes the degree of deviation of the drinking action, and the method further includes: When the deviation of the drinking action continuously meets the prompting condition, an action prompt is output; The continuous fulfillment of the prompt conditions includes the deviation of the drinking action in a preset number of consecutive valid windows exceeding a deviation threshold. The effective window is an analysis window that simultaneously meets the following conditions: the drinking confirmation signal is valid, the confidence level and the time uncertainty meet the preset judgment conditions, and the data quality of the cup end motion data and the reference end motion data is qualified; The continuous counting is interrupted when a non-drinking window cannot be identified, and the non-drinking window is not accumulated as abnormal or normal.

16. An electronic device, characterized in that, include: Memory and processor; The memory is used to store programs; The processor is used to execute the program to implement each step of the drinking action recognition method as described in any one of claims 1 to 15.