Digital painting therapy generation system based on dynamic difficulty adjustment and reinforcement learning
The digital painting therapy generation system, which utilizes dynamic difficulty adjustment and reinforcement learning, solves the problems of composition deviation recognition and insufficient task feedback. It achieves adaptability and technical application to different patient conditions, thereby improving the effectiveness and adaptability of painting therapy.
Patent Information
- Application Number
- CN202511071833.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-01
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2045-08-01
AI Technical Summary
In existing digital painting therapy, the composition stage lacks a task adjustment mechanism based on the patient's current emotional state and cognitive threshold, which leads to deviations such as cognitive escape or compositional closure in the composition behavior. Traditional difficulty adjustment mechanisms are unable to identify these deviations, resulting in the painting task failing to provide effective feedback.
A digital painting therapy generation system based on dynamic difficulty adjustment and reinforcement learning is adopted, including an initialization module, a closed composition recognition module, a task guidance module, a cognitive capacity assessment module, a strategy network construction module, and a dynamic adjustment module. By recognizing brush stroke trajectory stacking and jump lingering behavior, the system dynamically adjusts the task difficulty and path, and establishes a task guidance strategy network based on reinforcement learning.
It enables real-time identification and dynamic adjustment of compositional deviations, enhances the adaptability of digital painting therapy to different individual patient states, improves the intervention continuity and psychological adjustment effectiveness of painting tasks, and avoids painting interruptions and guidance failures.
Smart Images

Figure CN120564975B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of auxiliary treatment technology for mental disorders, and more specifically, to a digital painting therapy generation system based on dynamic difficulty adjustment and reinforcement learning. Background Technology
[0002] In digital painting therapy, the composition stage is the most crucial period for psychological intervention, during which patients exhibit significant individual cognitive differences. Most existing path scheduling systems are static planning structures, lacking task adjustment mechanisms based on the patient's current emotional state and cognitive thresholds. This leads to a deeper problem: compositional behavior often manifests as "cognitive escape" or "compositional closure" deviations. Patients avoid focal areas, cling to edges and corners, or form repetitive circular patterns during the composition process. These deviations reflect underlying psychological avoidance mechanisms and expressive difficulties. This type of cognitive deviation is not equivalent to differences in painting skills but rather a subconscious variation in psychological compositional behavior. Traditional difficulty adjustment mechanisms struggle to identify these deviations, resulting in ineffective feedback from the painting task and a loss of psychological and cognitive adjustment abilities early in training. Summary of the Invention
[0003] To overcome the aforementioned deficiencies of the prior art, embodiments of the present invention provide a digital painting therapy generation system based on dynamic difficulty adjustment and reinforcement learning to solve the problems mentioned in the background art.
[0004] To achieve the above objectives, the present invention provides the following technical solution:
[0005] A digital painting therapy generation system based on dynamic difficulty adjustment and reinforcement learning includes an initialization module, a closed composition recognition module, a task guidance module, a cognitive capacity assessment module, a policy network construction module, and a dynamic adjustment module, among which:
[0006] The initialization module establishes the drawing task area and initializes the corresponding task objectives and task difficulty.
[0007] During the patient's drawing task, the closed composition recognition module identifies the stacking and lingering behaviors of brush strokes and marks the corresponding local composition areas as closed composition areas.
[0008] The task guidance module excludes all candidate task points within the closed area of the graph and establishes executable task guidance paths in the remaining area based on the semantic coherence and difficulty of the tasks.
[0009] The cognitive capacity assessment module collects and records patients' emotional response data during task guidance, and defines the upper limit of patients' cognitive capacity based on the first mapping region transformation event that occurs in the task guidance path.
[0010] The strategy network construction module uses patient emotional response data and cognitive capacity limits as control parameters to establish a task-guided strategy network based on reinforcement learning.
[0011] The dynamic adjustment module continuously collects data on patients' drawing behavior and emotional response during the new drawing task cycle, and performs dynamic adjustments to the drawing task location and difficulty.
[0012] In a preferred embodiment, the initialization module establishes the drawing task area and initializes the corresponding task objective and task difficulty, specifically including:
[0013] At the start of the painting task, a coordinate system is established based on the canvas plane, and the painting area of the current painting task is divided.
[0014] Assign spatial numbers to the painting areas and bind them to the preset task configuration table;
[0015] Retrieve the task target data item associated with the drawing area. The task target data item contains the task target name and drawing structure requirements specified for the drawing area.
[0016] The task difficulty level of the labeled task target data item is determined by the drawing structure requirements, which include drawing structure complexity, prompt accuracy, and allowable drawing deviation range.
[0017] The painting area number, task target name, and task difficulty level are compiled into a painting task initialization configuration set.
[0018] In a preferred embodiment, the closed composition recognition module identifies brushstroke trajectory stacking and jump / lingering behaviors during the patient's drawing task, and marks the corresponding local composition areas as closed composition areas. Specifically, this includes:
[0019] Based on the configured drawing area coordinate system, the trajectory of continuous brush stroke events when the patient performs the drawing task is sampled, and the spatial coordinates of the start and end points of the brush strokes and the generation sequence are recorded.
[0020] Statistically analyze the number of overlapping brush stroke paths and the duration of operation in each drawing area to generate a trajectory stacking density distribution;
[0021] The system retrieves the region numbers in the trajectory stacking density distribution where the local density is greater than the average distribution value, marks them as behavior stacking segments, and performs a progress analysis on the drawing tasks in the behavior stacking segments.
[0022] If the task completion progress of the area corresponding to the behavior stacking segment exceeds the preset target, the corresponding area is marked as a closed area of the graph, and its area number and task target name are recorded.
[0023] In a preferred embodiment, the task guidance module excludes all candidate task points within the closed area of the graph and establishes an executable task guidance path in the remaining area based on task semantic coherence and task difficulty ranking, specifically including:
[0024] Within the current painting task cycle, for all area numbers, candidate points whose numbers overlap with the numbers of closed areas in the composition are eliminated to generate the remaining task point set.
[0025] Analyze the spatial adjacency relationships of the remaining task points, extract point pairs with distance continuity, and generate structurally coherent point segments that can construct paths;
[0026] Read the task difficulty level index associated with each task point, and perform a dual-track sorting of the target sequence association table based on semantic coherence and ascending task difficulty.
[0027] A task guidance path index list is generated based on the sorted task point sequence, and this index list is used as the executable task guidance path within the current painting task cycle.
[0028] In a preferred embodiment, the cognitive capacity assessment module collects and records the patient's emotional response data during task guidance, and defines the patient's cognitive capacity upper limit based on the first mapping region transition event that occurs during the task guidance path, specifically including:
[0029] The patient is guided to perform tasks based on an executable task guidance path, and the patient's emotional response data sequence during the task guidance is collected at the same time.
[0030] A waiting window is set for each task node in the executable task guidance path. The task event that first appears in the closed area of the map within the waiting window is listened for, and the task difficulty of the previous task position of the corresponding task event is marked as the upper limit difficulty of the patient's cognitive capacity.
[0031] In a preferred embodiment, the collection of patient emotional response data during task guidance specifically includes:
[0032] During the drawing task, a front-facing camera frame acquisition program is launched to capture a continuous stream of face images.
[0033] Inter-frame vector variation analysis was performed on the eye fissure width, frowning degree, and mouth corner tilt in the image stream to extract the facial tension sequence;
[0034] The system collects a sequence of grip pressure values in real time from the pressure sensing unit of the input device and records the average grip force fluctuation rate between pen stroke events.
[0035] By aligning facial tension and grip strength fluctuation data with timestamps, temporal emotional response data of patients can be generated.
[0036] In a preferred embodiment, the strategy network construction module, using patient emotional response data and cognitive capacity limits as control parameters, establishes a task-guided strategy network based on reinforcement learning, specifically including:
[0037] Using the cognitive capacity limit state defined by the task cycle as the endpoint, the continuously sampled emotional response data sequence is converted into a state vector set, and the state vector is bound to a specific task in the executable task guidance path;
[0038] In the executable task guidance path, the operation area number and task difficulty are defined as the two output dimensions of the strategy action space. A matching mapping between the state vector and the action variable is established and recorded as the state-action mapping.
[0039] Set a response flag field for the state-action mapping, define the successful switching event of the mapping target and the event of increased behavior response rate as positive feedback conditions, and generate a set of reward function vectors;
[0040] Using the state vector set, state-action mapping, and reward function vector set as input, the policy estimation network is invoked to perform batch policy training, adjust the action probability distribution function, record the update parameter trajectory, and output the converged policy model.
[0041] In a preferred embodiment, the dynamic adjustment module continuously collects patient drawing behavior and emotional response data during a new drawing task cycle, and performs drawing task position reallocation and dynamic adjustment of task difficulty, specifically including:
[0042] The sequence of emotional response data collected in the latest drawing task cycle is converted into a state vector and input into the task guidance policy network;
[0043] Based on the output of the policy network, update the task position and task difficulty in the original executable task guidance path in real time;
[0044] During task execution, pen stroke trajectory and synchronous emotion data are continuously collected, real-time feedback records are generated, and written into the strategy network experience playback structure to continuously update the strategy network.
[0045] The technical effects and advantages of this invention's digital painting therapy generation system based on dynamic difficulty adjustment and reinforcement learning are as follows:
[0046] This invention provides a digital painting therapy guidance method oriented towards compositional deviation detection. It can identify abnormal stacking and lingering characteristics in the patient's compositional behavior during the painting task execution process, mark closed areas of the composition, and eliminate abnormal task points accordingly, thereby dynamically constructing a task guidance path that better matches the current cognitive state. The system collects the patient's emotional response data during task guidance and combines it with the first transition event of the compositional area to determine the individual's cognitive capacity limit. This state is used as the input for strategy training to establish a reinforcement learning-driven task guidance strategy network. In subsequent painting cycles, the strategy output controls the task focus and prompt difficulty, forming a closed-loop task scheduling mechanism of "state recognition—strategy control—behavior collection—strategy update." This method possesses the ability to identify abnormal compositional behavior, the ability to adapt the task path structure in real time, and the ability to continuously optimize the guidance strategy. It can avoid problems such as painting task interruption, expression avoidance, and guidance failure caused by cognitive escape or compositional closure, enhancing the adaptability of digital painting therapy to the differences in individual patient states and improving the continuity of intervention and psychological adjustment efficacy of painting tasks. Attached Figure Description
[0047] Figure 1 This is a schematic diagram of the structure of the digital painting therapy generation system based on dynamic difficulty adjustment and reinforcement learning of the present invention. Detailed Implementation
[0048] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.
[0049] Example 1
[0050] Figure 1 This invention presents a digital painting therapy generation system based on dynamic difficulty adjustment and reinforcement learning, comprising an initialization module, a closed composition recognition module, a task guidance module, a cognitive capacity assessment module, a policy network construction module, and a dynamic adjustment module, wherein:
[0051] The initialization module establishes the drawing task area and initializes the corresponding task objectives and task difficulty.
[0052] During the patient's drawing task, the closed composition recognition module identifies the stacking and lingering behaviors of brush strokes and marks the corresponding local composition areas as closed composition areas.
[0053] The task guidance module excludes all candidate task points within the closed area of the graph and establishes executable task guidance paths in the remaining area based on the semantic coherence and difficulty of the tasks.
[0054] The cognitive capacity assessment module collects and records patients' emotional response data during task guidance, and defines the upper limit of patients' cognitive capacity based on the first mapping region transformation event that occurs in the task guidance path.
[0055] The strategy network construction module uses patient emotional response data and cognitive capacity limits as control parameters to establish a task-guided strategy network based on reinforcement learning.
[0056] The dynamic adjustment module continuously collects data on patients' drawing behavior and emotional response during the new drawing task cycle, and performs dynamic adjustments to the drawing task location and difficulty.
[0057] The initialization module establishes the drawing task area and initializes the corresponding task objectives and task difficulty.
[0058] During the initialization phase of the painting task, the system first identifies the canvas structure involved in the current task. In this embodiment, the canvas is presented in a two-dimensional plane. Based on its drawable area, the system establishes a Cartesian coordinate system, with the upper left corner of the canvas as the origin (0,0) and the lower right corner as the maximum boundary point (W,H). W and H define the horizontal and vertical dimensions of the canvas, and the units can be pixels, millimeters, or system-wide common graphics units. In this embodiment, the canvas size is set to 600×400 units. To support task area management, the system divides the canvas into several equal-area painting task unit areas according to fixed rules. In this embodiment, it is divided horizontally into 6 segments and vertically into 4 segments, resulting in a total of 24 painting areas, each 100×100 units in size. Each divided painting area is assigned a unique number, with the numbering rule being sequentially increasing from left to right and from top to bottom. For example, the upper left area is numbered R01, and the lower right area is numbered R24. This number is used not only for spatial positioning but also as the basic unit for subsequent task scheduling. To enable each region to have a callable task definition, the system sets up a task configuration table. This table is a database structure that records the mapping relationship between each drawing region number and its corresponding task attributes. The task configuration table includes, but is not limited to, the following fields: drawing region number, task target name, drawing structure requirements, suggested task order, and recommended prompting method.
[0059] The initial task configuration is defined by the system designers. For example, region R05 is configured as "basic background fill," region R14 as "outline structure sketching," and region R21 as "detailed meta-sketching lines." This configuration table can automatically filter and match task subsets based on patient profile information. The spatial binding rules for task configuration are established through the region number field. When the system initializes, it identifies the current task scope and automatically loads the corresponding task definition based on the region number.
[0060] After the drawing area coordinates are divided and numbered during the initialization phase of the drawing task, the binding and retrieval of the task target will be executed immediately. In this embodiment, the system retrieves the corresponding task target data item based on the drawing area number by calling the aforementioned task configuration table. Each task target data item exists in a structured data format, with fields including the task target name, the set of drawing structure requirements fields, and task prompt configuration fields. The drawing structure complexity is determined by comprehensively evaluating the shape boundaries, detail density, and structural closure of the task graphic in spatial distribution.
[0061] During system initialization, the drawing structure requirements parameters are calibrated by domain experts, with structural complexity ranging from 1 to 5 levels. Level 1 represents line filling tasks, and level 5 represents detailed line drawing or image reconstruction tasks. The prompt accuracy refers to the clarity of the task guidance information provided to the user, ranging from 1 to 3 levels. Level 1 provides free prompts (e.g., free-fill areas), level 2 provides structural masking prompts (e.g., boundary indicator lines), and level 3 provides graphic skeleton outlining prompts. The allowable drawing deviation range is the error value allowed by the task objective to deviate from the system reference path during drawing, measured in pixels or spatial units. In this example, it is set to ±10 pixels, meaning a valid response is considered to be within 10 pixels of the system graphic outline. For example, the task objective name for region R08 is "Outline-Guided Drawing," and its drawing structure requirements field contains: structural complexity level 3 (out of 5), prompt accuracy level 2 (out of 3), and allowable drawing deviation range of ±10 pixels, corresponding to a task difficulty level of 2. After reading and parsing the task objective fields, the system will automatically generate the task difficulty level. All generated task numbers, task target names, and task difficulty levels are compiled into a painting task initialization configuration set. This configuration set will serve as the core task parameter input structure before the painting task is executed, and will be called by the task guidance module and the strategy network module.
[0062] During the patient's drawing task, the closed composition recognition module identifies the stacking and lingering of brush strokes and marks the corresponding local composition areas as closed composition areas.
[0063] During the drawing process, the system collects continuous pen stroke trajectories via a stylus or touch device. Each pen stroke trajectory is represented by a discrete point sequence, including the start point, end point, and several intermediate sampling points. All points record their spatial coordinates and corresponding timestamps. The system sampling frequency is set to 100 times per second to ensure trajectory continuity and response accuracy. The trajectory data is mapped in real-time to various drawing areas within the canvas coordinate system. The system determines which spatial region a pen stroke belongs to based on its starting point coordinates. If a pen stroke spans multiple regions, the system allocates the path count to each region proportionally based on the duration of the trajectory's midpoint in each region. For each drawing area, the system calculates two key indicators: path overlap count (the number of times the trajectory within that region overlaps with previous trajectories) and operation dwell time (the total time the pen stroke remains within that region). The path overlap count is calculated using the local aggregation degree of the trajectory point positions. The system sets a spatial adjacency threshold of 10 pixels; that is, if the Euclidean distance between two trajectory points is less than 10 pixels, they are considered to overlap. The dwell time is calculated by accumulating the time difference of the brush strokes within that area.
[0064] The aforementioned metrics are used as the basis for generating a trajectory stacking density distribution map. The stacking density distribution map is indexed by region number, and the density value of each region is formed by a weighted average of its path overlap frequency and operation dwell time. For ease of judgment, the system performs normalization processing on the density values of all regions and calculates the average density and standard deviation for the current drawing cycle; the results are used for subsequent behavior stacking determination. The entire trajectory stacking density distribution is refreshed once after each task cycle and is generated in real-time using a progressive update method during the drawing process.
[0065] Based on the generated trajectory stacking density distribution map, the density values of all drawing areas are statistically analyzed. The average density of all drawing areas within the current task period is set as the global reference benchmark, and the system uses this as a threshold for local density filtering. If the trajectory stacking density value of a certain area exceeds this average, the area is initially marked as a candidate behavior stacking segment. In this embodiment, the average density value is set as the arithmetic mean of the density values of all areas within the task period. If the density value of a certain area is greater than the average by more than 15%, the system adds its number to the stacking candidate area list. This threshold is flexibly set based on the task difficulty and the precision of the specific treatment intervention. For areas marked as candidate stacking segments, the system further evaluates the completion progress of their corresponding tasks. The completion progress of the drawing task is comprehensively determined based on factors such as the brushstroke coverage rate, trajectory coverage range, and graphic structure closure within the area. In this embodiment, the coverage rate is defined as the percentage of effective filled pixels of the brushstroke path within the area; the trajectory coverage range is estimated using the area of the bounding rectangle of the trajectory distribution; and the graphic structure closure is automatically detected by whether the brushstrokes form a closed loop structure. The three indicators are weighted at 0.4, 0.4, and 0.2 to synthesize the task completion rate.
[0066] The threshold for determining the closure of a task completion progress is set at 85% (this threshold can be flexibly set based on the precision of the specific treatment intervention). That is, if the overall task completion rate of a region is greater than 85%, and it has previously been marked as a stacked segment, then that region is officially identified as a closed region of the composition. This value is derived empirically, reflecting that when a patient remains in a region for an extended period despite high operational intensity and task completion, it is likely due to a psychological reaction of cognitive avoidance or compositional fixation.
[0067] The task guidance module excludes all candidate task points within the closed area of the graph and establishes an executable task guidance path in the remaining area based on the semantic coherence of the task and the difficulty of the task.
[0068] After identifying closed areas in the composition, the system generates a table of labeled closed areas, recording the area numbers and corresponding task names of all areas determined to be in a closed state within the current drawing cycle. To prevent patients from being repeatedly guided to psychologically avoidable areas or creating a closed composition loop during task guidance, the system first performs area exclusion processing before constructing the task path. The system obtains a list of all drawing area numbers within the current cycle, iterates through this list, and compares it with the set of closed area numbers. If a number overlaps in both sets, the task point corresponding to that number is removed and not included in the current task path candidate point set. After exclusion, the system extracts the spatial position of the remaining task points in the canvas coordinate system and generates a two-dimensional coordinate matrix based on the number position. To filter continuous point pairs that can be used for path construction, the system makes a judgment based on spatial adjacency. Adjacency is defined as whether the distance between the center coordinates of any two task points is less than a set maximum connection distance threshold. In this embodiment, the maximum connection distance is set to 150 units (which can be automatically calculated based on the canvas scaling level). If the Euclidean distance between two points is less than this threshold, they are identified as adjacent point pairs and marked as constructible path segments. Structurally coherent point segments are constructed based on these adjacent point pairs. Each segment consists of several consecutive adjacent task points, arranged in a consistent direction or with a closed trend in space. The system further evaluates the role and position of the start and end regions of each structurally coherent segment in the image composition, such as "converging from the edge to the center" or "distributed according to a horizontal extension pattern." This structural information provides a reference for the compositional trend dimension in subsequent sorting.
[0069] After extracting the structurally coherent segments, the content attributes of the task points are jointly sorted. First, the task target name and task difficulty level index bound to each task point are read sequentially. The task difficulty level is a parameter configured by the system during the initialization phase, typically determined by a comprehensive assessment of the structural complexity of the drawing target, the accuracy of prompts, and the allowable range of drawing errors. A "target sequence association table" is constructed for all task points, recording the task point number, task target, task difficulty level, and its spatial order within the structurally coherent segments. The sorting strategy employs a dual-track joint rule: on the one hand, the semantic coherence between task targets is the primary sorting criterion; on the other hand, the task difficulty level is used for secondary sorting. Semantic coherence refers to whether there is a content progression relationship between task targets in terms of drawing semantics, such as "background coloring" - "edge outlining" - "structural sketching" forming a natural evolutionary order. The system pre-maps semantic tags to the task configuration table, labeling each task target with its superior and subordinate semantic categories. For example, "figure outline" is "structural main body," its subordinate category is "facial details," and its superior category is "background composition."
[0070] During the sorting process, the system first performs a coarse sorting of all task points in a structurally coherent segment according to semantic order. Then, within the same semantic level, it sorts them in ascending order of difficulty level, ultimately obtaining a task point execution priority path. The sorting result is output as a task guidance path index list, where each item is a region number, and their arrangement order represents the suggested guidance path execution sequence for the current painting task cycle.
[0071] The cognitive capacity assessment module collects and records the patient's emotional response data during task guidance, and defines the upper limit of the patient's cognitive capacity based on the first mapping region transformation event that occurs in the task guidance path.
[0072] After the drawing task officially begins, the system simultaneously activates the image frame acquisition module of the front-facing camera. The camera's operating frequency is set to 20 frames per second, enabling continuous observation of the patient's facial expression changes. The system calls the facial expression analysis subroutine to perform structured facial feature extraction processing on each acquired image frame. The system employs facial key point recognition technology to extract 68 standard landmarks from the facial image, focusing on analyzing three types of tension indicators: palpebral fissure width, frowning degree, and mouth corner tilt. Palpebral fissure width is obtained by measuring the longitudinal distance between the two corners of the eyes; this distance typically shows continuous contraction under emotional tension and anxiety. Frowning degree is estimated by combining the lateral contraction between the eyebrows with the upward angle of the brow peak. Mouth corner tilt is represented by the change in the angle between the mouth corner's axis of symmetry and the horizontal baseline, typically deviating significantly from the neutral value under emotional states such as disgust and distress. The system calculates the inter-frame difference of the changes in these three indicators between adjacent frames and converts it into a vector change sequence. This expression tension sequence reflects the micro-expression fluctuations of the patient's face during continuous task execution. To eliminate the influence of individual differences in facial expression structure, the system collects a 5-second static facial state as an "emotional baseline" before the task starts, and uses the baseline deviation as a reference indicator for subsequent changes. For example, if the width of the eye fissure decreases by more than 20% of the baseline for more than 3 consecutive seconds, the system classifies that period as the "expression contraction interval".
[0073] The input device is a capacitive stylus supporting multi-point pressure sensing. Equipped with a pressure sensing unit, it captures changes in grip pressure in real time during user drawing. The system samples grip force values at a frequency of 100Hz, storing the data continuously in time-series format. Each stroke's start and end is defined as a stroke event. Between every two stroke events, the system calculates the maximum, minimum, and average grip force (grip pressure) values, and then calculates the grip force fluctuation rate. The grip force fluctuation rate is defined as the ratio of the difference between the maximum and minimum grip force values within the current stroke event to the average grip force value. The system sets the initial baseline period to 10 seconds before task initiation, recording the average grip force fluctuation range when the patient is in a static state without any drawing activity. During actual drawing, if the grip force fluctuation rate exceeds 30% of the baseline value for multiple consecutive stroke events, the system marks the current period as an "abnormal grip force response interval." To integrate the two dimensions of facial expression tension and grip force response, the system merges the two signals using a unified timestamp alignment method. The emotional response state at each moment is recorded in the form of a triple: T (time), E (expression tension value), and P (grip strength fluctuation rate). For each drawing task node, the system constructs a time window (e.g., ±3 seconds) centered on the node trigger time, and extracts all corresponding emotional state triples within the window to form the temporal emotional response sequence for the current task stage.
[0074] An executable task guidance path typically consists of several task nodes, each corresponding to a specific drawing task area and objective. To detect whether there are operational points exceeding the patient's cognitive capacity during task progression, the system configures a "task waiting window" for each task node. The task waiting window refers to a limited monitoring time interval after the system issues the task prompt at that node, with a default setting of 5 seconds, which can be dynamically adjusted according to the complexity of the task structure, ranging from 3 to 8 seconds. During the task waiting window, the system monitors in real time whether the patient's behavioral trajectory enters the closed area of the drawing. The closed area of the drawing is a psychological escape area previously identified through stroke stacking and task completion. If the system detects that the current task execution behavior jumps to the closed area within the window, it determines that the current task point has triggered cognitive overload behavior. At this time, the system backtracks to the previous task node of this task event and extracts the task objective number and task difficulty level corresponding to that node. This task difficulty level is marked as the upper limit of the patient's cognitive capacity in the current cycle and used as a threshold reference input in the training samples of the policy network.
[0075] The strategy network construction module uses patient emotional response data and cognitive capacity limits as control parameters to establish a task-guided strategy network based on reinforcement learning.
[0076] Within each task cycle, each time point during the task execution period is constructed as a state record. The state vector structure includes: the current facial tension index (a weighted representation of the three tension indices of the tension dimension), grip strength fluctuation rate, current task area number, task target difficulty level, relative position index of the task path, and distance from the cognitive upper limit (time offset or task sequence distance). Simultaneously, normalization is performed on the emotional signal dimension, and discrete encoding is used on the task attribute dimension. This ultimately forms a set of state vectors, denoted as a structured state set driven by time series. Each state vector is bound to the task point that the system is currently guiding, linking the context of each emotional state with its corresponding drawing task state. For example, when the system guides the user to perform "structural border filling" in step 3 of the task path, if the emotional state collected by the system at this time shows a synchronous increase in grip strength fluctuation and facial tension reaction, then this set of state data is bound to the 3rd task node.
[0077] The policy network aims to intelligently output the most suitable task allocation strategy based on the patient's current cognitive condition. First, the expression structure of the policy action is defined: each policy action consists of two dimensions: the "task focus region number" and the "complexity level of the prompt task." The system extracts all task points from the guidance path, generating an action space set, where each action is a combination of (region number, level). The state vector set constructed in the previous step is matched item by item with the actual task allocation behavior given by the system at that time, forming a state-action mapping record. For example, when state vector S_i appears, the system schedules task point R07 with a difficulty level of 3, forming the mapping (S_i→A_j), where A_j is (R07, 3). Each state-action mapping record will serve as the training basis for subsequent policy functions.
[0078] A response flag field is added to the state-action mapping to evaluate the effectiveness of the strategy behavior. This field defines whether the strategy execution result is judged as "positive behavioral feedback," mainly consisting of two types of events: first, a successful switching event of the drawing target, that is, the patient successfully transitions from the current task to the next task without any closed loops or interruptions; second, an increase in behavioral response rate, that is, after the strategy action guidance, the patient's pen stroke initiation reaction time, path length, or drawing continuity indicators significantly improve. The above positive feedback events are marked as "1," and no feedback or negative reaction is marked as "0," forming a reward function vector set.
[0079] The policy evaluation network employs a reinforcement learning structure (Actor-Critic structure) to output the action probability distribution under each state. The evaluation network assesses the long-term value of the current policy. To improve training stability and convergence efficiency, the system uses a mini-batch training approach, training with a fixed number of state-action-reward triplets in each iteration. The policy network input consists of a mini-batch of state vectors, corresponding action combinations, and corresponding reward values. During training, the policy network outputs the action probability distribution based on the current state. The system calculates the deviation between the policy selection and the actual action, and, combined with the long-term reward evaluation from the evaluation network, performs backpropagation gradient correction on the policy parameters. After each iteration, the system records the policy parameter change trajectory and saves an intermediate version before convergence to prevent training oscillations or regressions. Specifically, the probability distribution is a normalized vector composed of the selection probability values of each candidate action (e.g., using a Softmax function) output according to a preset action space after the policy network receives the state vector input. This vector represents the relative execution tendency of each task-guided action under the current state.
[0080] The convergence criterion is set as follows: if the rate of change of the policy action probability distribution is lower than a set threshold (e.g., 2%) over 10 consecutive training rounds, and the average reward increase is less than 5%, the policy is considered to be stable. The converged policy model is formally written into the guiding policy library and activated during the initialization of the next drawing task cycle. The policy model output will override the default path sorting result and will be prioritized for focal region reconstruction and fine-tuning of cue complexity.
[0081] The dynamic adjustment module continuously collects patient drawing behavior and emotional response data during a new drawing task cycle, and performs dynamic adjustments to the drawing task location and difficulty.
[0082] When a new task cycle arrives, a state vector is constructed from the emotional response data sequence. The state vector consists of multiple features, including: emotional trend parameters, such as statistical features like tension fluctuation rate and grip strength variation rate over the past 10 seconds; task context parameters, such as the task node position in the current drawing path, its area number, and task prompt level; cognitive state parameters, such as its relative position to the cognitive capacity limit in the task path; and historical success rate labels, such as whether a closed loop occurred during the previous task execution. All state vectors are arranged in chronological order to form a state vector set, which is then input into a task guidance strategy network deployed on a local terminal or in the cloud. This strategy network has been trained over multiple task cycles and possesses the ability to infer appropriate task scheduling behavior based on the state. After inputting the state vectors, the strategy network outputs the recommended task position (task point number) and corresponding task guidance prompt level for the current state. This output is expressed as a probability distribution, and recommended actions are generated using either the maximum probability action selection strategy or a probability sampling strategy, depending on the strategy settings.
[0083] After the policy network outputs a recommended action, the system parses it into two key parameters: the new task focus area number and the suggested task cue complexity level. The system performs a partial replacement operation on the current task path. If the task point recommended by the policy network differs from the next node in the current path, the focus position is switched. The system sets a switching threshold: if the set action is in the top 20% of the action probability distribution and the emotional state is determined to be increased grip strength or attention shift, then path adjustment is activated. For task difficulty adjustment, while keeping the task point unchanged, the guidance method for the current task is changed according to the cue level recommended by the policy network. For example, if the original path setting area R08 is level 3 (structural guidance + text cue), while the policy network suggests level 1, the system switches to a "brief border mask cue" mode. This adjustment does not affect the task objective itself, but only lowers the execution threshold to improve acceptability.
[0084] During the task execution phase after the strategy network intervenes in the scheduling, the system continues to collect user operation behavior and emotional expression synchronously for subsequent continuous updates and self-correction of the strategy network. The collected data includes pen stroke trajectory parameters (such as start point, end point, path length, dwell area, and time interval between actions) and emotional response indicators (such as slight changes in facial tension and slight shaking of grip). After each task node is completed, the system evaluates the behavior of that task segment and generates feedback markers according to preset feedback rules. For example: (1) If the user's pen strokes are continuous, the trajectory is full, there is no obvious path retreat during task execution, and the emotional state remains stable or improves, the system marks it as "positive feedback"; (2) If the emotional tension increases, the pen stroke dwell time is prolonged, or the user jumps to a closed area of the composition during task execution, the system marks it as "negative feedback".
[0085] Each state vector, selected action (i.e., the recommended task point and prompt level for that node), and corresponding feedback tag triple are written into the experience replay structure. The experience structure uses a fixed-size rolling cache, retaining at most the task data from the most recent 50–100 rounds. Policy update training is performed every few rounds, calling the stored state-action-feedback samples for batch gradient optimization, and updating the action probability distribution function parameters within the policy network.
[0086] The above formulas are all dimensionless calculations. The formulas are derived from software simulations based on a large amount of collected data to obtain the most recent real-world results. The preset parameters and thresholds in the formulas are set by those skilled in the art according to the actual situation.
[0087] The above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any other combination thereof. When implemented using software, the above embodiments can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more sets of available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium. The semiconductor medium can be a solid-state drive.
[0088] Those skilled in the art will recognize that the modules and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0089] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and modules described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0090] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or modules may be electrical, mechanical, or other forms.
[0091] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0092] In addition, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module.
[0093] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0094] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0095] In conclusion, the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A digital painting therapy generation system based on dynamic difficulty adjustment and reinforcement learning, characterized in that, The system comprises an initialization module, a closed composition identification module, a task guidance module, a cognitive load evaluation module, a strategy network construction module, and a dynamic adjustment module, wherein: The initialization module establishes a drawing task area, initializes a corresponding task target and task difficulty; The closed composition identification module identifies the behavior of trajectory stacking and jump retention during the patient's execution of the drawing task, and marks the corresponding local composition area as a composition closed area; The task guidance module excludes all task candidate points in the composition closed area, establishes an executable task guidance path in the remaining area according to the semantic coherence of the task and the task difficulty ranking, and establishes an executable task guidance path; The cognitive load evaluation module collects and records the emotional response data of the patient during the task guidance, and defines the upper limit of the patient's cognitive load according to the first composition area conversion event in the task guidance path; The strategy network construction module establishes a task guidance strategy network based on reinforcement learning with the patient's emotional response data and cognitive load upper limit as control parameters; The dynamic adjustment module continuously collects the drawing behavior and emotional response data of the patient during a new round of drawing task period, and performs position redistribution and dynamic adjustment of task difficulty during the drawing task; The closed composition identification module identifies the behavior of trajectory stacking and jump retention during the patient's execution of the drawing task, and marks the corresponding local composition area as a composition closed area, specifically comprising: Based on the configured drawing area coordinate system, the continuous trajectory events of the patient performing the drawing task are sampled, and the spatial coordinates and generation time sequence of the starting point and ending point of the trajectory are recorded; The number of trajectory path overlaps and operation retention time in each drawing area are counted, and the trajectory stacking density distribution is generated; The region number of the local density greater than the average distribution value in the trajectory stacking density distribution is retrieved, and is marked as a behavior stacking section. The drawing task in the behavior stacking section is analyzed for completion progress; If the task completion progress of the behavior stacking section corresponding to the region exceeds the preset indicator, the corresponding region is marked as a composition closed area, and its region number and task target name are recorded; The cognitive load evaluation module collects and records the emotional response data of the patient during the task guidance, and defines the upper limit of the patient's cognitive load according to the first composition area conversion event in the task guidance path, specifically comprising: Based on the executable task guidance path, the patient is guided in the task, and the emotional response data sequence of the patient during the task guidance is collected; A waiting window is set for each task node in the executable task guidance path, and the first occurrence of a task event in the waiting window is listened to. The task difficulty of the last task position of the corresponding task event is marked as the upper limit of the patient's cognitive load. 2.The digital painting therapy generation system based on dynamic difficulty adjustment and reinforcement learning of claim 1, wherein, The initialization module establishes a drawing task area, initializes a corresponding task target and task difficulty, specifically comprising: At the starting moment of the drawing task, a coordinate system is established based on the canvas plane, and the drawing area of the current drawing task is divided; The drawing area is numbered and bound to the preset task configuration table; The task target data item associated with the drawing area is called, which includes the task target name and drawing structure requirement specified by the drawing area. annotating a task difficulty level of a task target data item, the level being determined by a drawing structure requirement, the drawing structure requirement including a drawing structure complexity, a hint precision, and an allowed drawing deviation range; summarizing the drawing area number, the task target name, and the task difficulty level into a drawing task initialization configuration set. 3.The digital painting therapy generation system based on dynamic difficulty adjustment and reinforcement learning of claim 1, wherein, The task guide module excludes all task candidate points in the composition closed area, and establishes an executable task guide path in the remaining area according to task semantic coherence and task difficulty sorting, which specifically includes: In all area numbers in the current drawing task period, the candidate points with overlapping numbers with the composition closed area numbers are executed to remove the candidate points, and a remaining task point set is generated; In the remaining task point set, analyze the spatial adjacency relationship of each point, extract point pairs with distance continuity, and generate structure coherent point segments that can be constructed into paths; Read the task difficulty level index associated with each task point, and perform double-track sorting of the target sequence association table in ascending order of semantic coherence and task difficulty; According to the sorted task point sequence, generate a task guide path index list, and use the index list as the executable task guide path in the current drawing task period. 4.The digital painting therapy generation system based on dynamic difficulty adjustment and reinforcement learning of claim 1, wherein, The emotion response data of the patient during the task guide period specifically includes: Start the front camera frame acquisition program to capture a continuous face image stream during the drawing task execution; Perform inter-frame vector change analysis on the eye slit width, frown degree, and mouth corner inclination in the image stream to extract an expression tension sequence; Real-time collect a grip pressure value sequence from the pressure sensing unit of the input device, and record the average grip fluctuation rate between pen touch events; Align the expression tension and grip fluctuation data by timestamp to generate the time sequence emotion response data of the patient. 5.The digital painting therapy generation system based on dynamic difficulty adjustment and reinforcement learning of claim 1, wherein, The strategy network construction module uses the patient emotion response data and the cognitive load upper limit as control parameters to establish a task guide strategy network based on reinforcement learning, which specifically includes: Use the cognitive load upper limit state calibrated by the task period as the terminal point, convert the continuously sampled emotion response data sequence into a state vector set, and bind the state vector to a specific task in the executable task guide path; In the executable task guide path, define the operation area number and the task difficulty as two output dimensions of the strategy action space, establish a matching mapping between the state vector and the action variable, and record it as a state-action mapping; Set a response marker field for the state-action mapping, define the composition target successful switching event and the behavior response rate rising event as positive feedback conditions, and generate a reward function vector set; Take the state vector set, the state-action mapping, and the reward function vector set as inputs, call the policy evaluation network to perform batch policy training, adjust the action probability distribution function, record the updated parameter trajectory, and output the converged policy model. 6.The digital painting therapy generation system based on dynamic difficulty adjustment and reinforcement learning of claim 1, wherein, The dynamic adjustment module continuously collects the drawing behavior and emotion response data of the patient in a new round of drawing task period, and performs drawing task position redistribution and task difficulty dynamic adjustment, which specifically includes: Convert the emotion response data sequence collected in the latest drawing task period into a state vector, and input it into the task guide strategy network; Based on the output of the policy network, update the task position and task difficulty in the original executable task guidance path in real time; During task execution, pen stroke trajectory and synchronous emotion data are continuously collected, real-time feedback records are generated, and written into the strategy network experience playback structure to continuously update the strategy network.
Citation Information
Patent Citations
Handwriting analysis method, device and equipment and readable storage medium
CN113869257A
Neuropsychological assessment and intervention method, system and device based on drawing creation
CN115394395A