Method for generating sliding block verification code track for image information

By calculating the similarity between the slider image and the background image and training the reinforcement learning model, the trajectory generation technology of the slider verification code can more accurately simulate the real human response, improve verification accuracy and reduce overhead, solving the problems of low verification pass rate and large additional overhead in intelligent human-computer recognition in the existing technology.

CN119885140APending Publication Date: 2025-04-25HANGZHOU BRANCH INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411942461.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-27
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

The existing slider verification code trajectory generation technology is difficult to maintain verification pass rate when facing intelligent human-computer recognition technology, and the additional overhead is high due to repeated trajectory use and attempted verification.

Method used

By calculating the similarity between the slider image and the background image, training reinforcement learning models will move the slider image to a place with high similarity and pause it to simulate the real person's reaction and generate the corresponding drag track.

Benefits of technology

Improve the verification accuracy of slider verification codes, reduce additional overhead, and avoid problems caused by repeated trajectory use and tentative verification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119885140A_ABST
    Figure CN119885140A_ABST
Patent Text Reader

Abstract

The invention discloses a method for generating a sliding block verification code track for image information. The method comprises the following specific steps: step 1, calculating the similarity between a sliding block image and a background image; 2, training a reinforcement learning model, enabling the reinforcement learning model to take the similarity as a judgment point of a sliding block verification code movement track, and enabling a sliding block image to move to a place with high similarity for pause so as to simulate real person reaction; and step 3, generating a dragging track of the sliding block verification code based on the trained reinforcement learning model. According to the invention, the sliding block can stay in a high-similarity area, the real person reaction is simulated, the verification precision is improved, and the extra overhead is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a method for generating a slider verification code track according to image information, and belongs to the technical field of Internet. Background Art

[0002] The main function of the verification code is to resist data capture, ensure data security, and reduce the burden on the server. In the face of increasingly intelligent trajectory human-machine recognition technology, the automation program needs to make the mouse dragging the slider action closer to the human operation mode. The current slider dragging trajectory generation technology can be classified into the following three categories:

[0003] 1. Use a specific mathematical function, such as the sine function, to generate the motion trajectory of the slider, and add random delays and pixel offsets to the trajectory. However, the trajectory generated by this solution is either too rigid or too smooth, and can no longer pass most human-computer verification tests.

[0004] 2. Establish a trajectory database by recording the actual user's slider dragging action offline. Given the displacement endpoint, retrieve the corresponding trajectory set from the database, and randomly select a trajectory for minor adjustments before use. The trajectory of this solution is realistic enough, but the number of trajectories retrieved from the database with a given endpoint is limited, and repeated trajectories are frequently used and will be blocked by the website after a period of time.

[0005] 3. Use machine learning models to learn human dragging behavior patterns from a large number of trajectory data. This solution learns the artificial dragging model from a large number of real trajectories and can generate real and diverse trajectories, but the generated trajectory is only related to the dragging end point, and does not consider the verification code pattern information. Even for the verification code at the same end point, due to the different similarities between the slider and the background image at different positions, the reaction during manual dragging is also different (positions with high similarity slow down, and positions with low similarity speed up). Therefore, this solution is conducting a trial verification, and it passes if the trajectory and the image just fit. However, with the strengthening of platform risk control, if multiple verifications fail, it will be prohibited from continuing verification for a short period of time. Summary of the invention

[0006] The purpose of the present invention is to provide a method for generating a slider verification code track for image information. The present invention can make the slider stay in a high similarity area, simulate real person reactions, improve verification accuracy and reduce additional overhead.

[0007] The technical solution of the present invention is a method for generating a slider verification code track based on image information, comprising the following specific steps:

[0008] Step 1: Calculate the similarity between the slider image and the background image;

[0009] Step 2: Train the reinforcement learning model so that the reinforcement learning model uses similarity as a judgment point of the slider image movement trajectory, and makes the slider image move to a place with high similarity and pause to simulate real-person reactions;

[0010] Step 3: Generate the drag trajectory of the slider image based on the trained reinforcement learning model.

[0011] In the above-mentioned method for generating a slider verification code trajectory for image information, the similarity is calculated by first preprocessing the slider image and the background image to make the slider image and the background image match stably, and then in the process of dragging the slider image from the left to the right, a pixel-by-pixel comparison method is used to calculate the similarity between the slider image and the background image.

[0012] In the aforementioned method for generating a slider verification code track based on image information, the preprocessing is to firstly grayscale the slider image and the background image, and then apply the Gaussian blur method to reduce noise and details after the grayscale processing.

[0013] The aforementioned method for generating a slider verification code track for image information, the specific steps of the pixel-by-pixel comparison method are as follows:

[0014] Use the sliding window method to gradually move the slider image on the background image;

[0015] At each window position, the normalized squared difference similarity between the slider image and the image area under the window is calculated;

[0016] The similarities of the normalized squared differences are tabulated, and the point with the highest similarity in the list is the end point of the sliding.

[0017] In the aforementioned method for generating a slider verification code trajectory for image information, the training of the reinforcement learning model is to maximize the reward for the slider image moving from the starting point to the end point under a limited time constraint; the reinforcement learning model regards the slider as an intelligent agent, and the intelligent agent moves left and right in the chute. The intelligent agent can obtain more rewards by moving to a position with high similarity and staying there, thereby encouraging the intelligent agent to stay there and simulating a real person's reaction. If the intelligent agent has not moved to the end point after the timeout, it will be punished. When the intelligent agent moves to the end point or triggers the timeout constraint, a round of tasks ends.

[0018] In the aforementioned method for generating a slider verification code trajectory for image information, the training of the reinforcement learning model includes state elements, and the state elements are represented as:

[0019] state(t)={similar,(x target ,y target ), (x self (t), y self (t)), t residual(t)};

[0020] Where: similar is a similarity list, (x target ,y target ) is the end point, (x self (t), y self (t)) is its own position, t residual (t) is the remaining time, t∈[1,T], T=N / n, N It indicates the specified duration, and n indicates the unit time slot.

[0021] In the aforementioned method for generating a slider verification code trajectory for image information, the training of the reinforcement learning model includes action elements, and the action elements are represented as:

[0022] action(t)={direction(t),distance(t)};

[0023] Where: direction(t)∈(0, 2π] indicates that the agent moves in any direction, and distance(t) is the distance the agent moves.

[0024] In the aforementioned method for generating a slider verification code trajectory for image information, the training of the reinforcement learning model includes a reward element, and the reward element is expressed as:

[0025]

[0026] Among them, x self (t) is the horizontal coordinate of the slider, similar[int(x self (t))] indicates the similarity between the current position of the slider and the background image.

[0027] In the aforementioned method for generating a slider verification code track based on image information, the data structure of the dragging track of the slider image is:

[0028] [[x self (t), y self (t), gap(t)], [x self (t+1), y self (t+1), gap(t+1)]..., [x self (T), y self (T), gap(T)]];

[0029] The formula for generating the trajectory based on the data structure action of the drag trajectory of the slider image is as follows:

[0030]

[0031] Among them, xself (t+1) represents the horizontal axis coordinate, y self (t+1) represents the vertical axis coordinate, and gap(t+1) represents the duration.

[0032] Compared with the prior art, the present invention has the following beneficial effects:

[0033] 1. The present invention uses the similarity between the slider image and the background image as a judgment point of the moving trajectory, and makes the intelligent agent move to a place with high similarity and pause, so as to more accurately simulate the real person's reaction.

[0034] 2. The trajectory generated by the present invention has a one-to-one correspondence with the image, thus avoiding the extra overhead caused by tentative verification. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 is a flow chart of the present invention;

[0036] Figure 2 It is a comparison of the slider image and the background image before and after preprocessing;

[0037] Figure 3 It is an example diagram of the slider verification code to be solved in the embodiment. DETAILED DESCRIPTION

[0038] The present invention is further described below in conjunction with the accompanying drawings and embodiments, but they are not intended to limit the present invention.

[0039] Embodiment: A method for generating a slider verification code track based on image information, the steps are as follows Figure 1 As shown, the specific steps include:

[0040] Step 1: Calculate the similarity between the slider image and the background image;

[0041] In this step, the slider image and background image in the slider verification code are first obtained, and then the slider image and the background image are preprocessed to make the slider image and the background image match stably. Then, in the process of dragging the slider image from the left to the right, the similarity between the slider image and the background image is calculated using a pixel-by-pixel comparison method.

[0042] Among them, the preprocessing is to first grayscale the slider image and the background image to achieve a better matching effect, and then use the Gaussian blur method after grayscale processing to reduce noise and details to make the matching more stable. Figure 2 As shown, a comparison of the slider image and the background image before and after preprocessing is shown.

[0043] In this step, the cv2.matchTemplate() method in OpenCV is used to compare the similarity between the slider and the background pixel by pixel. The specific steps are as follows:

[0044] cv2.matchTemplateO uses a sliding window method to gradually move the slider image on the background image, and aligns the window of the slider image with each possible position in the background image;

[0045] At each window position, the normalized squared difference similarity between the slider image and the image area under the window is calculated; the basic idea is to calculate the sum of the squares of the pixel value differences of the two image blocks and normalize them to obtain a similarity index on a proportional scale. The following is the calculation formula for normalized squared difference similarity:

[0046]

[0047] Where slider(i, j) is the pixel value of the slider at position (i, j), template(i, j) is the pixel value of the image behind the slider at position (i, j) in the picture, and Num is the total number of slider pixels, which is used for normalization. The closer NSD(silder, template) is to 1, the more similar the two image blocks are.

[0048] The similarities of the normalized squared differences are tabulated, and the point with the highest similarity in the list is the end point of the sliding.

[0049] Step 2: Train the reinforcement learning model so that it uses similarity as a judgment point of the slider verification code movement trajectory, and makes the slider image move to a place with high similarity and pause to simulate real-person reactions;

[0050] In this step, the training of the reinforcement learning model is to maximize the reward of the slider image moving from the starting point to the end point under the constraint of limited time; the reinforcement learning model regards the slider as an intelligent agent, and the intelligent agent moves left and right in the chute. The intelligent agent can get more rewards when it moves to a position with high similarity and stays there, thereby encouraging the intelligent agent to stay there and simulate real-life reactions. If the intelligent agent has not moved to the end point after the timeout, it will be punished. When the intelligent agent moves to the end point or triggers the timeout constraint, a round of tasks ends.

[0051] The training of the reinforcement learning model includes state elements, action elements and reward elements, wherein the state elements are represented as:

[0052] state(t)={similar,(x target ,y target ), (x self (t), y self (t)), t residual (t)};

[0053] Where: similar is a similarity list, (xtarget ,y target ) is the end point, (x self (t), y self (t)) is its own position, t residual (t) is the remaining time, t∈[1, T], T=N / n, N represents the specified time length, and n represents the unit time slot. In this embodiment,

[0054] similar=[0.124, 0.235,..., 0.345]

[0055] The action elements are represented as:

[0056] action(t)={direction(t),distance(t)};

[0057] Where: direction(t)∈(0, 2π] indicates that the agent can move in any direction, and distance(t) is the distance the agent moves.

[0058] The reward elements are expressed as:

[0059]

[0060] Among them, x self (t) is the horizontal coordinate of the slider, similar[int(x self (t))] indicates the similarity between the current position of the slider and the background image.

[0061] Step 3: Generate the drag trajectory of the slider verification code based on the trained reinforcement learning model.

[0062] In this step, the data structure of the dragging track of the slider image is:

[0063] [[x self (t), yy self (t), gap(t)], [x self (t+1), y self (t+1), gap(t+1)]…, [x self (T), yy self (T), gap(T)]];

[0064] The formula for generating the trajectory based on the data structure action of the drag trajectory of the slider image is as follows:

[0065]

[0066] Among them, x self (t+1) represents the horizontal axis coordinate, y self(t+1) represents the vertical axis coordinate, and gap(t+1) represents the duration.

[0067] Different types of trajectory generation schemes, for example Figure 3 The slider verification code shown, the human-machine verification example is as follows:

[0068] 1. Specific mathematical functions:

[0069] Step 1: Calculate the sliding end point.

[0070] Step 2: Call the function to generate the trajectory.

[0071] Step 3: Drag the mouse according to the trajectory.

[0072] Result: Verification failed because the trajectory was not authentic.

[0073] 2. Pre-record the manual dragging trajectory, and the model generates the trajectory according to the sliding end point

[0074] Step 1: Calculate the sliding end point.

[0075] Step 2: Call a trajectory from the database and generate the trajectory from the model.

[0076] Step 3: Drag the mouse according to the trajectory

[0077] Result: The mouse track did not give a true response at the image interference point and passed after multiple failed verifications.

[0078] 3. This paper's solution

[0079] Step 1: Calculate the similarity between the slider image and the background image. The point with the maximum similarity is the sliding end point, and other points with high similarity are interference points.

[0080] Step 2: Input the similarity information into the reinforcement learning model, and the model outputs the sliding trajectory.

[0081] Step 3: Drag the slider image according to the trajectory so that the slider image overlaps with the verification area of ​​the background image.

[0082] Result: Passed in one try.

[0083] In summary, the present invention uses the similarity between the slider image and the background image as a judgment point of the moving trajectory, and makes the intelligent agent move to a place with high similarity and pause, so as to more accurately simulate the real person's reaction. At the same time, the trajectory generated by the present invention has a one-to-one correspondence with the image, avoiding the extra overhead caused by trial verification.

[0084] Although the above describes the illustrative specific implementations of the present invention to facilitate the understanding of the present invention by those skilled in the art, it should be clear that the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in the field without creative work are within the protection scope of the present invention.

Claims

1. A method for generating a slider verification code track based on image information, characterized in that: The specific steps include: Step 1: Calculate the similarity between the slider image and the background image; Step 2: Train the reinforcement learning model so that the reinforcement learning model uses similarity as a judgment point of the slider image movement trajectory, and makes the slider image move to a place with high similarity and pause to simulate real-person reactions; Step 3: Generate the drag trajectory of the slider image based on the trained reinforcement learning model.

2. The method for generating a slider verification code track based on image information according to claim 1, characterized in that: The similarity is calculated by preprocessing the slider image and the background image to make the slider image and the background image match stably, and then calculating the similarity between the slider image and the background image by using a pixel-by-pixel comparison method when the slider image is dragged from the left to the right.

3. The method for generating a slider verification code track based on image information according to claim 2, characterized in that: The preprocessing is to firstly grayscale the slider image and the background image, and then apply the Gaussian blur method to reduce noise and details after the grayscale processing.

4. The method for generating a slider verification code track based on image information according to claim 2, characterized in that: The specific steps of the pixel-by-pixel comparison method are as follows: Use the sliding window method to gradually move the slider image on the background image; At each window position, the normalized squared difference similarity between the slider image and the image area under the window is calculated; The similarities of the normalized squared differences are tabulated, and the point with the highest similarity in the list is the end point of the sliding.

5. The method for generating a slider verification code track based on image information according to claim 1, characterized in that: The training of the reinforcement learning model is to maximize the reward of the slider image moving from the starting point to the end point under the constraint of limited time; the reinforcement learning model regards the slider as an intelligent agent, and the intelligent agent moves left and right in the chute. The intelligent agent can get more rewards when it moves to a position with high similarity and stays there, thereby encouraging the intelligent agent to stay there and simulate real-life reactions. If the intelligent agent has not moved to the end point after the timeout, it will be punished. When the intelligent agent moves to the end point or triggers the timeout constraint, a round of tasks ends.

6. The method for generating a slider verification code track based on image information according to claim 5, characterized in that: The training of the reinforcement learning model includes state elements, which are represented as: state(t)={similar,(x target ,y target ),(x self (t),y self (t)),t residual (t)}; Where: similar is a similarity list, (x target ,y target ) is the end point, (x self (t), y self (t)) is its own position, t residual (t) is the remaining time, t∈[1, T], T=N / n, N represents the specified time length, and n represents the unit time slot.

7. The method for generating a slider verification code track based on image information according to claim 6, characterized in that: The training of the reinforcement learning model includes action elements, which are expressed as: action(t)={direction(t),distance(t)}; Where: direction(t)∈(0, 2π] indicates that the agent moves in any direction. distance(t) is the distance the agent moves.

8. The method for generating a slider verification code track based on image information according to claim 7, characterized in that: The training of the reinforcement learning model includes a reward element, which is expressed as: Among them, x self (t) is the horizontal coordinate of the slider, similar[int(x self (t))] indicates the similarity between the current position of the slider and the background image.

9. The method for generating a slider verification code track based on image information according to claim 8, characterized in that: The data structure of the dragging track of the slider image is: [[x self (t),y self (t),gap(t)],[x self (t+1),y self (t+1),gap(t+1)]...,[x self (T),y self (T),gap(T)]]; The formula for generating the trajectory based on the data structure action of the drag trajectory of the slider image is as follows: Among them, x self (t+1) represents the horizontal axis coordinate, y self (t+1) represents the vertical axis coordinate, and gap(t+1) represents the duration.