Image recognition method and device, storage medium and electronic device
The second image template is created for certificate-type images through artificial intelligence large models and OCR algorithms, which solves the problem of poor information extraction of certificate-type images in the prior art, and achieves high-precision and high-efficiency text content recognition.
Patent Information
- Application Number
- CN202510094667.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-20
- Publication Date
- 2025-05-09
AI Technical Summary
The prior art has problems such as insufficient accuracy, lack of flexibility and low processing efficiency in the information extraction process of document-type images, resulting in identification errors and a large number of manual participation.
Determine whether there is an image template in the preset template library that matches the target image. If it does not exist, a second image template is created for the target image based on the artificial intelligence model and the OCR algorithm to identify the text content in the target image.
It realizes high-quality, high-precision and high-accuracy text content recognition of document-type images, improves the efficiency and accuracy of information extraction, and reduces manual participation.
Smart Images

Figure CN119964174A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer vision, and more specifically, to an image recognition method and device, a storage medium, and an electronic device. Background Art
[0002] In the related technology, the following technical problems are faced in the process of information extraction of certificate images:
[0003] 1) Insufficient accuracy: Traditional optical character recognition (OCR) technology has limited accuracy when processing complex document images, and is prone to recognition errors due to background interference / image quality / format diversity. 2) Lack of flexibility: Traditional OCR technology lacks flexibility when applied to documents of different types or formats, and often requires separate model customization for each scenario. 3) Inefficient processing: In large-scale document processing scenarios, fast and reliable information extraction is key. Traditional technologies usually require a lot of manual participation to create information extraction templates due to their lack of accuracy. Therefore, it can be seen that in related technologies, there is a problem of poor information extraction effect on document images.
[0004] In view of the problem of poor information extraction effect on document images in related technologies, no effective solution has been proposed yet. Summary of the invention
[0005] Embodiments of the present application provide an image recognition method and device, a storage medium, and an electronic device.
[0006] According to one embodiment of the embodiments of the present application, an image recognition method is provided, including: determining through an artificial intelligence big model whether there is a first image template matching a target image in a preset template library, wherein the target image is an image with a standardized format and content, and the preset template library includes: at least one image template; if the first image template does not exist in the preset template library, creating a second image template for the target image according to the artificial intelligence big model and a first algorithm, wherein the first algorithm is an algorithm for converting text information in an image into machine-readable text; and recognizing the text content in the target image through the second image template.
[0007] In an exemplary embodiment, before determining whether there is a first image template matching the target image in a preset template library through an artificial intelligence large model, the method also includes: performing clarity processing on the initial target image through a second algorithm, wherein the second algorithm is used to denoise the initial target image; locating multiple rectangular contours in the initial target image after clarity processing through a third algorithm; and performing standardization processing on target rectangular contours that meet preset conditions among the multiple rectangular contours to obtain the target image, wherein the preset conditions include at least: the area of the rectangular contour is greater than a first value, and the angle change of the rectangular contour relative to the outer contour of the initial target image is less than a second value.
[0008] In an exemplary embodiment, determining whether there is a first image template matching a target image in a preset template library through an artificial intelligence big model includes: determining a first key field set included in the target image through the artificial intelligence big model, wherein the first key field set includes: fields corresponding to standardized content in the target image; performing a vector search in the preset template library through the first key field set to obtain at least one candidate image template, wherein the similarity between the first key field set and the second key field set of the at least one candidate image template is higher than a third value; and determining from the at least one candidate image template whether there is a first image template matching the target image in the preset template library.
[0009] In an exemplary embodiment, determining whether there is a first image template matching the target image in the preset template library from the at least one candidate image template includes: determining first text box positions corresponding to the multiple first key fields in the first key field set in the target image, and determining second text box positions corresponding to the multiple second key fields in the second key field set in the at least one candidate image template; matching the first text box position and the second text box position by the artificial intelligence big model to obtain a matching result; and determining whether there is the first image template in the preset template library when the matching result indicates that there is a third image template in the at least one candidate image template, wherein the second text box position of the third image template coincides with the first text box position.
[0010] In an exemplary embodiment, a second image template is created for the target image based on the artificial intelligence big model and the first algorithm, including: determining a first key field set included in the target image through the artificial intelligence big model; and determining a third key field set included in the target image, and third text box positions corresponding to multiple third key fields in the third key field set through the first algorithm; extracting multiple groups of matching key fields in the first key field set and the third key field set; determining a fourth text box position in the target image corresponding to a content item of a fourth key field in each group of matching key fields through the multiple third text box positions, wherein the first key field set includes: the fourth key field; and generating the second image template through the fourth text box position.
[0011] In an exemplary embodiment, generating the second image template through the fourth text box position includes: adding multiple first key fields in the first key field set to the first position in the blank template respectively, wherein the first position corresponds to the position of the third text box position in the target image; determining the second position of the content item in the blank template according to the position of the fourth text box position in the target image; adding a prompt word corresponding to the content item to the second position; and determining the blank template to which at least the first key field and the prompt word are added as the second image template.
[0012] In an exemplary embodiment, identifying the text content in the target image through the second image template includes: identifying any key field in the target image and a fifth text box position corresponding to any key field through the first algorithm; calibrating the fifth text box position through the second image template to obtain a sixth text box position; and determining the text content through the sixth text box position and the encoding length of the content item corresponding to any key field.
[0013] According to another embodiment of the embodiments of the present application, an image recognition device is also provided, including: a determination module, used to determine whether there is a first image template matching a target image in a preset template library through an artificial intelligence big model, wherein the target image is an image with a standardized format and content, and the preset template library includes: at least one image template; a creation module, used to create a second image template for the target image according to the artificial intelligence big model and a first algorithm when the first image template does not exist in the preset template library, wherein the first algorithm is an algorithm for converting text information in an image into machine-readable text; and a recognition module, used to recognize the text content in the target image through the second image template.
[0014] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned image recognition method when running.
[0015] According to another aspect of an embodiment of the present application, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the image recognition method through the computer program.
[0016] According to another aspect of the embodiments of the present application, a computer program product is provided, including a computer program, wherein the computer program is executed by a processor to perform the method.
[0017] In an embodiment of the present application, when it is necessary to identify the text content of a target image with a standardized format and content, first determine whether there is a first image template matching the target image in a preset template library through an artificial intelligence big model, wherein the preset template library includes: at least one image template; if the first image template does not exist in the preset template library, then create a second image template for the target image according to the artificial intelligence big model and a first algorithm for converting text information in an image into machine-readable text, and then the text content in the target image can be identified by the obtained second image template. Through the embodiment of the present application, the problem of poor information extraction effect for document images (i.e., target images) in the related art can be solved. Therefore, in the process of identifying the text content of the target image, the embodiment of the present application allows the artificial intelligence big model to participate, and finally the high-quality, high-precision, and high-accuracy recognition of the text content of the target image can be achieved through the second image template created for the target image by combining the artificial intelligence big model and the first algorithm. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0019] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0020] Figure 1 is a flowchart of an image recognition method according to an embodiment of the present application;
[0021] Figure 2is a flowchart of an image recognition method according to an optional embodiment of the present application;
[0022] Figure 3 is another flow chart of an image recognition method according to an optional embodiment of the present application;
[0023] Figure 4 is a structural block diagram of an image recognition device according to an embodiment of the present application;
[0024] Figure 5 It is a schematic diagram of an electronic device according to an image recognition method of an embodiment of the present application. DETAILED DESCRIPTION
[0025] 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 drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0026] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0027] In this embodiment, an image recognition method is provided, which is applied to a computer device or other device that needs to perform image recognition. Figure 1 is a flowchart of an image recognition method according to an embodiment of the present application, the process comprising the following steps:
[0028] Step S102, determining whether there is a first image template matching the target image in a preset template library by using an artificial intelligence big model, wherein the target image is an image with a standardized format and content, and the preset template library includes: at least one image template;
[0029] It should be noted that the target image can be a document image, for example, images of various types of identity and license certificates such as identity cards, passports, driver's licenses, visas, business licenses, bank cards, etc.; the target image can also be an image corresponding to a file with a fixed template that is commonly used in a certain area, such as a visitor record sheet of a community, an application for admission, and a company's general reports, such as financial statements.
[0030] Step S104, when the first image template does not exist in the preset template library, creating a second image template for the target image according to the artificial intelligence large model and a first algorithm, wherein the first algorithm is an algorithm for converting text information in an image into machine-readable text;
[0031] Optionally, the first algorithm may adopt OCR technology.
[0032] It is understandable that, taking the ID card as an example, the first image template may have key fields of standardized content such as "name", "gender", "birth_year_month_day", "address", "citizen ID number", etc., these key fields are arranged according to the standardized format inherent in the ID card, and the content items corresponding to the key fields of these standardized contents are blank and have prompt words corresponding to the content items. Among them, the content items are, for example: a specific name "XX", a specific gender "male" or "female", etc. Among them, the prompt words are, for example: for the standardized key field "gender", the prompt word can be: the specific field content of the content item should be "male" or "female".
[0033] Step S106: recognizing text content in the target image using the second image template.
[0034] Optionally, when the second image template exists in the preset template library, the text content in the target image is recognized by the first image template.
[0035] Through the above steps, when it is necessary to identify the text content of a target image with a standardized format and content, first determine whether there is a first image template matching the target image in the preset template library through the artificial intelligence big model, wherein the preset template library includes: at least one image template; if the first image template does not exist in the preset template library, then create a second image template for the target image according to the artificial intelligence big model and the first algorithm for converting the text information in the image into machine-readable text, and then the text content in the target image can be identified by the obtained second image template. Through the embodiment of the present application, the problem of poor information extraction effect for document images in the related art can be solved. Therefore, in the process of identifying the text content of the target image, the embodiment of the present application allows the artificial intelligence big model to participate, and finally the high-quality, high-precision, and high-accuracy recognition of the text content of the target image can be achieved through the second image template created for the target image by combining the artificial intelligence big model and the first algorithm.
[0036] In some optional embodiments, before determining whether there is a first image template matching the target image in a preset template library through an artificial intelligence large model, the method also includes: performing clarity processing on the initial target image through a second algorithm, wherein the second algorithm is used to denoise the initial target image; locating multiple rectangular contours in the initial target image after clarity processing through a third algorithm; and performing standardization processing on target rectangular contours that meet preset conditions among the multiple rectangular contours to obtain the target image, wherein the preset conditions include at least: the area of the rectangular contour is greater than a first value, and the angle change of the rectangular contour relative to the outer contour of the initial target image is less than a second value.
[0037] Optionally, the initial target image may be a photograph directly taken of a certificate or the like, or a scanned image.
[0038] Optionally, in the denoising process of the initial target image, the second algorithm can use Gaussian filtering and / or bilateral filtering technology. When Gaussian filtering technology and bilateral filtering technology are used at the same time, the clarity processing quality of the initial target image can be higher. After the initial target image is denoised by the second algorithm, the denoised initial target image obtained will retain the image edge information while denoising to avoid blurring of key content. In addition, in the case of insufficient brightness of the initial target image, adaptive contrast enhancement (CLAHE) technology can also be used to enhance the contrast of the initial target image.
[0039] Further, after the initial target image is denoised, multiple rectangular contours in the initial target image after clarity processing can be located by an edge detection algorithm; wherein the edge detection algorithm is, for example, the Canny algorithm. Specifically, vertical lines and horizontal lines in the initial target image after clarity processing can be located by an edge detection algorithm, thereby obtaining multiple rectangular contours. The process of selecting the target rectangular contour includes: first, discarding the rectangular contours with an area less than a first value in the multiple rectangular contours to obtain the remaining rectangular contours with an area greater than the first value; then selecting the first side of any rectangular contour in the remaining rectangular contours, and determining the angle between the first side and the second side corresponding to the first side in the initial target image, wherein the first side is any side of any rectangular contour; discarding the rectangular contours with an angle greater than the second value in the remaining rectangular contours to obtain the middle rectangular contour; finally, the rectangular contour with the largest area in the middle rectangular contour is used as the target rectangular contour. Optionally, the first value is determined according to the area of the initial target image, for example, it can be one-fourth of the area of the initial target image; the second value can be selected as 30 degrees. Optionally, the method of determining the angle of the rectangular contour relative to the outer contour of the initial target image is not limited to the method shown in the embodiment of the present application.
[0040] Furthermore, the standardization process includes: determining a first distance between any two vertices of the target rectangular outline, and determining a second distance between two vertices corresponding to any two vertices of the target rectangular outline in the initial target image, and determining an updated vertex position of the target rectangular outline by the ratio between the first distance and the second distance; transforming the image of the range included in the target rectangular outline according to the updated vertex position and the perspective transformation algorithm to obtain the target image.
[0041] In summary, the above scheme of the embodiment of the present application performs clarity processing and standardization processing on the initial target image, so that the target image that can be finally obtained and can recognize text content is a sufficiently clear image with a normal angle and no skew, and all image ranges of the target image are the ranges that need to be recognized. This makes the recognition of the target image more accurate, and will not cause too many recognition errors due to insufficient image clarity; and makes the recognition of the target image more targeted, and will not waste resources on places in the initial target image that do not have recognition conditions.
[0042] After preprocessing the initial target image (including at least clarity processing and standardization processing), the artificial intelligence big model can be used to determine whether there is a first image template matching the target image in the preset template library, including: determining a first key field set included in the target image through the artificial intelligence big model, wherein the first key field set includes: fields corresponding to standardized content in the target image; performing a vector search in the preset template library through the first key field set to obtain at least one candidate image template, wherein the similarity between the first key field set and the second key field set of the at least one candidate image template is higher than a third value; determining from the at least one candidate image template whether there is a first image template matching the target image in the preset template library.
[0043] For example, when the target image is an ID card, the first key field set identified by the artificial intelligence large model may include at least one, at least several, or all of: "name", "gender", "birth_year_month_day", "address", "citizen ID number", etc. If the first key field set includes "name", "gender", and "address", the second key field set that may be searched by performing a vector search on the first key field set in the preset template library includes: "name", "gender", and "nationality"; it may also include: or "name", "gender", and "permitted driving type", and may also include: "name", "gender", and "address";
[0044] Then the image template corresponding to the second key field set including "name", "gender", and "nationality", the image template corresponding to the second key field set including or "name", "gender", and "driving license type", and the image template corresponding to the second key field set including "name", "gender", and "address" are at least one candidate image template. Optionally, the third value can be set as needed, such as 60%, 80%, etc., which is not limited in the embodiment of the present application.
[0045] Therefore, the embodiment of the present application can search for all image templates that may correspond to the target image from the preset template library through a vector search operation based on the first key field set, thereby narrowing the search range of the first image template required for accurate search of the target image to a certain extent, and then realizing the search for the first image template in at least one candidate image template.
[0046] Furthermore, determining whether there is a first image template matching the target image in the preset template library from the at least one candidate image template includes: determining first text box positions corresponding to the multiple first key fields in the first key field set in the target image, and determining second text box positions corresponding to the multiple second key fields in the second key field set in the at least one candidate image template; matching the first text box position and the second text box position by the artificial intelligence big model to obtain a matching result; and determining whether the first image template exists in the preset template library when the matching result indicates that there is a third image template in the at least one candidate image template, wherein the second text box position of the third image template coincides with the first text box position.
[0047] Optionally, in one implementation, the first algorithm (OCR technology) can be used to determine the first text box positions corresponding to the multiple first key fields in the first key field set in the target image, and determine the first center coordinates of the first text box position. In addition, the second text box positions corresponding to the multiple second key fields in the second key field set in the at least one candidate image template may also have second center coordinates corresponding to the second text box positions; and then the first center coordinates and the second center coordinates are matched through the artificial intelligence large model; if the multiple first center coordinates completely overlap with the multiple second center coordinates, then the third image template corresponding to the multiple second center coordinates is the first image template, that is, the first image template exists in the preset template library.
[0048] In another implementation, after determining the first text box position and the second text box position, the target image and at least one candidate image template can be binarized, and then the target image after binarization and at least one candidate image template after binarization are compared through the artificial intelligence large model; if the comparison result is that multiple second text box positions are completely consistent with multiple first text box positions, then the third image template corresponding to the multiple second text box positions is the first image template, that is, the first image template exists in the preset template library. Optionally, the binarization process may include: generating a mast area according to the target text box position, and setting all other parts except the target text box position to black, wherein the target text box position includes: the first text box position and the second text box position.
[0049] Therefore, the embodiment of the present application achieves the technical effect of accurately matching the target image with at least one candidate image template through methods such as binarization processing and coordinate matching. Through strict matching and comparison of key fields and text box positions, when a first image template exists in a preset template library, an accurate first image template can be obtained from the preset template library, rather than other confusing image templates that are extremely similar to the first image template, thereby improving the subsequent recognition effect of the target image.
[0050] Optionally, when the first image template does not exist in the preset template library, a second image template can be created for the target image based on the artificial intelligence big model and the first algorithm, including: determining a first key field set included in the target image through the artificial intelligence big model; and determining a third key field set included in the target image, and third text box positions corresponding to multiple third key fields in the third key field set through the first algorithm; extracting multiple groups of matching key fields from the first key field set and the third key field set; determining a fourth text box position in the target image corresponding to a content item of a fourth key field in each group of matching key fields through multiple third text box positions, wherein the first key field set includes: the fourth key field; and generating the second image template through the fourth text box position.
[0051] In the process of creating the second image template, the artificial intelligence big model and the first algorithm need to participate together. The artificial intelligence big model focuses more on providing accurate key fields, and the first algorithm focuses more on providing accurate text box positions. Specifically:
[0052] First, the first set of key fields included in the target image is extracted through the artificial intelligence model. Taking the ID card as an example, the first set of key fields may include: "name", "gender", "year_month_day of birth", "address", "citizen ID number", etc. At least some or all of them.
[0053] After or at the same time as the first key field set is extracted by the artificial intelligence big model, the first algorithm can be used to extract the third key field set and the third text box positions corresponding to the third key fields in the third key field set. Taking the ID card as an example, the third key field set page may include at least a few or all of: "name", "gender", "birth year_month_day", "address", "citizen ID number", etc. The third text box position can be embodied in the form of pixel coordinates.
[0054] Furthermore, if the first key field set includes: "Name", "Gender", "Year_Month_Day of Birth", and "Address", and the third key field set includes: "Name", "Gender", "Address", and "Citizen Identity Number", where the third text box positions corresponding to "Name", "Gender", "Address", and "Citizen Identity Number" are: (2,2), (2,3), (2,5), and (4,7), respectively, then the multiple groups of matching key fields extracted from the first key field set and the third key field set include: "Name, Name", "Gender, Gender", and "Address, Address", where the format of each group of matching key fields is: "First key field, third key field".
[0055] Furthermore, the fourth text box position corresponding to the content item of the fourth key field in each group of matching key fields is determined through multiple third text box positions, including: determining a fifth key field that is in the same group of matching key fields as the fourth key field, wherein the third key field set includes: the fifth key field; determining a seventh text box position corresponding to the fifth key field in the multiple third text box positions; and determining a fourth text box position corresponding to the content item of the fourth key field in the target image on the right and / or below the seventh text box position.
[0056] For example, taking "name, name" as an example, the seventh text box position corresponding to the third key field "name" is (2,2). Obviously, the coordinate (2,3) below (2,2) is the third key field "gender", and the fourth text box position of the content item of the fourth key field is determined from the right side of (2,2), for example, it can be (4,2) and so on.
[0057] In the above-mentioned scheme of the embodiment of the present application, in the process of creating the second image template, the artificial intelligence big model and the first algorithm are simultaneously adopted, which utilizes the advantages of the artificial intelligence big model in context understanding ability and high precision, and also utilizes the advantages of the first algorithm in high recognition accuracy and text box extraction, thereby achieving the technical effect of creating a second image template with extremely high matching degree with the target image and extremely high degree of reproduction of key fields in the target image.
[0058] After determining the fourth text box position, the second image template is generated through the fourth text box position, including: adding multiple first key fields in the first key field set to the first positions in the blank template respectively, wherein the first position corresponds to the position of the third text box position in the target image; determining the second position of the content item in the blank template according to the position of the fourth text box position in the target image; adding a prompt word corresponding to the content item to the second position; and determining the blank template to which at least the first key field and the prompt word are added as the second image template.
[0059] Optionally, adding multiple first key fields in the first key field set to the first position of the blank template includes: adding first key fields in the first key field set that are successfully matched with the third key field set to obtain a set of matching key fields to the first position of the blank template. For example, adding "name", "gender", and "address" in the first key field to (2,2), (2,3), (2,5), and (4,7) in the blank template respectively.
[0060] In addition, for unsuccessful matching, a set of key fields matching key fields, such as "birth_year_month_day", can be manually added to the second image template and the corresponding prompt words can be filled in to make the second image template more complete.
[0061] Among them, the second position of the content item in the blank template is determined according to the position of the fourth text box in the target image; a prompt word corresponding to the content item is added to the second position; for example: taking a set of matching key fields "name, name" as an example, when the fourth text box position is (4,2), the second position is also (4,2), and then a prompt word can be added to the virtual or actual text box at the second position, and the prompt word is such as: a person's name needs to be filled in here.
[0062] In an exemplary embodiment, identifying the text content in the target image through the second image template includes: identifying any key field in the target image and a fifth text box position corresponding to any key field through the first algorithm; calibrating the fifth text box position through the second image template to obtain a sixth text box position; and determining the text content through the sixth text box position and the encoding length of the content item corresponding to any key field.
[0063] It is understandable that if the first image template exists in the preset template library, the scheme of assisting the recognition of the text content in the target image by the first image template is consistent with the scheme of recognizing the text content in the target image by the second image template. In fact, after the second image template is created, the second image template can be updated to the preset template library.
[0064] Then, the specific text content recognition process includes:
[0065] After determining the position of the fifth text box, calibrating the position of the fifth text box by using the second image template to obtain the position of the sixth text box includes: fine-tuning the position of the fifth text box by using the center coordinates of the position corresponding to the position of the fifth text box in the second image template to calibrate the position of the fifth text box. For example, updating the center coordinates of the position of the fifth text box by using the center coordinates of the corresponding position to obtain the position of the sixth text box.
[0066] Optionally, the calibration process may also calibrate the text box position of the content item corresponding to any key field. The specific calibration process is consistent with the calibration process for the fifth text box position and will not be described in detail in the embodiments of the present application.
[0067] Then, the relationship between the encoding length of the content item corresponding to any key field and the fifth value is determined;
[0068] In the case where the size relationship indicates that the encoding length is greater than the fifth value, identifying the content item corresponding to any key field through the sixth text box position and the first algorithm, and using the content item corresponding to any key field as the text content;
[0069] When the size relationship indicates that the coding length is less than or equal to the fifth value, the content item corresponding to any key field is identified through the sixth text box position and the artificial intelligence large model, and the content item corresponding to any key field is used as the text content.
[0070] That is to say, the embodiment of the present application firstly realizes the calibration of the position of the fifth text box in the target image through the second image template, and then determines the recognition result of the content item recognized by which method as the text content according to the encoding length of the content item of any key field of the target image. Then, the advantages of the first algorithm (OCR) in long-coded character recognition are fully utilized, and the disadvantages of the artificial intelligence large model in long-coded character recognition are avoided. Long-coded characters are, for example, codes of long strings of numbers and letters.
[0071] In order to better understand the process of the above-mentioned image recognition method, the implementation method flow of the above-mentioned image recognition is described below in combination with an optional embodiment, but it is not used to limit the technical solution of the embodiment of the present application.
[0072] In the field of image text recognition, optical character recognition technology is an important research direction. Optical character recognition (OCR) technology is mainly used to convert printed text into machine-readable text. This technology has been widely used in many fields, including postal letter sorting, electronic document processing, and digital book archiving. After decades of development, OCR technology has become very mature and has the following advantages: 1) High maturity: After years of optimization and improvement, the OCR algorithm performs well in character recognition and can provide high-accuracy recognition results. 2) Fast speed: Focusing on specific tasks, OCR processing speed is fast and suitable for real-time applications. 3) Low cost: For most standardized text recognition applications, OCR technology is easy to deploy, has low hardware requirements, and is relatively low cost.
[0073] However, OCR technology also has some shortcomings: 1) Sensitivity to complex backgrounds: When dealing with complex backgrounds or low-quality images, the recognition accuracy of OCR may drop significantly. 2) Limited character set: Most OCR systems usually only support a single or a few languages and have difficulty coping with multilingual environments. 3) Lack of contextual understanding: OCR usually performs text recognition word by word and lacks an overall understanding of the text context.
[0074] Based on this, an optional embodiment of the present application provides an image recognition method for highly reliable information extraction from document images (equivalent to target images), and improves the accuracy and efficiency of data processing by combining a multimodal large model (equivalent to the artificial intelligence large model in the above embodiment) and optical character recognition (OCR) technology.
[0075] Optional, such as Figure 2 As shown, an image recognition method provided by an optional embodiment of the present application can be implemented through four parts, including: image preprocessing, template creation, template matching and information extraction.
[0076] Step 1: Image (i.e., target image) preprocessing: Preprocess the input image to at least obtain the outer contour of the image that is close to a rectangle.
[0077] Image preprocessing determines the effect of subsequent OCR and multimodal large models. Although OCR and multimodal large models have some processing capabilities for noisy and irregular images, experiments have shown that standardizing the image as much as possible through preprocessing can significantly improve the recognition accuracy.
[0078] Image preprocessing is mainly divided into two major modules:
[0079] The first is image clarity processing: Gaussian filtering and bilateral filtering techniques are used to reduce noise in the scanned image (equivalent to the target image), and the image edge information is retained while denoising to avoid blurring of key content. Adaptive contrast enhancement (CLAHE) is used to enhance the local contrast of images with insufficient brightness.
[0080] The second is image correction and cropping (equivalent to standardization): locate the outermost rectangle on the image through edge detection: locate the vertical and horizontal line segments through the Canny algorithm to determine the rectangle and then exclude candidates with too small area or too large angle changes in the four corners, and finally take the rectangle with the largest area as the outline of the document image. Set the distance ratio between vertices to the ratio of the regular pattern of the document (i.e. the document image) to convert the transformed vertex position, apply the perspective transformation algorithm to transform and crop the image, and finally obtain the standardized image.
[0081] Both the image clarity processing and image correction and cropping modules include anomaly detection, which records and reports anomalies when the image is blurry, the brightness is too low, the distortion is too large, the rectangle cannot be detected, or the image content is incomplete.
[0082] Step 2: Template matching. If there is a template in the matching template library (equivalent to the first image template), if no match is found, step 3 needs to be executed; if a match is found, step 4 is executed.
[0083] Specifically, a multimodal large model is used to search for candidates (equivalent to at least one candidate image template) for the input image (i.e., the target image), and then precise matching is performed on the position information of the key fields (equivalent to the second key field set) in the template to determine the consistency between the image and the template.
[0084] Multimodal large model candidate search, such as Figure 3 As shown, including:
[0085] Step 201: Submit the current preprocessed image to the multimodal large model to generate a key field set (i.e., a first key field set) and a document type;
[0086] Step 202: Perform a vector search using the text of step 201 (ie, the first key field set) to retrieve and recall templates with similar descriptions in the current template library as candidate templates (equivalent to at least one candidate image template).
[0087] Step 203: After obtaining the candidate template, use the key field position information for precise matching: 1) For the image to be matched (target image) and the candidate template, generate a mast area according to the text box position of the key field, and set all other parts to black. 2) Use the multimodal macro model to determine whether the content of the two is consistent.
[0088] Step 3: Template creation.
[0089] An image template is a detailed description of a type of document image. For an input image, if no matching template is found in the template library (i.e., the preset image template), the system will respond that a template needs to be created for it. The template includes the following:
[0090] Template name;
[0091] Image size;
[0092] A set of key fields generated by the multimodal large model and a description of the document type to which this image belongs;
[0093] Information for each keyword (i.e. key field, or keyword), including:
[0094] 1) Keyword name (optional, the text representation in the image can be used by default, such as "name"); 2) Text representation of the keyword in the image; 3) Keyword text box coordinates (optional, can be an area in the image with only content text, such as annotation information); 4) Text box coordinates of the content item (optional, can be an area in the image with only keywords, such as the title of a certificate); 5) Content item text type; 6) Description of content item value restrictions, format requirements and other prior knowledge (optional, when the text of the content item is enumerable or restricted, such as F or M for gender).
[0095] A processing flow for template creation is:
[0096] Step 301: The multimodal large model extracts a key field list (a first key field set), including image descriptions and keywords, and uses OCR technology to extract all text box positions (i.e., third text box positions).
[0097] Step 302: estimating the position of the keyword text box and the text box position where its information is located in both horizontal and vertical directions;
[0098] Step 303: Loop: 1) For each keyword returned in step 301, find the text box of the matching item in the OCR result according to the field content of each keyword (i.e., content item), and record whether the content item is a long segment code. 2) Find the nearest text box (i.e., the fourth text box position) from its right and bottom as the text box coordinates of the content area corresponding to the keyword. Manually add missing key field information, supplement the prompt words of difficult keywords, fine-tune the position information given by the system, fine-tune the text box position, fill in the prompt words of the content item, etc. Fill in the template name and save the template information.
[0099] Step 304: Store template information.
[0100] That is to say, in the process of creating auxiliary templates, the keyword set is first deeply analyzed and compared, and templates are automatically generated based on the image library. These templates contain the coordinate annotations, location identification, and content type definitions of keywords. The generated templates are manually reviewed, and corresponding keyword prompts can be selectively added to optimize the effectiveness of the multimodal large model. The prompts are designed to accurately interpret keywords that are difficult to understand directly, and to make detailed restrictions on the content format, such as specific letters, numbers, and their length.
[0101] Step 4: Information extraction.
[0102] After obtaining the matching template, although the multimodal large model has the ability to extract all information from the image at one time, according to experience, multiple queries are performed to extract one field each time and cooperate with the prompt of the field, which is more accurate and will not cause hallucinations.
[0103] The information extraction process is as follows:
[0104] Step 401: scaling the current image with the matching template (second image template) as the target, that is, adjusting the width and height of the image to align with the template.
[0105] Step 402: extract and adjust the text box position where the keyword to be extracted is located. Specifically, extract and adjust the OCR content (including any key field) and the text box position (including the fifth text box position) of the current image.
[0106] Step 403: For each key field, loop processing is performed (if the content type of the current field is long segment code, the OCR result is returned), including:
[0107] Step 4031: According to the OCR result, fine-tune the content text box of the key field recorded in the matching template (including the fifth text box position and the text box position corresponding to the content item of any key field) to calibrate the content text box of the current image;
[0108] Step 4032: adding a solid color rectangle to the image at the calibrated text box position (including the sixth text box position);
[0109] Step 4033: Use the prompt word + restriction description of the field in the template and the added solid color rectangle description to extract the content text from the multimodal large model.
[0110] Step 4034: Summarize the extraction results.
[0111] Step 4035: Exception handling: For fields that cannot be automatically identified or fail to be verified multiple times, the system triggers an exception mark and enters the manual editing process.
[0112] That is, the information extraction system analyzes and compares the image to be processed and matches it with the created template. The system uses the preset keyword content, text box coordinates and set prompts in the template to automatically extract content to ensure the integrity and consistency of the data. Finally, the extracted information is integrated into a structured JSON data format for subsequent processing and application.
[0113] Optionally, the optional embodiments of the present application can achieve high accuracy and high reliability in document information image extraction, and its suitable usage scenarios are as follows:
[0114] 1. Automated processing of e-government service platform: Upload and automatically review documents in online service halls and government service platforms. Documents uploaded by users (such as ID cards, household registration books, business licenses, etc.) will be automatically recognized by the system, and the extracted key information will be directly filled into the online application form, reducing the time users spend filling out documents manually.
[0115] 2. Merchant entry and verification of logistics and e-commerce platforms: When reviewing the entry of merchants or logistics companies, the platform requires the upload of relevant certificates (such as business licenses, road transport permits, etc.). The system automatically identifies and verifies the information in these certificates and generates an audit report.
[0116] Optionally, the method of the optional embodiment of the present application can be applied to all systems that need to process various types of identity and license certificates such as identity cards, driver's licenses, passports, visas, business licenses, bank cards, etc.
[0117] Therefore, the optional embodiments of the present application not only improve the accuracy of information extraction but also greatly enhance the processing efficiency through intelligent template design and flexible system integration, providing a reliable solution for document processing in various fields.
[0118] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment 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, or network device, etc.) to execute the methods of each embodiment of the present application.
[0119] Figure 4 is a structural block diagram of an image recognition device according to an embodiment of the present application; Figure 4 As shown, including:
[0120] The determination module 42 is used to determine whether there is a first image template matching the target image in the preset template library through the artificial intelligence large model, wherein the target image is an image with a standardized format and content, and the preset template library includes: at least one image template;
[0121] a creation module 44, configured to create a second image template for the target image according to the artificial intelligence large model and a first algorithm when the first image template does not exist in the preset template library, wherein the first algorithm is an algorithm for converting text information in an image into machine-readable text;
[0122] The recognition module 46 is configured to recognize text content in the target image using the second image template.
[0123] Through the above-mentioned device, when it is necessary to identify the text content of a target image with a standardized format and content, firstly, the artificial intelligence big model is used to determine whether there is a first image template matching the target image in the preset template library, wherein the preset template library includes: at least one image template; if the first image template does not exist in the preset template library, a second image template is created for the target image according to the artificial intelligence big model and a first algorithm for converting text information in the image into machine-readable text, and then the text content in the target image can be identified by the obtained second image template. Through the embodiment of the present application, the problem of poor information extraction effect for document images (i.e., target images) in the related art can be solved. Therefore, in the embodiment of the present application, the artificial intelligence big model is involved in the process of identifying the text content of the target image, and finally the high-quality, high-precision, and high-accuracy recognition of the text content of the target image can be achieved by combining the artificial intelligence big model and the second image template created for the target image by the first algorithm.
[0124] In an exemplary embodiment, the device also includes: a preprocessing module, which is used to determine whether there is a first image template matching the target image in the preset template library through an artificial intelligence large model: perform clarity processing on the initial target image through a second algorithm, wherein the second algorithm is used to denoise the initial target image; locate multiple rectangular contours in the initial target image after clarity processing through a third algorithm; and standardize the target rectangular contours that meet preset conditions among the multiple rectangular contours to obtain the target image, wherein the preset conditions include at least: the area of the rectangular contour is greater than a first value, and the angle change of the rectangular contour relative to the outer contour of the initial target image is less than a second value.
[0125] In an exemplary embodiment, the determination module 42 is also used to: determine a first key field set included in the target image through the artificial intelligence big model, wherein the first key field set includes: fields corresponding to the standardized content in the target image; perform a vector search in the preset template library through the first key field set to obtain at least one candidate image template, wherein the similarity between the first key field set and the second key field set of the at least one candidate image template is higher than a third value; determine from the at least one candidate image template whether there is a first image template matching the target image in the preset template library.
[0126] In an exemplary embodiment, the determination module 42 is also used to: determine the first text box positions corresponding to the multiple first key fields in the first key field set in the target image, and determine the second text box positions corresponding to the multiple second key fields in the second key field set in the at least one candidate image template; match the first text box position and the second text box position through the artificial intelligence big model to obtain a matching result; when the matching result indicates that there is a third image template in the at least one candidate image template, determine that the first image template exists in the preset template library, wherein the second text box position of the third image template coincides with the first text box position.
[0127] In an exemplary embodiment, the creation module 44 is also used to: determine the first key field set included in the target image through the artificial intelligence big model; and determine the third key field set included in the target image through the first algorithm, and the third text box positions corresponding to the multiple third key fields in the third key field set; extract multiple groups of matching key fields in the first key field set and the third key field set; determine the fourth text box position in the target image corresponding to the content item of the fourth key field in each group of matching key fields through the multiple third text box positions, wherein the first key field set includes: the fourth key field; generate the second image template through the fourth text box position.
[0128] In an exemplary embodiment, the creation module 44 is also used to: add multiple first key fields in the first key field set to the first position in the blank template respectively, wherein the first position corresponds to the position of the third text box position in the target image; determine the second position of the content item in the blank template according to the position of the fourth text box position in the target image; add a prompt word corresponding to the content item to the second position; and determine the blank template to which at least the first key field and the prompt word are added as the second image template.
[0129] In an exemplary embodiment, the recognition module 46 is also used to: identify any key field in the target image and the fifth text box position corresponding to any key field through the first algorithm; calibrate the fifth text box position through the second image template to obtain the sixth text box position; determine the text content through the encoding length of the sixth text box position and the content item corresponding to any key field.
[0130] An embodiment of the present application further provides a storage medium, which includes a stored program, wherein the program executes any of the above methods when it is run.
[0131] Optionally, in this embodiment, the storage medium may be configured to store program codes for executing the following steps:
[0132] S1, determining whether there is a first image template matching a target image in a preset template library through an artificial intelligence big model, wherein the target image is an image with a standardized format and content, and the preset template library includes: at least one image template;
[0133] S2, when the first image template does not exist in the preset template library, creating a second image template for the target image according to the artificial intelligence big model and a first algorithm, wherein the first algorithm is an algorithm for converting text information in an image into machine-readable text;
[0134] S3: Recognize text content in the target image using the second image template.
[0135] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0136] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0137] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0138] S1, determining whether there is a first image template matching a target image in a preset template library through an artificial intelligence big model, wherein the target image is an image with a standardized format and content, and the preset template library includes: at least one image template;
[0139] S2, when the first image template does not exist in the preset template library, creating a second image template for the target image according to the artificial intelligence big model and a first algorithm, wherein the first algorithm is an algorithm for converting text information in an image into machine-readable text;
[0140] S3: Recognize text content in the target image using the second image template.
[0141] An embodiment of the present application further provides a computer program product, including a computer program, which is used by a processor to execute the steps in any of the above method embodiments.
[0142] Optionally, in this embodiment, the computer program product may be executed by a processor to perform the following steps:
[0143] S1, determining whether there is a first image template matching a target image in a preset template library through an artificial intelligence big model, wherein the target image is an image with a standardized format and content, and the preset template library includes: at least one image template;
[0144] S2, when the first image template does not exist in the preset template library, creating a second image template for the target image according to the artificial intelligence big model and a first algorithm, wherein the first algorithm is an algorithm for converting text information in an image into machine-readable text;
[0145] S3: Recognize text content in the target image using the second image template.
[0146] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store program codes.
[0147] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.
[0148] Optionally, an embodiment of the present application further provides another electronic device for implementing the above-mentioned image recognition method, such as Figure 5 As shown, the electronic device includes a memory 502 and a processor 504. The memory 502 stores a computer program, and the processor 504 is configured to execute the steps in any of the above method embodiments through the computer program.
[0149] Optionally, in this embodiment, the electronic device may be located in at least one network device among a plurality of network devices of a computer network.
[0150] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0151] S1, determining whether there is a first image template matching a target image in a preset template library through an artificial intelligence big model, wherein the target image is an image with a standardized format and content, and the preset template library includes: at least one image template;
[0152] S2, when the first image template does not exist in the preset template library, creating a second image template for the target image according to the artificial intelligence big model and a first algorithm, wherein the first algorithm is an algorithm for converting text information in an image into machine-readable text;
[0153] S3: Recognize text content in the target image using the second image template.
[0154] Alternatively, a person skilled in the art may understand that: Figure 5 The structure shown is for illustration only, and the electronic device may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (MID), a PAD, or other terminal devices. Figure 5 The structure of the electronic device is not limited. Figure 5 More or fewer components (such as network interfaces, etc.) as shown in, or with Figure 5 Different configurations are shown.
[0155] Among them, the memory 502 can be used to store software programs and modules, such as the program instructions / modules corresponding to the image recognition method and device in the embodiment of the present invention. The processor 504 executes various functional applications and data processing by running the software programs and modules stored in the memory 502, that is, realizing the above-mentioned image recognition method. The memory 502 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 502 may further include a memory remotely located relative to the processor 504, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Among them, as an example, Figure 5As shown, the memory 502 may include but is not limited to the determination module 42, the creation module 44, and the recognition module 46 in the image recognition device. In addition, it may also include but is not limited to other module units in the image recognition device, which will not be repeated in this example.
[0156] Optionally, the transmission device 506 is used to receive or send data via a network. Specific examples of the network may include wired networks and wireless networks. In one example, the transmission device 506 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers via a network cable so as to communicate with the Internet or a local area network. In one example, the transmission device 506 is a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0157] In addition, the above-mentioned electronic device also includes: a display 508, which is used to display the above-mentioned initial target image, the preprocessing process (clarity processing, standardization processing, etc.) of the initial target image, the target image, the first image template, the second image template, the text content recognized from the target image, etc.; and a connection bus 510, which is used to connect the various module components in the above-mentioned electronic device.
[0158] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
[0159] If the technical solution of this application involves personal information, the product using the technical solution of this application has clearly informed the personal information processing rules and obtained the individual's voluntary consent before processing the personal information. If the technical solution of this application involves sensitive personal information, the product using the technical solution of this application has obtained the individual's separate consent before processing the sensitive personal information, and at the same time meets the "explicit consent" requirement. For example, on personal information collection devices such as cameras, clear and prominent signs are set to inform that the personal information collection scope has been entered and personal information will be collected. If the individual voluntarily enters the collection scope, it is deemed that he or she agrees to the collection of his or her personal information; or on the device that processes personal information, the personal information processing rules are notified by obvious signs / information, and the individual's authorization is obtained through pop-up information or by asking the individual to upload his or her personal information; among them, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the type of personal information processed.
[0160] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. An image recognition method, characterized in that: include: Determine, by means of an artificial intelligence big model, whether there is a first image template matching a target image in a preset template library, wherein the target image is an image with a standardized format and content, and the preset template library includes: at least one image template; In the case that the first image template does not exist in the preset template library, creating a second image template for the target image according to the artificial intelligence big model and a first algorithm, wherein the first algorithm is an algorithm for converting text information in an image into machine-readable text; The text content in the target image is recognized by using the second image template.
2. The image recognition method according to claim 1, characterized in that: Creating a second image template for the target image according to the artificial intelligence big model and the first algorithm includes: Determine a first key field set included in the target image by using the artificial intelligence big model; and determine a third key field set included in the target image by using the first algorithm, and third text box positions corresponding to a plurality of third key fields in the third key field set respectively; Extracting multiple groups of matching key fields from the first key field set and the third key field set; Determining a fourth text box position corresponding to a content item of a fourth key field in each group of matching key fields in the target image through a plurality of the third text box positions, wherein the first key field set includes: the fourth key field; The second image template is generated through the fourth text box position.
3. The image recognition method according to claim 2, characterized in that: Generating the second image template according to the fourth text box position includes: Adding a plurality of first key fields in the first key field set to first positions in the blank template respectively, wherein the first positions correspond to positions of the third text box positions in the target image; Determine a second position of the content item in the blank template according to the position of the fourth text box in the target image; Adding a prompt word corresponding to the content item to the second position; A blank template to which at least the first key field and the prompt word are added is determined as the second image template.
4. The image recognition method according to claim 1, characterized in that: Before determining whether there is a first image template matching the target image in the preset template library by using the artificial intelligence large model, the method further Includes, including: Performing clarity processing on the initial target image by using a second algorithm, wherein the second algorithm is used to denoise the initial target image; Locating multiple rectangular contours in the initial target image after clarity processing by a third algorithm; The target rectangular contour that meets the preset conditions among the multiple rectangular contours is standardized to obtain the target image, wherein the preset conditions at least include: the area of the rectangular contour is greater than a first value, and the angle change of the rectangular contour relative to the outer contour of the initial target image is less than a second value.
5. The image recognition method according to claim 1, characterized in that: Determining whether there is a first image template matching the target image in a preset template library by using an artificial intelligence big model includes: Determine a first key field set included in the target image by using the artificial intelligence big model, wherein the first key field set includes: fields corresponding to standardized content in the target image; perform vector search in the preset template library by using the first key field set to obtain at least one candidate image template, wherein the similarity between the first key field set and a second key field set of the at least one candidate image template is higher than a third value; It is determined from the at least one candidate image template whether there is a first image template matching the target image in the preset template library.
6. The image recognition method according to claim 5, characterized in that: Determining whether there is a first image template matching the target image in the preset template library from the at least one candidate image template includes: Determine first text box positions corresponding to a plurality of first key fields in the first key field set in the target image, and determine second text box positions corresponding to a plurality of second key fields in the second key field set in the at least one candidate image template; Matching the first text box position and the second text box position by using the artificial intelligence big model to obtain a matching result; When the matching result indicates that a third image template exists in the at least one candidate image template, it is determined that the first image template exists in the preset template library, wherein a second text box position of the third image template coincides with the first text box position.
7. The image recognition method according to claim 1, characterized in that: Recognizing text content in the target image by using the second image template includes: Identify, by using the first algorithm, any key field in the target image and a fifth text box position corresponding to the any key field; The fifth text box position is calibrated by the second image template to obtain the sixth text box position; the text content is determined by the encoding length of the content item corresponding to the sixth text box position and any key field.
8. An image recognition device, characterized in that: include: A determination module, configured to determine whether there is a first image template matching a target image in a preset template library through an artificial intelligence large model, wherein the target image is an image with a standardized format and content, and the preset template library includes: at least one image template; a creation module, configured to create a second image template for the target image according to the artificial intelligence large model and a first algorithm when the first image template does not exist in the preset template library, wherein the first algorithm is an algorithm for converting text information in an image into machine-readable text; A recognition module is used to recognize text content in the target image through the second image template.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program executes the method described in any one of claims 1 to 7 when executed.
10. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 7 through the computer program.
11. A computer program product, comprising a computer program, characterized in that The computer program is used by a processor to execute the method described in any one of claims 1 to 7.