Mouse track generation method and system for simulating user behavior, medium and equipment

By building a real trajectory library and performing precise matching and preprocessing, the problem of lack of authenticity of mouse trajectories generated in the prior art is solved, and a trajectory generation and verification effect with higher authenticity is achieved.

CN120014120APending Publication Date: 2025-05-16SUZHOU CHUANGLUTIANXIA INFORMATION TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411883057.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-19
Publication Date
2025-05-16

AI Technical Summary

Technical Problem

When the prior art generates mouse trajectory test samples of human-computer verification codes, it is difficult to truly reflect human operation characteristics, resulting in the lack of authenticity of the generated trajectory.

Method used

By collecting multiple real trajectory data, we can build a trajectory library, obtain the starting point and end point in the verification code image, calculate the trajectory direction and trajectory length, and match it in the trajectory library, obtain the target trajectory and preprocess it to generate a simulated trajectory.

Benefits of technology

Ensure that the generated trajectory data comes from real manual operations, avoid mechanical characteristics, improve the authenticity and applicability of the trajectory, and ensure the validity of verification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120014120A_ABST
    Figure CN120014120A_ABST
Patent Text Reader

Abstract

The invention discloses a mouse track generation method and system for simulating user behaviors, a medium and equipment, and relates to the technical field of user simulation. The method comprises the steps that multiple pieces of real track data are collected, and a track library is constructed based on the track data; obtaining a starting point and an end point in a verification code image needing to be verified, and calculating a track direction and a track length based on the starting point and the end point; matching in the trajectory library based on the trajectory direction and the trajectory length to obtain a target trajectory; and preprocessing the target trajectory to obtain a simulated trajectory. By implementing the technical scheme provided by the invention, the authenticity of the mouse track can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of user simulation technology, and in particular to a method, system, medium and device for generating mouse tracks for simulating user behavior. Background Art

[0002] With the rapid development of Internet behavioral verification codes, more and more human-machine verification products use human behavior analysis as one of the important defense methods. The most common practice is to use mouse tracks to distinguish between human behavior and machine behavior. In this type of behavioral verification code, users are usually required to click once or multiple times, and the background will collect the mouse tracks on the page to determine whether it is a real person operation.

[0003] At present, in order to evaluate the security and reliability of behavioral verification codes, researchers need to construct a large number of test samples. Currently, common testing methods mainly include two categories: one is to construct trajectories based on mathematical models, such as using mathematical models such as polynomial functions and trigonometric functions to generate trajectory data; the other is to superimpose random noise on the collected real trajectories to increase the diversity of trajectories. However, the trajectory data generated by these traditional methods often show obvious mechanical characteristics, rely too much on simple mathematical models or random disturbances, and are difficult to truly reflect the characteristics of human operations, resulting in the lack of authenticity of the generated trajectories. Summary of the invention

[0004] The present application provides a method for generating mouse tracks by simulating user behavior, which can truly reflect the characteristics of human operations and improve the authenticity of mouse tracks.

[0005] In a first aspect, the present application provides a method for generating a mouse trajectory simulating user behavior, the method comprising: Collecting a plurality of real trajectory data, and building a trajectory library based on each of the trajectory data; Obtaining a starting point and an end point in a verification code image to be verified, and calculating a trajectory direction and a trajectory length based on the starting point and the end point; Matching the trajectory library based on the trajectory direction and the trajectory length to obtain a target trajectory; The target trajectory is preprocessed to obtain a simulated trajectory.

[0006] By adopting the above technical solution, a trajectory library is constructed by collecting multiple real trajectory data, ensuring that the basic data for generating the trajectory comes from real manual operations. This method based on real data avoids the mechanical characteristics generated by the traditional mathematical model construction method. Secondly, by calculating the trajectory direction and trajectory length in the verification code image and accurately matching them in the trajectory library, it is ensured that the selected target trajectory is highly consistent with the verification requirements in terms of motion characteristics, thereby improving the applicability of the generated trajectory. Finally, by preprocessing the target trajectory, while maintaining the basic characteristics of the trajectory, it is fully adapted to the specific needs of the current verification scenario, which not only ensures the authenticity of the trajectory, but also ensures the effectiveness of the verification.

[0007] Optionally, collecting a plurality of real trajectory data and constructing a trajectory library based on each of the trajectory data includes: Obtain the continuous movement and click operations of different users' mice to obtain multiple real initial trajectory data; Detecting the mouse pressing and lifting actions in each of the initial trajectory data, and extracting the movement data between two adjacent mouse pressing and lifting actions as a valid trajectory segment; A trajectory library is constructed based on each of the valid trajectory segments.

[0008] Optionally, constructing a trajectory library based on the valid trajectory segments includes: Obtaining the starting point and the end point of each valid trajectory segment; Calculating the trajectory direction and trajectory length based on the starting point and the end point of each valid trajectory segment, and dividing the trajectory direction of each valid trajectory segment into a plurality of direction intervals; Each valid trajectory segment is classified and stored according to the corresponding direction interval to obtain a trajectory library, which includes multiple valid trajectory segments and the trajectory direction and trajectory length corresponding to each valid trajectory segment.

[0009] Optionally, the calculating the trajectory direction and the trajectory length based on the starting point and the end point includes: Selecting a first group of sampling points within a preset range centered at the starting point, and selecting a second group of sampling points within a preset range centered at the end point; Calculating the centroid coordinates of the first group of sampling points and the second group of sampling points respectively to obtain first centroid coordinates and second centroid coordinates; Calculate a main direction vector based on the first centroid coordinates and the second centroid coordinates; The angle between the main direction vector and the horizontal direction is taken as the trajectory direction; The Euclidean distance between the first centroid coordinates and the second centroid coordinates is calculated as the trajectory length.

[0010] Optionally, the matching in the trajectory library based on the trajectory direction and the trajectory length to obtain the target trajectory includes: Filtering out a first trajectory in a direction interval corresponding to the trajectory direction in the trajectory library; Calculating the difference between the trajectory length of each of the first trajectories and the trajectory length; Obtaining a preset number of second trajectories with the smallest difference values; Calculating the curvature characteristics and the speed characteristics of each of the second trajectories; Each of the second trajectories is scored based on the curvature feature and the speed feature, and the second trajectory with the highest score is used as the target trajectory.

[0011] Optionally, preprocessing the target trajectory to obtain a simulated trajectory includes: Calculating a proportionality coefficient between the trajectory length of the target trajectory and the trajectory length in the verification code image; Proportionally scaling each trajectory point of the target trajectory based on the proportional coefficient to obtain a scaled trajectory; The scaled trajectory is sampled, translated and rotated in sequence to obtain a simulated trajectory.

[0012] Optionally, the sampling, translating and rotating the scaled trajectory in sequence to obtain a simulated trajectory includes: Sampling the scaled trajectory points to obtain a sampling point sequence; The sampling point sequence is translated to the starting point to obtain a translated trajectory; Calculating the angle between the trajectory direction and the translated trajectory; The translated trajectory is subjected to a rotation transformation based on the angle so that the translated trajectory is consistent with the trajectory direction to obtain the simulated trajectory.

[0013] In a second aspect of the present application, a mouse trajectory generation system for simulating user behavior is provided, the system comprising: A trajectory library building module, used for collecting a plurality of real trajectory data and building a trajectory library based on each of the trajectory data; A trajectory calculation module, used to obtain a starting point and an end point in the verification code image to be verified, and calculate a trajectory direction and a trajectory length based on the starting point and the end point; A trajectory matching module, used for matching in the trajectory library based on the trajectory direction and the trajectory length to obtain a target trajectory; The trajectory processing module is used to pre-process the target trajectory to obtain a simulated trajectory.

[0014] In a third aspect of the present application, a computer storage medium is provided, wherein the computer storage medium stores a plurality of instructions, wherein the instructions are suitable for being loaded by a processor and executing the above method steps.

[0015] In a fourth aspect of the present application, an electronic device is provided, comprising: a processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the above-mentioned method steps.

[0016] In summary, one or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: This application builds a trajectory library by collecting multiple real trajectory data, ensuring that the basic data for generating the trajectory comes from real manual operations. This method based on real data avoids the mechanical characteristics generated by the traditional mathematical model construction method. Secondly, by calculating the trajectory direction and trajectory length in the verification code image and accurately matching them in the trajectory library, it is ensured that the selected target trajectory is highly consistent with the verification requirements in terms of motion characteristics, thereby improving the applicability of the generated trajectory. Finally, by preprocessing the target trajectory, while maintaining the basic characteristics of the trajectory, it is made fully adaptable to the specific needs of the current verification scenario, which not only ensures the authenticity of the trajectory, but also ensures the effectiveness of the verification. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 It is a flowchart of a method for generating a mouse trajectory simulating user behavior provided in an embodiment of the present application; Figure 2 This is a schematic diagram of a mouse track of a click-type verification code provided in an embodiment of the present application; Figure 3 It is a schematic diagram of trajectory direction classification provided by an embodiment of the present application; Figure 4 is a schematic diagram of a target trajectory matched in a trajectory library provided in an embodiment of the present application; Figure 5 It is a schematic diagram of a simulation trajectory provided in an embodiment of the present application; Figure 6 It is a module schematic diagram of a mouse trajectory generation system simulating user behavior provided in an embodiment of the present application; Figure 7 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application.

[0018] Description of reference numerals: 700, electronic device; 701, processor; 702, communication bus; 703, user interface; 704, network interface; 705, memory. DETAILED DESCRIPTION

[0019] In order to enable technicians in this field to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this application, not all of the embodiments.

[0020] In the description of the embodiments of the present application, words such as "for example" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "for example" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "for example" or "for example" is intended to present related concepts in a specific way.

[0021] In the description of the embodiments of the present application, the meaning of the term "multiple" refers to two or more. For example, multiple systems refer to two or more systems, and multiple screen terminals refer to two or more screen terminals. In addition, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. The terms "include", "comprise", "have" and their variations all mean "including but not limited to", unless otherwise specifically emphasized.

[0022] The following will provide a clear and complete description of the technical solutions in the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments.

[0023] Please refer to Figure 1 , a flowchart of a method for generating a mouse track simulating user behavior is proposed. The method can be implemented by a computer program, a single-chip microcomputer, or run on a mouse track generation system simulating user behavior. The computer program can be integrated into a computer device or run as an independent tool application. Specifically, the method includes steps 10 to 40, and the steps are as follows: Step 10: Collect multiple real trajectory data and build a trajectory library based on each trajectory data.

[0024] In the embodiment of the present application, the trajectory data refers to the sequence of continuous coordinate points formed by the movement of the mouse on a two-dimensional plane from pressing the mouse to lifting the mouse when the user operates the mouse. Each trajectory data contains the position information, time information, and the pressing and lifting status information of the mouse during the movement of the mouse.

[0025] like Figure 2FIG. 1 is a schematic diagram of a mouse track of a click-type verification code provided in an embodiment of the present application. Figure 2 It can be seen that the security verification prompt of the verification code is: Please click on the animals living on land. The user completes a series of clicks according to the verification prompt, and finally forms the following Figure 2 The trajectory shown by the green line is the real trajectory referred to in the embodiment of the present application. The real trajectory data can be obtained during the user's clicking process.

[0026] In the embodiment of the present application, the trajectory library refers to a data set storing multiple valid trajectory segments, each of which contains complete trajectory data information and is divided into different direction intervals for storage according to the trajectory direction. Each trajectory record in the trajectory library contains characteristic information such as trajectory point sequence, corresponding trajectory direction and trajectory length.

[0027] Specifically, since real users are affected by various factors such as personal habits and operating environment when operating the mouse, the mouse trajectory has unique human characteristics. In order to generate realistic simulation trajectories, this embodiment first needs to establish a trajectory library containing a large amount of real user operation data.

[0028] When collecting trajectory data, first obtain the continuous mouse movement and click operations of different users in actual scenarios, record the position coordinates and corresponding timestamps of the mouse movement process, and obtain multiple real initial trajectory data. These initial trajectory data completely record the movement trajectory of the mouse from the beginning to the end of the user's operation. Then, the acquired initial trajectory data is processed, and the movement data between two adjacent mouse presses and lifts are extracted as valid trajectory segments by detecting the mouse press and lift actions in the trajectory data. For each valid trajectory segment, obtain its starting point and end point coordinates, and calculate the trajectory direction and trajectory length of the trajectory segment based on these two coordinates. In order to facilitate subsequent trajectory matching, the calculated trajectory direction is divided into multiple direction intervals, and each valid trajectory segment is classified and stored according to its corresponding direction interval to form a final trajectory library.

[0029] Based on the above embodiment, as an optional embodiment, the step of collecting multiple real trajectory data and building a trajectory library based on each trajectory data may further include the following steps: Step 101: Acquire continuous mouse movement and click operations of different users to obtain a plurality of real initial trajectory data.

[0030] Specifically, in order to build a trajectory library containing real user operation characteristics, it is first necessary to collect a large amount of real user mouse operation data. In the actual collection process, by embedding a data collection script in the web page, the mouse movement trajectory of the user during normal web browsing and operation is recorded. When the user moves the mouse, the collection script records the mouse coordinate position at a fixed time interval (for example, every 20 milliseconds), and records the corresponding timestamp information, and organizes this information into initial trajectory data in chronological order. Each initial trajectory data contains the complete process information from the start of the user's operation to the end of the operation.

[0031] Step 102: Detect the mouse pressing and lifting actions in each initial trajectory data, and extract the movement data between two adjacent mouse pressing and lifting actions as a valid trajectory segment.

[0032] Specifically, during the actual operation of the user, the mouse may hover, shake slightly unconsciously, or pause in the middle, and these data will affect the authenticity of the subsequent simulation trajectory. Therefore, it is necessary to process the initial trajectory data to extract the truly effective operation trajectory segments. First, identify the event points of mouse pressing and lifting in the initial trajectory data. These event points mark the user's conscious operation behavior. Then, extract the movement data between two adjacent mouse pressing and lifting events as a valid trajectory segment. Each valid trajectory segment reflects the complete trajectory of the user to complete a specific operation purpose.

[0033] Step 103: construct a trajectory library based on each valid trajectory segment.

[0034] Specifically, first obtain the starting point and end point coordinates of each valid trajectory segment, and based on these two coordinates, calculate the trajectory direction and trajectory length of the trajectory segment. Among them, the trajectory direction reflects the overall direction of the trajectory, and the trajectory length represents the spatial span of the trajectory. The 360-degree direction range is divided into multiple direction intervals, such as eight. According to the trajectory direction calculated for each valid trajectory segment, it is classified into the corresponding direction interval for storage. When storing, each trajectory record contains complete trajectory point sequence data, corresponding trajectory direction and trajectory length information. The trajectory library constructed in this way has a clear direction partition structure, and each direction interval stores trajectory data with similar motion directions.

[0035] Based on the above embodiment, as an optional embodiment, the step of constructing a trajectory library based on each valid trajectory segment may further include the following steps: Step 1031: Obtain the starting point and end point of each valid trajectory segment.

[0036] Step 1032: Calculate the trajectory direction and trajectory length based on the starting point and the end point of each valid trajectory segment, and divide the trajectory direction of each valid trajectory segment into multiple direction intervals.

[0037] Specifically, the starting point coordinates (x1, y1) and the end point coordinates (x2, y2) are extracted from the trajectory point sequence of each valid trajectory segment. Based on these two key coordinates, the trajectory direction and trajectory length are calculated. Among them, the trajectory direction is calculated by the inverse tangent function: trajectory direction = arctan ((y2-y1) / (x2-x1)), and the calculation result needs to be quadrant-adjusted according to the relative positions of the starting point and the end point to ensure that the obtained angle value is between 0 and 360 degrees. The trajectory length is obtained by calculating the Euclidean distance between the starting point and the end point: trajectory length = sqrt ((x2-x1)² + (y2-y1)²). Taking into account the continuity characteristics of the trajectory direction in practical applications, and in order to improve the efficiency of subsequent trajectory matching, the calculated trajectory direction is divided into discrete direction intervals, and the division method of the embodiment of the present application is to divide 360 ​​degrees into 8 direction intervals.

[0038] like Figure 3 FIG. 1 is a schematic diagram of a track direction classification provided by an embodiment of the present application. Figure 3 It can be seen that 360 degrees can be divided into eight intervals, which are the eight directions in the figure. The interval of direction 1 is [345°, 15°), the interval of direction 2 is [15°, 75°), the interval of direction 3 is [75°, 105°), the interval of direction 4 is [105°, 165°), the interval of direction 5 is [165°, 195°), the interval of direction 6 is [195°, 255°), the interval of direction 7 is [255°, 285°), and the interval of direction 8 is [285°, 345°).

[0039] Step 1033: Classify and store each valid trajectory segment according to the corresponding direction interval to obtain a trajectory library, which includes multiple valid trajectory segments and the trajectory direction and trajectory length corresponding to each valid trajectory segment.

[0040] Specifically, for each valid trajectory segment, the direction interval to which it belongs is determined according to the calculated trajectory direction. For example, when the trajectory direction is 30 degrees, the trajectory segment will be classified into the direction 2 interval [15°, 75°) for storage. When storing, each trajectory record contains a complete trajectory point sequence, corresponding trajectory direction, trajectory length and other information. Among them, the trajectory point sequence records the coordinates of all sampling points from the starting point to the end point of the trajectory and their corresponding timestamps. This information fully retains the dynamic characteristics of the trajectory.

[0041] Step 20: Obtain the starting point and the end point in the verification code image to be verified, and calculate the trajectory direction and the trajectory length based on the starting point and the end point.

[0042] Specifically, the verification code image is analyzed by image processing technology to identify the given starting point coordinates and end point coordinates. After obtaining these coordinates, the same calculation method as in the trajectory library construction process can be used to calculate the trajectory direction and trajectory length based on these two key coordinates.

[0043] Based on the above embodiment, as an optional embodiment, the step of calculating the trajectory direction and the trajectory length based on the starting point and the end point may further include the following steps: Step 201: Select a first set of sampling points within a preset range with a starting point as the center, and select a second set of sampling points within a preset range with an end point as the center.

[0044] Specifically, in order to make the generated simulation trajectory smoother and more natural, it is necessary to add a gradual transition effect at the start and end of the trajectory. This gradual effect can be achieved by selecting multiple sampling points in the area near the starting point and the end point. With the starting point (start_x, start_y) as the center, N sampling points (for example, N=8) are randomly selected as the first set of sampling points in a circular area with a radius of R (for example, R=10 pixels). Similarly, with the end point (end_x, end_y) as the center, N sampling points are randomly selected as the second set of sampling points in a circular area with the same radius R. When selecting sampling points, polar coordinate random sampling is used, that is, the distance r (0≤r≤R) and angle θ (0°≤θ<360°) from the center point are randomly generated, and the specific coordinates of the sampling points are obtained by coordinate conversion. This sampling method ensures that the sampling points are evenly distributed within the preset range.

[0045] Step 202: Calculate the centroid coordinates of the first group of sampling points and the second group of sampling points respectively to obtain the first centroid coordinates and the second centroid coordinates.

[0046] Specifically, the centroid coordinates of the two sets of sampling points are calculated respectively. For the first set of sampling points, the centroid coordinates (center1_x, center1_y) are calculated as follows: center1_x = ∑xi / N, center1_y = ∑yi / N, where (xi, yi) are the coordinates of the i-th point in the first set of sampling points. Similarly, the centroid coordinates (center2_x, center2_y) of the second set of sampling points are calculated as follows: center2_x = ∑xi / N, center2_y = ∑yi / N, where (xi, yi) are the coordinates of the i-th point in the second set of sampling points.

[0047] Step 203: Calculate the main direction vector based on the first centroid coordinates and the second centroid coordinates.

[0048] Step 204: taking the angle between the main direction vector and the horizontal direction as the trajectory direction.

[0049] Specifically. Based on the first center of mass coordinates (center1_x, center1_y) and the second center of mass coordinates (center2_x, center2_y), calculate the main direction vector v=(dx, dy), where dx=center2_x-center1_x, dy=center2_y-center1_y. This vector represents the overall motion trend of the trajectory. Then, calculate the angle between this vector and the horizontal positive direction as the trajectory direction, and the calculation formula is: trajectory direction=arctan(dy / dx).

[0050] Step 205: Calculate the Euclidean distance between the first centroid coordinate and the second centroid coordinate as the trajectory length.

[0051] Specifically, the actual trajectory length is calculated based on the two centroid coordinates, using the Euclidean distance calculation formula: trajectory length = sqrt((center2_x-center1_x)²+(center2_y-center1_y)²). The trajectory length obtained by this calculation method reflects the actual spatial span of the trajectory, providing a more accurate reference value for subsequent trajectory matching.

[0052] Step 30: Match the trajectory in the trajectory library based on the trajectory direction and trajectory length to obtain the target trajectory.

[0053] Specifically, first determine the search direction interval based on the calculated trajectory direction, and further screen based on the trajectory length within the determined direction interval. Set the matching threshold of the trajectory length, for example, 0.2. When the relative difference between the length of a trajectory in the trajectory library and the trajectory length is within the threshold range, the trajectory will be retained as a candidate trajectory. For all candidate trajectories that meet the length requirements, calculate their comprehensive matching degree with the target feature. The matching degree calculation comprehensively considers the direction difference and length difference, and the trajectory with the highest matching is used as the final target trajectory.

[0054] Based on the above embodiment, as an optional embodiment, the step of matching in the trajectory library based on the trajectory direction and the trajectory length to obtain the target trajectory may also include the following steps: Step 301: Filter out the first trajectory in a direction interval corresponding to the trajectory direction in the trajectory library.

[0055] Specifically, first determine the corresponding direction interval according to the calculated trajectory direction. For example, when the trajectory direction is 78 degrees, search in the direction 3 interval [75°, 105°). Since the trajectory library adopts a classification storage structure based on the direction interval, all trajectories stored in the direction interval can be directly accessed, and these trajectories are called first trajectories.

[0056] Step 302: Calculate the difference between the trajectory length of each first trajectory and the trajectory length.

[0057] Specifically, for each first track in the direction interval, the stored track length is extracted, and a difference is calculated between the track length and the track length in the verification code image to obtain a length difference.

[0058] Step 303: Obtain a preset number of second trajectories with the smallest difference.

[0059] Specifically, the first trajectories are sorted in ascending order according to the length differences, and a preset number of M trajectories (eg, M=5) with the smallest differences are selected as the second trajectories.

[0060] Step 304: Calculate the curvature characteristics and speed characteristics of each second trajectory.

[0061] Specifically, for each second trajectory, its curvature feature and speed feature are calculated. The curvature feature is calculated using the three-point method. For three consecutive sampling points on the trajectory (xi-1, yi-1), (xi, yi) and (xi+1, yi+1), the local curvature is calculated by the formula |y'x''- x'y''| / (x''+ y'')^(3 / 2), where x' and y' are first-order differences, and x'' and y'' are second-order differences. The local curvatures of all points on the trajectory are averaged to obtain the overall curvature feature of the trajectory. The calculation of the speed feature is based on the time interval and spatial displacement between adjacent sampling points, that is, sqrt((xi+1-xi)²+(yi+1-yi)²) / (ti+1-ti), where ti is the timestamp of the sampling point. By calculating the speed mean and standard deviation of each segment of the trajectory, the statistics describing the velocity distribution characteristics of the trajectory are obtained, including the average speed and the speed standard deviation.

[0062] Step 305: Score each second trajectory based on the curvature feature and the speed feature, and use the second trajectory with the highest score as the target trajectory.

[0063] Specifically, a comprehensive score is calculated for each second trajectory. The score calculation first normalizes the curvature feature and the speed feature to eliminate the influence of different feature dimensions. The normalization of the curvature feature uses the interval mapping method to map the curvature value to the [0,1] interval. The normalization of the speed feature considers the two statistics of the speed mean and the speed standard deviation, and normalizes them separately. The weighted comprehensive score is calculated based on the normalized curvature feature and speed feature. After the score calculation is completed, the second trajectory with the highest score is selected as the final target trajectory.

[0064] like Figure 4 As shown, Figure 4 A schematic diagram of a target trajectory matched in a trajectory library provided in an embodiment of the present application, wherein the target trajectory is a trajectory with the same direction category and the most matching length in the trajectory library. Figure 4 The left picture is the trajectory coordinate point, that is, the spatial distribution of the target trajectory on the two-dimensional plane, and the right picture is the time interval, which shows the distribution of time intervals between adjacent sampling points. These time interval information reflects the movement speed characteristics of the trajectory at different positions: a larger time interval indicates that the trajectory moves slower, and a smaller time interval indicates that the trajectory moves faster.

[0065] Step 40: Preprocess the target trajectory to obtain a simulated trajectory.

[0066] Specifically, the target trajectory is first scaled and transformed, and the required scaling ratio of the target trajectory is calculated based on the coordinates of the starting point and the ending point, and then scaled proportionally according to the scaling ratio. If the length of the matching trajectory is greater than the actual trajectory length, it is also necessary to sample the scaled trajectory points. During sampling, the trajectory point coordinates and time intervals are sampled simultaneously. This proportional scaling ensures that the shape characteristics of the trajectory are maintained. Then, the scaled trajectory is translated so that the starting point of the trajectory coincides with the given starting position, and the translation amount is obtained by calculating the coordinate difference between the starting point of the scaled trajectory and the starting point of the target. Then, the angle between the trajectory direction and the translated trajectory is calculated; based on the angle, the translated trajectory is rotated and transformed so that the translated trajectory is consistent with the trajectory direction, and the final simulated trajectory is obtained.

[0067] Based on the above embodiment, as an optional embodiment, the step of preprocessing the target trajectory to obtain a simulated trajectory may further include the following steps: Step 401: Calculate the proportionality coefficient between the trajectory length of the target trajectory and the trajectory length in the verification code image.

[0068] Specifically, first, the target trajectory length and the trajectory length in the verification code image are obtained respectively, and the scaling coefficient of the two lengths is calculated, which can be the ratio of the two lengths. The scaling coefficient reflects the required scaling degree of the target trajectory, ensuring that the scaled trajectory length meets the requirements in the verification code image.

[0069] Step 402: scaling each track point of the target track in equal proportion based on the scale factor to obtain a scaled track.

[0070] Specifically, each trajectory point on the target trajectory is scaled proportionally to obtain a scaled trajectory. Since the same scaling factor is used for all coordinate points, this proportional scaling can keep the shape characteristics of the trajectory unchanged and only change its overall size.

[0071] Step 403: The scaled trajectory is sampled, translated and rotated in sequence to obtain a simulated trajectory.

[0072] Specifically, in order to make the scaled trajectory better meet the specific needs of the verification scenario, it is necessary to adjust the trajectory to the appropriate position and direction through a series of spatial transformation operations such as sampling, translation and rotation. These transformation operations not only ensure the accuracy of the starting position of the trajectory, but also ensure that the movement direction of the trajectory is consistent with the verification requirements, while maintaining the smoothness of the trajectory through a reasonable sampling strategy.

[0073] First, sampling is performed according to the random sampling principle. Assume that 8 sampling points are randomly sampled from 10 points, namely P1, P3, P4, P5, P6, P8, P9, and P10. The timestamps of these 8 sampling points are recorded as t1, t3, t4, t5, t6, t8, t9, and t10. The timestamp interval between two adjacent sampling points is calculated as the final time interval. Then, the scaled trajectory is sampled in sequence according to the time interval to obtain a sampling point sequence. The sampling point sequence is translated so that the starting point of the trajectory coincides with the given starting position. The translation amount is obtained by calculating the coordinate difference between the first point of the sampling sequence and the target starting point. The same translation operation is performed on all points in the sequence to obtain the translated trajectory. Calculate the angle θ between the trajectory direction and the translated trajectory. The trajectory direction is the direction angle given in the verification code image. The direction of the trajectory after translation can be calculated through the coordinates of its starting point and end point. The translated trajectory is rotated based on the calculated angle. The two-dimensional plane rotation transformation formula can be used for rotation. Through this rotation transformation, it is ensured that the direction of the final simulated trajectory is completely consistent with the given trajectory direction.

[0074] like Figure 5As shown, a schematic diagram of a simulation trajectory provided in an embodiment of the present application is shown. The starting point of the simulation trajectory is A (10, 21) and the end point is B (540, 440). The simulation trajectory not only meets the precise requirements of position and direction, but also maintains the naturalness and continuity of the trajectory, and can more realistically reflect the characteristics of human operation.

[0075] See also Figure 6 , is a module diagram of a mouse trajectory generation system for simulating user behavior provided in an embodiment of the present application. The mouse trajectory generation system for simulating user behavior may include: a trajectory library construction module, a trajectory calculation module, a trajectory matching module and a trajectory processing module, wherein: A trajectory library building module, used for collecting a plurality of real trajectory data and building a trajectory library based on each of the trajectory data; A trajectory calculation module, used to obtain a starting point and an end point in the verification code image to be verified, and calculate a trajectory direction and a trajectory length based on the starting point and the end point; A trajectory matching module, used for matching in the trajectory library based on the trajectory direction and the trajectory length to obtain a target trajectory; The trajectory processing module is used to pre-process the target trajectory to obtain a simulated trajectory.

[0076] Optionally, the trajectory library building module is further used to obtain continuous movement and click operations of different users' mice to obtain multiple real initial trajectory data; Detecting the mouse pressing and lifting actions in each of the initial trajectory data, and extracting the movement data between two adjacent mouse pressing and lifting actions as a valid trajectory segment; A trajectory library is constructed based on each of the valid trajectory segments.

[0077] Optionally, the trajectory library construction module is further used to obtain the starting point and the end point of each valid trajectory segment; Calculating the trajectory direction and trajectory length based on the starting point and the end point of each valid trajectory segment, and dividing the trajectory direction of each valid trajectory segment into a plurality of direction intervals; Each valid trajectory segment is classified and stored according to the corresponding direction interval to obtain a trajectory library, which includes multiple valid trajectory segments and the trajectory direction and trajectory length corresponding to each valid trajectory segment.

[0078] Optionally, the trajectory calculation module is further used to select a first group of sampling points within a preset range centered at the starting point, and to select a second group of sampling points within a preset range centered at the end point; Calculating the centroid coordinates of the first group of sampling points and the second group of sampling points respectively to obtain first centroid coordinates and second centroid coordinates; Calculate a main direction vector based on the first centroid coordinates and the second centroid coordinates; The angle between the main direction vector and the horizontal direction is taken as the trajectory direction; The Euclidean distance between the first centroid coordinates and the second centroid coordinates is calculated as the trajectory length.

[0079] Optionally, the trajectory matching module is further used to filter out a first trajectory in a direction interval corresponding to the trajectory direction in the trajectory library; Calculating the difference between the trajectory length of each of the first trajectories and the trajectory length; Obtaining a preset number of second trajectories with the smallest difference values; Calculating the curvature characteristics and the speed characteristics of each of the second trajectories; Each of the second trajectories is scored based on the curvature feature and the speed feature, and the second trajectory with the highest score is used as the target trajectory.

[0080] Optionally, the trajectory matching module is further used to calculate a proportional coefficient between the trajectory length of the target trajectory and the trajectory length in the verification code image; Proportionally scaling each trajectory point of the target trajectory based on the proportional coefficient to obtain a scaled trajectory; The scaled trajectory is sampled, translated and rotated in sequence to obtain a simulated trajectory.

[0081] Optionally, the trajectory matching module is further used to sample the scaled trajectory points to obtain a sampling point sequence; The sampling point sequence is translated to the starting point to obtain a translated trajectory; Calculating the angle between the trajectory direction and the translated trajectory; The translated trajectory is subjected to a rotation transformation based on the angle so that the translated trajectory is consistent with the trajectory direction to obtain the simulated trajectory.

[0082] It should be noted that: when the system provided in the above embodiment realizes its functions, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the system and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.

[0083] An embodiment of the present application also provides a computer storage medium, which can store multiple instructions. The instructions are suitable for being loaded by a processor and executing a mouse trajectory generation method that simulates user behavior in the above embodiment. The specific execution process can be found in the specific description of the above embodiment, which will not be repeated here.

[0084] Please refer to Figure 7 The application also discloses an electronic device. Figure 7 The electronic device 700 may include: at least one processor 701 , at least one network interface 704 , a user interface 703 , a memory 705 , and at least one communication bus 702 .

[0085] The communication bus 702 is used to realize the connection and communication between these components.

[0086] The user interface 703 may include a display screen (Display) and a camera (Camera). Optionally, the user interface 703 may also include a standard wired interface and a wireless interface.

[0087] The network interface 704 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface).

[0088] Among them, the processor 701 may include one or more processing cores. The processor 701 uses various interfaces and lines to connect various parts in the entire server, and executes various functions of the server and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory 705, and calling data stored in the memory 705. Optionally, the processor 701 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 701 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 701, and it can be implemented separately through a chip.

[0089] Among them, the memory 705 may include a random access memory (Random Access Memory, RAM) and may also include a read-only memory (Read-Only Memory). Optionally, the memory 705 includes a non-transitory computer-readable storage medium. The memory 705 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 705 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 705 may optionally also be at least one storage device located away from the aforementioned processor 701. Refer to Figure 7 , the memory 705 as a computer storage medium may include an operating system, a network communication module, a user interface module, and an application program of a method for generating a mouse track simulating user behavior.

[0090] exist Figure 7 In the electronic device 700 shown, the user interface 703 is mainly used to provide an input interface for the user and obtain the data input by the user; and the processor 701 can be used to call the application program stored in the memory 705 for a method of generating a mouse trajectory that simulates user behavior. When executed by one or more processors 701, the electronic device 700 executes one or more of the methods described in the above embodiments. It should be noted that for the aforementioned method embodiments, for the sake of simple description, they are all expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited by the described order of actions, because according to the present application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required for the present application.

[0091] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0092] In the several embodiments provided in this application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some service interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.

[0093] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0094] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0095] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a memory and includes several instructions for a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned memory includes: various media that can store program codes, such as USB flash drives, mobile hard drives, magnetic disks or optical disks.

[0096] The above is only an exemplary embodiment of the present disclosure and cannot be used to limit the scope of the present disclosure. That is, any equivalent changes and modifications made according to the teachings of the present disclosure are still within the scope of the present disclosure. After considering the disclosure of the specification and the truth of practice, those skilled in the art will easily think of other embodiments of the present disclosure.

[0097] This application is intended to cover any variation, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary technical means in the art not described in the present disclosure. The description and examples are to be regarded as exemplary only, and the scope and spirit of the present disclosure are defined by the claims.

Claims

1. A method for generating mouse tracks simulating user behavior, characterized in that: The method comprises: Collecting a plurality of real trajectory data, and building a trajectory library based on each of the trajectory data; Obtaining a starting point and an end point in a verification code image to be verified, and calculating a trajectory direction and a trajectory length based on the starting point and the end point; Matching the trajectory library based on the trajectory direction and the trajectory length to obtain a target trajectory; The target trajectory is preprocessed to obtain a simulated trajectory.

2. The method for generating mouse tracks simulating user behavior according to claim 1, characterized in that: The collecting of a plurality of real trajectory data and building a trajectory library based on each of the trajectory data includes: Obtain the continuous movement and click operations of different users' mice to obtain multiple real initial trajectory data; Detecting the mouse pressing and lifting actions in each of the initial trajectory data, and extracting the movement data between two adjacent mouse pressing and lifting actions as a valid trajectory segment; A trajectory library is constructed based on each of the valid trajectory segments.

3. The method for generating mouse tracks simulating user behavior according to claim 2, characterized in that: The constructing a trajectory library based on the valid trajectory segments comprises: Obtaining the starting point and the end point of each valid trajectory segment; Calculating the trajectory direction and trajectory length based on the starting point and the end point of each valid trajectory segment, and dividing the trajectory direction of each valid trajectory segment into a plurality of direction intervals; Each valid trajectory segment is classified and stored according to the corresponding direction interval to obtain a trajectory library, which includes multiple valid trajectory segments and the trajectory direction and trajectory length corresponding to each valid trajectory segment.

4. The method for generating mouse tracks simulating user behavior according to claim 1, characterized in that: The calculating the trajectory direction and the trajectory length based on the starting point and the end point includes: Selecting a first group of sampling points within a preset range centered at the starting point, and selecting a second group of sampling points within a preset range centered at the end point; Calculating the centroid coordinates of the first group of sampling points and the second group of sampling points respectively to obtain first centroid coordinates and second centroid coordinates; Calculate a main direction vector based on the first centroid coordinates and the second centroid coordinates; The angle between the main direction vector and the horizontal direction is taken as the trajectory direction; The Euclidean distance between the first centroid coordinates and the second centroid coordinates is calculated as the trajectory length.

5. The method for generating mouse tracks simulating user behavior according to claim 1, characterized in that: The matching in the trajectory library based on the trajectory direction and the trajectory length to obtain the target trajectory includes: Filtering out a first trajectory in a direction interval corresponding to the trajectory direction in the trajectory library; Calculating the difference between the trajectory length of each of the first trajectories and the trajectory length; Obtaining a preset number of second trajectories with the smallest difference values; Calculating the curvature characteristics and the speed characteristics of each of the second trajectories; Each of the second trajectories is scored based on the curvature feature and the speed feature, and the second trajectory with the highest score is used as the target trajectory.

6. The method for generating mouse tracks simulating user behavior according to claim 1, characterized in that: The preprocessing of the target trajectory to obtain a simulated trajectory includes: Calculating a proportionality coefficient between the trajectory length of the target trajectory and the trajectory length in the verification code image; Proportionally scaling each trajectory point of the target trajectory based on the proportional coefficient to obtain a scaled trajectory; The scaled trajectory is sampled, translated and rotated in sequence to obtain a simulated trajectory.

7. The method for generating mouse tracks simulating user behavior according to claim 6, characterized in that: The scaling trajectory is sequentially sampled, translated and rotated to obtain a simulated trajectory, including: Sampling the scaled trajectory points to obtain a sampling point sequence; The sampling point sequence is translated to the starting point to obtain a translated trajectory; Calculating the angle between the trajectory direction and the translated trajectory; The translated trajectory is subjected to a rotation transformation based on the angle so that the translated trajectory is consistent with the trajectory direction to obtain the simulated trajectory.

8. A mouse trajectory generation system simulating user behavior, characterized in that: The system comprises: A trajectory library building module, used for collecting a plurality of real trajectory data and building a trajectory library based on each of the trajectory data; A trajectory calculation module, used to obtain a starting point and an end point in the verification code image to be verified, and calculate a trajectory direction and a trajectory length based on the starting point and the end point; A trajectory matching module, used for matching in the trajectory library based on the trajectory direction and the trajectory length to obtain a target trajectory; The trajectory processing module is used to pre-process the target trajectory to obtain a simulated trajectory.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the method according to any one of claims 1 to 7.

10. An electronic device, characterized in that: It includes a processor, a memory, a user interface and a network interface, the memory is used to store instructions, the user interface and the network interface are used to communicate with other devices, and the processor is used to execute the instructions stored in the memory so that the electronic device executes the method as described in any one of claims 1-7.

Citation Information

Cited By

  • Method and system for generating anthropomorphic sliding track

    CN121639840A

  • Anthropomorphic sliding trajectory generation method and system

    CN121639840B