A method and system for dynamically adapting intelligent services for an elderly-oriented scene

By constructing a lifestyle profile and service adaptation model, and matching user behavior data in real time, the system achieves accurate prediction and dynamic adaptation of smart home services, solving the problem of delayed service response in age-friendly scenarios and improving user experience.

CN122490122APending Publication Date: 2026-07-31TIANJIN XINGHE TECHNOLOGY DEVELOPMENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
TIANJIN XINGHE TECHNOLOGY DEVELOPMENT CO LTD
Filing Date
2026-05-06
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Existing smart home service solutions struggle to accurately predict and dynamically adapt to age-friendly scenarios, resulting in delayed service responses and an inability to accommodate individual behavioral differences, thus impacting user experience.

Method used

By acquiring a profile of the target user's lifestyle habits, a service adaptation model is constructed, consisting of contextual triggering conditions, behavioral sequence templates, and dynamic service mapping. User behavior data is collected in real time for dynamic matching, and service instructions are generated and issued. The model is then combined with a residential space topology model to switch between pre-adaptation and formal services.

Benefits of technology

It enables proactive service triggering in the early stages of user behavior, improving the accuracy and timeliness of intelligent services, adapting to individual differences, and reducing service response lag time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122490122A_ABST
    Figure CN122490122A_ABST
Patent Text Reader

Abstract

This application provides a method and system for dynamic adaptation of intelligent services for elderly-friendly scenarios. The method includes the following steps: obtaining a profile of the target user's lifestyle habits; constructing a corresponding service adaptation model for each lifestyle habit in the profile; collecting the target user's current behavior data, current environmental parameters, and current vital signs in real time to form a current behavior sequence; dynamically matching the current behavior sequence with each of the aforementioned service adaptation models; when the matching degree of any service adaptation model exceeds a first preset threshold, determining that the habit corresponding to that service adaptation model is currently in an instantiation execution state, and identifying the target service adaptation model that has been successfully matched; generating service instructions based on the dynamic service mapping in the target service adaptation model, and sending them to the corresponding service execution terminal to drive the service execution terminal to provide the target user with a dynamically adapted service that is adapted to the current instantiation execution state.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of age-friendly home technology, specifically relating to a method and system for dynamic adaptation of intelligent services for age-friendly scenarios. Background Technology

[0002] As the population ages, smart home service technologies for the elderly have received widespread attention. Existing smart home service solutions typically provide services through preset rules or scene modes, such as setting scheduled tasks, sensor triggering conditions, or controlling devices via voice commands. These solutions require users to actively set or initiate services, lacking the ability to automatically perceive and predict user behavior intentions.

[0003] Another common approach is to identify the user's current activity (such as walking, resting, or eating) based on sensor data and then execute the corresponding device control upon successful identification. However, this approach has the following technical problems: First, its service triggering relies on a precise match between the user's current behavior and preset activities, often triggering the service only when the user's action has been completed or is about to be completed, resulting in a delayed service response and an inability to provide assistance when the user needs it most. Second, due to differences in lifestyle and physical function, the behavioral patterns of different elderly people are highly personalized, and a uniform identification rule is difficult to adapt to individual differences, easily leading to missed or incorrect identifications, which affects the user experience.

[0004] Therefore, how to achieve accurate prediction and dynamic adaptation of intelligent services in age-friendly scenarios, avoid service lag, and take into account the differences in individual behavioral patterns is a technical problem that urgently needs to be solved in this field. Summary of the Invention

[0005] In view of the above-mentioned defects or deficiencies in the existing technology, a method and system for dynamic adaptation of intelligent services for age-friendly scenarios is provided.

[0006] Firstly, this application proposes a method for dynamic adaptation of intelligent services for age-friendly scenarios, including the following steps: Obtain a profile of the target user's lifestyle habits. The profile is generated based on historical data through a classification model and is used to characterize the target user's long-term behavioral patterns in different dimensions of life. For each lifestyle habit in the aforementioned lifestyle profile, a corresponding service adaptation model is constructed; the service adaptation model includes: The context trigger condition set includes environmental parameter conditions, time conditions, and user physical condition conditions that must be met when the habit is instantiated and executed in a specific context. A behavior sequence template, which contains a description of the temporal behavioral characteristics of the habit during execution; Dynamic service mapping includes a set of service instructions that need to be dynamically adapted and issued when the habit is identified as being instantiated. The system collects the target user's current behavior data, current environmental parameters, and current vital signs in real time to form a current behavior sequence. The current behavior sequence is dynamically matched with each of the service adaptation models, and the matching degree between the current behavior sequence and each service adaptation model is calculated. When the matching degree of any service adaptation model exceeds the first preset threshold, it is determined that the habit corresponding to the service adaptation model is currently in the instantiation execution state, and the target service adaptation model that has been successfully matched is determined. Based on the dynamic service mapping in the target service adaptation model, a service instruction is generated and sent to the corresponding service execution terminal to drive the service execution terminal to provide the target user with a dynamically adapted service that is adapted to the current instantiation execution state.

[0007] According to the technical solution provided in this application, after determining that the habit corresponding to the service adaptation model is currently in an instantiation execution state, the method further includes the following steps: Retrieve the residential space topology model, which includes the physical location relationships of each functional area within the residence; Based on the residential space topology model, identify the associated functional areas adjacent to the current functional area; Obtain the behavior sequence template of the current habit and the behavior sequence template of the candidate habit, wherein the candidate habit is a habit in historical data whose execution probability exceeds a second preset threshold after the current habit ends; If the functional area corresponding to the candidate habit is consistent with the associated functional area, then the pre-adaptation service is executed in the associated functional area, so that the service execution terminal of the associated functional area enters a low-power pre-start state. When a target user is detected moving from the current functional area to the associated functional area, the pre-adapted service is upgraded to a formal service, the service execution terminal of the associated functional area is switched to normal operation, and the dynamic service mapping corresponding to the candidate habit is executed.

[0008] According to the technical solution provided in this application, after performing the pre-adaptation service in the associated functional area, the method further includes the following steps: During the execution of the pre-adaptation service, the movement direction data of the target user is continuously collected; The movement direction data is divided according to a preset time window to obtain a continuous sequence of direction time segments; The directional time segment sequence is dynamically matched with a preset transfer behavior template to calculate the directional matching degree; the transfer behavior template includes standard directional change features when moving from the current functional area to the associated functional area. When the matching degree of P consecutive time segments in each direction is lower than the third preset threshold, it is determined that the target user's transfer intention is interrupted, and a pre-adaptation cancellation instruction is generated; the pre-adaptation cancellation instruction is used to control the service execution terminal of the associated functional area to exit the low-power pre-start state and return to the standby state; In the pre-adaptation cancellation state, the movement direction data continues to be collected. When the matching degree of Q consecutive directional time segments is detected to rise above the fourth preset threshold, it is determined that the transfer intention is restored and the pre-adaptation service is re-executed.

[0009] According to the technical solution provided in this application, before upgrading the pre-adapted service to the formal service, the following steps are also included: When a target user is detected moving from the current functional area to the associated functional area, the target user's movement speed data is collected synchronously. Based on the spatial distance between the current functional area and the associated functional area, and the movement speed data, the estimated arrival time is calculated; The estimated arrival time is compared with the warm-up time of the service execution terminal in the associated functional area; If the estimated arrival time is greater than the warm-up time, then at the moment when the estimated arrival time minus the warm-up time, the pre-adaptation service is upgraded to the formal service. If the estimated arrival time is less than or equal to the warm-up time, the pre-adaptation service will be immediately upgraded to the official service.

[0010] According to the technical solution provided in this application, after performing the pre-adaptation service in the associated functional area, the method further includes the following steps: Collect images of the passageway between the associated functional area and the current functional area to identify whether there are moving obstacles; If a moving obstacle is detected, an obstacle prompt command is generated and the obstacle's location information is broadcast via a voice device; at the same time, the execution intensity of the pre-adaptation service is reduced to a preset low-intensity mode. Once the camera detects that the obstacle has been removed, the standard execution strength of the pre-adaptation service is restored.

[0011] According to the technical solution provided in this application, before constructing a corresponding service adaptation model for each lifestyle habit in the lifestyle habit profile, the following steps are also included: After each habit is determined to be in the instantiation execution state, the timing data of key action points of the target user during the execution of the habit are collected, and the action execution speed characteristics and action continuity characteristics are extracted; the heart rate fluctuation amplitude characteristics and gait stability characteristics during the process are collected simultaneously. Based on the characteristics of the movement execution speed, movement continuity, heart rate fluctuation amplitude, and gait stability, the current physical function decline index is obtained. The physical function decline index is compared with the historical decline index sequence to calculate the decline rate; if the decline rate exceeds the first dynamic threshold, the target user is determined to be in a period of rapid change in physical function. The lifestyle profile described during periods of rapid change in bodily functions is revised.

[0012] According to the technical solution provided in this application, the method of revising the lifestyle profile during a period of rapid change in bodily functions includes the following steps: Acquire the timing data of key action points from the last N habit execution records before the start of the rapid change period in bodily functions, and use them as the baseline template set; simultaneously acquire the most recent M habit execution records within the rapid change period, and use them as the current sample set; Each habit execution in the current sample set is dynamically time-aligned with the corresponding habit template in the benchmark template set, and the time axis stretching coefficient sequence and key point trajectory offset sequence of each habit are calculated at different execution stages. Based on the time axis stretching coefficient sequence and the key point trajectory offset sequence, a multidimensional degradation feature vector is generated. The multidimensional degradation feature vector includes: time axis deformation feature, spatial trajectory offset feature and motion loss rate feature. The multidimensional degradation feature vector is input into a preset compensation factor generation model, which outputs differentiated compensation factors for different lifestyles. The differentiated compensation factors include: time window amplification coefficient, key point matching tolerance amplification coefficient, and trigger threshold reduction coefficient.

[0013] According to the technical solution provided in this application, after outputting the differentiated compensation factor for different lifestyles, the method further includes the following steps: According to the aforementioned differential compensation factor, the behavioral sequence templates corresponding to each lifestyle habit are subjected to nonlinear time axis deformation to generate degenerate adaptation templates; at the same time, the original templates are retained. According to the trigger threshold reduction coefficient, the user vital sign condition threshold in the context trigger condition set corresponding to each lifestyle habit is reduced to form a degenerate adaptation trigger condition; at the same time, the original trigger condition is retained. A template selector is constructed, which takes the current physical function decline index and the real-time matching degree between the current behavior sequence and each template as input, and dynamically selects between the original template and the degenerate adaptation template. When the habitual execution is successfully matched with the degenerate adaptation template in K consecutive executions and the matching degree is consistently higher than the preset threshold, the degenerate adaptation template is upgraded to the main template and the original template is downgraded to the backup template.

[0014] According to the technical solution provided in this application, the compensation factor generation model is constructed and used through the following steps: Constructing a training dataset: Collecting habit execution data from multiple users under different physical functional states in historical records. The habit execution data includes multidimensional degradation feature vectors of each habit and corresponding annotation compensation factors. The annotation compensation factors are obtained through manual annotation or by reverse optimization through subsequent matching success rates. Using the multidimensional degenerate feature vector as input and the labeled compensation factor as output, a regression model or a neural network model is trained to obtain the compensation factor generation model. During the usage phase, the target user's current multidimensional degradation feature vector is input into the compensation factor generation model, which outputs differentiated compensation factors for different lifestyles. The time window amplification coefficient in the differential compensation factor is used to nonlinearly stretch the time window of each stage in the behavioral sequence template. The stretching ratio is positively correlated with the stretching coefficient of each stage in the time axis deformation feature. The keypoint matching tolerance amplification coefficient is used to expand the spatial matching range of each keypoint in the behavioral sequence template. The amplification magnitude is positively correlated with the offset of each keypoint in the spatial trajectory offset feature. The trigger threshold reduction coefficient is used to reduce the thresholds of each user's vital signs in the context trigger condition set. The reduction magnitude is positively correlated with the action loss rate feature and the decay rate.

[0015] Secondly, this application proposes an intelligent service dynamic adaptation system for age-friendly scenarios, used to implement the method described above, including: A construction module is configured to obtain a profile of the target user's lifestyle habits. The profile of the lifestyle habits is generated based on historical data through a classification model and is used to characterize the long-term behavioral patterns of the target user in different dimensions of life. The construction module is also configured to build a corresponding service adaptation model for each lifestyle habit in the lifestyle habit profile; the service adaptation model includes: The context trigger condition set includes environmental parameter conditions, time conditions, and user physical condition conditions that must be met when the habit is instantiated and executed in a specific context. A behavior sequence template, which contains a description of the temporal behavioral characteristics of the habit during execution; Dynamic service mapping includes a set of service instructions that need to be dynamically adapted and issued when the habit is identified as being instantiated. The acquisition module is configured to collect the target user's current behavior data, current environmental parameters, and current vital signs in real time to form a current behavior sequence; The matching module is configured to dynamically match the current behavior sequence with each of the service adaptation models, calculate the matching degree between the current behavior sequence and each service adaptation model; when the matching degree of any service adaptation model exceeds a first preset threshold, it is determined that the habit corresponding to the service adaptation model is currently in the instantiation execution state, and the target service adaptation model that has been successfully matched is identified. The instruction module is configured to generate service instructions based on the dynamic service mapping in the target service adaptation model, and send the service instructions to the corresponding service execution terminal to drive the service execution terminal to provide the target user with a dynamically adapted service that is adapted to the current instantiation execution state.

[0016] Compared with the prior art, the beneficial effects of this application are as follows: First, by constructing a profile of the target user's lifestyle habits, we model the user's long-term behavioral patterns in different lifestyle dimensions and build a corresponding service adaptation model for each lifestyle habit dimension. This model includes a set of contextual trigger conditions, behavioral sequence templates, and dynamic service mapping, thereby deeply binding the user's personalized lifestyle habits with the service response mechanism and solving the problem that unified rules are difficult to adapt to individual differences.

[0017] Second, by collecting users' current behavioral data, environmental parameters, and vital signs in real time, a current behavioral sequence is formed and dynamically matched with various service adaptation models. When the matching degree exceeds a preset threshold, the habit is determined to be in an instantiated execution state, and corresponding service instructions are then issued. This mechanism can identify users' intentions in the early stages of habitual behavior execution, enabling proactive service triggering and effectively solving the problem of delayed service response in existing solutions. This allows users to receive timely service assistance during the behavior execution process.

[0018] Third, by combining lifestyle profiles with service adaptation models, a profile is generated based on historical data using a classification model, and service instructions are delivered in real time through dynamic matching. This ensures the alignment between services and users' long-term behavioral patterns, while also enabling rapid response to current behavioral intentions. This forms a complete technical closed loop of long-term profile guidance, real-time sequence matching, and dynamic instruction delivery, significantly improving the accuracy and timeliness of intelligent services in age-friendly scenarios. Attached Figure Description

[0019] Other features, objects, and advantages of this application will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings: Figure 1 A flowchart illustrating the steps of the intelligent service dynamic adaptation method for age-friendly scenarios provided in this application. Detailed Implementation

[0020] The present application will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings.

[0021] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0022] Example 1 As mentioned in the background section, this application proposes a method for dynamic adaptation of intelligent services for age-friendly scenarios, such as... Figure 1 As shown, it includes the following steps: S1. Obtain a profile of the target user's lifestyle habits. The profile is generated based on historical data through a classification model and is used to characterize the target user's long-term behavioral patterns in different lifestyle dimensions. S2. For each lifestyle habit in the aforementioned lifestyle profile, construct a corresponding service adaptation model; the service adaptation model includes: The context trigger condition set includes environmental parameter conditions, time conditions, and user physical condition conditions that must be met when the habit is instantiated and executed in a specific context. A behavior sequence template, which contains a description of the temporal behavioral characteristics of the habit during execution; Dynamic service mapping includes a set of service instructions that need to be dynamically adapted and issued when the habit is identified as being instantiated. S3. Real-time collection of the target user's current behavior data, current environmental parameters, and current vital signs parameters to form a current behavior sequence; S4. Dynamically match the current behavior sequence with each of the service adaptation models, and calculate the matching degree between the current behavior sequence and each service adaptation model; when the matching degree of any service adaptation model exceeds the first preset threshold, determine that the habit corresponding to the service adaptation model is currently in the instantiation execution state, and determine the target service adaptation model that has been successfully matched. S5. Based on the dynamic service mapping in the target service adaptation model, generate service instructions and send the service instructions to the corresponding service execution terminal to drive the service execution terminal to provide the target user with a dynamically adapted service that is adapted to the current instantiation execution state.

[0023] Specifically, this embodiment provides a method for dynamically adapting smart services to age-friendly scenarios, applicable to the home living environment of elderly people living alone. The system hardware includes at least one camera deployed within the residence, installed in a location that covers the main activity areas, such as a corner of the ceiling at the intersection of the living room and hallway. The camera's image acquisition resolution is 1920×1080 pixels, with a frame rate of 15 to 30 frames per second. The system also includes a smart bracelet worn by the elderly person, which incorporates an accelerometer, heart rate sensor, and gyroscope, communicating with a home gateway via Bluetooth 4.0 or higher. The home gateway is a smart router with edge computing capabilities, used to run the computational logic of the method described in this invention, and communicating with various service execution terminals via WiFi. Service execution terminals include devices such as smart light bulbs, smart air conditioners, smart curtain motors, and smart speakers, all supporting WiFi or Zigbee communication protocols. Detailed implementation method: Step 1: Obtain a profile of the target user's lifestyle habits: The system first constructs a lifestyle profile of the target user. This profile is generated based on historical data using a classification model and is used to characterize the target user's long-term behavioral patterns across different dimensions of their lives.

[0025] Specifically, the system continuously collects historical data for 30 days after initial deployment. The camera continuously captures images at a rate of 15 frames per second, and each frame is input into the human pose estimation model. This embodiment uses the OpenPose pose estimation model, which outputs the two-dimensional coordinates of 25 key points on the human body, including the pixel coordinates of key points such as the head, shoulders, elbows, wrists, hips, knees, and ankles. The system extracts the key point coordinates every 5 frames to form time-series data.

[0026] The smart bracelet collects heart rate data once per second and triaxial acceleration data 50 times per second. The system processes the acceleration data into a sliding window with a window length of 2 seconds and a step size of 1 second, and calculates the average acceleration amplitude within each window as an indicator of the user's activity intensity.

[0027] The collected 30 days of historical data were input into the classification model. The classification model in this embodiment uses a time-series clustering algorithm based on DBSCAN density clustering. The specific processing flow is as follows: Each day is divided into 96 time periods, each lasting 15 minutes; for each time period, features are extracted from three dimensions: the user's location coordinates within the residence, posture type, and activity intensity; features from the same time period across all days are clustered to obtain the typical behavioral pattern for that time period; time periods with similar behavioral patterns in adjacent time periods are merged to form habit units. For example, the system might identify that between 7:00 and 8:00 AM each day, the user's location moves from the bedroom bed area to the living room sofa area, their posture changes from lying down to sitting, and their activity intensity changes from moderate to low; the system classifies this pattern as a morning habit. The system generates a unique identifier for each habit, recording its occurrence time window, involved functional areas, typical execution duration, and other information to form a lifestyle habit profile.

[0028] Step 2: For each lifestyle habit in the lifestyle habit profile, build a corresponding service adaptation model: The system iterates through each lifestyle habit profile and builds a service adaptation model for it. Each service adaptation model is a JSON data object containing three core components.

[0029] The first component is the contextual trigger condition set, which contains parameterized descriptions of three types of conditions. Environmental parameter conditions are stored in key-value pairs. For example, the light condition is represented as `ambient_light_max: 50`, in lux, meaning that the condition is met when the ambient light intensity is below 50 lux; the temperature condition is represented as `temperature_min: 18`, `temperature_max: 26`, in degrees Celsius. Time conditions are stored in the form of time windows, such as `start_time: 06:30`, `end_time: 09:30`, indicating that the effective matching time window for this habit is from 6:30 AM to 9:30 AM daily. User vital sign conditions are stored in the form of thresholds, such as `heart_rate_max: 100`, in beats per minute; `gait_stability_min: 0.7`, ranging from 0 to 1, calculated from the autocorrelation analysis of wearable device acceleration data.

[0030] The second component is the behavior sequence template, which describes the temporal behavioral characteristics of the habit during execution. The generation process of the behavior sequence template is as follows: extract the temporal data of all successfully executed records of the habit from historical data. Each record includes a timestamp, user location coordinates, and posture keypoint coordinates; align the timelines of all records using a dynamic time warping algorithm; calculate the mean location and mean posture keypoint values ​​at each aligned time point to form a standard trajectory; divide the standard trajectory according to action stages, with each stage described by start and end times, positional change, and keypoint change. Taking the morning habit as an example, its behavior sequence template includes four stages: Stage 1 is the sitting-up action, lasting 2 seconds, characterized by a 0.3-meter vertical rise in the hip keypoint; Stage 2 is the standing action, lasting 3 seconds, characterized by knee extension; Stage 3 is walking towards the bedroom door, lasting 8 seconds, characterized by the user's location coordinates moving towards the door at a speed of 0.3 meters per second; Stage 4 is entering the living room, lasting 5 seconds, characterized by the user's location coordinates entering the boundary of the living room area.

[0031] The third component is dynamic service mapping, which contains the set of service instructions to be issued when a habit is identified as being instantiated. Dynamic service mapping is generated based on user presets or historical preference learning. For example, the dynamic service mapping for a morning habit can be represented as: {device: bedroom_light, action: fade_in, duration:10, target_brightness: 80}, meaning to control the bedroom light bulb to gradually brighten to 80% brightness over 10 seconds; {device: livingroom_ac, action: turn_on, temperature: 24, mode: cooling}, meaning to control the living room air conditioner to turn on and set the cooling mode to 24 degrees Celsius; {device: smart_speaker, action:play_playlist, playlist_id: morning_music, volume: 30}, meaning to control the smart speaker to play the morning music playlist at 30% volume.

[0032] Step 3: Collect the target user's current behavior data, current environmental parameters, and current vital signs in real time to form a current behavior sequence: During operation, the system continuously collects data at a fixed frequency. The camera captures images at a rate of 15 frames per second. Each frame is used by a human pose estimation model to extract the coordinates of 25 key points, forming the current behavior data. Every 0.5 seconds, the system performs median filtering on the key point data from the most recent 7 frames to remove single-frame jitter noise, resulting in smooth time-series data points. Each data point includes fields such as timestamp, user location coordinates, coordinates of each key point, movement direction angle, and movement speed.

[0033] Environmental parameters are estimated through camera image analysis. Specifically, the average brightness is extracted from the camera image as an estimate of the ambient light intensity; window areas in the image are detected, and the brightness changes in the window areas and whether the user is near the window are analyzed as reference indicators for natural ventilation.

[0034] Vital parameters are collected in real time via the smart bracelet, including heart rate, triaxial acceleration, steps, and heart rate variability. Heart rate variability is calculated using the standard deviation of consecutive heartbeat intervals to reflect the user's autonomic nervous system state.

[0035] The above data is organized in chronological order to form the current behavior sequence, which is stored in a circular buffer in the system memory. The buffer capacity is 300 data points, corresponding to approximately 150 seconds of historical data.

[0036] Step 4: Dynamically match the current behavior sequence with each service adaptation model, and calculate the matching degree between the current behavior sequence and each service adaptation model: The system calculates the matching degree between the current behavior sequence and the service adaptation model corresponding to each lifestyle habit. The matching degree calculation adopts a multi-dimensional weighted comprehensive method.

[0037] First, time condition matching is performed. The system obtains the current time and determines whether it falls within the time condition window of the service adaptation model. If it is not within the window, the time matching degree is directly 0; if it is within the window, the time matching degree is calculated based on the distance from the window boundary, with the matching degree being higher the closer to the center of the window, and the value range is 0.7 to 1.0.

[0038] Next, environmental parameter matching is performed. The system obtains the current estimated ambient light value and compares it with the environmental parameter conditions in the service adaptation model. If the light value is below 50 lux and the model requires lighting to be turned on, the environmental matching score increases by 0.3 points; if it is above 50 lux, the score is 1.0. In this embodiment, the total weight of environmental parameter matching is 0.2.

[0039] The system performs another round of user vital sign matching. It obtains the current heart rate and gait stability and compares them with thresholds in the service adaptation model. If the heart rate is below 100 and the gait stability is above 0.7, the vital sign matching score is 1.0; if it exceeds the threshold but the exceedance is within 20%, the score linearly decreases to 0.5; if the exceedance exceeds 20%, the score is 0. In this embodiment, the vital sign matching weight is 0.3.

[0040] Finally, behavior sequence matching is performed. The system dynamically aligns the current behavior sequence with the behavior sequence template using time warping. The specific algorithm is as follows: an n×m distance matrix is ​​constructed, where n is the length of the current sequence and m is the length of the template sequence. Each element (i,j) in the matrix represents the Euclidean distance between the i-th point in the current sequence and the j-th point in the template sequence. The Euclidean distance is calculated based on a weighted sum of position coordinates and keypoint coordinates. Dynamic programming is used to find the shortest path from (1,1) to (n,m), and the total cost of this path is the sequence similarity. The similarity is normalized to the interval 0 to 1 to obtain the behavior matching score. In this embodiment, the behavior matching weight is 0.5.

[0041] Total match score = 0.2 × environmental match score + 0.3 × physical characteristic match score + 0.5 × behavioral match score. If the time condition is not met, the total match score is set to 0.

[0042] Step 5: Determine the execution status of the habit instantiation and identify the target service adaptation model: The system compares the calculated matching degree of each service adaptation model with a first preset threshold. In this embodiment, the first preset threshold is initially set to 0.75, and this value can be adaptively adjusted according to the actual running effect. When the matching degree of the same service adaptation model exceeds 0.75 in three consecutive matching degree calculations, the system determines that the habit is in the instantiation execution state, and the service adaptation model is identified as the target service adaptation model.

[0043] Step Six: Generate and issue service instructions: The system extracts the service instruction set from the dynamic service mapping in the target service adaptation model. For each service instruction, the system generates a specific device control message based on the instruction content. For example, for a light gradient instruction, the system calculates the gradient steps. If the gradient duration is 10 seconds and the device control cycle is 0.1 seconds, then 100 control messages are generated, each containing the target brightness value and the current frame number. For an air conditioner control instruction, the system generates a binary protocol message containing the temperature setpoint and operating mode. For a speaker playback instruction, the system generates a JSON control message containing the playlist identifier and volume.

[0044] The generated service instructions are sent to the corresponding service execution terminals via the home gateway's WiFi module or Zigbee coordinator. Upon receiving the instructions, the service execution terminals perform the corresponding operations, providing dynamically adapted services to the target users.

[0045] The technical principle of this implementation lies in: establishing individualized user lifestyle profiles through historical data mining, abstracting each habit into a triplet model containing triggering conditions, behavioral sequences, and service mappings; matching real-time collected multimodal data with the model, and determining that a habit is being executed when the behavioral sequence highly matches the template, thus issuing service instructions in advance. Compared with existing technologies, this solves the problem of uniform rules being difficult to adapt to individual differences, achieves synchronization between service and user behavior rhythm, and reduces service response lag time.

[0046] In a preferred embodiment, after determining that the habit corresponding to the service adaptation model is currently in an instantiation execution state, the method further includes the following steps: Retrieve the residential space topology model, which includes the physical location relationships of each functional area within the residence; Based on the residential space topology model, identify the associated functional areas adjacent to the current functional area; Obtain the behavior sequence template of the current habit and the behavior sequence template of the candidate habit, wherein the candidate habit is a habit in historical data whose execution probability exceeds a second preset threshold after the current habit ends; If the functional area corresponding to the candidate habit is consistent with the associated functional area, then the pre-adaptation service is executed in the associated functional area, so that the service execution terminal of the associated functional area enters a low-power pre-start state. When a target user is detected moving from the current functional area to the associated functional area, the pre-adapted service is upgraded to a formal service, the service execution terminal of the associated functional area is switched to normal operation, and the dynamic service mapping corresponding to the candidate habit is executed.

[0047] Once the system determines that a habit is in an instantiated execution state using the above method, the system obtains the current functional area corresponding to that habit. The method for determining the current functional area is as follows: the system obtains the user's current position coordinates through the camera and performs a point containment test between these coordinates and the pre-stored functional area boundary polygon. The functional area boundary polygon is either manually drawn by the user on the system interface during system initialization or automatically generated by the system through scene recognition. For example, the boundary of the bedroom area is a list of polygon coordinates [(100,200),(300,200),(300,400),(100,400)].

[0048] Step 1: Retrieve the residential space topology model: The system pre-stores a residential spatial topology model, which is a graph data structure. The node list stores the identifiers, names, boundary polygons, and center point coordinates of each functional area. The edge list stores the connectivity relationships between functional areas; each edge includes a starting area identifier, an ending area identifier, spatial distance, and a path description. Spatial distances are in meters, and path descriptions are a sequence of key point coordinates from the center of the starting area to the center of the ending area. The residential spatial topology model is constructed as follows: During system initialization, the user sequentially marks the location and name of each functional area on the system interface and indicates the connectivity relationships between adjacent areas; the system automatically calculates the Euclidean distance between the center points of each area based on the markings, using this as the initial value for the spatial distance; during use, the system tracks the user's actual movement trajectory using a camera, continuously correcting the spatial distances and path descriptions to gradually refine the model.

[0049] Step 2: Identify related functional areas adjacent to the current functional area: The system uses the edge list in the residential space topology model to find all edges originating from the current functional area. The endpoint of each edge is a related functional area. For example, if the current functional area is a bedroom, and the edge list contains edges from the bedroom to the hallway and from the bedroom to the bathroom, then the related functional areas are the hallway and the bathroom. If the current functional area is the living room, the related functional areas might be the kitchen, balcony, dining room, etc.

[0050] Step 3: Obtain the behavior sequence template for the current habit and the behavior sequence template for candidate habits: The system retrieves the current habit behavior sequence template from the service adaptation model. Simultaneously, the system queries the habit transition probability matrix. The habit transition probability matrix is ​​constructed as follows: the system continuously records the start and end times of each habit execution; after a habit ends, it records the next habit to occur, forming a habit transition pair; the frequency of all transition pairs is counted, and the conditional probability of transitioning to other habits after each habit ends is calculated. For example, after the morning habit ends, there is an 80% probability of transitioning to the living room habit, a 15% probability of transitioning to the bathroom habit, and a 5% probability of transitioning to other habits. The system selects habits with transition probabilities exceeding a second preset threshold as candidate habits; in this embodiment, the second preset threshold is set to 0.6.

[0051] Step 4: If the functional area corresponding to the candidate habit is consistent with the associated functional area, then perform the pre-adaptation service in the associated functional area: The system obtains behavioral sequence templates for candidate habits and parses the functional areas where the habit primarily occurs from these templates. For example, the functional area for a habit of going to the living room is the living room, and the functional area for a habit of going to the bathroom is the bathroom. The system compares this functional area with the list of associated functional areas obtained in step two. If the functional area of ​​the candidate habit belongs to one of the associated functional areas, then the pre-adaptation trigger condition is met.

[0052] Once the conditions are met, the system executes a pre-adaptation service in the associated functional area. The specific execution method of the pre-adaptation service is as follows: the system sends a low-power pre-start command to the service execution terminal within the associated functional area. For smart lighting devices, the low-power pre-start command switches the device from deep sleep mode to light sleep mode, keeping the wireless communication module active, the LED driver circuit in standby mode, and reducing the response latency from seconds to milliseconds. For smart air conditioning devices, the low-power pre-start command keeps the fan running at low speed to maintain air circulation, the compressor in standby mode, and the temperature sensor continuously collects data. For smart curtain motors, the low-power pre-start command keeps the motor in standby mode and activates the track resistance sensor. The power consumption of all devices in the low-power pre-start state is approximately 10% to 20% of the normal operating state.

[0053] Step 5: When a target user is detected moving from the current functional area to a related functional area, the pre-adapted service is upgraded to the official service. The system continuously monitors the user's position changes via camera. The monitoring method is as follows: the user's position coordinates are acquired every 0.5 seconds, and the displacement vector between the current coordinates and the previous coordinates is calculated; it is determined whether the vector points in the direction of the associated functional area, based on whether the difference between the angle of the displacement vector and the angle of the center direction of the area is less than 45 degrees; at the same time, it is determined whether the user has left the boundary of the current functional area.

[0054] When the system detects that a user has left the current functional area boundary and is moving towards an associated functional area, it triggers a service upgrade process. The upgrade process involves the system sending a formal service instruction to the service execution terminal of the associated functional area. This instruction switches the device from a low-power pre-boot state to a normal operating state and executes the specific operations in the dynamic service mapping corresponding to the candidate habit. For example, if the candidate habit is to watch TV in the living room, the formal service instruction includes turning on all the living room lights, setting the living room air conditioner to the user's preferred temperature, and turning on the living room TV and switching to the user's frequently watched channel.

[0055] This solution extends the proactive nature of service response from the behavior execution phase to the behavior transfer phase. When the user arrives at the target area, the device is already ready, achieving zero service wait time. At the same time, the low-power pre-boot design balances response speed and energy consumption.

[0056] In a preferred embodiment, after performing the pre-adaptation service in the associated functional area, the method further includes the following steps: During the execution of the pre-adaptation service, the movement direction data of the target user is continuously collected; The movement direction data is divided according to a preset time window to obtain a continuous sequence of direction time segments; The directional time segment sequence is dynamically matched with a preset transfer behavior template to calculate the directional matching degree; the transfer behavior template includes standard directional change features when moving from the current functional area to the associated functional area. When the matching degree of P consecutive time segments in each direction is lower than the third preset threshold, it is determined that the target user's transfer intention is interrupted, and a pre-adaptation cancellation instruction is generated; the pre-adaptation cancellation instruction is used to control the service execution terminal of the associated functional area to exit the low-power pre-start state and return to the standby state; In the pre-adaptation cancellation state, the movement direction data continues to be collected. When the matching degree of Q consecutive directional time segments is detected to rise above the fourth preset threshold, it is determined that the transfer intention is restored and the pre-adaptation service is re-executed.

[0057] Specifically, after the system performs pre-adaptation services in the associated functional area, the system initiates the intent monitoring process.

[0058] Step 1: During the pre-adaptation service execution, continuously collect the target user's movement direction data: The system captures the user's location coordinates five times per second using a camera, with each capture including a timestamp and pixel coordinates. The system then converts the pixel coordinates into physical coordinates in the residential plane coordinate system. The conversion method is based on the camera calibration parameters, mapping the image coordinates to actual ground coordinates through perspective transformation.

[0059] The system segments the movement direction data according to a preset time window. In this embodiment, the time window length is set to 2 seconds, and the window overlap rate is 50%, meaning that one direction time segment is output every 1 second. Within each time window, the system calculates the fitted straight line direction for all position points within the window, which serves as the movement direction angle for that window. Specifically, the calculation method involves performing linear regression on the sequence of position points within the window to obtain the direction angle of the regression line; simultaneously, the movement speed of the position points within the window is calculated as the confidence weight for the direction calculation. This results in a continuous sequence of direction time segments, each segment containing the start and end times of the time window, the direction angle, and the movement speed.

[0060] Step 2: Dynamically match the directional time segment sequence with the preset transition behavior template and calculate the directional matching degree: The system pre-stores a transfer behavior template, which describes the standard directional change characteristics when moving from the current functional area to an associated functional area. The transfer behavior template is generated as follows: During the system learning phase, historical data on successful user transfers from the current functional area to an associated functional area is collected. Each trajectory is divided into a sequence of directional segments within a 2-second time window. Dynamic time warping and alignment are performed on all trajectory sequences, and the mean and standard deviation of the direction at each time point are calculated to form a standard direction sequence. Each element in the standard direction sequence includes the desired direction angle and the allowable deviation range.

[0061] The system dynamically matches real-time acquired direction time segment sequences with transition behavior templates. The matching degree is calculated using a sliding window method: taking the current time as the endpoint, a historical direction segment sequence of the same length as the template sequence is selected; the direction difference between the two sequences at each corresponding position is calculated; if the difference is within the template's allowable deviation range, the matching degree at that position is 1; otherwise, the matching degree is 1 minus the ratio of the difference divided by 180 degrees; the average of all position matching degrees is taken to obtain the direction matching degree. When the real-time sequence length is less than the template sequence length, the maximum available length is used for matching, and the matching degree is corrected by multiplying the length ratio.

[0062] Step 3: When the matching degree of P consecutive time segments in each direction is lower than the third preset threshold, it is determined that the target user's transfer intention has been interrupted. The system sets a third preset threshold, which is 0.4 in this embodiment. The system sets the P value to 3, representing three consecutive time segments.

[0063] The system maintains a matching score queue of length P. Each time a new directional matching score is calculated, it is added to the tail of the queue, and the old value at the head of the queue is removed. The system checks if all matching scores in the queue are below 0.4. If the condition is met, the system determines that the target user's transfer intention has been interrupted.

[0064] The logic for determining the interruption of the transfer intention means that if the user's movement direction deviates significantly from the standard transfer direction within 6 consecutive seconds (2 seconds per time segment, 3 consecutive segments), it indicates that the user has deviated from the original movement path and is no longer moving towards the associated functional area.

[0065] Step 4: Generate pre-adaptation cancellation command: Upon determining that the transfer intention has been interrupted, the system generates a pre-adaptation cancellation command. This command sends a control message to the service execution terminal of the associated functional area to exit the low-power pre-start state. For smart lighting devices, the cancellation command causes the device to enter deep sleep mode from light sleep mode, and the wireless communication module enters a periodic wake-up listening state, further reducing power consumption. For smart air conditioning devices, the cancellation command stops the fan, completely shuts down the compressor, and only retains periodic sampling by the temperature sensor. For smart curtain motors, the cancellation command de-energizes the motor and disables the track resistance sensor. After the device enters standby mode, the system stops providing pre-adaptation services to that area.

[0066] Step 5: In the pre-adaptation cancellation state, continue to collect movement direction data. When the matching degree of Q consecutive directional time segments is detected to rise above the fourth preset threshold, it is determined that the transfer intention has been restored, and the pre-adaptation service is re-executed. In the pre-adaptation cancellation state, the system continues to collect movement direction data and calculate the direction matching degree according to step one. The system sets a fourth preset threshold, which in this embodiment is set to 0.6, slightly higher than the third preset threshold, to avoid frequent switching. The system sets the Q value to 3.

[0067] The system maintains another matching queue of length Q. When all matching scores in the queue are higher than 0.6, the transfer intention is considered restored. This means that if the user exhibits behavior characteristics consistent with the standard transfer direction again within 6 consecutive seconds, it indicates that the user may have adjusted their path to continue moving towards the related functional area.

[0068] After determining that the transfer intention has been restored, the system re-executes the pre-adaptation service, that is, it sends a low-power pre-start command to the service execution terminal of the associated functional area again, so that the device re-enters the pre-start state and resumes monitoring the user's mobile behavior, waiting for the conditions for the formal service upgrade to be met.

[0069] This solution addresses the issue of pre-adaptation services potentially becoming ineffective due to users temporarily changing their intentions, avoids energy waste and equipment damage caused by prolonged ineffective standby, and improves system robustness by using continuous multi-segment judgment conditions to prevent misjudgments caused by single-direction fluctuations.

[0070] In a preferred embodiment, before upgrading the pre-adapted service to the official service, the following steps are further included: When a target user is detected moving from the current functional area to the associated functional area, the target user's movement speed data is collected synchronously. Based on the spatial distance between the current functional area and the associated functional area, and the movement speed data, the estimated arrival time is calculated; The estimated arrival time is compared with the warm-up time of the service execution terminal in the associated functional area; If the estimated arrival time is greater than the warm-up time, then at the moment when the estimated arrival time minus the warm-up time, the pre-adaptation service is upgraded to the formal service. If the estimated arrival time is less than or equal to the warm-up time, the pre-adaptation service will be immediately upgraded to the official service.

[0071] Specifically, when the system detects that a target user is moving from the current functional area to an associated functional area, the system enters the service upgrade timing calculation process.

[0072] Step 1: Synchronously collect the target user's movement speed data: When the system detects a change in the user's position coordinates via the camera, and the displacement direction points towards the associated functional area, the system begins collecting the user's movement speed data. The movement speed is collected as follows: the camera continuously collects the user's position coordinates at a frequency of 10 times per second, recording a timestamp t_i and coordinate point (x_i, y_i) for each collection; the system calculates the displacement distance Δd_i and time difference Δt_i between two adjacent collections, and the movement speed v_i = Δd_i / Δt_i. To eliminate single-collection errors, the system uses a sliding window averaging filter with a window length of 5 sampling points, calculating the average speed within the window as the current movement speed v_current.

[0073] The system also records the moment when the user begins to move, t_start, which is defined as the time when the user's position coordinates first leave the boundary of the current functional area.

[0074] Step 2: Calculate the estimated arrival time: The system obtains the spatial distance D between the current functional area and related functional areas from the residential space topology model. The spatial distance is stored as a numerical value in meters, which is marked by the user during system initialization or automatically corrected by tracking the user's movement trajectory through a camera during use. For example, the spatial distance between the bedroom and the living room may be 8 meters, including the total path length from the bedroom door to the hallway and then to the living room sofa area.

[0075] The system calculates the estimated arrival time T_arrival based on the current moving speed v_current and the spatial distance D. The formula for calculating the estimated arrival time is T_arrival = D / v_current. Considering that the moving speed of elderly people may be uneven, the system uses an exponentially weighted moving average method to smooth the speed during the calculation, avoiding drastic changes in the estimated time due to single speed fluctuations.

[0076] The system simultaneously acquires the warm-up time T_warmup of the service execution terminal in the associated functional area. Warm-up time refers to the time required for the service execution terminal to switch from a low-power pre-start state to a normal operating state; the warm-up time varies depending on the type of device. The warm-up time for smart lighting devices is typically 0.1 to 0.5 seconds because LED beads have extremely fast response speeds, requiring only circuit switching. The warm-up time for smart air conditioning devices is longer, typically 5 to 15 seconds, because the compressor needs to establish refrigerant circulation and the fan needs to reach the set speed. The warm-up time for smart curtain motors is approximately 1 to 2 seconds, as the motor needs to be activated from standby mode and a communication link established. The warm-up time for smart speakers is approximately 0.5 to 1 second, requiring the audio amplifier to be activated from standby mode. The warm-up time parameter is stored in the system configuration file, and users can set it according to the actual device model.

[0077] Step 3: Compare the estimated arrival time with the preheating time and determine the upgrade time: The system compares the estimated arrival time T_arrival with the warm-up time T_warmup, and adopts different service upgrade strategies based on the comparison results.

[0078] If the estimated arrival time is longer than the warm-up time, it means the time required for the user to reach the target area is longer than the device's warm-up time. The system can employ precise timing control, upgrading the device to full service only when the user is about to arrive, avoiding energy waste caused by premature full-speed operation. Specifically, the system calculates the service upgrade time T_upgrade = t_start + T_arrival - T_warmup. Upon reaching this time, the system sends a formal service command to the service execution terminal in the associated functional area, switching the device from a low-power pre-start state to normal operation. For example, if the user starts moving at t_start at 10:00:00, the estimated arrival time is 20 seconds, and the device warm-up time is 5 seconds, then the service upgrade time is 10:00:15. This means the device is activated 15 seconds after the user starts moving and 5 seconds before the estimated arrival time, ensuring the device is ready when the user arrives.

[0079] If the estimated arrival time is less than or equal to the warm-up time, it means the time required for the user to reach the target area is shorter than or equal to the device's warm-up time. The system cannot save energy by delaying startup, otherwise the device would not have completed warm-up by the time the user arrives. In this case, the system adopts an immediate upgrade strategy. The moment the user begins to move, the system immediately upgrades the pre-adaptation service to a formal service, sending a formal service command to the service execution terminal in the associated functional area, enabling the device to enter normal operation as quickly as possible. For example, if the user begins to move at 10:00:00, the estimated arrival time is 3 seconds, and the device warm-up time is 5 seconds, the system immediately sends the formal service command at 10:00:00, the device completes warm-up at 10:00:05, and the user arrives at approximately 10:00:03. The device is still warming up when the user arrives, but this is the optimal solution under the current conditions.

[0080] Step 4: Perform service upgrade: The system sends formal service instructions to the service execution terminals in the associated functional areas according to the determined upgrade time or immediate upgrade strategy. The specific format of the formal service instructions is the same as that of the dynamic service mapping execution method. For smart lighting devices, the formal service instructions include the target brightness value and the duration of the gradient; for smart air conditioning devices, they include the temperature setpoint, fan speed mode, and operating mode; for smart curtain motors, they include the opening and closing direction and travel distance; for smart speakers, they include the playback content and volume settings. After receiving the instructions, the service execution terminals perform the corresponding operations to provide formal services to the users.

[0081] This solution achieves a dynamic balance between service response speed and energy consumption. At the same time, it solves the problem of optimizing the timing of pre-adaptive service upgrades by collecting mobile speed data in real time and accurately calculating estimated arrival time.

[0082] In a preferred embodiment, after performing the pre-adaptation service in the associated functional area, the method further includes the following steps: Collect images of the passageway between the associated functional area and the current functional area to identify whether there are moving obstacles; If a moving obstacle is detected, an obstacle prompt command is generated and the obstacle's location information is broadcast via a voice device; at the same time, the execution intensity of the pre-adaptation service is reduced to a preset low-intensity mode. Once the camera detects that the obstacle has been removed, the standard execution strength of the pre-adaptation service is restored.

[0083] Specifically, this embodiment includes aisle obstacle detection and pre-adaptation intensity adjustment steps. After the system performs pre-adaptation services in the associated functional area, the system enters the aisle safety monitoring process.

[0084] Step 1: Acquire images of the passageway between the associated functional area and the current functional area: The system captures images of the corridor area using cameras. The boundaries of the corridor area are defined by a residential space topology model, which records the range of pixel coordinates of the corridor area in the camera images. The system continuously captures image frames of the corridor area at a rate of 15 frames per second, with each frame measuring 640×480 pixels, and converts them to grayscale images for subsequent processing.

[0085] Step 2: Identify the presence of moving obstacles: The system identifies moving obstacles in the acquired corridor images. The moving obstacle identification method combines background subtraction and optical flow analysis.

[0086] First, background modeling is performed. During periods when no user activity is detected, the system acquires 100 frames of aisle images, calculates the mean and standard deviation of the grayscale value for each pixel, and builds a background model. The background model is updated every 30 minutes to adapt to changes in lighting.

[0087] Next, foreground detection is performed. For each new frame of the image, the system calculates the difference between the grayscale value of each pixel and the mean of the background. If the difference exceeds three times the standard deviation of the background, it is marked as a foreground pixel. The system performs morphological processing on the foreground pixels, using a 5×5 structuring element to perform opening operations to remove noise points, and then performing closing operations to fill holes and form connected regions.

[0088] The system performs motion feature analysis again. It calculates the centroid coordinates for each connected region and tracks the centroid's trajectory across multiple consecutive frames. If the displacement of a connected region exceeds a preset threshold within five consecutive frames, and its size is greater than 50×50 pixels, it is identified as a moving obstacle. Moving obstacles include, but are not limited to, chairs, cardboard boxes, shoes, pets, cleaning tools, and other items that may obstruct passage.

[0089] The system simultaneously records the location coordinates and dimensions of obstacles. If an obstacle remains at the same location for more than 30 seconds, the system marks it as a static obstacle, distinguishing it from temporarily passing moving obstacles.

[0090] Step 3: Generate obstacle prompts and broadcast them via voice device: When a moving obstacle is detected, the system generates an obstacle warning instruction. This instruction includes a description of the obstacle's location, such as whether it's near a bedroom door, in the middle of a hallway, or near a corner of the living room. The location description is generated by comparing the obstacle's center coordinates with the hallway boundary coordinates to determine the obstacle's relative position within the hallway.

[0091] The system announces obstacle location information via a voice device. This device can be a smart speaker or a smart home gateway with voice functionality. The announcements are generated using natural language, such as "There is a cardboard box in the middle of the aisle, please avoid it" or "There is a chair near the bedroom door in the aisle, please walk carefully." The volume and speed of the announcements can be set according to user preferences, and each announcement is made only once to avoid repetitive announcements that could cause interference.

[0092] Step 4: Reduce the execution intensity of the pre-adapted service to the preset low-intensity mode: Upon detecting a moving obstacle, the system simultaneously reduces the execution intensity of the pre-adaptive service to a preset low-intensity mode. The definition of execution intensity varies depending on the device type.

[0093] For smart lighting devices, low-intensity mode reduces light brightness to 30% of normal brightness to avoid providing excessive illumination when obstacles are present, preventing users from overlooking obstacles in their haste to pass. For smart air conditioning devices, low-intensity mode reduces fan speed to a low setting to avoid potential discomfort or objects being blown over by strong winds. For smart curtain motors, low-intensity mode pauses motor operation to prevent curtains from colliding with obstacles during opening and closing. For smart speakers, low-intensity mode reduces volume to 20% of normal volume to prevent background music from distracting users from obstacles.

[0094] The low-intensity mode has no duration limit, and the system continuously monitors the obstacle status until the obstacle is removed.

[0095] Step 5: Once the camera detects that the obstacle has been removed, restore the standard execution strength of the pre-adaptation service: The system continuously monitors the status of obstacles using cameras. The criteria for removing an obstacle are: in 10 consecutive frames, the difference between the pixel value at the obstacle's location and the background model is below a preset threshold, and no other moving objects are detected in that area.

[0096] Once the obstacle is determined to be removed, the system generates an intensity restoration command, controlling the service execution terminals in the associated functional area to return from low-intensity mode to standard execution intensity. The definition of standard execution intensity is consistent with the normal operating state defined by the previous dynamic service mapping. For example, lighting equipment returns to 80% brightness, air conditioning returns to the user-set fan speed, curtain motors return to standby mode, and speakers return to normal volume.

[0097] This solution combines environmental safety monitoring with intelligent service execution, adding a proactive safety protection mechanism during the pre-adaptation service period to resolve the risk of users tripping due to obstacles in passageways. At the same time, it achieves a balance between safety and service quality through dynamic adjustment of service intensity.

[0098] In a preferred embodiment, before constructing a corresponding service adaptation model for each lifestyle habit in the lifestyle habit profile, the following steps are further included: After each habit is determined to be in the instantiation execution state, the timing data of key action points of the target user during the execution of the habit are collected, and the action execution speed characteristics and action continuity characteristics are extracted; the heart rate fluctuation amplitude characteristics and gait stability characteristics during the process are collected simultaneously. Based on the characteristics of the movement execution speed, movement continuity, heart rate fluctuation amplitude, and gait stability, the current physical function decline index is obtained. The physical function decline index is compared with the historical decline index sequence to calculate the decline rate; if the decline rate exceeds the first dynamic threshold, the target user is determined to be in a period of rapid change in physical function. The lifestyle profile described during periods of rapid change in bodily functions is revised.

[0099] Specifically, before building the service adaptation model, the system first conducts continuous monitoring of physical function decline and dynamically adjusts the lifestyle profile based on the monitoring results.

[0100] Step 1: Collect timing data and physiological parameters of key movement points: The system automatically triggers a bodily function data collection process each time a habit is determined to be in an instantiated execution state. The collection timing is chosen during habit execution to ensure that the collected data accurately reflects the user's current bodily function state.

[0101] The camera captures continuous images of the user's habit-forming process at a rate of 30 frames per second, and extracts the two-dimensional coordinates of 25 key points using a human pose estimation model. The system records complete key point time-series data from the start to the end of the habit, with each key point containing its x-coordinate, y-coordinate, and confidence score. The start and end times of the habit are determined by the matching process, starting from the moment the matching score first exceeds a first preset threshold and ending when the matching score remains below that threshold.

[0102] Simultaneously, the smart bracelet collects heart rate data once per second and three-axis acceleration and gyroscope data 50 times per second. Heart rate data records the time interval of each heartbeat to calculate heart rate variability. Acceleration data records acceleration values ​​in the x, y, and z directions to calculate activity intensity and gait characteristics. Gyroscope data records angular velocity changes to aid in determining body posture.

[0103] Step 2: Extract action execution speed features and action continuity features: The system extracts action execution speed features and action continuity features from the collected key point time-series data.

[0104] The method for extracting action execution speed features is as follows: The hip keypoint is selected as the body center reference point. The displacement distance of this keypoint between consecutive frames is calculated, and divided by the inter-frame time difference to obtain the instantaneous movement speed. The average movement speed is obtained by averaging all instantaneous speeds during habit execution. Simultaneously, the peak and trough values ​​of speed during habit execution are extracted to reflect the user's maximum and minimum movement capabilities. For habits involving specific movements, such as sitting up, the system calculates the speed features of the sitting-up phase separately, i.e., the average speed from the hip keypoint upwards to achieving a stable sitting posture.

[0105] The method for extracting motion continuity features involves calculating the smoothness index of key point trajectories. The system performs a second difference on the trajectory sequence of hip key points, calculating the sum of the absolute values ​​of the second derivatives of the trajectories. The smaller this value, the smoother the trajectory and the more continuous the motion. Simultaneously, the system calculates the coefficient of variation of speed during habitual execution, i.e., the ratio of the speed standard deviation to the average speed. The smaller this value, the more stable the speed changes and the more continuous the motion. The system also detects the number and duration of pauses during motion execution. A pause is defined as a period where the speed is below 0.05 meters per second and the duration exceeds 0.5 seconds.

[0106] Step 3: Extract heart rate fluctuation amplitude features and gait stability features: The system extracts heart rate fluctuation amplitude features and gait stability features from the data collected by the smart bracelet.

[0107] The method for extracting heart rate variability characteristics is as follows: Heart rate variability, specifically the standard deviation of consecutive heartbeat intervals, is calculated from heart rate data. Heart rate variability reflects the regulatory capacity of the autonomic nervous system; it typically decreases in older adults as their physical function declines. The system also calculates the difference between the average heart rate and the resting heart rate during habit execution, reflecting the physiological load required to perform the habit. Heart rate variability is defined as the difference between the maximum and minimum heart rate during habit execution; an excessively large value may indicate insufficient bodily regulation.

[0108] The method for extracting gait stability features is as follows: Gait parameters are extracted from triaxial acceleration data. The system performs bandpass filtering on the acceleration data, removing frequency components below 0.5Hz and above 5Hz, retaining the frequency range relevant to walking. Gait cycles are identified by peak detection of the acceleration data, and stride frequency, stride length, and gait symmetry index are calculated. The gait symmetry index is calculated by the correlation between the left and right gait cycles; a value closer to 1 indicates a more symmetrical and stable gait. The system also calculates the autocorrelation function of the acceleration data; the peak decay rate of the autocorrelation function reflects the regularity and stability of the gait, with faster decay indicating a less stable gait.

[0109] Step 4: Obtain the current physical function decline index: The system inputs the features extracted from the four dimensions above into a preset physical function assessment model and outputs the current physical function decline index. The physical function assessment model adopts a logistic regression model, which is trained during the system training phase by collecting sample data from healthy elderly people and elderly people with declining physical function.

[0110] The model's input feature vector includes six features: average movement speed, velocity coefficient of variation, heart rate variability, heart rate load, cadence, and gait symmetry. Each feature is normalized before input, mapping its value to the interval between 0 and 1. The logistic regression model's output value ranges from 0 to 1, where 0 indicates good physical function and 1 indicates significant decline in physical function. The probability value output by the model is the physical function decline index.

[0111] Step 5: Calculate the rate of decline and determine if the body is in a period of rapid change in bodily functions: The system stores the physical function decline index calculated after each habit execution into a historical decline index sequence, which is arranged in chronological order with timestamps accurate to the day.

[0112] The system calculates the rate of decline as follows: A 30-day decline index sequence is taken, and a linear regression is performed on the sequence to obtain the slope k of the regression line. The slope k represents the average daily change in the decline index, which is the rate of decline. If the decline index shows an upward trend and the slope is positive, it indicates that bodily functions are declining; if the slope is negative, it indicates that bodily functions are recovering.

[0113] The system sets a first dynamic threshold, with an initial value of 0.005, representing a daily decline of 0.005, equivalent to a decline of 0.15 over 30 days. When the decline rate k exceeds the first dynamic threshold, the system determines that the target user is in a period of rapid change in bodily functions. The first dynamic threshold can be personalized based on the user's age and health condition; for example, for older users, the threshold can be appropriately lowered for more sensitive detection of decline.

[0114] Step Six: Revise the lifestyle profile during the period of rapid changes in bodily functions: Once the system determines that a user is in a period of rapid change in physical function, it triggers a profile correction process. The core objective of this correction is to adjust the parameters in the lifestyle profile related to the service adaptation model to adapt them to the user's current physical condition.

[0115] The specific revisions include the following three aspects: First, the system lowers the threshold values ​​for user vital signs in the context triggering condition set. The system proportionally lowers parameters such as heart rate and gait stability thresholds based on the rate of decline. For example, if the original heart rate threshold was set at 100 beats per minute with a decline rate of 0.01, the system lowers the threshold to 90 beats per minute to ensure that users can still trigger the service even after their physical function declines.

[0116] Second, the time axis in the behavior sequence template is stretched. The system stretches the time window of each stage in the behavior sequence template proportionally according to the decay rate. For example, if the original behavior sequence template has a sitting-up action time of 2 seconds and a decay rate of 0.01, the system stretches the sitting-up action time window to 2.2 seconds to adapt to the situation where the user's actions slow down.

[0117] Third, the intensity of service execution is reduced. The system adjusts the service intensity parameters in the dynamic service mapping based on the decay index. For example, the assist force for getting up on the smart mattress is reduced from 80% to 60%, and the lifting speed of the smart chair is adjusted from fast to slow to ensure that the service intensity matches the user's current physical capacity.

[0118] The revised lifestyle profile replaces the original profile and is used for subsequent real-time behavior matching and service adaptation.

[0119] This solution resolves the contradiction between the static nature of lifestyle profiles and the dynamic changes in users' physical functions, enabling proactive self-correction of profiles and avoiding missed or incorrect service decisions due to declining user physical functions. At the same time, it ensures the security of service execution through dynamic adjustment of service intensity.

[0120] In a preferred embodiment, the process of revising the lifestyle profile during a period of rapid change in bodily functions includes the following steps: Acquire the timing data of key action points from the last N habit execution records before the start of the rapid change period in bodily functions, and use them as the baseline template set; simultaneously acquire the most recent M habit execution records within the rapid change period, and use them as the current sample set; Each habit execution in the current sample set is dynamically time-aligned with the corresponding habit template in the benchmark template set, and the time axis stretching coefficient sequence and key point trajectory offset sequence of each habit are calculated at different execution stages. Based on the time axis stretching coefficient sequence and the key point trajectory offset sequence, a multidimensional degradation feature vector is generated. The multidimensional degradation feature vector includes: time axis deformation feature, spatial trajectory offset feature and motion loss rate feature. The multidimensional degradation feature vector is input into a preset compensation factor generation model, which outputs differentiated compensation factors for different lifestyles. The differentiated compensation factors include: time window amplification coefficient, key point matching tolerance amplification coefficient, and trigger threshold reduction coefficient.

[0121] Specifically, this embodiment includes the steps of quantifying degenerative features and generating compensation factors in the portrait correction process. When the system determines that the target user is in a period of rapid change in physical function, the system executes the steps of quantifying degenerative features and generating compensation factors in the portrait correction process.

[0122] Step 1: Obtain the baseline template set and the current sample set: The system acquires the timing data of key action points from the last N habit execution records before the start of the rapid change period in bodily functions, using this as a baseline template set. The value of N is determined based on the amount of historical data; in this embodiment, N is 10, meaning it takes the 10 most recent successful execution records of the habit before the start of the rapid change period. The start time of the rapid change period is determined by the moment when the rate of decline first exceeds the first dynamic threshold.

[0123] The system simultaneously retrieves the M most recent habit execution records within the rapid change period as the current sample set. The value of M needs to ensure that there are enough samples to reflect the current degradation state, while avoiding the inclusion of too much historical data that would lead to feature averaging. In this embodiment, M is set to 5, meaning that the 5 most recent successful execution records of this habit within the rapid change period are retrieved. If there are fewer than 5 execution records within the rapid change period, all available records are retrieved.

[0124] The timing data for action key points is stored as a JSON object array, where each array element contains a timestamp, the two-dimensional coordinates of 25 key points, and a confidence score. For each habit, the system maintains a separate data storage directory, organizing files by date.

[0125] Step 2: Dynamic Time Normalization and Alignment The system dynamically aligns each habit execution in the current sample set with the corresponding habit template in the baseline template set using time warping. The specific implementation of the dynamic time warping algorithm is as follows.

[0126] For the current sample sequence Q = [q1, q2, ..., qm] and the baseline template sequence C = [c1, c2, ..., cn], where qi and cj are multi-dimensional feature vectors, each containing dimensions such as user position coordinates, hip keypoint coordinates, and knee keypoint coordinates, the system constructs an m x n cost matrix D. The formula for calculating each element D(i,j) in the matrix is: D(i,j) = dist(qi, cj) + min(D(i-1,j), D(i,j-1), D(i-1,j-1)) Here, dist(qi, cj) is the Euclidean distance between qi and cj, using a weighted Euclidean distance. Different keypoints are assigned different weights, with higher weights for trunk keypoints and lower weights for keypoints at the extremities. D(0,0) is initialized to 0, and the first row and first column are initialized to infinity.

[0127] The system uses dynamic programming to calculate the cumulative distance matrix from D(1,1) to D(m,n). Starting from D(m,n), it backtracks along the direction that minimizes the cumulative distance back to D(1,1) to obtain the optimal alignment path. The alignment path records the correspondence between points in the current sample sequence and the baseline template sequence.

[0128] Based on the alignment path, the system calculates the time-axis stretching coefficient sequence for each habit at different execution stages. The calculation method for the time-axis stretching coefficient is as follows: the ratio of the current sample's index to the template index in the alignment path is used as the instantaneous stretching coefficient for that point. For example, if the 5th frame of the current sample aligns with the 3rd frame of the template, the instantaneous stretching coefficient is 5 / 3 ≈ 1.67. The system divides the entire habit execution process into several stages, and the stretching coefficient for each stage is the average of the instantaneous stretching coefficients of all alignment points within that stage. The stage division is based on the natural segmentation of the action, such as the sit-up stage, standing stage, and walking stage, and the segment boundaries are determined through keypoint change rate detection.

[0129] The system simultaneously calculates the keypoint trajectory offset sequence. The keypoint trajectory offset is calculated as follows: for each corresponding point on the alignment path, the Euclidean distance between the coordinates of the current sample keypoint and the coordinates of the template keypoint is calculated, and this distance is used as the trajectory offset for that point. The system records the average offset of each keypoint at each stage, forming a keypoint trajectory offset sequence. For example, the average offset of the hip keypoint is 0.05 meters in the sitting-up stage, 0.03 meters in the standing stage, and 0.08 meters in the walking stage.

[0130] Step 3: Generate multidimensional degenerate feature vectors: The system generates a multidimensional degradation feature vector based on the time axis stretching coefficient sequence and the keypoint trajectory offset sequence. The multidimensional degradation feature vector is a structured data object containing three main feature dimensions.

[0131] The method for generating time axis deformation features is as follows: statistical analysis is performed on the stretching coefficients at each stage, and the mean, variance, maximum, and minimum values ​​of the stretching coefficients are calculated. The mean reflects the degree of slowing down of the overall movement, and the variance reflects the unevenness of the movement rhythm. The time axis deformation features are represented as a vector [t_mean, t_var, t_max, t_min].

[0132] The method for generating spatial trajectory offset features is as follows: statistical analysis is performed on the offset of each keypoint at each stage, and the mean and variance of the offset are calculated. Simultaneously, the morphological changes of the keypoint trajectory are calculated, i.e., principal component analysis is performed on the aligned trajectory to compare the differences between the current sample and the baseline template in the principal component directions. The spatial trajectory offset features are represented as a vector [s_mean, s_var, s_pc_diff].

[0133] The method for generating the action missing rate feature is as follows: In the alignment path, it detects whether there are time periods in the current sample that cannot be aligned with the template. These time periods typically correspond to users omitting or skipping certain actions. The system calculates the proportion of frames that cannot be aligned to the total number of frames, which is used as the action missing rate. Simultaneously, it detects changes in the action order, such as whether the user has changed the execution order of the actions. If the order changes, it is recorded as an order anomaly, increasing the weight of the action missing rate feature. The action missing rate feature is represented by a scalar value m_missing, ranging from 0 to 1.

[0134] Step 4: Input compensation factors to generate model output differentiated compensation factors: The system inputs a multidimensional degradation feature vector into a pre-defined compensation factor generation model, outputting differentiated compensation factors for different lifestyles. The compensation factor generation model employs a multilayer perceptron neural network with an input layer, two hidden layers, and an output layer. The input layer has 7 nodes, corresponding to 4 dimensions of temporal deformation features, 3 dimensions of spatial trajectory offset features, and 1 dimension of action missing rate features. The first hidden layer has 16 nodes, with ReLU activation. The second hidden layer has 8 nodes, also with ReLU activation. The output layer has 3 nodes, corresponding to three compensation factors: a time window augmentation coefficient, a keypoint matching tolerance augmentation coefficient, and a trigger threshold downscaling coefficient.

[0135] The training process for the compensation factor generation model is completed before system deployment. The training dataset is collected from habit execution data of multiple elderly users under different physical functional states. Each sample contains a multidimensional degenerative feature vector and manually labeled compensation factors. The manually labeled compensation factors are determined by rehabilitation medicine experts based on the user's degree of functional decline. The labeling principle is that the compensation factor is positively correlated with the degree of decline, but does not exceed a safe upper limit. In this embodiment, the labeling range of the time window amplification coefficient is 1.0 to 3.0, the labeling range of the keypoint matching tolerance amplification coefficient is 1.0 to 2.5, and the labeling range of the trigger threshold downscaling coefficient is 0.3 to 1.0.

[0136] The output layer uses the sigmoid activation function to map the output values ​​to the interval between 0 and 1, and then uses a linear transformation to map them to the range of actual compensation factors. For example, the time window amplification coefficient = 1.0 + 2.0 × sigmoid(output_1), with a value range of 1.0 to 3.0; the trigger threshold down-adjustment coefficient = 0.3 + 0.7 × sigmoid(output_3), with a value range of 0.3 to 1.0.

[0137] The output of the compensation factor generation model varies depending on lifestyle habits. For morning habits, which involve more standing and walking movements, the time axis deformation is more pronounced, resulting in a larger time window expansion coefficient in the model output, for example, 2.2. For drinking habits, which mainly involve raising and grasping, the impact is less, resulting in a smaller time window expansion coefficient in the model output, for example, 1.3. This differentiated compensation ensures the accuracy of profile correction and avoids applying the same compensation magnitude to all habits.

[0138] This solution enables precise quantification of motor degeneration in the elderly, distinguishing between different movement types and degeneration patterns, and providing accurate compensation parameters for subsequent profile correction.

[0139] In a preferred embodiment, after outputting the differentiated compensation factors for different lifestyles, the method further includes the following steps: According to the aforementioned differential compensation factor, the behavioral sequence templates corresponding to each lifestyle habit are subjected to nonlinear time axis deformation to generate degenerate adaptation templates; at the same time, the original templates are retained. According to the trigger threshold reduction coefficient, the user vital sign condition threshold in the context trigger condition set corresponding to each lifestyle habit is reduced to form a degenerate adaptation trigger condition; at the same time, the original trigger condition is retained. A template selector is constructed, which takes the current physical function decline index and the real-time matching degree between the current behavior sequence and each template as input, and dynamically selects between the original template and the degenerate adaptation template. When the habitual execution is successfully matched with the degenerate adaptation template in K consecutive executions and the matching degree is consistently higher than the preset threshold, the degenerate adaptation template is upgraded to the main template and the original template is downgraded to the backup template.

[0140] Specifically, this embodiment includes template generation and dynamic selection steps in portrait retouching. After the system outputs the differentiation compensation factor, the system performs template generation and dynamic selection in portrait retouching.

[0141] Step 1: Perform nonlinear time axis deformation according to the differentiated compensation factor to generate a degradation adaptation template: The system performs nonlinear time axis deformation on the behavioral sequence templates corresponding to each lifestyle habit according to the time window amplification coefficient in the differential compensation factor. The implementation method of nonlinear time axis deformation is as follows.

[0142] The system acquires the original behavior sequence template, which is a time-series data sequence of length L, with each time point corresponding to an action state vector. Based on the stretching coefficients of each stage in the deformation characteristics of the time axis, the system constructs a nonlinear time mapping function f(t), which maps the original time axis t to a new time axis t'.

[0143] The mapping function is constructed using cubic spline interpolation. The system divides the conventional execution process into K stages, each with a different stretching coefficient s_k. The time coordinates of the stage boundary points are t_0, t_1, ..., t_K, where t_0=0 and t_K=L. For stage k, the original time interval is [t_{k-1}, t_k], and the mapped time interval is [t'_{k-1}, t'k], where t'k = t'{k-1}+s_k×(t_k - t{k-1}). The system constructs a smooth mapping function f(t) through cubic spline interpolation, satisfying f(t_k)=t'_k.

[0144] After obtaining the mapping function, the system resamples the original template. For each integer time point t' on the mapped time axis, the system finds the corresponding t = f^{-1}(t') (inverse function) on the original time axis and obtains the action state vector at that time point through linear interpolation. The interpolation uses a linear combination of the action states of neighboring frames to ensure the continuity of the action.

[0145] After the nonlinear time axis deformation is completed, the system generates a degenerate adaptation template. The degenerate adaptation template has the same structure as the original template, but the time axis is stretched and the rhythm of the action state changes is adjusted to adapt to the user's current action speed characteristics.

[0146] The system also retains the original template without overwriting or deleting it. The original template is stored in a separate database and marked as the original version for subsequent template selection and historical comparison.

[0147] Step 2: Form degradation adaptation trigger conditions according to the trigger threshold reduction coefficient: The system lowers the user's vital sign thresholds in the contextual triggering condition set corresponding to each lifestyle habit according to the trigger threshold reduction coefficient in the differentiated compensation factor. The specific operation is as follows.

[0148] For each user's vital sign threshold, the system calculates the new threshold as: original threshold × trigger threshold reduction factor. For example, if the original heart rate threshold is set to 100 beats per minute and the trigger threshold reduction factor is 0.8, then the new heart rate threshold is 80 beats per minute. If the original gait stability threshold is 0.7 and the trigger threshold reduction factor is 0.85, then the new gait stability threshold is 0.595.

[0149] Regarding time conditions, the system makes corresponding adjustments based on the deformation characteristics of the time axis. If the user's actions slow down, resulting in a longer execution time, the system extends the end time of the time window, with the extension amount related to the average stretching coefficient. For example, if the original time window was 6:30 to 9:30 and the average stretching coefficient was 1.5, the system would adjust the time window to 6:30 to 10:30.

[0150] The system does not adjust environmental parameters because they are unrelated to the user's physical functions.

[0151] The system saves the adjusted set of trigger conditions as degradation adaptation trigger conditions, while retaining the original trigger conditions. Degradation adaptation trigger conditions are used in conjunction with degradation adaptation templates.

[0152] Step 3: Build the template selector: The system constructs a template selector, which takes the current physical function decline index and the real-time matching degree between the current behavior sequence and each template as input, and dynamically selects between the original template and the degenerate adaptation template.

[0153] The template selector is implemented as a decision function. This function first calculates the matching score_orig between the current behavior sequence and the original template, and the matching score_degraded between the current behavior sequence and the degraded template. The matching score is calculated in the same way as previously described, using the dynamic time warping algorithm to calculate sequence similarity.

[0154] The decision function operates as follows: If `score_orig` ≥ 0.7 and `score_degraded` ≥ 0.7, it indicates a good match between the two templates. The selector chooses based on the current physical function decline index. If the decline index is greater than 0.6, the degraded template is selected first; otherwise, the original template is selected first. If `score_orig` ≥ 0.7 and `score_degraded` < 0.7, the selector selects the original template. If `score_orig` < 0.7 and `score_degraded` ≥ 0.7, the selector selects the degraded template. If the matching degree of both templates is less than 0.5, the selector returns no matching result, and the system does not trigger the service.

[0155] The output of the template selector is the selected template identifier and the corresponding matching degree, which is used for subsequent service triggering judgment.

[0156] Step 4: Gradual Upgrade Mechanism The system establishes a progressive upgrade mechanism. When the habitual execution is successfully matched with the degenerate adaptation template for K consecutive times and the matching degree is consistently higher than the preset threshold, the degenerate adaptation template is upgraded to the main template, and the original template is downgraded to the backup template.

[0157] In this embodiment, K is set to 14, representing two consecutive weeks. The counting condition for K consecutive times is: during each habit execution, the template selector selects the degenerate adaptation template, and the matching degree is higher than 0.8. The system maintains a counter, which increments by 1 each time the condition is met. When the counter reaches K, an upgrade is triggered. If the condition is not met even once, the counter is reset and counted again.

[0158] The upgrade process involves the following steps: The system will mark the degenerate adaptation template as the primary template and the original template as the backup template. The primary template will have higher priority in subsequent matching processes; the template selector will prioritize using the primary template for matching, and will only consider the backup template if the primary template's matching degree is below a threshold. Simultaneously, the system will mark the degenerate adaptation trigger condition as the primary trigger condition, and the original trigger condition will be downgraded to a backup trigger condition.

[0159] After the upgrade is complete, the system will continue to monitor the user's physical condition. If the physical function decline index decreases in the future, and the user's habitual actions are successfully matched with the original template for K consecutive times, the system will perform a reverse upgrade and restore the original template to the main template.

[0160] This solution addresses the security and stability issues in the portrait correction process, avoiding erroneous corrections caused by single anomalies, while retaining the ability to roll back, ensuring that the portrait can adapt to the recovery of the user's physical functions.

[0161] In a preferred embodiment, the compensation factor generation model is constructed and used through the following steps: Constructing a training dataset: Collecting habit execution data from multiple users under different physical functional states in historical records. The habit execution data includes multidimensional degradation feature vectors of each habit and corresponding annotation compensation factors. The annotation compensation factors are obtained through manual annotation or by reverse optimization through subsequent matching success rates. Using the multidimensional degenerate feature vector as input and the labeled compensation factor as output, a regression model or a neural network model is trained to obtain the compensation factor generation model. During the usage phase, the target user's current multidimensional degradation feature vector is input into the compensation factor generation model, which outputs differentiated compensation factors for different lifestyles. The time window amplification coefficient in the differential compensation factor is used to nonlinearly stretch the time window of each stage in the behavioral sequence template. The stretching ratio is positively correlated with the stretching coefficient of each stage in the time axis deformation feature. The keypoint matching tolerance amplification coefficient is used to expand the spatial matching range of each keypoint in the behavioral sequence template. The amplification magnitude is positively correlated with the offset of each keypoint in the spatial trajectory offset feature. The trigger threshold reduction coefficient is used to reduce the thresholds of each user's vital signs in the context trigger condition set. The reduction magnitude is positively correlated with the action loss rate feature and the decay rate.

[0162] Specifically, step one: construct the training dataset: The system constructs a training dataset for the compensation factor generation model. The construction of the training dataset consists of two stages: data collection and labeling.

[0163] During the data collection phase, the system gathers habit execution data from multiple elderly users under different physical functional states. The data collection subjects include healthy elderly individuals, those with mild decline, and those with moderate decline, with a sample size of no less than 100 individuals. Each individual's data includes at least 30 habit execution records. Each record contains a multidimensional degeneration feature vector and a corresponding labeled compensation factor. The calculation method for the multidimensional degeneration feature vector is the same as previously described, including time axis deformation features, spatial trajectory offset features, and action loss rate features.

[0164] During the data annotation phase, the system uses two methods to obtain the annotation compensation factor.

[0165] The first method is manual annotation. The system invites rehabilitation medicine experts and geriatric care experts to evaluate each habit execution record. Experts assess the user's physical function decline based on their movement performance and annotate appropriate compensation factors. The annotation standards are as follows: The time window amplification coefficient ranges from 1.0 to 3.0, judged by the degree of movement slowdown: a 10% decrease in movement speed is annotated as 1.1, a 50% decrease as 2.0, and an 80% decrease as 3.0. The keypoint matching tolerance amplification coefficient ranges from 1.0 to 2.5, judged by the degree of movement trajectory deviation: minor deviation is annotated as 1.0, significant deviation as 1.5, and severe deviation as 2.5. The trigger threshold reduction coefficient ranges from 0.3 to 1.0, judged by the degree of movement loss and stability decline: complete and stable movement is annotated as 1.0, minor loss as 0.8, significant loss as 0.5, and severe loss as 0.3.

[0166] The second approach involves inverse optimization of the matching success rate. The system collects actual performance data of the compensation factors through trial runs. For a set of compensation factors, the system calculates the matching success rate after profile correction using those factors; the matching success rate is defined as the proportion of corrected habits that are correctly identified. The system searches for the parameter combination that maximizes the matching success rate in the compensation factor parameter space using grid search or Bayesian optimization methods, and uses this combination as the labeled compensation factor. Inverse optimization employs cross-validation, dividing the dataset into training and validation sets. Parameters are searched on the training set, and the performance is evaluated on the validation set.

[0167] The results of the two annotation methods can be used in combination: manual annotation provides the initial annotations, and reverse optimization refines the annotations.

[0168] Step 2: Train the compensation factor generation model: The system takes a multidimensional degenerate feature vector as input and annotated compensation factors as output to train a regression model, thereby obtaining a compensation factor generation model. This embodiment uses a multilayer perceptron neural network as the regression model, and the model structure is as follows.

[0169] The input layer has 7 nodes, corresponding to time axis deformation features, spatial trajectory offset features, and action missing rate features. In the data preprocessing stage, the system standardizes all input features by subtracting the mean and dividing by the standard deviation to bring all features to the same order of magnitude.

[0170] The network structure consists of two hidden layers. The first hidden layer has 32 nodes, uses the ReLU activation function, and includes a Dropout layer with a Dropout ratio of 0.2 to prevent overfitting. The second hidden layer has 16 nodes and also uses the ReLU activation function. The output layer has 3 nodes, corresponding to three compensation factors, and uses a linear activation function.

[0171] The loss function uses mean squared error, and the calculation formula is MSE = (1 / n)×Σ(y_pred-y_true). 2 The optimizer used is Adam, with an initial learning rate of 0.001, which decays by 10% every 10 epochs. Early stopping is used during training; training stops when the validation set loss no longer decreases for 5 consecutive epochs.

[0172] After training is complete, the system saves the model parameters, including the weight matrix and bias vector of each layer, for use in subsequent inference.

[0173] Step 3: Use the compensation factor generation model to output differentiated compensation factors: During the usage phase, the system inputs the target user's current multidimensional degradation feature vector into the trained compensation factor generation model. The reasoning process is as follows.

[0174] The system first standardizes the input features using the mean and standard deviation calculated during the training phase. The standardized feature vector is then input into the neural network, passing through the first hidden layer, Dropout layer, second hidden layer, and output layer in sequence, resulting in three raw output values ​​o1, o2, and o3.

[0175] The system maps the original output values ​​to the actual range of compensation factors. The mapping formula for the time window amplification coefficient is: Coefficient 1 = 1.0 + 2.0 × sigmoid(o1). The mapping formula for the keypoint matching tolerance amplification coefficient is: Coefficient 2 = 1.0 + 1.5 × sigmoid(o2). The mapping formula for the trigger threshold downscaling coefficient is: Coefficient 3 = 0.3 + 0.7 × sigmoid(o3).

[0176] The system outputs differentiated compensation factors for different lifestyle habits. For different lifestyle habits, the system calls the model separately, inputs the multidimensional degradation feature vector of the corresponding habit, and obtains the independent compensation factor for each habit.

[0177] Step 4: Specific calculation rules for the compensation factor: The system clearly defines the specific calculation rules for each compensation factor, ensuring the interpretability and operability of the compensation factors.

[0178] The time window expansion coefficient is used to nonlinearly stretch the time window of each stage in the behavioral sequence template. The stretching ratio is positively correlated with the stretching coefficient of each stage in the time axis deformation characteristics. Specifically, for each stage of habitual execution, the system calculates the stretching coefficient s_stage for that stage, and the time window expansion coefficient and the stretching coefficient of that stage satisfy the relationship s_stage ≈ time window expansion coefficient × original stretching coefficient. During nonlinear stretching, the system multiplies the original time window length by the stretching coefficient of each stage. The stretching coefficient is calculated by combining the output of the compensation factor generation model with the degradation characteristics of each stage.

[0179] The keypoint matching tolerance amplification coefficient is used to expand the spatial matching range of each keypoint in the behavioral sequence template. The amplification magnitude is positively correlated with the offset of each keypoint in the spatial trajectory offset feature. Specifically, for each keypoint, the system calculates the average offset d_kp, and the matching tolerance amplification coefficient is 1.0 + α × d_kp, where α is a coefficient factor generated by the compensation factor model. The amplified matching range is a circular region centered on the template keypoint with a radius equal to the original radius multiplied by the amplification coefficient. During matching, if the current keypoint falls within the amplified region, the match is considered successful.

[0180] The trigger threshold reduction coefficient is used to lower the thresholds for user vital signs in the context trigger condition set. The reduction magnitude is positively correlated with the action missing rate and decay rate. The specific rule is: Trigger threshold reduction coefficient = β × (1 - m_missing) × (1 - k_decay), where m_missing is the action missing rate, k_decay is the decay rate, and β is the base coefficient output by the compensation factor generation model. The reduced trigger threshold is the original threshold multiplied by the trigger threshold reduction coefficient. For example, if the action missing rate is 0.2, the decay rate is 0.01, and the base coefficient is 0.9, then the trigger threshold reduction coefficient = 0.9 × 0.8 × 0.99 ≈ 0.71.

[0181] This solution addresses the challenge of accurately quantifying compensation factors. Through data-driven model learning, it enables the adaptive generation of compensation factors. Furthermore, by employing explicit calculation rules, it ensures the transparency and controllability of the compensation process.

[0182] Example 2 This embodiment proposes an intelligent service dynamic adaptation system for age-friendly scenarios, used to implement the method described in Embodiment 1, including: A construction module is configured to obtain a profile of the target user's lifestyle habits. The profile of the lifestyle habits is generated based on historical data through a classification model and is used to characterize the long-term behavioral patterns of the target user in different dimensions of life. The construction module is also configured to build a corresponding service adaptation model for each lifestyle habit in the lifestyle habit profile; the service adaptation model includes: The context trigger condition set includes environmental parameter conditions, time conditions, and user physical condition conditions that must be met when the habit is instantiated and executed in a specific context. A behavior sequence template, which contains a description of the temporal behavioral characteristics of the habit during execution; Dynamic service mapping includes a set of service instructions that need to be dynamically adapted and issued when the habit is identified as being instantiated. The acquisition module is configured to collect the target user's current behavior data, current environmental parameters, and current vital signs in real time to form a current behavior sequence; The matching module is configured to dynamically match the current behavior sequence with each of the service adaptation models, calculate the matching degree between the current behavior sequence and each service adaptation model; when the matching degree of any service adaptation model exceeds a first preset threshold, it is determined that the habit corresponding to the service adaptation model is currently in the instantiation execution state, and the target service adaptation model that has been successfully matched is identified. The instruction module is configured to generate service instructions based on the dynamic service mapping in the target service adaptation model, and send the service instructions to the corresponding service execution terminal to drive the service execution terminal to provide the target user with a dynamically adapted service that is adapted to the current instantiation execution state.

[0183] The above description is merely a preferred embodiment of this application and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of the invention involved in this application is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the inventive concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features with similar functions disclosed in this application.

Claims

1. A method for dynamic adaptation of intelligent services for age-friendly scenarios, characterized in that, Includes the following steps: Obtain a profile of the target user's lifestyle habits. The profile is generated based on historical data through a classification model and is used to characterize the target user's long-term behavioral patterns in different dimensions of life. For each lifestyle habit in the aforementioned lifestyle profile, a corresponding service adaptation model is constructed; The service adaptation model includes: The context trigger condition set includes environmental parameter conditions, time conditions, and user physical condition conditions that must be met when the habit is instantiated and executed in a specific context. A behavior sequence template, which contains a description of the temporal behavioral characteristics of the habit during execution; Dynamic service mapping includes a set of service instructions that need to be dynamically adapted and issued when the habit is identified as being instantiated. The system collects the target user's current behavior data, current environmental parameters, and current vital signs in real time to form a current behavior sequence. The current behavior sequence is dynamically matched with each of the service adaptation models, and the matching degree between the current behavior sequence and each service adaptation model is calculated. When the matching degree of any service adaptation model exceeds the first preset threshold, it is determined that the habit corresponding to the service adaptation model is currently in the instantiation execution state, and the target service adaptation model that has been successfully matched is determined. Based on the dynamic service mapping in the target service adaptation model, a service instruction is generated and sent to the corresponding service execution terminal to drive the service execution terminal to provide the target user with a dynamically adapted service that is adapted to the current instantiation execution state.

2. The method for dynamic adaptation of intelligent services for age-friendly scenarios according to claim 1, characterized in that, After determining that the habit corresponding to the service adaptation model is currently in an instantiated execution state, the process further includes the following steps: Retrieve the residential space topology model, which includes the physical location relationships of each functional area within the residence; Based on the residential space topology model, identify the associated functional areas adjacent to the current functional area; Obtain the behavior sequence template of the current habit and the behavior sequence template of the candidate habit, wherein the candidate habit is a habit in historical data whose execution probability exceeds a second preset threshold after the current habit ends; If the functional area corresponding to the candidate habit is consistent with the associated functional area, then the pre-adaptation service is executed in the associated functional area, so that the service execution terminal of the associated functional area enters a low-power pre-start state. When a target user is detected moving from the current functional area to the associated functional area, the pre-adapted service is upgraded to a formal service, the service execution terminal of the associated functional area is switched to normal operation, and the dynamic service mapping corresponding to the candidate habit is executed.

3. The method for dynamic adaptation of intelligent services for age-friendly scenarios according to claim 2, characterized in that, After performing the pre-adaptation service in the associated functional area, the method further includes the following steps: During the execution of the pre-adaptation service, the movement direction data of the target user is continuously collected; The movement direction data is divided according to a preset time window to obtain a continuous sequence of direction time segments; The directional time segment sequence is dynamically matched with a preset transfer behavior template to calculate the directional matching degree; the transfer behavior template includes standard directional change features when moving from the current functional area to the associated functional area. When the matching degree of P consecutive time segments in each direction is lower than the third preset threshold, it is determined that the target user's transfer intention is interrupted, and a pre-adaptation cancellation instruction is generated; the pre-adaptation cancellation instruction is used to control the service execution terminal of the associated functional area to exit the low-power pre-start state and return to the standby state; In the pre-adaptation cancellation state, the movement direction data continues to be collected. When the matching degree of Q consecutive directional time segments is detected to rise above the fourth preset threshold, it is determined that the transfer intention is restored and the pre-adaptation service is re-executed.

4. The method for dynamic adaptation of intelligent services for age-friendly scenarios according to claim 2, characterized in that, Before upgrading the pre-adapted service to the official service, the following steps are also included: When a target user is detected moving from the current functional area to the associated functional area, the target user's movement speed data is collected synchronously. Based on the spatial distance between the current functional area and the associated functional area, and the movement speed data, the estimated arrival time is calculated; The estimated arrival time is compared with the warm-up time of the service execution terminal in the associated functional area; If the estimated arrival time is greater than the warm-up time, then at the moment when the estimated arrival time minus the warm-up time, the pre-adaptation service is upgraded to the formal service. If the estimated arrival time is less than or equal to the warm-up time, the pre-adaptation service will be immediately upgraded to the official service.

5. The method for dynamic adaptation of intelligent services for age-friendly scenarios according to claim 2, characterized in that, After performing the pre-adaptation service in the associated functional area, the method further includes the following steps: Collect images of the passageway between the associated functional area and the current functional area to identify whether there are moving obstacles; If a moving obstacle is detected, an obstacle prompt command is generated and the obstacle's location information is broadcast via a voice device; at the same time, the execution intensity of the pre-adaptation service is reduced to a preset low-intensity mode. Once the camera detects that the obstacle has been removed, the standard execution strength of the pre-adaptation service is restored.

6. The method for dynamic adaptation of intelligent services for age-friendly scenarios according to claim 1, characterized in that, Before constructing a corresponding service adaptation model for each lifestyle habit in the lifestyle habit profile, the following steps are also included: After each habit is determined to be in the instantiation execution state, the timing data of key action points of the target user during the execution of the habit are collected, and the action execution speed characteristics and action continuity characteristics are extracted; the heart rate fluctuation amplitude characteristics and gait stability characteristics during the process are collected simultaneously. Based on the characteristics of the movement execution speed, movement continuity, heart rate fluctuation amplitude, and gait stability, the current physical function decline index is obtained. The physical function decline index is compared with the historical decline index sequence to calculate the decline rate; if the decline rate exceeds the first dynamic threshold, the target user is determined to be in a period of rapid change in physical function. The lifestyle profile described during periods of rapid change in bodily functions is revised.

7. The method for dynamic adaptation of intelligent services for age-friendly scenarios according to claim 6, characterized in that, The process of revising the lifestyle profile during periods of rapid change in bodily functions includes the following steps: Acquire the timing data of key action points from the last N habit execution records before the start of the rapid change period in bodily functions, and use them as the baseline template set; simultaneously acquire the most recent M habit execution records within the rapid change period, and use them as the current sample set; Each habit execution in the current sample set is dynamically time-aligned with the corresponding habit template in the benchmark template set, and the time axis stretching coefficient sequence and key point trajectory offset sequence of each habit are calculated at different execution stages. Based on the time axis stretching coefficient sequence and the key point trajectory offset sequence, a multidimensional degradation feature vector is generated. The multidimensional degradation feature vector includes: time axis deformation feature, spatial trajectory offset feature and motion loss rate feature. The multidimensional degradation feature vector is input into a preset compensation factor generation model, which outputs differentiated compensation factors for different lifestyles. The differentiated compensation factors include: time window amplification coefficient, key point matching tolerance amplification coefficient, and trigger threshold reduction coefficient.

8. The method for dynamic adaptation of intelligent services for age-friendly scenarios according to claim 7, characterized in that, After outputting the differentiated compensation factors for different lifestyles, the following steps are also included: According to the aforementioned differential compensation factor, the behavioral sequence templates corresponding to each lifestyle habit are subjected to nonlinear time axis deformation to generate degenerate adaptation templates; at the same time, the original templates are retained. According to the trigger threshold reduction coefficient, the user vital sign condition threshold in the context trigger condition set corresponding to each lifestyle habit is reduced to form a degenerate adaptation trigger condition; at the same time, the original trigger condition is retained. A template selector is constructed, which takes the current physical function decline index and the real-time matching degree between the current behavior sequence and each template as input, and dynamically selects between the original template and the degenerate adaptation template. When the habitual execution is successfully matched with the degenerate adaptation template in K consecutive executions and the matching degree is consistently higher than the preset threshold, the degenerate adaptation template is upgraded to the main template and the original template is downgraded to the backup template.

9. The method for dynamic adaptation of intelligent services for age-friendly scenarios according to claim 7, characterized in that, The compensation factor generation model is constructed and used through the following steps: Constructing a training dataset: Collecting habit execution data from multiple users under different physical functional states in historical records. The habit execution data includes multidimensional degradation feature vectors of each habit and corresponding annotation compensation factors. The annotation compensation factors are obtained through manual annotation or by reverse optimization through subsequent matching success rates. Using the multidimensional degenerate feature vector as input and the labeled compensation factor as output, a regression model or a neural network model is trained to obtain the compensation factor generation model. During the usage phase, the target user's current multidimensional degradation feature vector is input into the compensation factor generation model, which outputs differentiated compensation factors for different lifestyles. The time window amplification coefficient in the differential compensation factor is used to nonlinearly stretch the time window of each stage in the behavioral sequence template. The stretching ratio is positively correlated with the stretching coefficient of each stage in the time axis deformation feature. The keypoint matching tolerance amplification coefficient is used to expand the spatial matching range of each keypoint in the behavioral sequence template. The amplification magnitude is positively correlated with the offset of each keypoint in the spatial trajectory offset feature. The trigger threshold reduction coefficient is used to reduce the thresholds of each user's vital signs in the context trigger condition set. The reduction magnitude is positively correlated with the action loss rate feature and the decay rate.

10. A dynamic intelligent service adaptation system for age-friendly scenarios, used to implement the method described in any one of claims 1-9, characterized in that, include: A construction module is configured to obtain a profile of the target user's lifestyle habits. The profile of the lifestyle habits is generated based on historical data through a classification model and is used to characterize the long-term behavioral patterns of the target user in different dimensions of life. The construction module is also configured to build a corresponding service adaptation model for each lifestyle habit in the lifestyle habit profile; the service adaptation model includes: The context trigger condition set includes environmental parameter conditions, time conditions, and user physical condition conditions that must be met when the habit is instantiated and executed in a specific context. A behavior sequence template, which contains a description of the temporal behavioral characteristics of the habit during execution; Dynamic service mapping includes a set of service instructions that need to be dynamically adapted and issued when the habit is identified as being instantiated. The acquisition module is configured to collect the target user's current behavior data, current environmental parameters, and current vital signs in real time to form a current behavior sequence; The matching module is configured to dynamically match the current behavior sequence with each of the service adaptation models, calculate the matching degree between the current behavior sequence and each service adaptation model; when the matching degree of any service adaptation model exceeds a first preset threshold, it is determined that the habit corresponding to the service adaptation model is currently in the instantiation execution state, and the target service adaptation model that has been successfully matched is identified. The instruction module is configured to generate service instructions based on the dynamic service mapping in the target service adaptation model, and send the service instructions to the corresponding service execution terminal to drive the service execution terminal to provide the target user with a dynamically adapted service that is adapted to the current instantiation execution state.