Character image judgment method and device, computer equipment and storage medium

By preprocessing the text image, stroke feature extraction and dimensionality reduction processing, combined with the comparison and recognition of text content and layout features, the problem of text recognition in complex backgrounds is solved, and accurate tampering detection of text images is achieved.

CN119580293APending Publication Date: 2025-03-07PING AN TECH (SHENZHEN) CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411696788.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-22
Publication Date
2025-03-07

AI Technical Summary

Technical Problem

The prior art is difficult to accurately identify text in complex backgrounds, resulting in the inability to effectively detect whether text in text images has undergone tampering.

Method used

By obtaining the text image to be detected, pre-processing is performed to obtain standard text images, extracting stroke feature vectors, performing dimensionality reduction processing, using the pre-constructed text image detection model for detection, and comparing and identifying the text content and layout features, and the final fusion result is judged.

Benefits of technology

It realizes accurate detection of whether text in text images is tampered with, ensuring the authenticity and security of text images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119580293A_ABST
    Figure CN119580293A_ABST
Patent Text Reader

Abstract

The embodiment of the invention belongs to the field of image processing, and relates to a character image judgment method and device, computer equipment and a storage medium, and the method comprises the following steps: carrying out the preprocessing of a to-be-detected character image, and obtaining a standard character image; performing stroke feature extraction on the standard character image to obtain a stroke feature vector; performing dimension reduction processing on the stroke feature vector to obtain a low-dimension stroke feature vector; performing character image detection on the low-dimensional stroke feature vector to obtain a character image detection result; performing character feature extraction on the standard character image to obtain character content and character layout features; comparing and identifying the text content and the text layout features based on the real document information set to obtain a content layout text image result; and fusing the character image detection result and the content layout character image result to obtain an effective character image judgment result. According to the method and the device, whether the characters in the to-be-detected character image are tampered or not can be accurately detected.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, specifically to the field of digital medicine, and in particular to a text image judgment method, device, computer equipment and storage medium. Background Art

[0002] As digital healthcare and financial technology are booming, text tampering detection technology is facing unprecedented challenges and opportunities. This technology plays an important role in protecting data security and business authenticity in the application of finance and healthcare.

[0003] On the one hand, the text content in the text image, such as the amount and date on the financial bill, or the diagnosis information and prescription in the medical record, are all key information that are indispensable for the normal operation of the business. Once this information is maliciously tampered with, it may not only cause significant economic losses to the bank and the customer, but also pose a serious threat to medical safety. For example, the wrong prescription may cause damage to the patient's health or even endanger his life. Therefore, ensuring the authenticity of the text in the text image is a necessary prerequisite for maintaining financial order and ensuring patient safety.

[0004] However, on the other hand, with the continuous advancement of printing technology, the background patterns of text images have become more complex and varied, and the visual boundaries between pattern lines and text strokes have become increasingly blurred, which undoubtedly brings great difficulties to text tampering detection. The traditional method of using geometric features such as the horizontal arrangement of text lines and the thickness changes of text strokes for detection is no longer able to cope with the current complex and changeable text image environment. How to accurately identify text in a complex background for effective detection has become a key issue that needs to be urgently solved in text tampering detection technology. Summary of the invention

[0005] The purpose of the embodiments of the present application is to provide a text image judgment method, device, computer equipment and storage medium to solve the problem of being unable to effectively and accurately detect whether the text in the text image to be detected has been tampered with.

[0006] In order to solve the above technical problems, the present application provides a text image judgment method, which adopts the following technical solution:

[0007] Acquire a text image to be detected, and preprocess the text image to be detected to obtain a standard text image;

[0008] Extracting stroke features from the standard text image to obtain a stroke feature vector;

[0009] Performing dimensionality reduction processing on the stroke feature vector to obtain a low-dimensional stroke feature vector;

[0010] Performing text image detection on the low-dimensional stroke feature vector according to a pre-built text image detection model to obtain a text image detection result;

[0011] Extracting text features from the standard text image to obtain text content and text layout features;

[0012] Comparatively identifying the text content and the text layout features based on a pre-built real document information set, and obtaining a content layout text image result;

[0013] The text image detection result and the content layout text image result are merged to obtain a valid text image judgment result.

[0014] Furthermore, the step of obtaining the to-be-detected text image and preprocessing the to-be-detected text image to obtain a standard text image specifically includes:

[0015] Acquire an image extraction identifier, and extract the text image to be detected from a database according to the image extraction identifier;

[0016] Performing image denoising on the to-be-detected text image to obtain a denoised text image;

[0017] The denoised text image is binarized to obtain the standard text image.

[0018] Furthermore, the step of extracting stroke features from the standard text image to obtain a stroke feature vector specifically includes:

[0019] Get the preset stroke direction template;

[0020] Judging the stroke direction of the standard character image according to the preset stroke direction template to obtain a stroke direction feature;

[0021] Performing grayscale value distribution analysis on the standard text image to obtain stroke thickness features;

[0022] Performing connection relationship analysis on the standard text image according to a connected domain analysis method to obtain stroke connection features;

[0023] The stroke direction feature, the stroke thickness feature, and the stroke connection feature are combined to obtain the stroke feature vector.

[0024] Furthermore, the step of performing dimensionality reduction processing on the stroke feature vector to obtain a low-dimensional stroke feature vector specifically includes:

[0025] Obtain a pre-established stroke feature dictionary;

[0026] Performing sparse representation feature extraction on the stroke feature vector based on the stroke feature dictionary to obtain a sparse representation coefficient;

[0027] A sparse representation feature vector is generated according to the sparse representation coefficient, and a principal component analysis is performed on the sparse representation feature vector to obtain the low-dimensional stroke feature vector.

[0028] Furthermore, the step of performing text image detection on the low-dimensional stroke feature vector according to the pre-built text image detection model to obtain a text image detection result specifically includes:

[0029] Inputting the low-dimensional stroke feature vector into the text image detection model to obtain the text distribution deviation;

[0030] Determine whether the text distribution deviation is greater than or equal to a preset deviation threshold;

[0031] If the text distribution deviation is greater than or equal to the preset deviation threshold, the image text object is determined according to the text distribution deviation to obtain the text image detection result.

[0032] Furthermore, the step of extracting text features from the standard text image to obtain text content and text layout features specifically includes:

[0033] Performing text detection on the standard text image to obtain an image text area;

[0034] Performing text recognition on the text area of ​​the image to obtain the text content;

[0035] Divide the standard text image into regions according to the image text regions to obtain image region distribution information;

[0036] Layout features are extracted according to the image area distribution information to obtain the text layout features.

[0037] Furthermore, the step of comparing and identifying the text content and the text layout features based on the pre-constructed real document information set to obtain a content layout text image result specifically includes:

[0038] Obtaining a document model extraction identifier, and extracting the real document information set from a database according to the document model extraction identifier;

[0039] Comparing the text content with the text content of the information set of the real document information set to obtain a text content comparison result;

[0040] Comparing the text layout feature with the information set text layout feature of the real document information set to obtain a text layout comparison result;

[0041] A text image result score is calculated according to the text content comparison result and the text layout comparison result, and the content layout text image result is generated according to the text image result score.

[0042] In order to solve the above technical problems, the embodiment of the present application further provides a text image judgment device, which adopts the following technical solution:

[0043] An image processing module is used to obtain a text image to be detected, and pre-process the text image to be detected to obtain a standard text image;

[0044] A stroke feature extraction module, used to extract stroke features from the standard text image to obtain a stroke feature vector;

[0045] A feature dimension reduction module, used for performing dimension reduction processing on the stroke feature vector to obtain a low-dimensional stroke feature vector;

[0046] An image detection module, used to perform text image detection on the low-dimensional stroke feature vector according to a pre-built text image detection model to obtain a text image detection result;

[0047] A text feature extraction module, used to extract text features from the standard text image to obtain text content and text layout features;

[0048] A feature recognition module is used to compare and recognize the text content and the text layout features based on a pre-built real document information set to obtain a content layout text image result;

[0049] The result judgment module is used to merge the text image detection result and the content layout text image result to obtain a valid text image judgment result.

[0050] In order to solve the above technical problems, the embodiment of the present application further provides a computer device, which adopts the following technical solution:

[0051] A computer device comprises a memory and a processor, wherein the memory stores computer-readable instructions, and the processor implements the steps of any one of the above-mentioned methods for determining a text image when executing the computer-readable instructions.

[0052] In order to solve the above technical problems, the embodiment of the present application further provides a computer-readable storage medium, which adopts the following technical solution:

[0053] A computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by a processor, the steps of the text image determination method as described in any one of the above items are implemented.

[0054] Compared with the prior art, the embodiment of the present application has the following beneficial effects: the embodiment obtains the text image to be detected, pre-processes the text image to be detected, and obtains a standard text image; extracts stroke features from the standard text image to obtain a stroke feature vector; performs dimensionality reduction processing on the stroke feature vector to obtain a low-dimensional stroke feature vector; performs text image detection on the low-dimensional stroke feature vector according to a pre-constructed text image detection model to obtain a text image detection result; extracts text features from the standard text image to obtain text content and text layout features; compares and identifies the text content and the text layout features based on a pre-constructed real document information set to obtain a content layout text image result; merges the text image detection result and the content layout text image result to obtain a valid text image judgment result. This effectively realizes accurate detection of whether the text in the text image to be detected has been tampered with, so as to obtain the corresponding valid text image judgment result. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] In order to more clearly illustrate the scheme in the present application, a brief introduction is given below to the drawings required for use in the description of the embodiments of the present application. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0056] Figure 1 is an exemplary system architecture diagram to which the present application may be applied;

[0057] Figure 2 A flowchart of an embodiment of a text image determination method according to the present application;

[0058] Figure 3 yes Figure 2 A flowchart of a specific implementation of step S10;

[0059] Figure 4 yes Figure 2 A flowchart of a specific implementation of step S20;

[0060] Figure 5 yes Figure 2 A flowchart of a specific implementation of step S30;

[0061] Figure 6 yes Figure 2 A flowchart of a specific implementation of step S40;

[0062] Figure 7 yes Figure 2A flowchart of a specific implementation of step S50;

[0063] Figure 8 yes Figure 2 A flowchart of a specific implementation of step S60;

[0064] Fig. 9 is a structural schematic diagram of an embodiment of a text image determination device according to the present application;

[0065] Fig.10 It is a structural diagram of an embodiment of a computer device according to the present application. DETAILED DESCRIPTION

[0066] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of the present application; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit the present application; the terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of the present application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.

[0067] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor does it refer to non-related or alternative embodiments that are mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0068] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.

[0069] like Figure 1 As shown, the system architecture 100 may include a terminal device 101, a network 102 and a server 103. The terminal device 101 may be a laptop 1011, a tablet computer 1012 or a mobile phone 1013. The network 102 is used to provide a medium for a communication link between the terminal device 101 and the server 103. The network 102 may include various connection types, such as wired, wireless communication links or optical fiber cables.

[0070] The user can use the terminal device 101 to interact with the server 103 through the network 102 to receive or send messages, etc. Various communication client applications can be installed on the terminal device 101, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.

[0071] The terminal device 101 can be any electronic device with a display screen and supporting web browsing. In addition to a laptop computer 1011, a tablet computer 1012 or a mobile phone 1013, the terminal device 101 can also be an e-book reader, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 (Moving Picture Experts Group Audio Layer IV), a laptop computer, a desktop computer, etc.

[0072] The server 103 may be a server that provides various services, such as a background server that provides support for a web page displayed on the terminal device 101 .

[0073] It should be noted that the text image determination method provided in the embodiment of the present application is generally executed by a server / terminal device, and accordingly, the text image determination device is generally arranged in the server / terminal device.

[0074] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0075] Continue to refer Figure 2 , shows a flow chart of an embodiment of a method for determining text images according to the present application. The text image determination method comprises the following steps:

[0076] Step S10, obtaining a text image to be detected, and preprocessing the text image to be detected to obtain a standard text image;

[0077] In this embodiment, the text image to be detected is an image with text information to be detected. The text image to be detected can be a medical-related information image, including medical reports and records (such as X-rays, CT scans or MRI scan reports), drug instructions and labels, labels of medical equipment and instruments, laboratory test results, medical images containing text information, etc. The standard text image is image information for subsequent processing obtained after preprocessing the text image to be detected, and the preprocessing includes image denoising and binarization processing.

[0078] Step S20, extracting stroke features from the standard text image to obtain a stroke feature vector;

[0079] In this embodiment, stroke feature extraction is used to extract key information that can characterize the stroke morphology of the text from the standard text image, and encode this information into a vector form to obtain a stroke feature vector. The stroke feature vector includes stroke direction features, stroke thickness features, and stroke connection features.

[0080] Step S30, performing dimensionality reduction processing on the stroke feature vector to obtain a low-dimensional stroke feature vector;

[0081] In this embodiment, the dimensionality reduction processing of the stroke feature vector is completed based on sparse representation and principal component analysis, wherein sparse representation is a signal processing technology that attempts to represent signals or data with as few non-zero coefficients as possible. In image processing, sparse representation is usually used to extract key features from images, which can be meaningful image blocks, textures or edges. Principal component analysis is a linear dimensionality reduction method that reduces the dimension of data by finding the direction with the largest variance in the data set. By performing sparse representation and principal component analysis on the stroke feature vector, a low-dimensional stroke feature vector with a low-dimensional representation can be effectively obtained.

[0082] Step S40, performing text image detection on the low-dimensional stroke feature vector according to a pre-built text image detection model to obtain a text image detection result;

[0083] In this embodiment, the pre-built text image detection model can adopt a convolutional neural network model, and the training steps of the convolutional neural network model include: collecting a data set containing text images, ensuring that the data set contains text images of various fonts, sizes, directions and backgrounds, annotating the data set, marking the location of the text area and the corresponding text content; performing operations such as scaling, cropping, and flipping on the image to expand the data set and increase the generalization ability of the model to obtain a sample image data set; setting a text distribution deviation task, using the regression layer as the output layer to output the numerical value of the text distribution deviation; extracting a low-dimensional sample stroke feature vector from the sample image data set, and inputting the low-dimensional sample stroke feature vector into the convolutional neural network for training.

[0084] Step S50, extracting text features from the standard text image to obtain text content and text layout features;

[0085] In this embodiment, the text feature extraction of the standard text image includes text content recognition and text layout feature extraction, wherein text content recognition includes file detection and text recognition, and text layout feature extraction includes area division and layout feature extraction. Text content refers to the actual text information in the image, which covers all recognizable text characters in the image and may further form text units such as words, sentences or paragraphs. Text layout features include text direction, text position, text size, text spacing, text arrangement, text density, text area shape, and the relative position relationship between text and other elements.

[0086] Step S60, comparing and identifying the text content and the text layout features based on the pre-constructed real document information set, and obtaining a content layout text image result;

[0087] In this embodiment, the real document information set is an information set that includes real text content and text layout features. The text content and text layout features are compared with the information set text content and information set text layout features in the real document information set to identify whether the text in the image has signs of tampering and obtain the corresponding content layout text image result.

[0088] Step S70, fusing the text image detection result and the content layout text image result to obtain a valid text image determination result.

[0089] In this embodiment, the text image detection result and the content layout text image result are fused by weighted fusion. In the weighted fusion, the text image detection result and the content layout text image result are assigned corresponding first result weights and second result weights. The text image detection result and the content layout text image result are normalized by standard, and then the normalized text image detection result and the content layout text image result are weighted with the first result weight and the second result weight respectively to obtain a comprehensive result value. The comprehensive result value is then compared with the corresponding result threshold. If the comprehensive result value is greater than or equal to the result threshold, it is determined that the text information in the text image to be detected has been tampered with. If the comprehensive result value is less than the result threshold, it is determined that the text information in the text image to be detected has not been tampered with, and the corresponding valid text image judgment result is generated at the same time.

[0090] In this embodiment, the above method can be applied to a medical service system, in which the medical service system performs text tampering detection on medical text images related to the medical field, thereby effectively ensuring the authenticity and validity of the medical text images. Specifically, in this embodiment, the medical service system can be one or more of a medical insurance system and a disease insurance system, and the medical text image is medical-related image data containing text. The medical text image is stored in the medical insurance system and the disease insurance system and is obtained from the database of the above system. The valid text image judgment result is generated by the above system through processing by the method of this embodiment and stored in the database of the above system.

[0091] This embodiment obtains a text image to be detected, pre-processes the text image to be detected, and obtains a standard text image; extracts stroke features from the standard text image to obtain a stroke feature vector; performs dimensionality reduction processing on the stroke feature vector to obtain a low-dimensional stroke feature vector; performs text image detection on the low-dimensional stroke feature vector according to a pre-constructed text image detection model to obtain a text image detection result; extracts text features from the standard text image to obtain text content and text layout features; compares and identifies the text content and the text layout features based on a pre-constructed real document information set to obtain a content layout text image result; and fuses the text image detection result and the content layout text image result to obtain a valid text image judgment result. This effectively realizes accurate detection of whether the text in the text image to be detected has been tampered with, so as to obtain the corresponding valid text image judgment result.

[0092] refer to Figure 3 In some optional implementations of this embodiment, step S10 includes the following steps:

[0093] Step S101, obtaining an image extraction identifier, and extracting the text image to be detected from a database according to the image extraction identifier;

[0094] In this embodiment, the image extraction identifier is identification information corresponding to the text image to be detected, and a matching query is performed in the database through the image extraction identifier to obtain the corresponding text image to be detected.

[0095] Step S102, performing image denoising on the to-be-detected text image to obtain a denoised text image;

[0096] In this embodiment, the image to be detected is subjected to image denoising by using a Gaussian filtering algorithm, and the steps of performing image denoising by using a Gaussian filtering algorithm include: selecting the size of the Gaussian kernel, wherein the size of the Gaussian kernel (i.e., the size of the filter) determines the neighborhood range considered when calculating the weighted average value of each pixel point; according to the Gaussian function, the weight of each pixel point in its neighborhood is calculated. The shape of the Gaussian function is determined by the standard deviation σ, which controls the speed at which the weight decreases with increasing distance; for each pixel point in the image, the weighted average value is calculated using the pixel value in its neighborhood and the corresponding Gaussian weight, and the value is used as the value of the pixel point in the denoised image, and the above steps are repeated until the entire image processing is completed.

[0097] Step S103, binarizing the denoised text image to obtain the standard text image.

[0098] In this embodiment, the denoised text image is binarized by a global threshold method, and the steps of binarization by the global threshold method include: selecting a suitable global threshold; comparing each pixel value in the image with the global threshold, if the pixel value is higher than the threshold, setting it to white (255); if the pixel value is lower than the threshold, setting it to black (0), and when each pixel value is processed, a standard text image is obtained.

[0099] This embodiment obtains an image extraction identifier, extracts the text image to be detected from a database according to the image extraction identifier; performs image denoising on the text image to be detected to obtain a denoised text image; and performs binarization processing on the denoised text image to obtain a standard and effective standard text image, so as to facilitate the subsequent extraction of stroke features and text features based on the standard text image.

[0100] refer to Figure 4 In some optional implementations of this embodiment, step S20 includes the following steps:

[0101] Step S201, obtaining a preset stroke direction template;

[0102] In this embodiment, the preset stroke direction template is a preset data set of stroke directions of multiple characters, and the stroke directions of the characters include horizontal, vertical, and diagonal (upper left, upper right, lower left, and lower right), etc. The above-mentioned stroke direction template can be a simple binary image, which only contains white lines representing the stroke directions and a black background.

[0103] Step S202, judging the stroke direction of the standard character image according to the preset stroke direction template to obtain a stroke direction feature;

[0104] In this embodiment, the direction is determined by comparing the standard text image with a preset stroke direction template. This comparison can be achieved by calculating the similarity between the standard text image and the preset stroke direction template, and the similarity can be obtained by calculating the cosine similarity between the standard text image and the preset stroke direction template.

[0105] Step S203: Analyze the gray value distribution of the standard text image to obtain the stroke thickness feature.

[0106] In this embodiment, by calculating the gray value of each pixel in the standard text image and statistically analyzing the gray value distribution in the stroke area, statistical quantities such as the distribution range, average value, and standard deviation of the gray value are analyzed to effectively quantify the thickness of the stroke and obtain the stroke thickness feature.

[0107] Step S204: Analyze the connection relationship of the standard text image according to the connected component analysis method to obtain the stroke connection feature.

[0108] In this embodiment, connected component analysis is an image processing technique used to identify pixel regions that are connected to each other in an image. The connection relationship analysis includes determining which strokes are connected (such as the horizontal and vertical strokes of a "plus" sign) and which strokes are independent (such as the four sides of a "square" character). By analyzing the characteristics of the number, shape, and position of the connected components, the stroke connection feature can be effectively obtained.

[0109] Step S205: Combine the stroke direction feature, the stroke thickness feature, and the stroke connection feature to obtain the stroke feature vector.

[0110] In this embodiment, by splicing the stroke direction feature, the stroke thickness feature, and the stroke connection feature, a stroke feature vector that effectively combines features from multiple dimensions can be obtained.

[0111] In this embodiment, a preset stroke direction template is obtained; the stroke direction of the standard text image is determined according to the preset stroke direction template to obtain the stroke direction feature; the gray value distribution of the standard text image is analyzed to obtain the stroke thickness feature; the connection relationship of the standard text image is analyzed according to the connected component analysis method to obtain the stroke connection feature; the stroke direction feature, the stroke thickness feature, and the stroke connection feature are combined, so as to effectively obtain a stroke feature vector that comprehensively represents multiple dimensions (stroke direction, stroke thickness, stroke connectivity) of the text, which is convenient for subsequent dimensionality reduction processing.

[0112] Reference Figure 5 In some alternative implementation manners of this embodiment, step S30 includes the following steps:

[0113] Step S301, obtaining a pre-established stroke feature dictionary;

[0114] In this embodiment, the pre-established stroke feature dictionary includes a large number of pre-defined stroke features, which can be extracted based on historical data, expert knowledge or machine learning algorithms. Each feature in the dictionary corresponds to a specific stroke pattern or attribute, such as the shape, direction, thickness, etc. of the stroke. These features are usually stored in the form of vectors and constitute the columns (or "atoms") of the dictionary.

[0115] Step S302, performing sparse representation feature extraction on the stroke feature vector based on the stroke feature dictionary to obtain a sparse representation coefficient;

[0116] In this embodiment, the step of sparse representation feature extraction includes: creating a sparse representation coefficient vector with the same number of columns (i.e., the number of features) as the stroke feature dictionary, and initializing it to zero or a random small value; using orthogonal matching pursuit (OMP) to gradually update the sparse representation coefficient vector in an iterative manner. In each iteration, the algorithm calculates an approximate stroke feature vector based on the current sparse representation coefficient and the stroke feature dictionary, and compares it with the original stroke feature vector. Then, the sparse representation coefficient is adjusted according to the comparison result to reduce the approximation error. The iteration includes the following steps: a. Select one or more stroke features (i.e., columns in the dictionary) with the largest approximation error with the current one. b. Update the sparse representation coefficient to include the contribution of the selected stroke features. c. Recalculate the approximate stroke feature vector and evaluate the approximation error. d. Repeat the above steps until a predetermined number of iterations is reached or the approximation error is less than a certain threshold. After multiple iterations, the algorithm will converge to a stable sparse representation coefficient vector, which contains the sparse representation of the original stroke feature vector on the stroke feature dictionary, i.e., the sparse representation coefficient.

[0117] Step S303: generating a sparse representation feature vector according to the sparse representation coefficient, and performing principal component analysis on the sparse representation feature vector to obtain the low-dimensional stroke feature vector.

[0118] In this embodiment, principal component analysis (PCA) is a commonly used data dimensionality reduction technique, which achieves dimensionality reduction by projecting the original data onto a low-dimensional subspace composed of principal components. The principal components are obtained by calculating the covariance matrix of the data and performing eigendecomposition thereof, and they represent the directions with the largest variance in the data. In the PCA process, the first few principal components (i.e., the directions with the largest variance) are selected to form a low-dimensional subspace, and the low-dimensional stroke feature vector is obtained by projecting the sparse representation feature vector onto this subspace.

[0119] This embodiment obtains a pre-established stroke feature dictionary; performs sparse representation feature extraction on the stroke feature vector based on the stroke feature dictionary to obtain a sparse representation coefficient; generates a sparse representation feature vector according to the sparse representation coefficient, and performs principal component analysis on the sparse representation feature vector, thereby effectively obtaining a low-dimensional stroke feature vector that performs a low-dimensional representation on the stroke feature vector, so as to facilitate subsequent text image detection processing.

[0120] Continue to refer Figure 6 In some optional implementations of this embodiment, step S40 includes the following steps:

[0121] Step S401, inputting the low-dimensional stroke feature vector into the text image detection model to obtain the text distribution deviation;

[0122] In this embodiment, the text image detection model can adopt a convolutional neural network model, and by using a low-dimensional stroke feature vector as the input of the text image detection model, the text image detection model can effectively output the model result of the text distribution deviation.

[0123] Step S402, determining whether the text distribution deviation is greater than or equal to a preset deviation threshold;

[0124] In this embodiment, the text distribution deviation is a measure of the degree of deviation of the text distribution. The preset deviation threshold is a pre-set standard deviation threshold. By numerically comparing the text distribution deviation with the preset deviation threshold, it is possible to effectively determine whether the text distribution deviation is greater than or equal to the preset deviation threshold.

[0125] Step S403, if the text distribution deviation is greater than or equal to the preset deviation threshold, determining the image text object according to the text distribution deviation to obtain the text image detection result;

[0126] In this embodiment, characters with a character distribution deviation greater than or equal to a preset deviation threshold are determined as image character objects with significantly different distribution from the expected distribution, and these image character objects are sorted to obtain a character image detection result.

[0127] Step S404: if the text distribution deviation is less than the preset deviation threshold, the text image to be detected is determined as a non-image text object.

[0128] In this embodiment, a mark corresponding to a non-image text object is added to the text image to be detected, so that the text image to be detected is effectively determined as a non-image text object.

[0129] This embodiment obtains the text distribution deviation by inputting the low-dimensional stroke feature vector into the text image detection model; determines whether the text distribution deviation is greater than or equal to the preset deviation threshold; if the text distribution deviation is greater than or equal to the preset deviation threshold, the image text object is determined according to the text distribution deviation to obtain the text image detection result. If the text distribution deviation is less than the preset deviation threshold, the text image to be detected is determined as a text-free image object. In this way, effective text image detection is achieved according to the text image detection model, which facilitates the subsequent result fusion step.

[0130] Continue to refer Figure 7 In some optional implementations of this embodiment, step S50 includes the following steps:

[0131] Step S501, performing text detection on the standard text image to obtain an image text area;

[0132] In this embodiment, text detection can be performed on a standard text image through a pre-trained text detection model. The pre-trained text detection model can adopt a convolutional neural network model trained by annotated sample text images. By inputting the standard text image into the pre-trained text detection model, the image text area in the standard text image can be effectively identified.

[0133] Step S502, performing text recognition on the text area of ​​the image to obtain the text content;

[0134] In this embodiment, each detected text area can be processed by a text recognition algorithm (such as OCR technology) to identify the text content therein. The preprocessed text area is input into the OCR algorithm, which analyzes the pixel pattern in the image and uses its internally trained model to recognize each character. The recognition includes feature extraction: extracting useful features from the image, such as the outline, shape, and strokes of the character. Character classification: using machine learning or deep learning models to map the extracted features to specific character categories. Text construction: combining the recognized characters into words, sentences, or paragraphs.

[0135] Step S503, dividing the standard text image into regions according to the image text regions to obtain image region distribution information;

[0136] In this embodiment, the standard text image is divided into multiple sub-regions according to the position, size and mutual relationship of the text regions in the image, and these sub-regions can be determined based on the boundary, center or other features of the text region. After the sub-regions are divided, the image region distribution information is obtained by sorting out the position, size and other information of the sub-regions.

[0137] Step S504: extracting layout features according to the image area distribution information to obtain the text layout features.

[0138] In this embodiment, by analyzing the sub-region attributes and their mutual relations in the image region distribution information, the text layout features including the arrangement mode, density, directionality, etc. of the text region are extracted. The feature extraction can be implemented based on statistical methods (histogram statistics, regional attribute statistics, grid statistics), machine learning algorithms (support vector machine (SVM), decision tree, clustering algorithm) or deep learning models (convolutional neural network, recursive neural network).

[0139] This embodiment obtains the image text area by performing text detection on the standard text image; performs text recognition on the image text area to obtain the text content; performs area division on the standard text image according to the image text area to obtain image area distribution information; performs layout feature extraction according to the image area distribution information to obtain the text layout feature. This effectively realizes the extraction of text content and text layout features in the standard text image, so as to facilitate subsequent comparison and recognition processing.

[0140] Continue to refer Figure 8 In some optional implementations of this embodiment, step S60 includes the following steps:

[0141] S601, obtaining a document model extraction identifier, and extracting the real document information set from a database according to the document model extraction identifier;

[0142] In this embodiment, the document model extraction identifier is a unique information identifier corresponding to the real document information set, and a matching query is performed in the database through the document model extraction identifier to extract the corresponding real document information set.

[0143] S602, comparing the text content with the text content of the information set of the real document information set to obtain a text content comparison result;

[0144] In this embodiment, a string matching algorithm (such as exact matching, fuzzy matching, semantic matching, etc.) can be used to compare the text content and the information set text content, wherein exact matching can effectively check whether the two strings are exactly the same, fuzzy matching allows a certain degree of character difference (such as insertion, deletion, replacement), and semantic matching considers whether the meanings of the strings are similar. In this embodiment, exact matching is used to achieve the comparison between the text content and the information set text content. When the comparison is completed, the corresponding text content comparison result can be output. If the comparison result is completely matched, the matching result is output. If the comparison result is deviated, the non-matching result is output. The matching results and non-matching results of all text contents are sorted to obtain the text content comparison result.

[0145] S603, comparing the text layout feature with the information set text layout feature of the real document information set to obtain a text layout comparison result;

[0146] In this embodiment, the text layout comparison result can be effectively obtained by comparing the differences between the text layout features and the information set text layout features in terms of arrangement, density, directionality, etc. The above comparison can be achieved by calculating the distance between feature vectors (such as Euclidean distance, cosine similarity, etc.), or by using a special layout matching algorithm or deep learning model for comparison.

[0147] S604: Calculate a text image result score according to the text content comparison result and the text layout comparison result, and generate the content layout text image result according to the text image result score.

[0148] In this embodiment, the text image result score is calculated by weighted fusion of the text content comparison result and the text layout comparison result, wherein the text content comparison result corresponds to the content result weight, and the text layout comparison result corresponds to the layout result weight. In this embodiment, the content result weight and the layout result weight are both set to 0.5, and the content result weight and the layout result weight can be set and adjusted according to actual conditions. Then the text image result score is compared with the preset result score threshold. When the text image result score is greater than or equal to the result score threshold, it is judged that the content layout has been tampered with. When the text image result score is less than the result score threshold, it is judged that the content layout has not been tampered with, and the content layout text image result is generated accordingly.

[0149] This embodiment extracts the text image detection report template from the template database by taking the text image type as a query condition; matches the image text image information with the template parameters of the text image detection report template to obtain an information matching result; fills the image text image information into the corresponding parameters of the text image detection report template according to the information matching result, thereby obtaining a text image detection report that effectively displays the image text image information.

[0150] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through computer-readable instructions, and the computer-readable instructions can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the aforementioned storage medium can be a non-volatile storage medium such as a disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

[0151] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.

[0152] Further references Fig. 9 , as a response to the above Figure 1 The present application provides an embodiment of a text image judgment device, and the device embodiment is similar to Figure 1 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.

[0153] like Fig. 9 As shown, the text image judgment device 800 described in this embodiment includes: an image processing module 801, a stroke feature extraction module 802, a feature dimension reduction module 803, an image detection module 804, a text feature extraction module 805, a feature recognition module 806, and a result judgment module 807. Among them:

[0154] The image processing module 801 is used to obtain a text image to be detected, and pre-process the text image to be detected to obtain a standard text image;

[0155] A stroke feature extraction module 802 is used to extract stroke features from the standard text image to obtain a stroke feature vector;

[0156] A feature dimension reduction module 803 is used to perform dimension reduction processing on the stroke feature vector to obtain a low-dimensional stroke feature vector;

[0157] An image detection module 804 is used to perform text image detection on the low-dimensional stroke feature vector according to a pre-built text image detection model to obtain a text image detection result;

[0158] The text feature extraction module 805 is used to extract text features from the standard text image to obtain text content and text layout features;

[0159] A feature recognition module 806 is used to compare and recognize the text content and the text layout features based on a pre-built real document information set to obtain a content layout text image result;

[0160] The result judgment module 807 is used to merge the text image detection result and the content layout text image result to obtain a valid text image judgment result.

[0161] By adopting the above-mentioned text image judgment device, this embodiment can obtain the text image to be detected, pre-process the text image to be detected to obtain a standard text image; extract stroke features from the standard text image to obtain a stroke feature vector; perform dimensionality reduction processing on the stroke feature vector to obtain a low-dimensional stroke feature vector; perform text image detection on the low-dimensional stroke feature vector according to a pre-constructed text image detection model to obtain a text image detection result; extract text features from the standard text image to obtain text content and text layout features; compare and identify the text content and the text layout features based on a pre-constructed real document information set to obtain a content layout text image result; merge the text image detection result and the content layout text image result to obtain a valid text image judgment result. This effectively realizes accurate detection of whether the text in the text image to be detected has been tampered with, so as to obtain the corresponding valid text image judgment result.

[0162] To solve the above technical problems, the present application also provides a computer device. Fig.10 , Fig.10 This is a basic structural block diagram of the computer device in this embodiment.

[0163] The computer device 9 includes a memory 91, a processor 92, and a network interface 93 that are interconnected and communicated through a system bus. It should be noted that the figure only shows a computer device 9 with components 91-93, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc.

[0164] The computer device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The computer device may interact with a user through a keyboard, a mouse, a remote controller, a touch pad, or a voice control device.

[0165] The memory 91 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 91 can be an internal storage unit of the computer device 9, such as a hard disk or memory of the computer device 9. In other embodiments, the memory 91 can also be an external storage device of the computer device 9, such as a plug-in hard disk equipped on the computer device 9, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (FlashCard), etc. Of course, the memory 91 can also include both the internal storage unit of the computer device 9 and its external storage device. In this embodiment, the memory 91 is generally used to store the operating system and various application software installed on the computer device 9, such as computer-readable instructions of the text image judgment method, etc. In addition, the memory 91 can also be used to temporarily store various types of data that have been output or are to be output.

[0166] The processor 92 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments. The processor 92 is generally used to control the overall operation of the computer device 9. In this embodiment, the processor 92 is used to run computer-readable instructions stored in the memory 91 or process data, such as computer-readable instructions for running the text image determination method.

[0167] The network interface 93 may include a wireless network interface or a wired network interface. The network interface 93 is generally used to establish a communication connection between the computer device 9 and other electronic devices.

[0168] By adopting the above-mentioned computer device, this embodiment can obtain the text image to be detected, pre-process the text image to be detected to obtain a standard text image; extract stroke features from the standard text image to obtain a stroke feature vector; perform dimensionality reduction processing on the stroke feature vector to obtain a low-dimensional stroke feature vector; perform text image detection on the low-dimensional stroke feature vector according to a pre-constructed text image detection model to obtain a text image detection result; extract text features from the standard text image to obtain text content and text layout features; compare and identify the text content and the text layout features based on a pre-constructed real document information set to obtain a content layout text image result; merge the text image detection result and the content layout text image result to obtain a valid text image judgment result. This effectively realizes accurate detection of whether the text in the text image to be detected has been tampered with, so as to obtain the corresponding valid text image judgment result.

[0169] The present application also provides another embodiment, namely, providing a computer-readable storage medium, wherein the computer-readable storage medium stores computer-readable instructions, and the computer-readable instructions can be executed by at least one processor to enable the at least one processor to perform the steps of the text image judgment method as described above.

[0170] By adopting the above-mentioned computer-readable storage medium, this embodiment can obtain a text image to be detected, pre-process the text image to be detected, and obtain a standard text image; extract stroke features from the standard text image to obtain a stroke feature vector; perform dimensionality reduction processing on the stroke feature vector to obtain a low-dimensional stroke feature vector; perform text image detection on the low-dimensional stroke feature vector according to a pre-constructed text image detection model to obtain a text image detection result; extract text features from the standard text image to obtain text content and text layout features; compare and identify the text content and the text layout features based on a pre-constructed real document information set to obtain a content layout text image result; merge the text image detection result and the content layout text image result to obtain a valid text image judgment result. This effectively realizes accurate detection of whether the text in the text image to be detected has been tampered with, so as to obtain the corresponding valid text image judgment result.

[0171] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0172] Obviously, the embodiments described above are only some embodiments of the present application, rather than all embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application is described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific implementation methods, or to perform equivalent replacement of some of the technical features therein. Any equivalent structure made using the contents of the specification and drawings of this application, directly or indirectly used in other related technical fields, is similarly within the scope of patent protection of this application.

[0173] The non-Company software tools or components appearing in the embodiments of this application are merely examples and do not represent actual use.

Claims

1. A method for determining a text image, characterized in that: The steps include: Acquire a text image to be detected, and preprocess the text image to be detected to obtain a standard text image; Extracting stroke features from the standard text image to obtain a stroke feature vector; Performing dimensionality reduction processing on the stroke feature vector to obtain a low-dimensional stroke feature vector; Performing text image detection on the low-dimensional stroke feature vector according to a pre-built text image detection model to obtain a text image detection result; Extracting text features from the standard text image to obtain text content and text layout features; Comparatively identifying the text content and the text layout features based on a pre-built real document information set, and obtaining a content layout text image result; The text image detection result and the content layout text image result are merged to obtain a valid text image judgment result.

2. The text image determination method according to claim 1, characterized in that: The step of obtaining a text image to be detected and preprocessing the text image to be detected to obtain a standard text image specifically includes: Acquire an image extraction identifier, and extract the text image to be detected from a database according to the image extraction identifier; Performing image denoising on the to-be-detected text image to obtain a denoised text image; The denoised text image is binarized to obtain the standard text image.

3. The character image determination method according to claim 1, characterized in that: The step of extracting stroke features from the standard text image to obtain a stroke feature vector specifically includes: Get the preset stroke direction template; Judging the stroke direction of the standard character image according to the preset stroke direction template to obtain a stroke direction feature; Performing grayscale value distribution analysis on the standard text image to obtain stroke thickness features; Performing connection relationship analysis on the standard text image according to a connected domain analysis method to obtain stroke connection features; The stroke direction feature, the stroke thickness feature, and the stroke connection feature are combined to obtain the stroke feature vector.

4. The character image determination method according to claim 1, characterized in that: The step of performing dimensionality reduction processing on the stroke feature vector to obtain a low-dimensional stroke feature vector specifically includes: Obtain a pre-established stroke feature dictionary; Performing sparse representation feature extraction on the stroke feature vector based on the stroke feature dictionary to obtain a sparse representation coefficient; A sparse representation feature vector is generated according to the sparse representation coefficient, and a principal component analysis is performed on the sparse representation feature vector to obtain the low-dimensional stroke feature vector.

5. The text image determination method according to claim 1, characterized in that: The step of performing text image detection on the low-dimensional stroke feature vector according to the pre-built text image detection model to obtain a text image detection result specifically includes: Inputting the low-dimensional stroke feature vector into the text image detection model to obtain the text distribution deviation; Determine whether the text distribution deviation is greater than or equal to a preset deviation threshold; If the text distribution deviation is greater than or equal to the preset deviation threshold, the image text object is determined according to the text distribution deviation to obtain the text image detection result.

6. The character image determination method according to claim 1, characterized in that: The step of extracting text features from the standard text image to obtain text content and text layout features specifically includes: Performing text detection on the standard text image to obtain an image text area; Performing text recognition on the text area of ​​the image to obtain the text content; Divide the standard text image into regions according to the image text regions to obtain image region distribution information; Layout features are extracted according to the image area distribution information to obtain the text layout features.

7. The character image determination method according to claim 1, characterized in that: The step of comparing and identifying the text content and the text layout features based on the pre-constructed real document information set to obtain a content layout text image result specifically includes: Obtaining a document model extraction identifier, and extracting the real document information set from a database according to the document model extraction identifier; Comparing the text content with the text content of the information set of the real document information set to obtain a text content comparison result; Comparing the text layout feature with the information set text layout feature of the real document information set to obtain a text layout comparison result; A text image result score is calculated according to the text content comparison result and the text layout comparison result, and the content layout text image result is generated according to the text image result score.

8. A text image judgment device, characterized in that: include: An image processing module is used to obtain a text image to be detected, and pre-process the text image to be detected to obtain a standard text image; A stroke feature extraction module, used to extract stroke features from the standard text image to obtain a stroke feature vector; A feature dimension reduction module, used for performing dimension reduction processing on the stroke feature vector to obtain a low-dimensional stroke feature vector; An image detection module, used to perform text image detection on the low-dimensional stroke feature vector according to a pre-built text image detection model to obtain a text image detection result; A text feature extraction module, used to extract text features from the standard text image to obtain text content and text layout features; A feature recognition module is used to compare and recognize the text content and the text layout features based on a pre-built real document information set to obtain a content layout text image result; The result judgment module is used to merge the text image detection result and the content layout text image result to obtain a valid text image judgment result.

9. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores computer-readable instructions, and the processor implements the steps of the text image determination method as claimed in any one of claims 1 to 7 when executing the computer-readable instructions.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by a processor, the steps of the text image determination method according to any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Intelligent checking identification method and device for financial statements and electronic equipment

    CN120182987A

  • Online monitoring and early warning method for printed matter printing content

    CN122090461A