Method, apparatus and electronic device for identifying an image

By combining a target image recognition model and a multi-channel confidence prediction graph with connected component analysis, the preprocessing complexity problem in the existing technology for recognizing examination numbers is solved, achieving higher recognition accuracy and robustness.

CN115205865BActive Publication Date: 2026-05-05HUAYUN (HEBEI XIONGAN) BIG DATA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HUAYUN (HEBEI XIONGAN) BIG DATA TECH CO LTD
Filing Date
2022-07-25
Publication Date
2026-05-05

AI Technical Summary

Technical Problem

Existing technologies for identifying exam numbers involve complex preprocessing, are prone to anomalies leading to identification errors, and lack accuracy and robustness.

Method used

A target image recognition model is used to determine the position of the number in the string through a multi-channel confidence prediction graph. Combined with connected component analysis, the number in the image can be recognized without preprocessing.

Benefits of technology

It improves the accuracy and robustness of digit recognition in images and avoids recognition errors caused by abnormal situations during preprocessing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115205865B_ABST
    Figure CN115205865B_ABST
Patent Text Reader

Abstract

This invention discloses a method, apparatus, and electronic device for image recognition. The method includes: acquiring an image to be recognized, wherein a predetermined region of the image includes a string composed of digits; inputting the image to be recognized into a pre-trained target image recognition model to obtain a multi-channel output image, where each channel in the output image corresponds to a confidence prediction map of a preset digit; determining the position of the preset digit within the string based on the confidence prediction map; and combining the preset digits into a recognition result based on their positions within the string. This method eliminates the need for preprocessing such as removing table lines or segmenting characters from the image to be recognized, avoiding recognition errors caused by abnormal situations during preprocessing and improving the accuracy and robustness of the recognition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to a method, apparatus, and electronic device for recognizing images. Background Technology

[0002] In practice, students' exam numbers are recorded on their daily homework, test papers, or answer sheets for smart writing assignments. These exam numbers are usually automatically identified by an intelligent marking system.

[0003] In related technologies, methods for identifying exam numbers mainly include the following two steps. The first step is preprocessing, which involves segmenting the digits that make up the exam number from images of daily assignments or exam papers. For example, methods such as Hough transform, single-necklace mapping, and projection are used to remove the table lines around the digits. Then, methods such as histogram projection or connected component analysis are used to obtain the image region where the digits are located and to segment each digit from the image. The second step is to identify the individual digits obtained from the segmentation. Because the rules involved in the preprocessing method are relatively complex, anomalies can easily occur during the preprocessing process, leading to recognition errors. Summary of the Invention

[0004] In view of this, the purpose of the present invention is to provide a method, apparatus and electronic device that can improve the accuracy and robustness of digit recognition in images.

[0005] To achieve the above objectives, the present invention adopts the following technical solution:

[0006] In a first aspect, the present invention provides a method for recognizing an image, the method comprising: acquiring an image to be recognized, wherein a predetermined region of the image to be recognized includes a string composed of numbers; inputting the image to be recognized into a pre-trained target image recognition model to obtain a multi-channel output image, wherein each channel in the output image corresponds to a confidence prediction map of a preset number; determining the position of the preset number in the string based on the confidence prediction map; and combining the preset numbers into a recognition result of the string based on the position of the preset number in the string.

[0007] In some embodiments, determining the position of a preset number in a string based on a confidence prediction map includes: extracting the confidence prediction map corresponding to a channel from the output image; performing smoothing and binarization on the confidence prediction map to obtain a processed prediction map; performing connectivity analysis on a predetermined region in the processed prediction map to determine the connected components within the predetermined region in the processed prediction map; and determining the position of the preset number corresponding to the channel in the string based on the position of the connected components.

[0008] In some embodiments, the output image includes 11 channels, wherein 10 channels correspond to confidence prediction maps for numbers 0 to 9, and 1 channel corresponds to a confidence prediction map for numbers with tampering marks.

[0009] In some embodiments, the image to be identified is an image obtained by photographing the text to be identified, and the string represents the examination number in the text to be identified.

[0010] In some embodiments, the target image recognition model is trained by the following steps: obtaining a sample set, wherein the sample images in the sample set include at least one labeled virtual sample image and at least one labeled real sample image, wherein the sample region in the sample image includes a sample string, the virtual sample image is an image generated based on the real sample image, and the real sample image is an image obtained by photographing the sample text; training a pre-constructed initial image recognition model based on the virtual sample image to obtain a pre-trained image recognition model; and training the pre-trained image recognition model again based on the real sample image to obtain the target image recognition model.

[0011] In some embodiments, virtual sample images are generated as follows: a single digital image is segmented from a real sample image, and the digits in the single digital image are marked to obtain multiple sample digital images; a sample altered digital image is generated based on the sample digital images; an initial image is generated, and a sample region is determined in the initial image, where the pixel value of each pixel in the initial image is 0; a single-row table is generated within the sample region, and the table includes a random number of cells; for each cell, a sample digital image is randomly selected and superimposed onto the region of that cell; sample altered digital images are randomly superimposed onto the regions of each cell to generate a sample string; based on the marking results of the sample digital images superimposed onto the regions of each cell, the sample string is marked to obtain a virtual sample image.

[0012] In some embodiments, the sample tampered digital image is generated as follows: an initial sample image is generated, in which the pixel value of each pixel is 0; one or more straight lines are randomly generated in the initial sample image; a sample digital image is randomly selected and superimposed on the initial sample image to obtain the sample tampered digital image.

[0013] In some embodiments, the table is generated as follows: the height, length, and number of cells of the table to be generated are randomly determined; based on the height, length, and number of cells of the table to be generated, the straight lines to be drawn are determined; each straight line to be drawn is divided into a preset number of line segments, and a random number is generated for each line segment; if the random number corresponding to the line segment is greater than a preset threshold, the line segment is drawn to obtain the table, and the line width of the line segment is the sum of the preset stroke width and the random disturbance.

[0014] Secondly, the present invention provides an apparatus for recognizing images, the apparatus comprising: an image acquisition unit configured to acquire an image to be recognized, wherein a predetermined region of the image to be recognized includes a string composed of numbers; an image prediction unit configured to input the image to be recognized into a pre-trained target image recognition model to obtain a multi-channel output image, wherein each channel in the output image corresponds to a confidence prediction map of a preset number; a position determination unit configured to determine the position of the preset number in the string based on the confidence prediction map; and a result determination unit configured to combine the preset numbers into a recognition result of the string based on the position of the preset number in the string.

[0015] Thirdly, the present invention provides an electronic device including one or more processors; a storage device having one or more programs stored thereon, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method for recognizing images in any of the above embodiments.

[0016] The beneficial effects of the image recognition method provided by this invention are as follows:

[0017] The method provided by this invention can simultaneously segment the string in the image to be recognized and recognize the numbers in the string using a target image recognition model. Then, based on the output image of the target image recognition model, the position of each preset number in the string is determined, and these positions are combined to form the recognition result of the string. This method can recognize numbers in an image without preprocessing such as removing table lines or segmenting characters, avoiding recognition errors caused by abnormal situations during preprocessing and improving the accuracy and robustness of the recognition. Attached Figure Description

[0018] The above and other objects, features and advantages of the present invention will become clearer from the following description of embodiments of the invention with reference to the accompanying drawings.

[0019] Figure 1 This is a flowchart illustrating an embodiment of the method for image recognition according to the present invention;

[0020] Figure 2 This is a flowchart illustrating the determination of the position of a preset number in a string according to an embodiment of the method for recognizing images based on the present invention;

[0021] Figure 3 This is a schematic flowchart illustrating the process of training an image recognition model according to one embodiment of the method for recognizing images based on the present invention;

[0022] Figure 4 This is a schematic flowchart illustrating the process of generating a virtual sample image in one embodiment of the method for image recognition according to the present invention;

[0023] Figure 5 This is a schematic diagram of an embodiment of an image recognition device according to the present invention. Detailed Implementation

[0024] The present invention will be described below based on embodiments. Those skilled in the art should understand that the accompanying drawings provided herein are for illustrative purposes and are not necessarily drawn to scale.

[0025] Unless the context explicitly requires it, the words "comprising," "including," and similar terms throughout the specification and claims should be interpreted as encompassing rather than being exclusive or exhaustive; that is, meaning "including but not limited to."

[0026] Figure 1 A flowchart 100 of an embodiment of a method for image recognition according to the present invention is shown. The process 100 includes the following steps:

[0027] Step 110: Obtain the image to be recognized.

[0028] The image to be identified includes a string of numbers within a predetermined region.

[0029] In this embodiment, the string in the image to be identified can represent the identity of the object, and is usually composed of handwritten numbers, such as exam number, student number or other types of numeric ID.

[0030] In some optional implementations of this embodiment, the image to be recognized is an image obtained by photographing the text to be recognized, and the string represents the examination number in the text to be recognized.

[0031] In a specific example, the executing entity could be a terminal device equipped with an intelligent marking system, which can take real-time photos of the exam paper to be processed through a camera, and then use the captured image as the image to be recognized. The predetermined area is the area in the exam paper used to fill in the exam number, and the string represents the exam number in the exam paper.

[0032] Step 120: Input the image to be recognized into the pre-trained target image recognition model to obtain a multi-channel output image.

[0033] Each channel in the output image corresponds to a confidence prediction map of a preset number.

[0034] In this embodiment, the target image recognition model can be, for example, a convolutional neural network. By performing convolution processing on the image to be recognized, high-level abstract features of the image to be recognized are extracted. Then, through feature mapping, the confidence level of each pixel in the image to be recognized belonging to a preset number is predicted, and a confidence prediction map of the preset number is generated based on the confidence level of each preset number. After that, the confidence prediction maps of different preset numbers are summarized as different channels to form a multi-channel output image.

[0035] Typically, the preset numbers can include digits 0-9. Correspondingly, the output image is a 10-channel image, where each channel corresponds to a confidence prediction map for one digit. As an example, the confidence prediction map for the digit 9 represents the probability value of a pixel in the image to be identified belonging to the digit 9; the confidence prediction map for the digit 0 represents the probability value of a pixel in the image to be identified belonging to the digit 0.

[0036] In some optional implementations of this embodiment, the output image includes 11 channels, of which 10 channels correspond to the confidence prediction maps of numbers 0 to 9 respectively, and 1 channel corresponds to the confidence prediction map of numbers with tampering marks.

[0037] In practice, users often make mistakes when writing their exam numbers and then erase or modify them. Numbers with alteration marks increase the difficulty of image recognition, thus requiring image recognition algorithms to have higher accuracy and robustness.

[0038] With this in mind, the target image recognition model in this embodiment can identify digits with tampering marks in the image to be recognized, and use the predicted confidence map as an image channel of the output image, so that the output image contains the recognition results of digits with tampering marks, which can improve the accuracy and robustness of image recognition.

[0039] Step 130: Determine the position of the preset number in the string based on the confidence prediction graph.

[0040] In this embodiment, the executing entity can determine the regions in the image to be identified that contain the preset number based on the confidence prediction map of each preset number, and then determine the position of the preset number in the string by sorting the positions of multiple consecutive regions located in the predetermined regions.

[0041] As an example, the executing entity can determine the regions in the image to be recognized for the number 0 as Region 1, Region 2, and Region 3 based on the confidence prediction map corresponding to the number 0. This step is repeated to sequentially determine the regions in the image to be recognized for the number 1 as Region 4 and Region 5, the region for the number 2 as Region 6, the region for the number 5 as Region 7 and Region 8, and the region for the number 6 as Region 9. The numbers 7, 8, and 9 are not present in the image to be recognized. The regions located within the predetermined regions include: Region 3, Region 4, Region 5, Region 6, and Region 9. Then, the executing entity sorts the regions according to the rule of ascending x-coordinates, resulting in the sorted order: Region 9, Region 6, Region 5, Region 3, and Region 4. The executing entity can then determine the position of each preset number in the string based on the sorted region order. For example, the number 0 is located in the fourth position in the string, the number 1 in the third and fifth positions, the number 6 in the first position, and the number 2 in the second position.

[0042] Step 140: Based on the position of the preset numbers in the string, combine the preset numbers into the recognition result of the string.

[0043] In this embodiment, the executing entity can combine the preset numbers into a number string according to the position of the preset numbers in the string determined in step 130. This number string is the recognition result of the string in the image to be recognized.

[0044] Continuing with the example in step 130, the recognition result of the string composed of the execution subject is: 62101.

[0045] The method provided in this embodiment can simultaneously segment the string in the image to be recognized and recognize the numbers in the string using a target image recognition model. Then, based on the output image of the target image recognition model, the position of each preset number in the string is determined, and these positions are combined to form the recognition result of the string. This method can recognize numbers in an image without preprocessing such as removing table lines or segmenting characters, avoiding recognition errors caused by abnormal situations during preprocessing and improving the accuracy and robustness of the recognition.

[0046] Next reference Figure 2 , Figure 2 A flowchart illustrating the method for image recognition according to the present invention is provided, showing the position of a preset number within a string. The flowchart 200 includes the following steps:

[0047] Step 210: Extract the confidence prediction map corresponding to each channel from the output image.

[0048] Step 220: Smooth and binarize the confidence prediction map to obtain the processed prediction map.

[0049] In this embodiment, the executing entity performs smoothing and binarization processing on the confidence prediction map, which can transform the confidence prediction map into a smoother single-channel image, thereby obtaining the processed prediction map.

[0050] Step 230: Perform connectivity analysis on the predetermined region in the processed prediction graph to determine the connected components within the predetermined region in the processed prediction graph.

[0051] In this embodiment, connected components can represent the regions in the image to be identified where the digits are located.

[0052] As an example, the executing entity can first determine the connected components in the processed prediction graph through a connected component analysis algorithm, and then determine the connected components located within the predetermined region by comparing the positions of the predetermined region and the connected components.

[0053] Step 240: Based on the position of the connected components, determine the position of the preset number corresponding to the channel in the string.

[0054] As an example, the executing entity can sort multiple connected components according to the x-coordinates of the connected components located within the predetermined region corresponding to each predetermined number, and then determine the arrangement position of the predetermined number in the string based on the sorting result, thereby determining the position of the predetermined number in the string.

[0055] from Figure 2 It can be seen that, Figure 2 The illustrated embodiment first extracts each confidence prediction map from the output image, then binarizes and smooths the confidence prediction maps. Next, it performs connected component analysis on the processed prediction maps to determine the regional positions of each predetermined digit in the image to be recognized. Finally, based on the positions of the connected components, it determines the positions of each predetermined digit within the string. By representing the regions of digits in the image to be recognized through connected components, and by improving the accuracy of connected component analysis through binarization and smoothing, it helps to more accurately determine the positions of the preset digits within the string, thereby improving the accuracy of the recognition results.

[0056] Continue to refer to Figure 3 , Figure 3 A flowchart illustrating the training of an image recognition model is shown in one embodiment of the method for image recognition according to the present invention. The process 300 includes the following steps:

[0057] Step 310: Obtain the sample set.

[0058] The sample images in the sample set include at least one labeled virtual sample image and at least one labeled real sample image. The sample region in the sample image includes a sample string. The virtual sample image is an image generated based on the real sample image, and the real sample image is an image obtained by photographing the sample text.

[0059] For example, a real sample image can be an image of a sample exam paper, while a virtual sample image is a composite image obtained by processing a real sample image using image processing algorithms (e.g., segmenting and then synthesizing).

[0060] Step 320: Based on virtual sample images, train the pre-constructed initial image recognition model to obtain the pre-trained image recognition model.

[0061] As an example, the initial image recognition model can be a convolutional neural network. After the executing entity inputs a virtual sample image into the initial image recognition model, it obtains the prediction result of the virtual sample image. Then, the labeling result of the virtual sample image can be used as the expected output. Based on the difference between the prediction result and the labeling result, the loss function value is determined. Afterward, using the backpropagation characteristic of the neural network, the weight coefficients of the initial image recognition model are adjusted according to the loss function value. The above steps are iterated until the loss function converges, completing the pre-training of the initial image recognition model. During this process, the executing entity can use the mean squared error loss function, the Adam optimization algorithm, and the StepLR learning rate adjustment method to improve the efficiency and accuracy of pre-training.

[0062] Step 330: Based on real sample images, retrain the pre-trained image recognition model to obtain the target image recognition model.

[0063] In this embodiment, the executing entity can input real sample images into a pre-trained image recognition model to obtain prediction results, then use the labeling results of the real sample images as the expected output, determine the loss function value, and fine-tune the parameters of the pre-trained image recognition model based on the loss function value to further improve the performance of the pre-trained image recognition model, thereby obtaining the target image recognition model.

[0064] from Figure 3 It can be seen that, Figure 3 The illustrated embodiment demonstrates the use of virtual sample images to pre-train an initial image recognition model, followed by fine-tuning the pre-trained model using real sample images to obtain the target image recognition model. The use of more readily available virtual sample images expands the training sample set, helping to improve the efficiency and robustness of model training. Fine-tuning the trained image recognition model using real sample images allows for the determination of the accuracy of the target image recognition model in practical applications.

[0065] Next, refer to Figure 4 , Figure 4 A flowchart illustrating the generation of a virtual sample image in one embodiment of the method for image recognition according to the present invention is shown. The process 400 includes the following steps:

[0066] Step 410: Segment individual digit images from real sample images and label the digits in the individual digit images to obtain multiple sample digit images.

[0067] As an example, the executing entity can use pre-calibrated template information to segment a predetermined region in a real sample image, then extract multiple individual digital images from it, and use calibration software to label them to obtain multiple sample digital images.

[0068] Step 420: Generate a sample altered digital image based on the sample digital image.

[0069] In this embodiment, the executing entity can generate tampering marks in the sample digital image to obtain a sample tampered digital image. For example, various irregular patterns can be generated in the sample digital image.

[0070] In some optional implementations of this embodiment, the sample tampered digital image is generated as follows: an initial sample image is generated, in which the pixel value of each pixel is 0; one or more straight lines are randomly generated in the initial sample image; a sample digital image is randomly selected and superimposed on the initial sample image to obtain the sample tampered digital image.

[0071] In this embodiment, the executing entity can generate a sample tampered digital image by randomly generating a straight line model to cover up the traces and superimposing the sample digital image onto the initial sample image, which can conveniently and efficiently expand the number of samples.

[0072] Step 430: Generate an initial image and determine the sample region in the initial image.

[0073] In the initial image, the pixel value of each pixel is 0.

[0074] As an example, the executing entity can determine the sample region in the initial image based on a predetermined region in the real image.

[0075] Step 440: Generate a single-row table within the sample area.

[0076] The table contains a random number of cells.

[0077] In this embodiment, the table is used to represent the grid lines around the test number in practice, and each cell is used to fill in a number.

[0078] As an example, the executive director could randomly determine the number of digits (n) in the exam number, as well as the height and width of the table, and then divide the table into n cells. In this way, the tables in different initial images will not be exactly the same.

[0079] In some optional implementations of this embodiment, the table is generated as follows: the height, length, and number of cells of the table to be generated are randomly determined; based on the height, length, and number of cells of the table to be generated, the straight lines to be drawn are determined; each straight line to be drawn is divided into a preset number of line segments, and a random number is generated for each line segment; if the random number corresponding to the line segment is greater than a preset threshold, the line segment is drawn to obtain the table, and the line width of the line segment is the sum of the preset stroke width and the random disturbance.

[0080] In this embodiment, the executing entity can determine the height, length, and vector of the table in a random manner, and then generate the lines in the table in a random manner, so that the table attributes in different initial images are also different, which improves the diversity of virtual sample images. By training the model in this way, the robustness of the image recognition model can be improved.

[0081] Step 450: For each cell, randomly select a sample digital image and overlay it onto the area of ​​that cell.

[0082] As an example, the executing entity can randomly select a sample digital image from the multiple sample digital images obtained in step 410, then adjust the resolution of the sample digital image and overlay it onto any position within the cell area until all cells are overlaid with a sample digital image.

[0083] Step 460: Randomly overlay sample altered digital images within the area of ​​each cell to generate sample strings.

[0084] As an example, the executing entity can generate a random number for each cell, then compare the random number with a predetermined value, and determine whether to overlay a sample tampered digit image in the cell based on the comparison result. For instance, if the random number is less than the predetermined value, a sample tampered digit image is randomly selected from the multiple sample tampered digit images generated in step 420 and overlaid into the cell; if the random number is greater than or equal to the predetermined value, no sample tampered digit image is overlaid into the cell. In this way, multiple sample tampered digit images may exist in the same initial image, or no sample tampered digit image may exist.

[0085] Step 470: Based on the labeling results of the sample digital images superimposed in the regions of each cell, label the sample strings to obtain virtual sample images.

[0086] In some optional implementations of this embodiment, the executing entity may also generate new virtual sample images based on the virtual sample images obtained in step 470 to further expand the number of samples. For example, new virtual sample images may be generated by randomly adding noise, randomly rotating, cropping, etc.

[0087] Figure 4 The illustrated embodiment can generate virtual sample images based on real sample images and generate sample strings in a random manner, which can improve the diversity of virtual sample images. This can be used to train the image recognition model and improve the robustness of the image recognition model.

[0088] Next, refer to Figure 5 , Figure 5 A schematic diagram of an embodiment of the system for image recognition according to the present invention is shown, as follows: Figure 5 As shown, the present invention provides an image recognition device comprising: an image acquisition unit 510 configured to acquire an image to be recognized, wherein a predetermined region of the image to be recognized includes a string composed of numbers; an image prediction unit 520 configured to input the image to be recognized into a pre-trained target image recognition model to obtain a multi-channel output image, wherein each channel in the output image corresponds to a confidence prediction map of a preset number; a position determination unit 530 configured to determine the position of the preset number in the string based on the confidence prediction map; and a result determination unit 540 configured to combine the preset numbers into a recognition result of the string based on the position of the preset number in the string.

[0089] The image recognition apparatus provided by this invention can simultaneously segment a string in an image to be recognized and recognize the numbers within that string using a target image recognition model. Then, based on the output image of the target image recognition model, the position of each preset number within the string is determined, and these positions are combined to form the recognized string. This eliminates the need for preprocessing the image, such as removing table lines or segmenting characters, thus avoiding recognition errors caused by abnormal situations during preprocessing and improving the accuracy and robustness of the recognition.

[0090] The present invention also provides an electronic device, the electronic device including one or more processors; a storage device having one or more programs stored thereon, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method for recognizing images as described above.

[0091] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0092] It will be readily understood by those skilled in the art that, without conflict, the above-mentioned preferred solutions can be freely combined and superimposed.

[0093] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. For those skilled in the art, the present invention can be modified and varied in various ways. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principle of the present invention should be included within the scope of protection of the present invention.

Claims

1. A method for recognizing images, characterized in that, The method includes: Obtain an image to be recognized, wherein a predetermined region of the image to be recognized includes a string consisting of numbers; The image to be recognized is input into a pre-trained target image recognition model to obtain a multi-channel output image. Each channel in the output image corresponds to a confidence prediction map of a preset number; one channel in the output image corresponds to a confidence prediction map of a number with tampering marks. The target image recognition model is trained through the following steps: acquiring a sample set, wherein the sample images in the sample set include at least one labeled virtual sample image and at least one labeled real sample image, wherein the sample region in the sample image includes a sample string, and the virtual sample image is an image generated based on the real sample image, wherein the real sample image is an image obtained by photographing sample text; the virtual sample image is generated in the following way: from the real sample image A single digital image is segmented from the image, and the digits in the single digital image are marked to obtain multiple sample digital images; based on the sample digital images, a sample altered digital image is generated; an initial image is generated, and a sample region is determined in the initial image, where the pixel value of each pixel in the initial image is 0; a single-row table is generated within the sample region, and the table includes a random number of cells; for each cell, a sample digital image is randomly selected and superimposed onto the region of that cell; the sample altered digital images are randomly superimposed into the regions of each cell to generate the sample string; based on the marking results of the sample digital images superimposed into the regions of each cell, the sample string is marked to obtain the virtual sample image; Based on the confidence prediction map, the position of the preset number in the string is determined; specifically, this includes: extracting the confidence prediction map corresponding to the channel from the output image; performing smoothing and binarization on the confidence prediction map to obtain a processed prediction map; performing connected component analysis on a predetermined region in the processed prediction map to determine the connected components within the predetermined region in the processed prediction map; and determining the position of the preset number corresponding to the channel in the string based on the position of the connected components. Based on the position of the preset numbers in the string, the preset numbers are combined to form the recognition result of the string.

2. The method according to claim 1, characterized in that, The output image includes 11 channels, of which 10 channels correspond to the confidence prediction maps for numbers 0 to 9 respectively.

3. The method according to any one of claims 1 to 2, characterized in that, The image to be identified is an image obtained by photographing the text to be identified, and the string represents the examination number in the text to be identified.

4. The method according to claim 3, characterized in that, The target image recognition model is also trained through the following steps: Based on the virtual sample images, a pre-constructed initial image recognition model is trained to obtain a pre-trained image recognition model; Based on the real sample images, the pre-trained image recognition model is trained again to obtain the target image recognition model.

5. The method according to claim 1, characterized in that, The digital image of the sample alteration is generated in the following manner: Generate an initial sample image, wherein the pixel value of each pixel in the initial sample image is 0; One or more straight lines are randomly generated in the initial sample image; A randomly selected sample digital image is superimposed onto the initial sample image to obtain the sample altered digital image.

6. The method according to claim 5, characterized in that, The table is generated in the following way: Randomly determine the height, length, and number of cells of the table to be generated; Based on the height, length, and number of cells of the table to be generated, determine the straight line to be drawn; Each line to be drawn is divided into a preset number of segments, and a random number is generated for each segment. If the random number corresponding to the line segment is greater than a preset threshold, the line segment is drawn to obtain the table. The line width of the line segment is the sum of the preset stroke width and the random disturbance.

7. An apparatus for recognizing images, characterized in that, The device includes: An image acquisition unit is configured to acquire an image to be recognized, wherein a predetermined region of the image to be recognized includes a string of numbers; An image prediction unit is configured to input the image to be recognized into a pre-trained target image recognition model to obtain a multi-channel output image. Each channel in the output image corresponds to a confidence prediction map of a preset number; one channel in the output image corresponds to a confidence prediction map of a number with tampering marks. The target image recognition model is trained through the following steps: acquiring a sample set, wherein the sample images in the sample set include at least one labeled virtual sample image and at least one labeled real sample image, wherein the sample regions in the sample images include sample strings, and the virtual sample image is an image generated based on the real sample image, wherein the real sample image is an image obtained by photographing sample text; the virtual sample image is generated in the following manner: from the... A single digit image is segmented from a real sample image, and the digits in the single digit image are marked to obtain multiple sample digit images; based on the sample digit images, a sample altered digit image is generated; an initial image is generated, and a sample region is determined in the initial image, where the pixel value of each pixel in the initial image is 0; a single-row table is generated within the sample region, and the table includes a random number of cells; for each cell, a sample digit image is randomly selected and superimposed onto the region of that cell; the sample altered digit images are randomly superimposed into the regions of each cell to generate the sample string; based on the marking results of the sample digit images superimposed into the regions of each cell, the sample string is marked to obtain the virtual sample image; The position determination unit is configured to determine the position of the preset number in the string based on the confidence prediction map; specifically, it includes: extracting the confidence prediction map corresponding to the channel from the output image; performing smoothing and binarization processing on the confidence prediction map to obtain a processed prediction map; performing connected component analysis on a predetermined region in the processed prediction map to determine the connected components within the predetermined region in the processed prediction map; and determining the position of the preset number corresponding to the channel in the string based on the position of the connected components. The result determination unit is configured to combine the preset numbers into a recognition result of the string based on the position of the preset numbers in the string.

8. An electronic device, characterized in that, The electronic device includes: One or more processors; Storage device, on which one or more programs are stored, When the one or more programs are executed by the one or more processors, the one or more processors implement the method for recognizing images as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Character identification method and apparatus

    CN105184289A

  • Container number identification method and device, and computer equipment

    CN110942057A