A recognition training system for a rotation authentication code
By cleaning up data through fingerprint comparison and ROI extraction, expanding the offline full-space discretization, and performing multi-classification tasks using lightweight convolutional neural networks, the problems of uneven feature space and oscillation in regression models in rotating CAPTCHA recognition were solved, achieving high-precision posture correction.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN SKIEER INFORMATION TECH CO LTD
- Filing Date
- 2026-04-27
- Publication Date
- 2026-05-29
Smart Images

Figure CN122116377A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of character recognition technology, specifically to a recognition and training system for rotating CAPTCHAs. Background Technology
[0002] In the fields of computer vision and image data processing, optical character recognition (OCR) and image pose estimation are core research directions. With the popularization of digital interaction, image CAPTCHAs, as an effective means of distinguishing human users from computer programs, are widely used in various data interaction interfaces. To prevent malicious recognition by automated scripts, modern CAPTCHA images typically employ complex anti-interference designs, such as applying random large-angle rotations and distortions to the characters or graphic subjects, and superimposing high-density background noise or interfering lines. This complex morphological change poses a significant challenge to existing image recognition and pose correction algorithms.
[0003] In existing CAPTCHA image processing workflows, the purity of feature extraction directly determines the accuracy of subsequent recognition. However, traditional image preprocessing techniques often employ global filtering or simple thresholding methods, which struggle to effectively remove complex background textures while preserving the edge details of the target subject. When interference lines with similar colors or interwoven textures to the target subject exist in the image, existing convolutional neural networks (CNNs) are easily misled by background noise, incorrectly encoding background textures as target features. This feature aliasing between the background and the subject causes the model to waste computational resources on invalid areas, severely reducing its robustness in complex background environments.
[0004] Furthermore, to improve the model's ability to recognize rotated CAPTCHAs, existing technologies typically employ online random data augmentation strategies, i.e., rotating samples at random angles during training. While this method expands the dataset to some extent, the uncertainty of its random sampling often leads to uneven feature space coverage. Within a limited training iteration cycle, some rotation angles are frequently sampled, while other subtle angle changes become blind spots, resulting in a long-tailed distribution of training data. The existence of these coverage blind spots makes it difficult for the model to learn the fine morphological changes of images in continuous rotation space, thus resulting in insufficient generalization ability when faced with test samples at certain angles.
[0005] More importantly, in the task of predicting the rotation angle of CAPTCHAs, existing technologies generally use regression models to directly predict continuous angle values. However, angles have a physical periodicity; that is, 0° and 360° coincide visually, but are at opposite extremes in numerical space. This numerical discontinuity at the periodic boundaries causes the loss function of the regression model to oscillate violently when dealing with angles near the boundaries, making it difficult for the model to determine the convergence direction. This prediction oscillation not only reduces the convergence speed but also significantly increases the prediction error near the boundary angles, failing to meet the requirements of high-precision attitude correction. Summary of the Invention
[0006] To address the shortcomings of existing technologies, this invention provides a training system for the recognition of rotating CAPTCHAs, which solves the problems of uneven feature space coverage caused by random data augmentation and prediction oscillations caused by numerical discontinuity when traditional regression models deal with periodic angles in existing CAPTCHA recognition technologies.
[0007] To achieve the above objectives, the present invention provides the following technical solution: At the data construction level, this invention establishes a data purification mechanism based on fingerprint comparison. The system first acquires raw images via a network interface. To address the redundancy issue in massive crawled data, feature fingerprint calculation technology is used to verify the uniqueness of each image. By comparing the feature fingerprint similarity between newly acquired images and images in the existing corpus, highly similar or completely duplicated redundant samples are automatically removed, thereby ensuring the independence and validity of samples in the initial corpus and reducing unnecessary computational overhead in subsequent processing.
[0008] At the image preprocessing level, to address the interference of background texture in CAPTCHAs on rotation feature extraction, this invention introduces a region of interest (ROI) extraction mechanism based on morphological analysis. The system accurately locates the circular outline of the target subject in the image through algorithms such as grayscale conversion, edge enhancement, and Hough transform, and generates a mask accordingly. Using mask logic operations, background noise outside the circle is forcibly removed, retaining only the core region containing rotation features. Furthermore, a human-computer collaborative dual-window interaction mechanism is introduced. Through real-time comparison between the reference window and the operation window, the system assists in manually establishing the absolute positive reference pose of the image, providing accurate ground truth for subsequent automated expansion.
[0009] At the data augmentation level, unlike traditional online random rotation augmentation, this invention employs an offline full-space discretization augmentation strategy. Based on an established baseline positive pose, the system performs deterministic discretization rotation generation within a complete space from 0 degrees to 360 degrees, according to a preset step size (e.g., 1 degree). This process maps a single baseline sample to a complete dataset covering all angle categories and directly embeds the rotation angle values as classification labels. This offline full-coverage strategy eliminates feature blind spots left by random sampling, ensuring that the model can learn the feature changes of the image at any tiny angle.
[0010] At the model recognition level, this invention constructs a lightweight convolutional neural network and models the angle prediction task as a fine-grained multi-class classification task rather than a regression task. The network input layer receives a preprocessed RGB image and extracts high-dimensional rotational texture features through multiple convolutional units. The output layer is designed as a fully connected layer with the same number of discretized categories (e.g., 360 dimensions, corresponding to 360 angle categories).
[0011] During the training phase, the difference between the predicted distribution and the true classification label is calculated using the normalized exponential function and the cross-entropy loss function, and the weights are optimized through backpropagation. During the prediction phase, the system compares the probability values of each category in the output vector and directly selects the index corresponding to the maximum probability as the prediction angle, achieving non-linear angle determination. Furthermore, the system integrates a dynamic fine-tuning mechanism, constructing incremental samples based on feedback during operation to update and iterate the model parameters online.
[0012] This invention provides a training system for recognizing rotating CAPTCHAs. It has the following beneficial effects: 1. This invention utilizes Hough transform and contour analysis to locate the target subject and generates a circular mask to perform logical operations on the original image, removing complex background textures and interfering lines in the verification code image. This processing ensures that the input of the convolutional neural network only contains the effective pixels of the target subject, avoiding the model from mistaking background noise for rotation features, thereby improving the purity and accuracy of feature extraction in complex background environments.
[0013] 2. Based on the established benchmark positive pose, this invention generates a full set of discrete samples in a space from 0 degrees to 360 degrees with a fixed step size. This deterministic expansion method eliminates the feature coverage blind spots or long-tail distribution problems caused by random sampling, ensuring that the model can traverse and learn the morphological changes of the image at any small angle, thereby improving the system's generalization response capability to inputs with any random rotation angle.
[0014] 3. This invention models the angle prediction task as a fine-grained 360-class classification task, and uses the probability distribution output by the fully connected classification layer to effectively avoid the numerical oscillation and discontinuity problems that will occur at the periodic boundaries of 0 degrees and 360 degrees in the regression model. At the same time, through the optimization of the cross-entropy loss function, the model output has a clear confidence index, which has a faster convergence speed and higher fault tolerance and robustness compared with the direct regression method. Attached Figure Description
[0015] Figure 1 This is a schematic diagram of the overall process of the image verification code data expansion and recognition method of the present invention. Figure 2 This is a schematic diagram of the offline full-space discretization data augmentation process of the present invention; Figure 3 This is a schematic diagram of the discrete classification network architecture and training process of the present invention; Figure 4 This is a schematic diagram of the online posture correction and recognition reasoning process for the verification code of the present invention. Detailed Implementation
[0016] 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 skilled in the art without creative effort are within the scope of protection of the present invention.
[0017] See attached document Figure 1 The present invention provides a rotation CAPTCHA recognition and training system, which can be deployed in electronic devices with computing and storage capabilities to realize the automated collection, processing, training and recognition of rotation CAPTCHAs.
[0018] The recognition and training system for this rotating CAPTCHA mainly includes: a CAPTCHA acquisition and cleaning module, an image preprocessing and annotation module, an offline full-space data expansion module, and a recognition training and prediction module.
[0019] The CAPTCHA acquisition and cleaning module is equipped with a network communication interface and data processing logic. It acquires raw CAPTCHA images via the network interface, performs feature comparison on the acquired images, and removes duplicate samples to construct an initial corpus. The CAPTCHA acquisition and cleaning module interacts with subsequent modules via a data bus or shared memory.
[0020] The image preprocessing and annotation module, connected to the CAPTCHA acquisition and cleaning module, receives images from the initial corpus. Equipped with image processing algorithms and a human-computer interaction interface, the module extracts features from the images in the initial corpus, locates the target subject, generates a region of interest (ROI) image containing the target subject, and establishes the baseline forward pose of the ROI image through human-computer interaction.
[0021] The offline full-space data augmentation module, connected to the image preprocessing and annotation module, is used to generate a discretized training dataset containing full-angle category labels by performing discretized rotations within a preset rotation space based on an established baseline positive pose and at preset step sizes. The offline full-space data augmentation module can store the generated augmented data in a local file system or database.
[0022] The recognition training and prediction module, connected to the offline full-space data augmentation module, is used to construct a convolutional neural network model. The module utilizes a discretized training dataset to establish a mapping relationship between image visual features and discrete angle categories, and determines the rotation angle of the image to be recognized based on the probability distribution output by the model.
[0023] In one embodiment of the present invention, the above-described rotating CAPTCHA recognition training system runs on a computer device. The computer device includes a processor, a memory, a system bus, and a network interface. The processor is connected to the memory and the network interface via the system bus. The memory stores computer program instructions, which, when executed by the processor, implement the functions of the CAPTCHA acquisition and cleaning module, the image preprocessing and annotation module, the offline full-space data augmentation module, and the recognition training and prediction module.
[0024] The processor can be a central processing unit (CPU), a graphics processing unit (GPU), or an application-specific integrated circuit (ASIC) used to perform large-scale image data processing and matrix operations of neural networks. The memory includes non-volatile storage media and internal memory, used to store the initial corpus, discretized training dataset, and trained model weight parameters.
[0025] The system workflow is as follows: The CAPTCHA acquisition and cleaning module first acquires and cleans the data from the network side, and then passes the cleaned unique samples to the image preprocessing and annotation module; the image preprocessing and annotation module performs noise reduction and ground truth annotation on the samples, producing benchmark image data; the offline full-space data augmentation module performs full-angle derivation on the benchmark image to generate a complete training set; finally, the recognition training and prediction module reads the training set to iterate the model, and provides angle prediction services after the model converges.
[0026] See attached document Figure 1The CAPTCHA collection and cleaning module is specifically configured to perform three sub-steps: data acquisition, feature fingerprint calculation, and deduplication filtering, in order to build an initial corpus without redundancy.
[0027] The CAPTCHA acquisition and cleaning module first performs network data scraping. This module has a built-in network protocol simulation unit that simulates the network request behavior of a real client application (App) or browser, sending HTTP / HTTPS requests to the target CAPTCHA distribution server. The request message contains valid header information and a verification payload, triggering the server to send a response data packet containing a rotated CAPTCHA image. The module parses the response data packet and saves the binary stream image data to local temporary storage.
[0028] Subsequently, the CAPTCHA acquisition and cleaning module performs feature fingerprint calculation on each downloaded image to be processed. To quickly and accurately identify duplicate images in massive amounts of data, this embodiment uses either the Perceptual Hash Algorithm or the Average Hash Algorithm as the fingerprint generation logic. Taking the Average Hash Algorithm as an example, the feature fingerprint calculation process includes the following steps: The first step is image scaling. This involves scaling the obtained original CAPTCHA image. Perform downsampling and scaling to a fixed value. Pixel size (where, This represents the side length of the scaled image, for example... (pixels) to obtain a scaled image This step removes high-frequency details from the image, retaining only low-frequency structural information.
[0029] The second step is grayscale conversion. This involves using a weighted average method to convert the scaled image to grayscale. The RGB three-channel color information in the image is converted into single-channel grayscale information. Assuming the coordinates in the scaled image... The red, green, and blue components of the pixel at that location are respectively , , Then the gray value of that point The calculation formula is as follows: ; in, These are the weighting coefficients for the color channels, which in this embodiment are set to values of [value]. ,
[0030] The third step is to calculate the pixel mean. This involves iterating through the scaled grayscale image and calculating the average grayscale value for all pixels. The formula is as follows: ; The fourth step is to generate a binary fingerprint sequence. The grayscale value of each pixel is compared with the average value to generate a binary bitstream consisting of 0s and 1s. (Binary fingerprint sequence). Assume the fingerprint sequence's... Position Its generation logic is as follows: ; in, For traversing in row-major or column-major order, the first... The coordinates of each pixel. The final generated feature fingerprint. For a length of The binary string.
[0031] After calculating the feature fingerprint of the image to be processed, the CAPTCHA acquisition and cleaning module performs a deduplication comparison operation. This module maintains an existing corpus fingerprint database and stores the feature fingerprints of the current image to be processed. The feature fingerprint of each existing image stored in the database A comparison is performed. The Hamming distance is used as the similarity metric. Defined as the number of distinct characters at corresponding positions in two strings of equal length, the calculation formula is as follows: ; in, Fingerprint length Represents the XOR operation. and These represent the two fingerprint sequences at the th... The value in the digit.
[0032] The CAPTCHA collection and cleaning module will calculate the Hamming distance. With preset threshold Comparison: like (For example or If the image to be processed is highly similar to or identical to an existing image in the library, it is considered a redundant sample. The CAPTCHA acquisition and cleaning module executes a deletion command, removing the image from the temporary storage area without further processing.
[0033] like If the image is found to be unique, the CAPTCHA acquisition and cleaning module moves the image to the official initial corpus storage path and writes its feature fingerprint into the fingerprint database as a benchmark for subsequent comparisons.
[0034] Through the aforementioned closed-loop cleaning mechanism based on feature fingerprints, the CAPTCHA acquisition and cleaning module can automatically remove CAPTCHA images with repetitive visual content, ensuring that the dataset output to the image preprocessing and annotation module has content differences and avoiding overfitting of the model on repetitive samples.
[0035] The image preprocessing and annotation module is specifically configured to perform operations such as target localization, background noise removal, and baseline positive pose establishment.
[0036] The image preprocessing and annotation module first performs region of interest extraction based on geometric features on the images in the initial corpus to eliminate background interference. This process specifically includes the following technical steps: The first step is edge enhancement and detection. The image preprocessing and annotation module reads the original CAPTCHA image, performs grayscale conversion, and then applies the Canny edge detection algorithm or the Sobel operator to extract high-frequency edge information from the image. Taking the Sobel operator as an example, the gradient in the horizontal direction of the image is calculated. and the gradient in the vertical direction Any pixel in the image gradient magnitude at The calculation formula is as follows: ; By setting a gradient threshold, a binarized edge image is generated, highlighting the boundary between the circular outline and the internal texture in the image.
[0037] The second step is Hough Circle Transform localization. Given that rotated CAPTCHAs typically exhibit circular geometry, the module applies the Hough gradient method to the edge image for circle detection. This algorithm maps edge points in image space to a three-dimensional parameter space. In the cumulative voting, among which ( Let the coordinates be the center of the circle. Let be the radius. The equation of a circle is defined as: ; The image preprocessing and annotation module traverses the parameter space to find local maxima where the accumulator value exceeds a preset detection threshold, and the parameters corresponding to these extreme points are... This refers to the center position and radius of the target object in the image.
[0038] The third step is mask generation and logical operations. Based on the detected center point... and radius The module constructs a binary mask matrix with the same size as the original image. The numerical values of each element in the mask matrix. The generation logic is as follows: ; in, These are pixel coordinates. A value of 1 represents the area to be retained (inside the mask), and a value of 0 represents the area to be removed (outside the mask).
[0039] Subsequently, the image preprocessing and annotation module will process the original color image. With mask matrix Perform a bitwise AND logical operation to generate an image of the region of interest. For each channel of an RGB three-channel image The calculation formula is: ; in, Fill the background with a preset color value (e.g., white 255 or pure black 0) to replace noisy pixels outside the mask; The source pixel value at the same pixel coordinates in the original captured CAPTCHA image; The pixel value at discrete pixel coordinates for the final generated region of interest image.
[0040] This step forces the removal of interfering lines, noise, and irrelevant background from the image, leaving only the circular area containing the target subject.
[0041] After the region of interest is extracted, the image preprocessing and annotation module starts the human-computer interaction annotation subroutine. This subroutine renders a dual-window interactive interface on the display terminal, which is logically divided into a reference window and an operation window.
[0042] The reference window is used to load and display a standard reference image with well-defined positive semantic features (e.g., an orthogonally placed Chinese character or a vertically upward arrow) as a baseline anchor point for visual alignment. The operation window is used to load the region of interest image to be labeled. .
[0043] The image preprocessing and annotation module responds to rotation commands issued by the user via input devices (such as mouse wheel, keyboard arrow keys, or touch gestures). Whenever a rotation step command is received... The image preprocessing and annotation module performs affine transformations on the images in the operation window.
[0044] Set the geometric center of the image This is the rotation anchor point (i.e., the origin of the coordinate system). For the region of interest image... Any discrete pixel in the array has pixel coordinates denoted as . After performing the rotation operation, the new coordinates of the pixel in the viewport coordinate system The calculation is as follows: ; in: Display the coordinates of the transformed floating-point points; This represents the currently accumulated rotation angle; The pixel coordinates of the image rotation center; matrix This is the rotation matrix for the corresponding angle.
[0045] Users visually compare the reference window and the operation window, manually adjusting until the visual pose of the target object in the operation window perfectly matches the positive definition of the physical world (e.g., the readable direction of text, the natural direction of gravity of an object). When the user triggers a confirmation command, the image preprocessing and annotation module locks the current rotation angle and records it as the reference positive pose angle of the image. This reference positive pose angle forms a one-to-one mapping key-value pair with the corresponding region of interest image, serving as the input foundation for the subsequent offline full-space data augmentation module.
[0046] See attached document Figure 2 The offline full-space data expansion module is specifically configured to perform operations such as rotation parameter setting, discretization image generation based on inverse mapping, bilinear interpolation resampling, and classification label solidification storage.
[0047] The offline full-space data augmentation module receives output data from the image preprocessing and annotation module, namely, a baseline CAPTCHA image with the region of interest extracted and the baseline positive pose established. To address the issues of uneven feature space coverage and long-tail distribution caused by randomness in online random augmentation techniques, this embodiment employs a deterministic full-space discretization traversal strategy.
[0048] The offline full-space data augmentation module first sets the discretization parameters of the rotation space. The system sets the rotation coverage area to a complete circular space, i.e., [ Set the rotation step size to... (In this embodiment, it is set) Then the total number of samples generated by discretizing the entire space is... The calculation is as follows: ; In this embodiment, when the step size is 1 degree, This means that each baseline image will be mapped to generate 360 independent training samples with different rotation angles.
[0049] Subsequently, the offline full-space data augmentation module enters the discretization image generation process. For each reference image... The offline full-space data augmentation module sets the geometric center of the image. For the rotation anchor point. Follow the index. ( The system sequentially generates the target rotation angle. : ; Rotation angle for each target The offline full-space data augmentation module constructs an inverse mapping transformation from the destination image to the base image. This is defined here. For the first generation to be generated A rotated image, the size of which is the same as the baseline CAPTCHA image. Consistent.
[0050] To prevent pixel holes in the target image due to coordinate rounding during rotation transformation, the offline full-space data augmentation module traverses the target image. Each discrete integer pixel coordinate Calculate its value in the benchmark CAPTCHA image. The corresponding floating-point coordinates The geometric transformation formula for the inverse mapping is as follows: ; in, For target image The column and row coordinates (discrete integer values) of the pixel currently being filled. The point obtained from the calculation is in the baseline CAPTCHA image. The corresponding sampling position coordinates (continuous floating-point values); Fixed coordinates for the center of rotation of the image; matrix It rotates counterclockwise. The inverse transformation matrix (i.e., the matrix corresponding to clockwise rotation) The matrix is used to map the target coordinates back to the reference coordinate system.
[0051] Because of the calculated floating-point coordinates It usually contains a decimal part and cannot be directly compared to the base CAPTCHA image. For a single pixel in the data, the offline full-space data augmentation module uses the bilinear interpolation algorithm to calculate the pixel value at that location.
[0052] The system first determines the coordinates. The four adjacent integer coordinates: top left corner Top right corner Bottom left corner and bottom right corner .
[0053] in, .
[0054] target pixel value The calculation is achieved by a weighted average in both the horizontal and vertical directions, as shown in the following formula: ; Through this interpolation calculation, the system will use the baseline verification code image. Reconstructing texture information into the target image of At the coordinates, the jagged effect caused by rotation is effectively suppressed. If the calculated... If the pixel value exceeds the boundary of the reference image, the pixel value at that location will be filled with the preset background color.
[0055] In generating the first Zhang Rotation Image Subsequently, the offline full-space data expansion module performs tag solidification and storage operations. This system models rotation angle recognition as a classification task; therefore, for rotation angle... For images, their classification labels are directly defined as angular indices. The offline full-space data expansion module persistently stores images according to a preset format.
[0056] For example, the image of a sample with the original ID imgA after rotating it by 15 degrees is named imgA_15.jpg, and the corresponding classification label is 15.
[0057] Through the above steps, the offline full-space data augmentation module constructs a full-space discretized dataset. : ; in, The total number of baseline samples in the initial corpus. As an angle category, This refers to the total number of derived samples for a single image as defined above. This dataset enforces coverage of... Each discrete angle point in the space ensures absolute balance of the training data across angle categories.
[0058] See attached document Figure 3 The discretized classification network training and inference module is specifically configured to perform operations such as deep feature extraction, full-space angle probability prediction, loss function calculation, and backpropagation optimization.
[0059] The discretized classification network training and inference module receives a full-space discretized dataset from the offline full-space data augmentation module. Unlike traditional regression networks that directly predict continuous angle values, this invention reconstructs the rotation angle recognition task into a fine-grained multi-class classification task. This is because the total number of derived samples per image is set in the preceding steps. 360 (corresponding to step size) Furthermore, each derived sample corresponds to an independent angle category. Therefore, the number of output nodes in the deep neural network constructed by the discretized classification network training and inference module is configured to be equal to the total number of derived samples in a single image. .
[0060] The discretized classification network training and inference module first constructs a deep convolutional neural network (DCNN) as its backbone architecture. The input to this network is a normalized image tensor. Assume the height and width of the input image are both... The number of channels is Then input tensor The dimension is ,in, This refers to the batch size during training.
[0061] The network backbone consists of multiple stacked residual convolutional blocks. Each residual convolutional block performs the following feature mapping operation: ; in, and These represent the input feature map tensor and the output feature map tensor of the residual convolutional block, respectively. The set of weight parameters representing the convolution kernel; This represents a composite transformation function that includes convolution, batch normalization, and activation functions. This represents a non-linear activation function (e.g., ReLU). This represents element-wise addition of feature maps, used to construct skip connections to prevent the vanishing gradient problem in deep networks.
[0062] In a preferred embodiment of the present invention, considering that CAPTCHA images typically contain high-frequency texture features (such as noise and interference lines), the training and inference module of the discretized classification network employs a small-size convolutional kernel stacking strategy. Specifically, the set of weight parameters of the convolutional kernels... Configured with a spatial size of 3×3, a stride of 1, and padding of 1, the network effectively expands the receptive field while maintaining a small number of parameters, thus enabling it to capture minute stroke direction features in CAPTCHA images.
[0063] After multi-layer convolutional feature extraction, the discretized classification network training and inference module uses a global average pooling (GAP) layer to compress the spatial feature map into a one-dimensional feature vector. This reduces the number of parameters in the fully connected layer and suppresses overfitting.
[0064] Subsequently, the discretized classification network training and inference module uses a fully connected classification layer to process the one-dimensional feature vector. Mapped to dimension Logits Vector Logical value vector Each element in ( ) represents the input image belonging to the first... The original confidence scores for each angle category.
[0065] To transform the logical values into a probability distribution, the training and inference modules of the discretized classification network apply the Softmax normalization function. For the... Each angle category has a predicted probability. The calculation is as follows: ; in, For the first Logical output values for each category; To sum the traversal indices.
[0066] Furthermore, considering the physical continuity and visual similarity of rotation angles, in order to prevent the model from becoming overconfident between adjacent angle categories and to improve generalization ability, the discretized classification network training and inference module adopts a Gaussian label smoothing strategy when constructing real labels.
[0067] Specifically, the training and inference modules of the discretized classification network no longer use a single one-hot hard label, but instead construct a probability distribution vector. As the target label. For the true angle category. Its neighborhood category tag value The assignment is as follows: ; in, The standard deviation parameter is a preset parameter used to control the smoothness of the distribution; Neighborhood category Compared to the real category The circumferential distance between them is calculated using the following formula: ; By introducing circumferential distance, this strategy clarifies... and Semantic adjacency relationships enable the network to learn the gradual change features of angles.
[0068] During the network training phase, the discretized classification network training and inference modules use the cross-entropy loss function to measure the difference between the predicted probability distribution and the true label distribution. Assume the true angle label of the current training sample is... (Corresponding to the index in One-hot encoding), then the loss value of a single sample The calculation formula is: ; in, This is an indicator function; it takes the value 1 when the condition within the parentheses is true, and 0 otherwise.
[0069] The discretized classification network training and inference module calculates the entire batch. average loss The loss function is calculated relative to the network weight parameters using the back propagation algorithm. gradient Update network weight parameters using stochastic gradient descent (SGD) or the Adam optimizer. Continue until the model converges.
[0070] In the inference application phase (i.e., the CAPTCHA recognition phase), the discretized classification network training and inference module receives the unknown CAPTCHA image to be recognized. The model outputs a predicted probability vector. Subsequently, the discretized classification network training and inference module selects the index with the highest probability as the predicted current rotation angle. : ; Finally, the discretized classification network training and inference modules are based on the predicted current rotation angle. Calculate the reverse rotation angle required for correction : ; The discretized classification network training and inference module utilizes this inverse rotation angle. An affine transformation is performed on the unknown CAPTCHA image to be identified, restoring it to a baseline positive pose, thereby completing the CAPTCHA pose correction task. Through this discretization classification strategy, this invention avoids the angular periodicity inherent in regression methods. and The problem of predicting oscillations caused by discontinuities in attitude has been solved, and high-precision attitude estimation has been achieved.
[0071] See attached document Figure 4 The discretized classification network training and inference module is not only responsible for the offline training of the model, but is also configured to perform the reception of the image to be recognized, preprocessing consistency verification, forward inference and pose correction in the online inference stage.
[0072] In online application scenarios, the discretized classification network training and inference module first receives the CAPTCHA image to be recognized from the client or verification server. To ensure that the feature distribution during online inference remains consistent with that during offline training, the discretized classification network's training and inference modules must be aligned with the CAPTCHA image to be recognized. Perform the same preprocessing steps as described in Part 3.
[0073] Specifically, the training and inference modules of the discretized classification network utilize the aforementioned gradient magnitude calculation formula. and mask matrix generation formula Image of the CAPTCHA to be recognized Perform background noise removal and scale it to a fixed size. The pixel size is used to obtain a standardized network input tensor.
[0074] Subsequently, the discretized classification network training and inference module inputs the preprocessed input Zhang Tang into the already trained deep convolutional neural network. The network performs forward propagation, with an output dimension of... Predicted probability vector Discretized classification network training and inference modules traverse and predict probability vectors. Find the index corresponding to the maximum probability value.
[0075] ; Based on this optimal index The discretized classification network training and inference module utilizes a preset rotation step size. Reverse decode the CAPTCHA image to be recognized Current estimated rotation angle : ; In order to identify the CAPTCHA image To restore the visually recognizable positive semantic pose, the discretized classification network training and inference modules calculate the inverse rotation angle required for physical correction. Taking into account the periodicity of the angle, the calculation formula is as follows: ; in, This represents the modulo operation, used for processing. and The boundary overlap situation. The discretized classification network training and inference module is based on the inverse rotation angle. Generate the corresponding affine transformation matrix for the CAPTCHA image to be recognized. Perform a rotation operation to output the final corrected image. .
[0076] Furthermore, one embodiment of the present invention also provides an electronic device comprising a memory and a processor. The memory stores computer program instructions, and the processor executes the computer program instructions to implement the aforementioned image CAPTCHA data augmentation and recognition method. When performing the function of the offline full-space data augmentation module, the electronic device trades memory space for computation time, utilizing the completeness of the full-space discretized dataset to eliminate the uncertainty brought about by traditional random augmentation. When performing the function of the discretized classification network training and inference module, it transforms the continuous regression problem into a classification problem, utilizing the strong convexity of the cross-entropy loss function to solve the common problem of discontinuous angle oscillations in CAPTCHA pose estimation, thereby improving recognition accuracy.
Claims
1. A training system for recognizing rotating CAPTCHAs, characterized in that, include: The CAPTCHA acquisition and cleaning module acquires raw CAPTCHA images through a network interface, performs feature comparison on the acquired raw CAPTCHA images and removes duplicate samples to build an initial corpus. The image preprocessing and annotation module extracts features from the images in the initial corpus and locates the target subject, generates a region of interest image containing the target subject, and establishes the baseline positive pose of the region of interest image through human-computer interaction. The offline full-space data augmentation module, based on the baseline positive attitude, performs discretized rotation generation within a preset rotation space at a preset step size to construct a discretized training dataset containing full-angle category labels. The recognition training and prediction module constructs a convolutional neural network model, establishes a mapping relationship between image visual features and discrete angle categories using the discretized training dataset, and determines the rotation angle of the image to be recognized based on the probability distribution output by the model.
2. The recognition and training system for a rotating CAPTCHA according to claim 1, characterized in that, The verification code collection and cleaning module is specifically used for: A reverse protocol is used to simulate a client requesting to download CAPTCHA images in batches, and the characteristic fingerprint of each downloaded image is calculated. The feature fingerprint of the image to be processed is compared with the feature fingerprint of the image in the existing corpus. If the similarity is higher than a preset threshold or the fingerprint is completely consistent, it is determined to be a redundant sample and deleted. The retained unique samples are collected into the initial corpus.
3. The recognition and training system for a rotating CAPTCHA according to claim 1, characterized in that, The steps of the image preprocessing and annotation module to generate an image of the region of interest containing the target subject specifically include: The original CAPTCHA image is subjected to grayscale conversion and edge enhancement processing, and the circular boundary in the image is located by using Hough transform combined with contour analysis algorithm. A mask is generated based on the circular boundary. Logical operations are performed between the original CAPTCHA image and the mask to retain the internal region of the mask and remove background noise outside the mask, resulting in a region of interest image containing only the target subject.
4. The recognition and training system for a rotating CAPTCHA according to claim 1, characterized in that, The steps of establishing the baseline positive pose of the region of interest image in the image preprocessing and annotation module specifically include: A dual-window interactive interface is provided, which includes a reference window for displaying a reference image and an operation window for displaying an image to be annotated. In response to user interaction commands, the rotation angle of the image in the operation window is adjusted until the visual pose of the image to be labeled is aligned with the positive state, and the angle state at this time is recorded as the reference positive pose of the image to be labeled.
5. The recognition and training system for a rotating CAPTCHA according to claim 1, characterized in that, The offline full-space data expansion module is specifically used for: Set the rotation step size to 1 degree, and the rotation range covers 0 degrees to 360 degrees; Starting from the baseline positive pose of each image, rotation transformations from 0 degrees to 359 degrees are performed to generate 360 derived images. The rotation angle value corresponding to each derived image is used as the classification label of the derived image, and all derived images and their classification labels are stored as offline files to form the discretized training dataset.
6. The recognition and training system for a rotating CAPTCHA according to claim 1, characterized in that, The convolutional neural network model constructed by the recognition training and prediction module specifically includes: The input layer is used to receive preprocessed three-channel RGB image data. The feature extraction layer, which contains multiple convolutional units, is used to extract rotational texture features of the image in high-dimensional space. The classification output layer, consisting of fully connected layers, has its output nodes having a dimension that is consistent with the total number of categories generated by full-angle discretization. These nodes are used to output non-normalized values of the input image belonging to each discrete angle category.
7. The recognition and training system for a rotating CAPTCHA according to claim 6, characterized in that, The classification output layer in the recognition training and prediction module has 360 output nodes, each corresponding to an integer angle category from 0 degrees to 359 degrees. The recognition training and prediction module is configured to map the input image into a vector of length 360, where each element of the vector represents the confidence level of the image belonging to the corresponding angle category.
8. The recognition and training system for a rotating CAPTCHA according to claim 7, characterized in that, The specific steps of the recognition training and prediction module in establishing the mapping relationship between image visual features and discrete angle categories are as follows: The output vector of the classification output layer is processed by a normalized exponential function to obtain the predicted probability distribution of each category from different angles; The difference between the predicted probability distribution and the true classification label is calculated using the cross-entropy loss function; Based on the difference values, the weight parameters of the convolutional neural network model are updated using the backpropagation algorithm until the convolutional neural network model converges.
9. The recognition and training system for a rotating CAPTCHA according to claim 8, characterized in that, The specific steps of the recognition training and prediction module in determining the rotation angle of the image to be recognized are as follows: Obtain the predicted probability distribution of 360 categories of the output of the convolutional neural network model for the current image to be recognized; Compare the probability values of all categories and select the index value corresponding to the category with the highest probability value; The index value is directly determined as the predicted rotation angle of the image to be identified, and the predicted angle value is returned through the system interface.
10. The recognition and training system for a rotating CAPTCHA according to claim 1, characterized in that, The recognition training and prediction module further includes a dynamic fine-tuning unit, which is used for: Collect and feedback recognition results during system operation; Incremental training samples are constructed based on feedback data, and the gradient bias of the prediction results is calculated. The parameters of the convolutional neural network model are updated online in an iterative manner to reduce the misclassification rate of the model in the subsequent recognition process.