Character comparison method and device based on image classification, equipment and medium
Through image generation and texture feature extraction technology, combined with image binary classification model, the problems of high recognition error rate and low efficiency of traditional OCR technology in multilingual name recognition are solved, and efficient and accurate text image comparison is achieved.
Patent Information
- Application Number
- CN202510651779.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-20
- Publication Date
- 2025-08-15
AI Technical Summary
Traditional OCR technology is difficult to accurately segment characters when dealing with multilingual names, resulting in high recognition error rates, unable to effectively deal with name comparison tasks across text systems, and low recognition efficiency, making it difficult to meet the high requirements in the fields of financial technology and medical and health.
High-quality text images are generated through image generation technology, texture features are extracted and similarity recognition is recognized using the pre-constructed image binary classification model, including text feature encoding, envelope extraction and texture feature extraction, adaptive text rotation and shape changes, improving the stability and accuracy of feature extraction.
It improves the accuracy and efficiency of text image recognition, can effectively handle multilingual name comparison, enhances the flexibility and accuracy of image comparison, and adapts to the differences in different text systems.
Smart Images

Figure CN120496097A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image detection technology, and in particular to a text comparison method, device, equipment and medium based on image classification. Background Art
[0002] With the acceleration of globalization and the widespread adoption of digital technology, the demand for multilingual name processing has grown significantly in sectors such as healthcare and fintech. Names in different scripts exhibit significant differences in character morphology, transliteration rules, and semantic structure. Traditional methods based on text-based optical character recognition struggle to effectively handle cross-script name matching.
[0003] For example, in healthcare, with the increasing frequency of cross-border medical collaboration, accurate recognition and comparison of multilingual names in medical records, medical archives, and patient identity verification are crucial. When a patient from an Arabic-speaking region seeks treatment at an international hospital, their name may contain complex Arabic characters, which differ significantly from Latin characters in morphology and have complex and variable transliteration rules. Traditional OCR technology often encounters recognition errors when processing such names due to significant character morphological differences and difficulty in word segmentation. This in turn impacts the accurate recording of medical records and the rapid verification of patient identities.
[0004] For example, in the fintech sector, with the rise of cross-border payments and international investment, multilingual name processing has become particularly important in user identity verification and transaction review. When making international remittances, accurately matching the sender's name with the recipient's name is key to ensuring the safe arrival of funds. However, when it comes to names in multiple languages, such as Chinese, Japanese, and Korean, traditional OCR technology cannot accurately process similar characters, rare characters, and differences between different writing systems, often resulting in name matching failures, which in turn leads to transaction delays or financial risks. Furthermore, fintech businesses have extremely high requirements for processing speed and efficiency. Traditional OCR technology, due to its heavy word segmentation workload and low recognition efficiency, struggles to meet actual business needs.
[0005] In the existing technology, text name recognition is mostly based on optical character recognition technology. The text to be recognized is first segmented, and then each segmented word is recognized to determine whether it is the target text. However, this method is difficult to accurately segment each word. When the amount of text data is large, the workload of word segmentation is large, and the word segmentation processing is difficult to continue, resulting in low recognition efficiency. At the same time, it is also impossible to more accurately process characters that are not in the database or similar characters, resulting in low text recognition accuracy.
[0006] Therefore, how to improve the recognition accuracy and efficiency of text images has become an urgent problem to be solved. Summary of the Invention
[0007] The present invention provides a text comparison method, device, equipment and medium based on image classification, the main purpose of which is to solve the problems of low accuracy and low recognition efficiency of text image recognition.
[0008] In a first aspect, to achieve the above-mentioned objectives, the present invention provides a text comparison method based on image classification, comprising:
[0009] Acquire a first target text and a second target text, and generate images of the first target text and the second target text to obtain a first image of text to be recognized and a second image of text to be recognized;
[0010] Performing envelope extraction on the first to-be-recognized character image and the second to-be-recognized character image to obtain corresponding first target image and second target image;
[0011] Extracting texture features from the first target image and the second target image respectively to obtain corresponding first features and second features;
[0012] The first feature and the second feature are similarly identified based on a pre-built image binary classification model to obtain an image comparison result.
[0013] In a second aspect, the present invention further provides a text comparison device based on image classification, comprising:
[0014] An image generation module is configured to obtain a first target text and a second target text, and perform image generation on the first target text and the second target text to obtain a first image of text to be recognized and a second image of text to be recognized;
[0015] an envelope extraction module, configured to perform envelope extraction on the first to-be-recognized character image and the second to-be-recognized character image to obtain corresponding first target images and second target images;
[0016] a texture feature extraction module, configured to extract texture features from the first target image and the second target image respectively to obtain corresponding first features and second features;
[0017] The similarity recognition module is used to perform similarity recognition on the first feature and the second feature according to a pre-built image binary classification model to obtain an image comparison result.
[0018] In a third aspect, the present invention further provides an electronic device, comprising:
[0019] at least one processor; and,
[0020] a memory communicatively connected to the at least one processor; wherein,
[0021] The memory stores a computer program that can be executed by the at least one processor. The computer program is executed by the at least one processor so that the at least one processor can execute the above-mentioned text comparison method based on image classification.
[0022] In a fourth aspect, the present invention also provides a computer-readable storage medium, in which at least one computer program is stored. The at least one computer program is executed by a processor in an electronic device to implement the above-mentioned text comparison method based on image classification.
[0023] The present invention accurately extracts text features from the target text and converts them into high-dimensional feature vectors, which not only retains the feature information of the text, but also enhances the stability of the features through numerical normalization. At the same time, based on image generation technology, it effectively avoids the common blur and distortion problems in traditional image generation, generates high-quality, recognizable text images, and significantly improves the authenticity and usability of the image; generates a minimum envelope area through contour fitting, which can adapt to the rotation angle and shape changes of the text, ensuring the stability and accuracy of feature extraction; by extracting texture features from two target images, it can capture subtle texture differences on the image surface and improve image recognition accuracy. The first feature and the second feature can be used as unique identifiers of the image to calculate the similarity between images, and can efficiently retrieve images with similar textures to the target image from a large number of images, thereby improving the efficiency of text image retrieval and matching; through the pre-constructed image binary classification model for feature similarity calculation, it can fully utilize the learning ability and generalization ability of the model, improve the accuracy of image comparison, enhance the comparison flexibility, and improve the efficiency of text image comparison. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments of the present invention. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0025] Figure 1 A schematic diagram of an application environment of a text comparison method based on image classification in one embodiment of the present invention;
[0026] Figure 2 A flowchart of a text comparison method based on image classification provided by one embodiment of the present invention;
[0027] Figure 3 A schematic diagram of a process for performing envelope extraction on the first image of text to be recognized and the second image of text to be recognized provided in one embodiment of the present invention;
[0028] Figure 4 A schematic diagram of a module of a text comparison device based on image classification provided by one embodiment of the present invention;
[0029] Figure 5 A schematic structural diagram of an electronic device for implementing a text comparison method based on image classification according to an embodiment of the present invention;
[0030] Figure 6 Another structural diagram of an electronic device for implementing a text comparison method based on image classification provided by an embodiment of the present invention.
[0031] The purpose, features and advantages of the present invention will be further described with reference to the accompanying drawings and in conjunction with the embodiments. DETAILED DESCRIPTION
[0032] In order to enable those skilled in the art to better understand the technical solutions of the present disclosure, and to fully understand and implement how the present disclosure applies technical means to solve technical problems and achieve the corresponding technical effects, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. The embodiments of the present disclosure and the various features in the embodiments can be combined with each other without conflict, and the technical solutions formed are all within the scope of protection of the present disclosure. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without making creative work should fall within the scope of protection of the present disclosure.
[0033] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, apparatus, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0034] The embodiment of the present application provides a text comparison method based on image classification, and the execution subject of the text comparison method based on image classification includes but is not limited to at least one of the electronic devices such as a server and a terminal that can be configured to execute the device provided by the embodiment of the present application. In other words, the text comparison method based on image classification can be executed by software or hardware installed on a terminal device or a server device. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, etc. The server can be an independent server, or it can be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0035] The present invention provides a text comparison method based on image classification, which can be applied in Figure 1 In this application environment, the client communicates with the server via a network. The server can obtain the target text from the client, accurately extract text features from the target text, and convert them into high-dimensional feature vectors. This not only preserves the text's feature information but also enhances the stability of the features through numerical normalization. Simultaneously, based on image generation technology, it effectively avoids the blurring and distortion common in traditional image generation, generating high-quality, recognizable text images, significantly improving the image's authenticity and usability. Contour fitting is used to generate a minimum envelope area, which can adapt to the rotation angle and shape changes of the text, ensuring the stability and accuracy of feature extraction. Texture features are extracted from the two target images to capture subtle texture differences on the image surfaces, improving image recognition accuracy. The first and second features, as unique identifiers of the images, can be used to calculate similarity between images, efficiently retrieving images with similar textures to the target image from a large number of images, improving the efficiency of text image retrieval and matching. Feature similarity calculations using a pre-built image binary classification model fully leverage the model's learning and generalization capabilities, improving the accuracy and flexibility of image comparison, and enhancing the efficiency of text image comparison. Finally, the image comparison results are output and fed back to the client. The client can be, but is not limited to, various personal computers, laptops, smartphones, tablet computers, and portable wearable devices. The server can be implemented as an independent server or a server cluster consisting of multiple servers. The present invention is described in detail below through specific embodiments.
[0036] Reference Figure 2 FIG. 1 is a flow chart of a text comparison method based on image classification according to an embodiment of the present invention. In this embodiment, the text comparison method based on image classification includes:
[0037] S1. Acquire a first target text and a second target text, generate images of the first target text and the second target text, and obtain a first image of text to be recognized and a second image of text to be recognized.
[0038] In an embodiment of the present invention, text features of the target text are extracted and encoded into spatial layout constraints through a text encoder, and a text image corresponding to the target text is generated according to a generative adversarial network model such as StyleGAN-Text combined with the spatial layout constraints.
[0039] In the embodiment of the present invention, the first target text may be a passport name, an ID card name, etc., and the second target text may be various system name texts pre-stored in a database.
[0040] For example, in the medical and health field, the first target text can be the patient's basic identity information such as name, ID number, etc. in the electronic medical record, and the second target text can be the standard medical record template field stored in the hospital database such as the patient's name in the medical record.
[0041] For example, in the field of financial technology business, the first target text may be financial credential information submitted by the user, such as the name of the bank card holder, etc., and the second target text may be standard text in the risk control database of the financial institution, such as the name of the insured person, etc.
[0042] In the embodiment of the present invention, the step of generating images of the first target text and the second target text to obtain a first image of text to be recognized and a second image of text to be recognized includes:
[0043] Performing text feature extraction on the first target text and the second target text to obtain corresponding first text features and second text features;
[0044] Performing feature coding on the first text feature and the second text feature to obtain corresponding first feature codes and second feature codes;
[0045] Performing position encoding fusion on the first feature code and the second feature code respectively to obtain corresponding first spatial constraint parameters and second spatial constraint parameters;
[0046] A pre-built adversarial network model is used to generate a first image of text to be recognized and a second image of text to be recognized according to the first spatial constraint parameter and the second spatial constraint parameter.
[0047] In the embodiments of the present invention, the spatial constraint parameters include the feature information of two target texts and are represented in a specific form for constraining and guiding the spatial structure, layout, etc. of an image during the image generation process; the adversarial network model generally refers to the Generative Adversarial Networks (GAN). The generative adversarial network consists of two parts: a generator and a discriminator. The generator is responsible for generating realistic images, and the discriminator is responsible for determining whether an image is a real image or a fake image generated by the generator. Through the adversarial training between the generator and the discriminator, the generator can continuously learn to generate more realistic images.
[0048] In the embodiments of the present invention, the bag-of-words model (BoW) can be used to convert the first target text and the second target text into high-dimensional vector representations respectively. The first target text and the second target text are split into sequences of words or characters using a tokenization tool, and at the same time, meaningless words (such as "of", "is") are removed to reduce noise. The unique words in all texts are counted to construct a vocabulary. For each text, the number of occurrences of each word in the vocabulary is counted to generate a term frequency vector, and the term frequency vector with high term frequency dimensions is used as the text feature.
[0049] Specifically, the extracted first text feature and second text feature are converted into an encoding form that is more suitable for computer processing and model training for subsequent image generation. Each feature can be represented as a binary vector through one-hot encoding, where only one element is 1 and the rest are 0. For example, for a feature with three categories, category 1 can be represented as [1, 0, 0], category 2 can be represented as [0, 1, 0], and category 3 can be represented as [0, 0, 1].
[0050] In the present invention, position encoding such as the position embedding in Transformer is added to the first feature encoding and the second feature encoding to clarify the relative position relationship between the two target texts in the image. A layout template (such as a table, a paragraph) is introduced as prior knowledge, and the layout template is converted into a numerical representation. For example, a table layout can be encoded as [1, 0]. The feature encoding, position encoding, and layout template are concatenated to generate the spatial constraint parameters.
[0051] In detail, the spatial constraint parameters are used as the input of the generator in the generative adversarial network model. The generator is usually a neural network model, which receives input parameters and generates corresponding images. The generator gradually generates image feature maps based on the input spatial constraint parameters by using multiple convolutional layers. Each convolutional layer is followed by batch normalization and activation function. Deconvolution or upsampling is used to enlarge the feature map to the target resolution to generate an initial image. The initial image may be blurry or unrealistic. The generated image is then input into the discriminator. The discriminator determines whether the image is a real image or a fake image generated by the generator. After multiple iterative optimizations, the generator can generate high-quality first and second text images to be recognized.
[0052] In an embodiment of the present invention, text features are accurately extracted from the target text and converted into high-dimensional feature vectors, which not only retains the feature information of the text, but also enhances the stability of the features through numerical normalization. At the same time, based on image generation technology, the common blur and distortion problems in traditional image generation are effectively avoided, and high-quality, recognizable text images are generated, which significantly improves the authenticity and usability of the image.
[0053] S2. Perform envelope extraction on the first to-be-recognized text image and the second to-be-recognized text image to obtain a corresponding first target image and a second target image.
[0054] In an embodiment of the present invention, the envelope extraction refers to grayscale processing of the first text image to be recognized and the second text image to be recognized, obtaining a set of edge pixel points through edge detection, performing contour fitting based on the set to generate an envelope area, and finally cropping the original grayscale image according to the envelope area to obtain the first target image and the second target image.
[0055] like Figure 3 As shown, in the embodiment of the present invention, performing envelope extraction on the first to-be-recognized text image and the second to-be-recognized text image to obtain the corresponding first target image and second target image includes:
[0056] grayscale the first image of the text to be recognized and the second image of the text to be recognized to obtain a first grayscale image and a second grayscale image;
[0057] Performing edge detection on the first grayscale image and the second grayscale image to obtain a corresponding first edge pixel point set and a second edge pixel point set;
[0058] performing contour fitting in the first grayscale image and the second grayscale image according to the first edge pixel set and the second edge pixel set, respectively, to generate corresponding first envelope regions and second envelope regions;
[0059] The first grayscale image is subjected to regional cropping according to the first envelope area to obtain a first target image, and the second grayscale image is subjected to regional cropping according to the second envelope area to obtain a second target image.
[0060] In detail, for the first text image to be recognized and the second text image to be recognized, a grayscale algorithm is used respectively to convert the color information of each pixel from the values of the three RGB (red, green, and blue) channels into a grayscale value. The weighted average method is usually used to assign different weights to the three RGB channels according to the sensitivity of the human eye to different colors. For example, a common formula is Gray = 0.299*R+0.587*G+0.114*B, where Gray represents the grayscale value, and R, G, and B represent the values of the three red, green, and blue channels respectively. The grayscale value of each pixel is calculated by this formula to obtain the first grayscale image and the second grayscale image.
[0061] In the embodiment of the present invention, the grayscale processing can reduce the amount of image data, lower the computational complexity, and eliminate the interference of color information on subsequent edge detection and other operations.
[0062] In detail, an edge detection algorithm such as the Canny edge detection algorithm can be used to process the first grayscale image and the second grayscale image to detect edge pixels in the image, wherein a Gaussian filter is used to smooth the grayscale image to remove noise in the image and reduce the impact of noise on the edge detection results. A gradient operator such as the Sobel operator is used to calculate the gradient amplitude and direction of each pixel in the image. The gradient amplitude reflects the degree of change in the image brightness, and the gradient direction indicates the direction in which the brightness changes fastest. Non-maximum suppression is performed in the gradient direction to remove some non-edge pixels and retain the pixels with the local maximum gradient amplitude to make the edge more refined.
[0063] Among them, two high and low gradient thresholds are set, and pixels with gradient amplitudes greater than the high threshold are marked as strong edge pixels, pixels with gradient amplitudes less than the low threshold are marked as non-edge pixels, and pixels with gradient amplitudes between the high and low thresholds are marked as weak edge pixels. By connecting strong edge pixels and adjacent weak edge pixels, a complete edge is formed, and a first edge pixel set and a second edge pixel set are also obtained.
[0064] In an embodiment of the present invention, a contour detection algorithm such as the findContours function in the OpenCV library is generally used to detect contours in a set of edge pixel points. The algorithm traverses the set of edge pixel points, finds all continuous edge curves, and uses these curves as contours. Based on the shape and position information of the contour, an appropriate fitting method such as the least squares method is used to fit the polygon to generate an envelope area.
[0065] The envelope area is a minimum polygonal area that can completely surround the contour, which contains the main part of the target text. The contour fitting can accurately locate the position and shape of the target text in the image, providing precise boundary information for subsequent area cropping.
[0066] In an embodiment of the present invention, a rectangular area is determined in the first grayscale image and the second grayscale image based on the boundary coordinates of the envelope area. The rectangular area includes all pixels in the envelope area. The rectangular area is cropped out from the grayscale image using a cropping function in an image processing library (such as OpenCV) to obtain a first target image and a second target image.
[0067] For example, in financial technology scenarios such as insurance claims and policyholder information entry, it is necessary to use image preprocessing techniques such as envelope extraction to locate text areas and extract the insurer's name information from insurance policies, ID cards and other documents.
[0068] The present invention converts one or more color insurance policy images containing the insurer's name area into a grayscale image. The specific conversion formula can be Gray = 0.299*R + 0.587*G + 0.114*B. For example, if the RGB value of a pixel is (120, 180, 200), the grayscale value is Gray = 0.299*120 + 0.587*180 + 0.114*200 ≈ 165, thereby obtaining a first grayscale image (corresponding to the original insurance policy image) and a second grayscale image (such as a scanned ID card).
[0069] In detail, the noise of the first grayscale image and the second grayscale image can be removed by a Gaussian filter, the horizontal and vertical edges can be detected by the Sobel operator, the non-maximum suppression can be used to refine the edges, and the strong edges such as the outline of the name text can be determined according to the preset high and low thresholds to obtain the first edge pixel point set (insurance policy name area) and the second edge pixel point set (identity card name area).
[0070] Specifically, the traversal function of OpenCV is used to traverse the edge pixel points, all continuous edge curves are found, and polygon fitting is performed on each contour, such as the minimum circumscribed rectangle. For example, if the edge points of the name "Zhang San" form an irregular quadrilateral, it is fitted into a rectangular envelope area. According to the boundary coordinates of the envelope area, the rectangular area is cropped out from the grayscale image through the cropping function of the image processing library to obtain the first target image and the second target image, that is, the first target image can be a grayscale image containing only "Zhang San" and the second target image can be a grayscale image containing only "Li Si".
[0071] S3. Extract texture features from the first target image and the second target image respectively to obtain corresponding first features and second features.
[0072] In an embodiment of the present invention, the texture feature extraction is a technology that extracts texture information from an image to describe the surface structure or pattern of the image. The first target image and the second target image are divided into blocks to obtain corresponding blocks. Texture calculation is then performed on each sub-block to generate a set of texture response maps. Then, the texture pattern histogram of each sub-block is statistically analyzed to form a histogram sequence, and a primary texture feature matrix is constructed through spatial reorganization. Subsequently, the covariance matrix is feature decomposed, and the principal component vector is selected according to a preset threshold for spatial projection. Finally, an optimized image feature representation is generated through feature fusion, that is, the first feature and the second feature are obtained.
[0073] In the embodiment of the present invention, extracting texture features from the first target image and the second target image to obtain corresponding first features and second features includes:
[0074] performing image block processing on the first target image and the second target image to obtain a plurality of first sub-region blocks corresponding to the first target image and a plurality of second sub-region blocks corresponding to the second target image;
[0075] Performing texture calculation on each of the plurality of first sub-region blocks and the plurality of second sub-region blocks to generate a corresponding first primary texture feature matrix and a second primary texture feature matrix;
[0076] Performing matrix principal component dimensionality reduction processing on the first primary texture feature matrix and the second primary texture feature matrix to obtain corresponding first optimized feature matrix and second optimized feature matrix;
[0077] Feature vector fusion is performed on the first optimized feature matrix and the second optimized feature matrix respectively to generate corresponding first features and second features.
[0078] In an embodiment of the present invention, the blocking parameters are set according to the image resolution and the target feature size. Assuming that the image resolution is 256×256 pixels, the block size can be set to 32×32 pixels (8×8 blocks). In order to retain edge information, the inter-block overlap rate can be set (such as 50%), that is, adjacent blocks overlap by 16 pixels in the horizontal and vertical directions. The array slicing function of OpenCV is used to divide the first target image and the second target image into multiple first sub-region blocks and multiple second sub-region blocks, so as to perform more detailed texture analysis on each small block and avoid the influence of the complexity of the overall image texture features on the extraction results.
[0079] Among them, the texture calculation includes normalization processing, center pixel extraction, local binary pattern encoding, histogram statistics, etc. By arranging the histogram sequence in a spatially ordered manner, the spatial distribution characteristics of the texture pattern can be retained. Combined with the center pixel benchmark, the robustness of local texture representation can be enhanced. Normalization preprocessing effectively eliminates the impact of illumination differences on texture calculation, and effectively improves the accuracy of text image comparison.
[0080] In the embodiment of the present invention, performing texture calculation on each of the plurality of first sub-region blocks and the plurality of second sub-region blocks to generate the corresponding first primary texture feature matrix and second primary texture feature matrix includes:
[0081] performing normalization processing on each of the plurality of first sub-region blocks and the plurality of second sub-region blocks to obtain a corresponding first normalized word block set and a second normalized word block set;
[0082] extracting a first central pixel and a second central pixel of the first normalized word block set and the second normalized word block set respectively;
[0083] Taking the first central pixel and the second central pixel as references, respectively performing local binary pattern encoding on each block in the first normalized sub-block set and the second normalized block set to generate corresponding first texture response map set and second texture response map set;
[0084] Counting the texture pattern histogram of each sub-block in the first texture response map set and the second texture response map set respectively to obtain a corresponding first histogram sequence and second histogram sequence;
[0085] The first histogram sequence and the second histogram sequence are respectively arranged and combined in sub-block spatial order to obtain a corresponding first primary texture feature matrix and a second primary texture feature matrix.
[0086] In detail, according to the grayscale stretching algorithm, the grayscale value of each sub-region block in the multiple first sub-region blocks and the multiple second sub-region blocks is mapped to a preset normalization range to obtain the corresponding first normalized word block set and second normalized word block set. The normalization processing can eliminate the differences between different sub-region blocks caused by factors such as lighting and contrast, making subsequent texture calculations more accurate and stable.
[0087] For example, for each 32×32 sub-block, the center pixel coordinates are (16, 16), and the grayscale values of the center pixel coordinates are extracted as the first center pixel and the second center pixel. The center pixel can be used as the reference point for local binary pattern encoding. A binary code is generated by comparing the grayscale value relationship between the center pixel and its neighboring pixels, thereby reflecting the local texture characteristics of the image.
[0088] In detail, with the central pixel as the center of the circle and a sampling radius of R=1, P=8 equidistant neighboring pixels are selected, each neighboring pixel is spliced into a binary number in a clockwise order, and converted into a decimal pixel value, and a texture response map is generated for each sub-block according to a preset image generation technology and pixel value, and all the texture response maps are collected to obtain a first texture response map set and a second texture response map set.
[0089] The first texture response map set and the second texture response map set are pattern quantized, that is, the number of pixels in each set is counted to generate a histogram vector, and the first histogram sequence and the second histogram sequence are generated according to the histogram vector.
[0090] The histogram vectors of all sub-blocks are arranged in spatial order to form a matrix form, which is convenient for subsequent dimensionality reduction processing. According to the position of the sub-block in the texture response map, such as row priority or column priority, an index is assigned to each histogram vector, and the histogram vectors are filled into the matrix in index order to generate the first primary texture feature matrix and the second primary texture feature matrix. The primary texture feature matrix contains the texture feature information of each sub-region block.
[0091] In an embodiment of the present invention, performing matrix principal component dimensionality reduction processing on the first primary texture feature matrix and the second primary texture feature matrix to obtain the corresponding first optimized feature matrix and second optimized feature matrix includes:
[0092] performing mean centering processing on the first primary texture feature matrix and the second primary texture feature matrix respectively to obtain corresponding first normalized matrices and second normalized matrices;
[0093] Performing covariance calculation on the first standardized matrix and the second standardized matrix to obtain corresponding first covariance matrix and second covariance matrix;
[0094] Performing eigenvalue decomposition on the first covariance matrix and the second covariance matrix respectively to obtain corresponding first eigenvector sets and second eigenvector sets;
[0095] Selecting a first target vector and a second target vector from the first set of feature vectors and the second set of feature vectors, respectively, according to a preset principal component number threshold;
[0096] The first target vector and the second target vector are linearly projected into a preset principal component space to obtain a first optimized feature matrix and a second optimized feature matrix.
[0097] In detail, the column mean calculation is performed on the first primary texture feature matrix and the second primary texture feature matrix, that is, the mean of each feature dimension, and then the mean of the corresponding column is subtracted from each element of the matrix to obtain the first standardized matrix and the second standardized matrix. The mean centering processing can eliminate the offset of the data and make the data centered on zero, which is convenient for subsequent calculations.
[0098] The present invention can use a covariance calculation formula to calculate the covariance matrix of the mean-centered matrix, and the covariance matrix reflects the correlation between texture features.
[0099] Specifically, the covariance calculation formula is as follows:
[0100]
[0101] Wherein, Cov(X) represents the first covariance matrix (second covariance matrix), n represents the number of matrices of the first standardized matrix, X1 represents the first standardized matrix, and T represents transpose.
[0102] In an embodiment of the present invention, the covariance matrix is subjected to eigenvalue decomposition, i.e., the principal component direction of the covariance matrix is found, each covariance matrix is multiplied by a diagonal matrix, i.e., the eigenvalue, to obtain a first eigenvector set and a second eigenvector set, and the eigenvalues in the first eigenvector set and the second eigenvector set are sorted from large to small, and the first k eigenvectors are selected as the first target vector and the second target vector according to a preset principal component number threshold, and the selected target vectors are projected into a selected low-dimensional principal component space to generate an optimized feature matrix, and all optimized feature matrices are spliced into a long eigenvector by rows or columns.
[0103] In an embodiment of the present invention, by extracting texture features from two target images, subtle texture differences on the image surface can be captured, thereby improving image recognition accuracy. The first feature and the second feature serve as unique identifiers of the image and can be used to calculate the similarity between images. Images with textures similar to the target image can be efficiently retrieved from a large number of images, thereby improving the efficiency of text image retrieval and matching.
[0104] S4. Perform similarity recognition on the first feature and the second feature according to a pre-built image binary classification model to obtain an image comparison result.
[0105] In the embodiment of the present invention, similarity calculation is performed on the first feature and the second feature to obtain a similarity value, and then the images are compared according to a preset similarity threshold to obtain an image comparison result such as success or failure.
[0106] In the embodiment of the present invention, the performing similarity identification on the first feature and the second feature based on the pre-built binary image classification model to obtain the image comparison result includes:
[0107] Calculating feature similarity between the first feature and the second feature according to a pre-built image binary classification model to obtain a similarity value;
[0108] Determine an image comparison result based on the similarity value and a preset similarity threshold;
[0109] If the similarity value is greater than the similarity threshold, the image comparison result is that the image comparison is successful; if the similarity value is less than the similarity threshold, the image comparison result is that the image comparison fails.
[0110] In detail, the image binary classification model is trained based on a large amount of labeled data, has the ability to measure the similarity of input feature vectors, and accurately evaluates the similarity between the features of two images.
[0111] Among them, when the first feature and the second feature are input into the image binary classification model, the model will use specific algorithms and calculation methods to perform feature calculations on the two feature vectors, such as vector distance measurement (such as Euclidean distance, cosine similarity, etc.), feature matching and other technologies, and calculate a specific similarity value to intuitively reflect the degree of similarity between the two images in terms of features.
[0112] Specifically, the preset similarity threshold is a pre-set standard value that serves as the critical point for determining the success or failure of an image comparison. For example, in applications with high image similarity requirements, such as medical image analysis, the threshold may be set relatively high to ensure the accuracy of the comparison results; whereas in applications with less stringent similarity requirements, such as image search, the threshold may be appropriately lowered.
[0113] After obtaining the similarity value, the present invention compares it with a preset similarity threshold. If the similarity value is greater than the similarity threshold, it means that the two images have a high degree of similarity. At this time, the image comparison result is determined to be a successful image comparison, which indicates that the two images may be from the same category or have similar attributes. For example, in face recognition, it may mean that the two face images belong to the same person. On the contrary, if the similarity value is less than the similarity threshold, it is considered that there are large differences between the two images, and the image comparison result is determined to be a failed image comparison.
[0114] Exemplarily, in cross-border medical cooperation, hospitals need to integrate patient medical record data from different countries. Since patient names may be in multiple languages (such as Chinese, English, Arabic, etc.) and there are differences in writing formats (such as Chinese family names before given names and English given names before family names), directly comparing names may lead to incorrect matches. By using an image binary classification model to identify the similarity of the image features of name texts, the comparison accuracy can be improved.
[0115] Specifically, collect name samples in multiple languages (such as "Zhang Wei", "Wei Zhang", etc.), store the name texts in image form (such as scanned copies, screenshots of electronic documents), preprocess the images (such as grayscale conversion, denoising, binarization), unify the image size and resolution, extract the texture features of the text images such as stroke structure, character spacing, font style, etc., generate the first and second feature vectors, input the feature vectors of the two name images into a pre-constructed image binary classification model, the model calculates the cosine similarity or Euclidean distance of the feature vectors, outputs the similarity value, set the similarity threshold to 0.85, if the similarity value is greater than or equal to 0.85, it is determined that "the name match is successful"; if it is less than 0.85, it is determined that "the name match fails".
[0116] Exemplarily, in cross-border payment or anti-money laundering (AML) monitoring, financial institutions need to verify the consistency between the customer name and the transaction record. Since names may be in different languages (such as Spanish, Korean), traditional text matching methods are difficult to handle. By comparing image features, the verification reliability can be improved.
[0117] The present invention obtains a scanned copy of the customer's identity document (such as a passport, ID card), extracts the image data of the name area, performs standardization processing on the image (such as cropping, rotation correction) to ensure that the name area is clearly visible, uses a pre-trained deep learning model to extract the texture features of the name image, such as texture features such as character shape, stroke thickness, font layout, etc., inputs the feature vectors of the two name images into an image binary classification model, the model optimizes the feature space through metric learning, calculates the similarity score of the feature vectors, such as setting a dynamic threshold based on the historical data distribution, if the similarity value is greater than or equal to the similarity threshold, it is determined that "the names are the same".
[0118] In the embodiments of the present invention, by calculating the feature similarity through a pre-constructed image binary classification model, the learning ability and generalization ability of the model can be fully utilized, the subtle differences between image features can be accurately captured, thereby improving the accuracy of image comparison and enhancing the comparison flexibility, and improving the efficiency of text image comparison.
[0119] It should be understood that the magnitudes of the sequence numbers of the steps in the above embodiments do not mean the order of execution. The order of execution of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
[0120] like Figure 4 , which is a functional module diagram of a text comparison device based on image classification provided by one embodiment of the present invention.
[0121] In the embodiment of the present disclosure, a text comparison device based on image classification is provided, and the text comparison device based on image classification corresponds to the text comparison method based on image classification in the above embodiment. Figure 5 As shown, the text comparison device 100 based on image classification can be installed in an electronic device. According to the functions to be implemented, the text comparison device 100 based on image classification includes an image generation module 101, an envelope extraction module 102, a texture feature extraction module 103, and a similarity recognition module 104. The functional modules are described in detail as follows:
[0122] An image generation module 101 is configured to obtain a first target text and a second target text, and generate images of the first target text and the second target text to obtain a first image of text to be recognized and a second image of text to be recognized;
[0123] An envelope extraction module 102 is configured to perform envelope extraction on the first to-be-recognized character image and the second to-be-recognized character image to obtain corresponding first target images and second target images;
[0124] A texture feature extraction module 103 is configured to extract texture features from the first target image and the second target image respectively to obtain corresponding first features and second features;
[0125] The similarity recognition module 104 is configured to perform similarity recognition on the first feature and the second feature based on a pre-built binary image classification model to obtain an image comparison result.
[0126] In one embodiment, when the image generation module 101 generates images of the first target text and the second target text to obtain the first image of the text to be recognized and the second image of the text to be recognized, it is configured to:
[0127] Performing text feature extraction on the first target text and the second target text to obtain corresponding first text features and second text features;
[0128] Performing feature coding on the first text feature and the second text feature to obtain corresponding first feature codes and second feature codes;
[0129] Performing position encoding fusion on the first feature code and the second feature code respectively to obtain corresponding first spatial constraint parameters and second spatial constraint parameters;
[0130] A pre-built adversarial network model is used to generate a first image of text to be recognized and a second image of text to be recognized according to the first spatial constraint parameter and the second spatial constraint parameter.
[0131] In one embodiment, when performing envelope extraction on the first to-be-recognized text image and the second to-be-recognized text image to obtain the corresponding first target image and second target image, the envelope extraction module 102 is configured to:
[0132] grayscale the first image of the text to be recognized and the second image of the text to be recognized to obtain a first grayscale image and a second grayscale image;
[0133] Performing edge detection on the first grayscale image and the second grayscale image to obtain a corresponding first edge pixel point set and a second edge pixel point set;
[0134] performing contour fitting in the first grayscale image and the second grayscale image according to the first edge pixel set and the second edge pixel set, respectively, to generate corresponding first envelope regions and second envelope regions;
[0135] The first grayscale image is subjected to regional cropping according to the first envelope area to obtain a first target image, and the second grayscale image is subjected to regional cropping according to the second envelope area to obtain a second target image.
[0136] In one embodiment, when the texture feature extraction module 103 performs texture feature extraction on the first target image and the second target image to obtain the corresponding first feature and second feature, it is configured to:
[0137] performing image block processing on the first target image and the second target image to obtain a plurality of first sub-region blocks corresponding to the first target image and a plurality of second sub-region blocks corresponding to the second target image;
[0138] Performing texture calculation on each of the plurality of first sub-region blocks and the plurality of second sub-region blocks to generate a corresponding first primary texture feature matrix and a second primary texture feature matrix;
[0139] Performing matrix principal component dimensionality reduction processing on the first primary texture feature matrix and the second primary texture feature matrix to obtain corresponding first optimized feature matrix and second optimized feature matrix;
[0140] Feature vector fusion is performed on the first optimized feature matrix and the second optimized feature matrix respectively to generate corresponding first features and second features.
[0141] In one embodiment, when performing texture calculation on each of the plurality of first sub-region blocks and the plurality of second sub-region blocks to generate the corresponding first primary texture feature matrix and second primary texture feature matrix, the texture feature extraction module 103 is configured to:
[0142] performing normalization processing on each of the plurality of first sub-region blocks and the plurality of second sub-region blocks to obtain a corresponding first normalized word block set and a second normalized word block set;
[0143] extracting a first central pixel and a second central pixel of the first normalized word block set and the second normalized word block set respectively;
[0144] Taking the first central pixel and the second central pixel as references, respectively performing local binary pattern encoding on each block in the first normalized sub-block set and the second normalized block set to generate corresponding first texture response map set and second texture response map set;
[0145] Counting the texture pattern histogram of each sub-block in the first texture response map set and the second texture response map set respectively to obtain a corresponding first histogram sequence and second histogram sequence;
[0146] The first histogram sequence and the second histogram sequence are respectively arranged and combined in sub-block spatial order to obtain a corresponding first primary texture feature matrix and a second primary texture feature matrix.
[0147] In one embodiment, when the texture feature extraction module 103 performs matrix principal component dimensionality reduction processing on the first primary texture feature matrix and the second primary texture feature matrix to obtain the corresponding first optimized feature matrix and the second optimized feature matrix, it is configured to:
[0148] performing mean centering processing on the first primary texture feature matrix and the second primary texture feature matrix respectively to obtain corresponding first normalized matrices and second normalized matrices;
[0149] Performing covariance calculation on the first standardized matrix and the second standardized matrix to obtain corresponding first covariance matrix and second covariance matrix;
[0150] Performing eigenvalue decomposition on the first covariance matrix and the second covariance matrix respectively to obtain corresponding first eigenvector sets and second eigenvector sets;
[0151] Selecting a first target vector and a second target vector from the first set of feature vectors and the second set of feature vectors, respectively, according to a preset principal component number threshold;
[0152] The first target vector and the second target vector are linearly projected into a preset principal component space to obtain a first optimized feature matrix and a second optimized feature matrix.
[0153] In one embodiment, when performing similarity recognition on the first feature and the second feature based on the pre-built binary image classification model to obtain an image comparison result, the similarity recognition module 104 is configured to:
[0154] Calculating feature similarity between the first feature and the second feature according to a pre-built image binary classification model to obtain a similarity value;
[0155] Determine an image comparison result based on the similarity value and a preset similarity threshold;
[0156] If the similarity value is greater than the similarity threshold, the image comparison result is that the image comparison is successful; if the similarity value is less than the similarity threshold, the image comparison result is that the image comparison fails.
[0157] In the present invention, the specific definition of a text comparison device based on image classification can be found in the definition of a text comparison method based on image classification above, and will not be repeated here. Each module in the above-mentioned text comparison device based on image classification can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0158] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 5 As shown. The computer device includes a processor, a memory, a network interface and a database connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile and / or volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external client via a network connection. When the computer program is executed by the processor, it realizes the functions or steps on the server side of a text comparison method based on image classification.
[0159] In one embodiment, a computer device is provided. The computer device may be a client, and its internal structure diagram may be as follows: Figure 6As shown. The computer device includes a processor, memory, network interface, display screen and input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external server via a network connection. When the computer program is executed by the processor, it implements the functions or steps on the client side of a text comparison method based on image classification.
[0160] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the following steps are performed:
[0161] Acquire a first target text and a second target text, and generate images of the first target text and the second target text to obtain a first image of text to be recognized and a second image of text to be recognized;
[0162] Performing envelope extraction on the first to-be-recognized character image and the second to-be-recognized character image to obtain corresponding first target image and second target image;
[0163] Extracting texture features from the first target image and the second target image respectively to obtain corresponding first features and second features;
[0164] The first feature and the second feature are similarly identified based on a pre-built image binary classification model to obtain an image comparison result.
[0165] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and apparatuses can be implemented in other ways. For example, the system embodiments described above are merely illustrative. For example, the module division is merely a logical function division, and actual implementation may employ other division methods.
[0166] In addition, the functional modules in various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or hardware plus software functional modules.
[0167] Therefore, the embodiments should be considered in all respects as illustrative and non-restrictive, and the scope of the invention is defined by the appended claims rather than the foregoing description, and all changes that come within the meaning and range of equivalents of the claims are intended to be embraced therein. Any reference to a figure in a claim should not be construed as limiting the claim to which it relates.
[0168] In some implementations of this embodiment, a computer-readable storage medium is provided, on which a computer program is stored, characterized in that when the computer program is executed by a processor, the steps of the method described in the above embodiment are implemented.
[0169] The readable storage medium of the present invention stores a computer program, which, when executed by a processor of an electronic device, can implement:
[0170] Acquire a first target text and a second target text, and generate images of the first target text and the second target text to obtain a first image of text to be recognized and a second image of text to be recognized;
[0171] Performing envelope extraction on the first to-be-recognized character image and the second to-be-recognized character image to obtain corresponding first target image and second target image;
[0172] Extracting texture features from the first target image and the second target image respectively to obtain corresponding first features and second features;
[0173] The first feature and the second feature are similarly identified based on a pre-built image binary classification model to obtain an image comparison result.
[0174] It should be noted that the above functions or steps that can be implemented by the computer-readable storage medium or computer device can be found in the relevant descriptions of the server side and the client side in the aforementioned method embodiment. To avoid repetition, they will not be described one by one here.
[0175] The computer-readable storage medium may also store at least one computer-executable program / instruction, such as a computer-readable instruction. Computer-readable storage media include, but are not limited to, volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory. Computer-readable storage media may include, for example, read-only memory (ROM), a hard disk, a flash memory, etc. For example, a non-transitory computer-readable storage medium may be connected to a computing device such as a computer, and then, when the computing device executes the computer-readable instructions stored on the computer-readable storage medium, the various methods described above may be performed.
[0176] In addition, the computer device may also include (but is not limited to) a data bus, an input / output (I / O) bus, a display, and input / output devices (eg, keyboard, mouse, speaker, etc.).
[0177] In one embodiment, the at least one computer executable instruction may also be compiled into or constitute a software product / computer program product, wherein one or more computer executable instructions are executed by a processor to perform the various functions and / or method steps in the embodiments described in the present technology.
[0178] Those skilled in the art will appreciate that all or part of the processes in the above-described embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-described methods. In particular, any reference to memory, storage, database, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory.
[0179] Those skilled in the art will clearly understand that for the sake of convenience and brevity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0180] In the embodiments provided in the present disclosure, it should be understood that the disclosed devices and methods may also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architectures, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram may represent a module, a program segment or a part of a code, and the above-mentioned module, program segment or a part of the code contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions marked in the box may also occur in an order different from that marked in the accompanying drawings. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart, may be implemented with a dedicated hardware-based system that performs the specified function or action, or may be implemented with a combination of dedicated hardware and computer instructions.
[0181] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention, and should all be included in the scope of protection of the present invention.
[0182] It should be noted that if software tools or components other than those of our company appear in the embodiments of this application, they are only used for illustration and do not represent actual use.
Claims
1. A text comparison method based on image classification, characterized in that: The text comparison method includes: Acquire a first target text and a second target text, and generate images of the first target text and the second target text to obtain a first image of text to be recognized and a second image of text to be recognized; Performing envelope extraction on the first to-be-recognized character image and the second to-be-recognized character image to obtain corresponding first target image and second target image; Extracting texture features from the first target image and the second target image respectively to obtain corresponding first features and second features; The first feature and the second feature are similarly identified based on a pre-built image binary classification model to obtain an image comparison result.
2. The text comparison method based on image classification according to claim 1, characterized in that: Generating images of the first target text and the second target text to obtain a first image of text to be recognized and a second image of text to be recognized includes: Performing text feature extraction on the first target text and the second target text to obtain corresponding first text features and second text features; Performing feature coding on the first text feature and the second text feature to obtain corresponding first feature codes and second feature codes; Performing position encoding fusion on the first feature code and the second feature code respectively to obtain corresponding first spatial constraint parameters and second spatial constraint parameters; A pre-built adversarial network model is used to generate a first image of text to be recognized and a second image of text to be recognized according to the first spatial constraint parameter and the second spatial constraint parameter.
3. The text comparison method based on image classification according to claim 1, characterized in that: The step of performing envelope extraction on the first to-be-recognized character image and the second to-be-recognized character image to obtain corresponding first target images and second target images includes: grayscale the first image of the text to be recognized and the second image of the text to be recognized to obtain a first grayscale image and a second grayscale image; Performing edge detection on the first grayscale image and the second grayscale image to obtain a corresponding first edge pixel point set and a second edge pixel point set; performing contour fitting in the first grayscale image and the second grayscale image according to the first edge pixel set and the second edge pixel set, respectively, to generate corresponding first envelope regions and second envelope regions; The first grayscale image is subjected to regional cropping according to the first envelope area to obtain a first target image, and the second grayscale image is subjected to regional cropping according to the second envelope area to obtain a second target image.
4. The text comparison method based on image classification according to claim 1, characterized in that: The extracting texture features of the first target image and the second target image respectively to obtain corresponding first features and second features includes: performing image block processing on the first target image and the second target image to obtain a plurality of first sub-region blocks corresponding to the first target image and a plurality of second sub-region blocks corresponding to the second target image; Performing texture calculation on each of the plurality of first sub-region blocks and the plurality of second sub-region blocks to generate a corresponding first primary texture feature matrix and a second primary texture feature matrix; Performing matrix principal component dimensionality reduction processing on the first primary texture feature matrix and the second primary texture feature matrix to obtain corresponding first optimized feature matrix and second optimized feature matrix; Feature vector fusion is performed on the first optimized feature matrix and the second optimized feature matrix respectively to generate corresponding first features and second features.
5. The text comparison method based on image classification according to claim 4, characterized in that: The performing texture calculation on each of the plurality of first sub-region blocks and the plurality of second sub-region blocks to generate a corresponding first primary texture feature matrix and a second primary texture feature matrix includes: performing normalization processing on each of the plurality of first sub-region blocks and the plurality of second sub-region blocks to obtain a corresponding first normalized word block set and a second normalized word block set; extracting a first central pixel and a second central pixel of the first normalized word block set and the second normalized word block set respectively; Taking the first central pixel and the second central pixel as references, respectively performing local binary pattern encoding on each block in the first normalized sub-block set and the second normalized block set to generate corresponding first texture response map set and second texture response map set; Counting the texture pattern histogram of each sub-block in the first texture response map set and the second texture response map set respectively to obtain a corresponding first histogram sequence and second histogram sequence; The first histogram sequence and the second histogram sequence are respectively arranged and combined in sub-block spatial order to obtain a corresponding first primary texture feature matrix and a second primary texture feature matrix.
6. The text comparison method based on image classification according to claim 4, characterized in that: The performing matrix principal component dimensionality reduction processing on the first primary texture feature matrix and the second primary texture feature matrix to obtain corresponding first optimized feature matrix and second optimized feature matrix includes: performing mean centering processing on the first primary texture feature matrix and the second primary texture feature matrix respectively to obtain corresponding first normalized matrices and second normalized matrices; Performing covariance calculation on the first standardized matrix and the second standardized matrix to obtain corresponding first covariance matrix and second covariance matrix; Performing eigenvalue decomposition on the first covariance matrix and the second covariance matrix respectively to obtain corresponding first eigenvector sets and second eigenvector sets; Selecting a first target vector and a second target vector from the first set of feature vectors and the second set of feature vectors, respectively, according to a preset principal component number threshold; The first target vector and the second target vector are linearly projected into a preset principal component space to obtain a first optimized feature matrix and a second optimized feature matrix.
7. The text comparison method based on image classification according to claim 1, characterized in that: The performing similarity identification on the first feature and the second feature according to the pre-built image binary classification model to obtain an image comparison result includes: Calculating feature similarity between the first feature and the second feature according to a pre-built image binary classification model to obtain a similarity value; Determine an image comparison result based on the similarity value and a preset similarity threshold; If the similarity value is greater than the similarity threshold, the image comparison result is that the image comparison is successful; if the similarity value is less than the similarity threshold, the image comparison result is that the image comparison fails.
8. A text comparison device based on image classification, characterized in that: The device comprises: An image generation module is configured to obtain a first target text and a second target text, and perform image generation on the first target text and the second target text to obtain a first image of text to be recognized and a second image of text to be recognized; an envelope extraction module, configured to perform envelope extraction on the first to-be-recognized character image and the second to-be-recognized character image to obtain corresponding first target images and second target images; a texture feature extraction module, configured to extract texture features from the first target image and the second target image respectively to obtain corresponding first features and second features; The similarity recognition module is used to perform similarity recognition on the first feature and the second feature according to a pre-built image binary classification model to obtain an image comparison result.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the text comparison method based on image classification as described in any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for text comparison based on image classification as described in any one of claims 1 to 7 is implemented.