A method, device and storage medium for identifying elements of bills
By analyzing and removing target elements in the bill image, generating sample image sets and training object detection models, the problem of many training data requirements in bill feature recognition is solved, and the recognition accuracy and scalability of the model are improved. It is suitable for complex Overseas check scene.
Patent Information
- Application Number
- CN202110312790.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-24
- Publication Date
- 2024-12-31
- Estimated Expiration
- 2041-03-24
AI Technical Summary
In the prior art, there are many training data requirements for identification of bill elements, resulting in low recognition accuracy and poor scalability of existing solutions, making it difficult to adapt to the complex layout and diversity of overseas checks.
By analyzing the preset number of bill images, the feature information of the target elements is obtained, the target elements are removed, the sample image set is generated, and the target element position detection model is obtained, and the model is used to recognize the bill images. Detect and identify, convert into structured information.
It improves the accuracy of bill element recognition, reduces the demand for real training data, enhances the scalability and robustness of the model, and is suitable for complex scenarios such as overseas checks.
Smart Images

Figure CN113011349B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of this specification relate to the field of artificial intelligence technology, and more particularly to a method, device and storage medium for identifying elements of a bill. Background Art
[0002] With the development of the Internet, electronic office has become a trend. When business personnel of enterprises handle business involving the transmission and management of bills, they often convert paper bills into bill images for transmission or management. When the relevant elements of the bill are needed, they often extract the relevant elements of the bill through manual reading, but the manual reading method of extracting bill elements is inefficient. In order to promote the empowerment of business by science and technology, the core business data is intelligently and automatically stored in the warehouse, and OCR text recognition technology is usually used to realize automatic recognition of bill elements to replace manual entry.
[0003] Taking checks as an example, the current general solution for domestic check feature recognition is: Checks with fixed layout: input image → target fragment domain cutting → feature location to be recognized → handwritten and printed category feature classification → feature recognition. Checks with non-fixed layout: input image → target fragment domain positioning → feature location to be recognized → handwritten and printed category feature classification → feature recognition
[0004] However, the check recognition solution with a fixed layout has poor model scalability. For example, when new requirements such as magnetic code recognition and QR code detection are added, it is necessary to add new models, add GPU resources, modify service scripts, and even modify historical plans to re-draft solutions. The check recognition solution with a non-fixed layout classifies handwritten and printed elements for recognition, which can improve the recognition accuracy of printed elements. However, it poses new challenges to the model training sample size, GPU resources, and service time.
[0005] Since the daily transaction volume of overseas check business is relatively small, it is unrealistic to ask the business to provide enough real data as training samples. In addition, overseas checks have complex and diverse layouts, element representation rules are quite different from domestic checks, and there is no single currency. Therefore, the solution of domestic check element recognition is no longer applicable to overseas check scenarios. Summary of the invention
[0006] The purpose of the embodiments of this specification is to provide a method, device and storage medium for identifying elements of a bill, so as to solve the problem of requiring a lot of training data in the prior art and improve the accuracy of identifying elements of a bill.
[0007] To solve the above problems, an embodiment of the present specification provides a method for identifying elements of bills, the method comprising: analyzing a preset number of bill images to obtain feature information of target elements in the bill images; removing the target elements in the bill images to obtain bill images with the target elements removed; filling simulated target elements in the bill images with the target elements removed according to the feature information of the target elements to generate a sample image set; the sample images in the sample image set include bill images with the simulated target elements filled in and position labels of the target elements in the bill images; training the sample images in the sample image set using a target detection algorithm to obtain a target element position detection model; detecting the bill images to be identified using the target element position detection model to obtain the position coordinates of the target elements in the bill images to be identified; identifying the target elements in the bill images to be identified according to the position coordinates, and converting the target elements into structured information output.
[0008] To solve the above problems, an embodiment of the present specification also provides a device for identifying elements of bills, the device comprising: an analysis module, used to analyze a preset number of bill images to obtain feature information of target elements in the bill images; a removal module, used to remove the target elements in the bill images to obtain the bill images with the target elements removed; a filling module, used to fill in simulated target elements in the bill images with the target elements removed according to the feature information of the target elements, to generate a sample image set; the sample images in the sample image set include bill images filled with simulated target elements and position labels of the target elements in the bill images; a training module, used to train the sample images in the sample image set using a target detection algorithm to obtain a target element position detection model; a detection module, used to detect the bill images to be identified using the target element position detection model to obtain the position coordinates of the target elements in the bill images to be identified; and a recognition module, used to identify the target elements in the bill images to be identified according to the position coordinates, and convert the target elements into structured information output.
[0009] To solve the above problems, an embodiment of the present specification also provides an electronic device, including: a memory for storing a computer program; a processor for executing the computer program to achieve: analyzing a preset number of bill images to obtain feature information of target elements in the bill images; removing the target elements in the bill images to obtain bill images with the target elements removed; filling simulated target elements in the bill images with the target elements removed according to the feature information of the target elements to generate a sample image set; the sample images in the sample image set include bill images with the simulated target elements filled in and position labels of the target elements in the bill images; training the sample images in the sample image set using a target detection algorithm to obtain a target element position detection model; detecting the bill images to be identified using the target element position detection model to obtain the position coordinates of the target elements in the bill images to be identified; identifying the target elements in the bill images to be identified according to the position coordinates, and converting the target elements into structured information output.
[0010] To solve the above problems, an embodiment of the present specification also provides a computer-readable storage medium having computer instructions stored thereon, which, when executed, achieve the following: analyzing a preset number of bill images to obtain feature information of target elements in the bill images; removing the target elements in the bill images to obtain bill images with the target elements removed; filling simulated target elements in the bill images with the target elements removed according to the feature information of the target elements to generate a sample image set; the sample images in the sample image set include bill images with the simulated target elements filled in and position labels of the target elements in the bill images; training the sample images in the sample image set using a target detection algorithm to obtain a target element position detection model; detecting the bill images to be identified using the target element position detection model to obtain the position coordinates of the target elements in the bill images to be identified; identifying the target elements in the bill images to be identified according to the position coordinates, and converting the target elements into structured information output.
[0011] It can be seen from the technical solutions provided by the above embodiments of this specification that, in the embodiments of this specification, a preset number of bill images can be analyzed to obtain the characteristic information of the target elements in the bill image; the target elements in the bill image can be removed to obtain the bill image with the target elements removed; the simulated target elements are filled in the bill image with the target elements removed according to the characteristic information of the target elements to generate a sample image set; the sample images in the sample image set include the bill image with the simulated target elements filled in and the position labels of the target elements in the bill image; the sample images in the sample image set are trained using the target detection algorithm to obtain a target element position detection model; the bill image to be identified is detected using the target element position detection model to obtain the position coordinates of the target elements in the bill image to be identified; the target elements in the bill image to be identified are identified according to the position coordinates, and the target elements are converted into structured information output. The method provided in the embodiments of this specification expands the sample data through the data enhancement integration method, solves the problem of many real training data requirements in the prior art, and improves the accuracy of bill element recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the embodiments of this specification 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, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0013] Figure 1 This is a schematic diagram of an example scenario of this manual;
[0014] Figure 2 This is a flowchart of the steps of data enhancement for model training in a scenario example of this specification;
[0015] Figure 3 A flowchart of the service packaging steps in a scenario example of this specification;
[0016] Figure 4 A flowchart of a method for identifying elements of a bill is provided for the embodiment of this specification;
[0017] Figure 5a This is the handwritten check image of this instruction manual;
[0018] Figure 5b This is the printed cheque image of this instruction manual;
[0019] Figure 6 A schematic diagram of target elements of the embodiments of this specification;
[0020] Figure 7 A specific example diagram of the target elements of the embodiments of this specification;
[0021] Figure 8a This is a schematic diagram of the effect of removing target elements in a bill image according to an embodiment of this specification;
[0022] Figure 8b This is a schematic diagram of the effect of removing target elements in a bill image according to an embodiment of this specification;
[0023] Fig. 9 This is a schematic diagram of an example scenario of this manual;
[0024] Fig.10 A fragmented image of a handwritten target element of an embodiment of this specification;
[0025] Fig.11 A fragmented image of a printed object element of the embodiment of this specification;
[0026] Fig.12 This is an example diagram of background noise in the embodiments of this specification;
[0027] Fig.13 A flowchart of the program for implementing the enhanced combination algorithm of the embodiment of this specification;
[0028] Fig.14 A schematic diagram of a sample image of an embodiment of this specification;
[0029] Fig.15 This is a functional structure diagram of an electronic device according to an embodiment of this specification;
[0030] Fig.16 The present invention is a functional structure diagram of a task scheduling device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0031] The following will be combined with the drawings in the embodiments of this specification to clearly and completely describe the technical solutions in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this specification.
[0032] Paper bills are paper documents with relatively fixed display styles and clear data items, such as value-added tax invoices, business licenses, financial bills, certificates, checks, etc. Generally speaking, bills of the same type have the same display styles and data items, and the position of the same data item is basically the same in different bills. In the information system, the output of paper bills is mostly achieved through duplication or printing templates. Due to the incompatibility of management systems and information systems between institutions, paper bills are widely used as carriers of business vouchers and data transmission within and between institutions. However, since paper bills are oriented to manual reading and lack structured information such as data items of bills, the work of extracting data from a large number of paper bills must rely on manual labor. Due to the low efficiency of manual labor and the inability to quickly process a large number of bills, for the recipients of paper bills, how to quickly structure bills through image recognition technology and avoid duplicate data entry has become the key to institutional informatization.
[0033] The main difference between paper bill recognition and traditional document recognition is that it is necessary not only to recognize the text on the paper bill, but also to recognize the values of each data item of the bill, that is, the elements of the bill, so as to structure the paper bill. Most of the existing bill recognition methods are aimed at specific bill types. The bill template of this type is pre-established through experience or machine learning. The bill template includes the standard image size of the bill and the relative position of each data item in the standard image. Then the bill template is applied to the new bill image to recognize the text corresponding to the position of each data item in the image. These methods usually require a large number of training samples for model training. In some scenarios, such as the scenario of element recognition of overseas checks, it is unrealistic to ask the business to provide enough real data as training data due to the relatively small daily transaction volume of overseas check business. In addition, overseas checks have complex and diverse layouts, the element representation rules are quite different from domestic checks, and the currency is not single. Therefore, the solution for element recognition of domestic checks is no longer applicable to overseas check scenarios.
[0034] Considering that if a small amount of bill images can be used as training data, and then the bill is analyzed for layout, the font style, font size, character interference noise around the target to be identified, and the location area where the target text may appear of the identification elements such as the amount and currency can be mastered; then data enhancement is carried out to generate sufficient original images and fragments of the area to be identified; then the detection model and recognition model training are carried out; finally, the model publishing service is encapsulated, it is expected to solve the problem of the large number of real training data required in the prior art and improve the accuracy of bill element recognition. Based on this, the embodiments of this specification provide a bill element method, device, and storage medium.
[0035] See also Figure 1 , introduces a scenario example of this manual. Figure 1The flowchart of the method for identifying elements of bills in the scenario example includes: real data preparation step 1, model training data enhancement step 2, model training step 3 and service packaging step 4.
[0036] In this scenario example, the element recognition of overseas checks is used as an example to illustrate.
[0037] The real data preparation step 1 includes preparing a preset number of real overseas check images.
[0038] The model training data enhancement step 2 includes performing a layout analysis on overseas checks to understand the font style, font size, character interference noise around the target to be identified, and the location area where the target text may appear of the identification elements such as the amount and currency; then performing data enhancement to remove the target elements in the bill image, and then filling in the simulated target elements in the target elements removed from the bill image based on the layout analysis of the overseas checks to generate a sufficient number of bill images as training samples.
[0039] Specifically, Figure 2 As shown, the model training data enhancement step 2 may include a real data analysis step 21, a background noise analysis 22, a data enhancement combination method design 23, and a generated data volume evaluation step 24. The real data analysis step 21 is used to perform a layout analysis on overseas checks to grasp the font style, font size, and location area where the target text may appear of the identification elements such as the amount and currency; the background noise analysis 22 is used to analyze the character interference noise of the target element, for example, the amount has many symbols such as "$", "USD", "S$", "※", "*", and the boundary line "_" as background noise next to the target element. Character noise directly affects the accuracy of the recognition model, so it is necessary to obtain and grasp the possible background noise from the business and introduce it during data enhancement; the data enhancement combination method design 23 is used to fill in the simulated target element in the target element removed from the bill image based on the layout analysis of the overseas checks to generate a sufficient amount of bill images as training samples. The generated data volume evaluation step 24 is used to evaluate the number of generated training samples in order to improve the accuracy of model training.
[0040] The model training step 3 includes training a target element position detection model and a target element recognition model. The target element position detection model is used to detect the position of the target element in the overseas check, and the target element recognition model recognizes the target element based on the position of the target element in the overseas check.
[0041] The service encapsulation step 4 includes encapsulating and publishing the trained target element position detection model and target element recognition model to facilitate the recognition of the target elements in the bill image to be recognized. Figure 3As shown, the service encapsulation step 4 may include the following steps.
[0042] Step 41: The service receives the image passed in from downstream.
[0043] Step 42: Send the image to the target feature position detection model to perform target feature position detection.
[0044] Step 43: Determine the output of the detection result of step 42. If the output is empty, it indicates that the target element position detection has failed.
[0045] Step 44: When step 43 returns empty, the programming message returns 1 to the caller. The message content at least includes the status retrun_code and the information return_msg. The message information must indicate that the detection model detection failed.
[0046] Step 45: When the return value of step 43 is not empty, it indicates that the target element position is detected successfully, and then the information under the target element position is pixel-expanded.
[0047] Step 46: Send the image obtained after the expansion of step 45 to the target element recognition model to carry out target element recognition.
[0048] Step 47: Determine whether the target feature recognition model return is empty, if so, enter the corresponding processing branch.
[0049] Step 48: When the target feature recognition model is returned as empty, the returned information content is modified to indicate that the target feature recognition model has failed to recognize.
[0050] Step 49: If the target element recognition model is successfully identified, the identification element structured information is constructed according to the message format agreed upon with the downstream caller.
[0051] Step 410: The message returns to 3.
[0052] The verification case is the recognition of the amount on a Singapore check. The business provided about 1,000 real pictures, of which about 700 were handwritten and about 300 were printed. This solution used 500 handwritten and 100 printed samples, respectively, and the rest of the pictures were used for testing. The amount of real business data required by the solution was reduced by 80% year-on-year. The overall accuracy of the end-to-end test of the service encapsulation backend was close to 94%, meeting the business usage requirements.
[0053] The method provided by this scenario example overcomes the defects of the current domestic check recognition scheme, such as high requirements for real training data, high GPU resource utilization, and poor scalability. This method can first prepare a small number of bill images, such as 500 handwritten bill images and 100 printed bill images; then perform layout analysis on the scene checks to grasp the font style, font size, character interference noise around the target to be recognized, and the location area where the target text may appear; then carry out data enhancement to generate sufficient original images and fragments of the area to be recognized; then carry out detection model and recognition model training; finally, encapsulate the model and release the service. The actual test proves that the scheme has high recognition rate, good versatility, strong scalability, and low GPU resource utilization, which enhances the robustness of the detection model, especially improves the target detection success rate of poor quality business images. In terms of preparing training model data, the data generation method is used to generate the images to be labeled, in which part of the target element recognition model training samples are automatically generated by data, and part of them come from the fragments of the target element detection model positioning output that have been appropriately expanded. In addition, handwritten and printed elements are mixed as training samples for the data generation model, and recognition model training is carried out after mixing, and encapsulated into a recognition model to improve the overall recognition accuracy of the model.
[0054] See also Figure 4 . An embodiment of this specification provides a method for identifying elements of a bill. In an embodiment of this specification, the subject that executes the method for identifying elements of a bill may be an electronic device with a logical operation function, and the electronic device may be a server. The server may be an electronic device with a certain computing and processing capability. It may have a network communication unit, a processor, a memory, etc. Of course, the server is not limited to the above-mentioned electronic device with a certain entity, and it may also be software running in the above-mentioned electronic device. The server may also be a distributed server, which may be a system with multiple processors, memories, network communication modules, etc. operating in collaboration. Alternatively, the server may also be a server cluster formed by several servers. The method may include the following steps.
[0055] S410: Analyze a preset number of bill images to obtain feature information of target elements in the bill images.
[0056] In some embodiments, the bill is an overseas check. For example, about 500 handwritten check images and 100 printed check images can be prepared. The amount, currency and other elements in the handwritten check are handwritten fonts, such as Figure 5aAs shown; the amount, currency and other elements in the printed check are printed in fonts, such as Hack-Regular, huawenzhongsong, msyh, simsun, SURSONG, WeiRuanYaHei-1 and other fonts, such as Figure 5b shown.
[0057] In some embodiments, the target element may be an element to be identified in the bill, and the target element may specifically be an element such as currency, magnetic code, date, etc. Figure 6 As shown in the figure, the main element to be identified on overseas checks is the amount (right), and the identification of the amount (left), currency, magnetic code and other elements are also involved. The characteristic information of the target element includes font style, font size, font color, text position, handwriting depth, etc. Figure 7 As shown. Analyzing a preset number of bill images may include analyzing font style, font size, font color, text position, handwriting depth, etc. to obtain feature information of the target element. After obtaining the feature information of the target element, the target element can be simulated and generated based on the feature information in subsequent steps, so as to generate a sufficient number of training samples to train the model, thereby improving the accuracy of target element recognition.
[0058] S420: removing the target element from the bill image to obtain a bill image with the target element removed.
[0059] In some embodiments, the target element in at least one bill image is removed to obtain a bill image with the target element removed. Of course, to improve the accuracy of target element recognition, target elements in multiple bill images of different types can be selected for removal to obtain multiple bill images with the target elements removed.
[0060] In some embodiments, removing the target element from the bill image to obtain the bill image with the target element removed includes: obtaining the target area of the bill image with the target element; arbitrarily erasing the target area, or copying other background areas of the bill image to replace the target area, to obtain the bill image with the target element removed. Specifically, the position of the target element in the bill image can be determined based on the characteristic information of the target element obtained in S410, and then the target area of the bill image with the target element, such as the currency type, magnetic code, etc. in the target area of the bill image, is obtained, and then the target element in the target area is removed, such as selecting to arbitrarily erase the target object, or copying other background areas of the image to replace the target area, and the effect is as follows: Figure 8a and Figure 8b By removing the target elements in the bill image as described above, the removal efficiency can be improved, and a bill image with sufficient target elements removed can be obtained.
[0061] In a specific scenario example, Fig. 9 Removing the target element from the bill image to obtain the bill image with the target element removed can be achieved through steps 230 and 231.
[0062] Specifically, step 230: template image preparation. First, obtain a complete real business image such as Figure 5a and Figure 5b It should be emphasized that in order to ensure the generalization of the solution, it is necessary to provide bill images of different styles in business scenarios as much as possible.
[0063] Step 231: Target element removal. For target elements that need to be identified, such as currency, elements, and magnetic codes, removal processing is performed, such as selecting any erased target object, or copying other background areas of the image to replace the target area.
[0064] S430: Filling a simulated target element into the bill image with the target element removed according to the feature information of the target element to generate a sample image set; the sample images in the sample image set include the bill image filled with the simulated target element and the position label of the target element in the bill image.
[0065] By filling the simulated target element in the bill image with the target element removed according to the characteristic information of the target element, a sample image set formed by multiple sample images can be obtained. The sample image includes the bill image filled with the simulated target element and the position label of the target element in the bill image.
[0066] Filling the simulated target element in the bill image from which the target element has been removed according to the characteristic information of the target element can be achieved in a variety of ways. For example, by writing on a text image, that is, writing on the corresponding position of the bill image from which the target element has been removed, thereby completing the filling of the simulated target element. This method is applicable to printed checks. Alternatively, by pasting text fragments, that is, pasting text fragment images on the corresponding position of the bill image from which the target element has been removed, these text fragment images include the target element simulated and generated based on the characteristic information of the target element, and the size of the text fragment images is adapted to the area where the target element is located in the bill image. This method is applicable to printed checks and handwritten checks.
[0067] In some embodiments, the simulated target element is filled into the bill image from which the target element has been removed according to the characteristic information of the target element by writing text images, and the sample image set is generated, including: determining simulation parameters according to the characteristic information of the target element; the simulation parameters represent generation parameters of the simulated target element; and filling the simulated target element into the bill image from which the target element has been removed according to the simulation parameters to generate the sample image set. In the above manner, sufficient training data of printed text of different styles can be generated, which is conducive to improving the accuracy and generalization of the model obtained by subsequent training.
[0068] Specifically, the simulation parameters may be parameters such as font style, font color, font size, and text position. Among them, the font styles may include Hack-Regular, huawenzhongsong, msyh, simsun, SURSONG, WeiRuanYaHei-1, etc. For the font color, printed checks are generally black or grayish black, while the colors of handwritten checks are wider, such as orange, blue, etc. Considering that the way of writing text images is generally for printed text, the color of image writing is selected to be black or grayish black. For the font size, only printed checks are considered, and the font size can be set between 13 and 25. For the text position, the position of the designed writing text in the original image will affect the robustness of the model, especially for some target elements that are covered by background noise or exceed a specific area. Based on this, different writing position offsets need to be designed for different target elements. For example, the magnetic code and the amount on the left should focus on the offset of the width, while the amount on the right and the currency have stricter requirements on the offset of the height. In real bill images, these two target elements are frequently overlapped with the boundary box or solid line within the area.
[0069] In some embodiments, the simulated target element is filled into the bill image from which the target element has been removed according to the characteristic information of the target element by pasting text fragments, and the generation of the sample image set includes: generating multiple fragment images according to the characteristic information of the target element; the fragment images include the simulated target element; the size of the fragment images is adapted to the area where the target element is located in the bill image; pasting the fragment images to a preset area in the bill image from which the target element has been removed to generate the sample image set. Pasting text fragments can generate sufficient printed training data and sufficient handwritten training data, so that the model obtained by subsequent training has the characteristics of good versatility and strong scalability.
[0070] In some embodiments, since the image obtained by pasting text fragments will have obvious color jitter at the pasting boundary, it is necessary to repair it so that the obtained image is closer to the real bill image and the quality of the sample image is improved. Therefore, the method can also include: using the average color method to repair the pasting boundary between the fragment image and the bill image with the target element removed.
[0071] In some embodiments, the fragment image can generate multiple fragment images according to the characteristic information of the target element, specifically using the WGAN algorithm to generate multiple fragment images according to the characteristic information of the target element; the simulated target element included in the image is a handwritten target element. Specifically, the WGAN algorithm is used to generate the handwritten target element, and an example is used to illustrate, in which some parameters include: training sample size: 600 (500 handwritten fragments and 100 printed fragments mixed); generated image size (width, height) = (288, 72); 20,000 iterations; the model generates a round of pictures every 1,000 times, with a total of 512 pictures. Since the pictures generated by the model are unlabeled, it is necessary to manually select the pictures that can be labeled from the generated pictures. The generated fragment images are as follows: Fig.10 By using the WGAN algorithm to generate multiple fragment images according to the feature information of the target element, the target element of the handwritten bill can be generated, thereby obtaining a bill image containing the handwritten target element, providing data for the training of subsequent models.
[0072] In some embodiments, it is also possible to generate multiple fragment images according to the characteristic information of the target element by writing on a text image. Similar to the above-mentioned method of generating a sample image set by filling in a simulated target element in a bill image with the target element removed according to the characteristic information of the target element by writing on a text image, the generating multiple fragment images according to the characteristic information of the target element includes: determining simulation parameters according to the characteristic information of the target element; the simulation parameters represent the generation parameters of the simulated target element; filling in the simulated target element in an image template of a preset size according to the simulation parameters to obtain multiple fragment images; the simulated target element included in the image is a printed target element. Considering that the generated fragment images can be used as training samples, it is necessary to ensure that the writing on the fragment images does not exceed the image boundary, otherwise the mismatch with the label affects the training process of the model and directly leads to a decrease in the accuracy of the model. To solve this problem, you can first prepare any template with a large enough size, then confirm that the text and font information to be written are fixed, and then call the Image.textsize() function to obtain the size of the text to be written. Finally, based on the text size and the set position offset, a fragment image can be reconstructed to generate a fragment image that can be directly used to train the recognition model. The generated fragment image is as follows Fig.11 shown.
[0073] Furthermore, considering that the target element is adjacent to the character noise, the type and quantity of the character noise must be consistent with the actual scene. For example, the noise asterisk "*" generally appears in 1-3 numbers on the left, right, or both ends of the amount to be recognized. Therefore, when constructing the written text, it is necessary to focus on the diversity of the character noise to ensure the generalization of the recognition model.
[0074] In some embodiments, the method may also include: analyzing a preset number of bill images to obtain background noise near the target element position; accordingly, filling in simulated target elements in the bill image with the target element removed according to the characteristic information of the target element, and introducing the background noise near the simulated target element position to generate a sample image set. Specifically, possible background noise around the target element, for example, the amount has many symbols such as "$", "USD", "S$", "※", "*" and boundary lines "_" as background noise next to the amount to be identified. Fig.12 As shown in the figure. Character noise directly affects the accuracy of target feature recognition. In the sample image, the background character noise close to the target is treated as the target and trained together, which can improve the detection success rate of the model. At the same time, for the recognition model, treating the character noise as a blank background filter only requires preparing a sufficient amount of complete background noise samples during the model training stage. Following the process, the recognition success rate of the target feature can be improved.
[0075] In some embodiments, the method may further include: performing effect enhancement processing on the bill image filled with the simulated target element; the effect enhancement processing includes at least one of pixel missing, blurred handwriting, local interference of solid lines, salt and pepper noise, etc. Specifically, the bill image filled with the simulated target element may be affected by pixel missing, blurred handwriting, local interference of solid lines, salt and pepper noise, etc. Considering that the model processing logic in the service package is the input of the target element recognition model from the output of the target element detection model, the detection success rate of the target element detection model for the position of the target element directly affects the accuracy of the target element recognition model for the target element recognition. By further enhancing the effect of the bill image filled with the simulated target element, the robustness of the target element detection model is enhanced, especially the detection success rate of the target element position of the business image with poor quality is improved. In a scene example, the effect enhancement method used may include: pixel missing: such as the trajectory of the black element text part is covered by other background colors, or filled with white. Local interference of solid lines: draw lines at random positions in the target element area, the color of the line is generally black, and the length, thickness and direction of the line are simulated and designed with the business image. Salt and pepper noise: Add salt and pepper noise. The noise ratios for this scene are 0.04 and 0.03. Blur: Select Gaussian blur. The blur intensity radius for this scene is [0.3, 0.4, 0.5, 0.6].
[0076] In a specific scenario example, Fig. 9 As shown, the simulated target element is filled in the bill image with the target element removed according to the characteristic information of the target element, and the generation of the sample image set can be achieved through steps 232, 231, 233 and 234.
[0077] Specifically, in step 232, the simulated target element can be filled in the bill image from which the target element has been removed according to the characteristic information of the target element by writing text images and pasting text fragments. At the same time, after filling in the simulated target element, background noise can be introduced into the generated image.
[0078] In step 233, the image generated in step 232 may be post-processed for effect enhancement to reduce the effects of pixel loss, blurred text, local interference of solid lines, salt and pepper noise, and the like.
[0079] In step 234, the above steps can be implemented by designing an enhanced combination algorithm. Specifically, Fig.13 As shown, programming to implement the data enhancement functions mentioned in step 232 to step 233 may include the following steps.
[0080] Step 234-0: Import Python image processing library.
[0081] In this scenario example, the data enhancement basic library is based on the PIL library, mainly involving modules such as Image, ImageDraw, and ImageFont.
[0082] Step 234 - 1 : Read in the original image with the target element removed.
[0083] The original image with the target element removed is the bill image with the target element removed. If it is a single image, it is directly sent to the Image.open() function to obtain the image data. If it is multiple images, that is, an image list, the algorithm needs to randomly extract a certain image and send it to the Image.open() function. The algorithm here can be implemented independently or constructed with the help of the random module.
[0084] Step 234-2: Whether to paste the fragments.
[0085] The image processing action branch is confirmed according to the command parameters passed in step 234-1, that is, whether to fill in the simulated target element in the bill image with the target element removed by pasting text fragments or writing text images.
[0086] Step 234-3: Fragment list.
[0087] When the method of pasting fragments is selected to fill the simulated target element in the bill image with the target element removed, a list of fragment images pasted in the target area of the original image needs to be formed.
[0088] Step 234-4: Algorithm random sampling.
[0089] Similar to step 234 - 1 , the extraction of a certain fragment image can be achieved by setting the probability of extracting a specific fragment according to the proportion of the image category in the business scenario.
[0090] Step 234-5: Image synthesis.
[0091] The fragments and the original image are pasted together with the help of the Image.paste() function, where the pasting position is selected from a preset area.
[0092] Step 234-6: Boundary repair.
[0093] Since the synthesized image will have obvious color jitter at the boundary, it needs to be repaired. This solution uses the average color of fragments to repair the boundary.
[0094] Step 234-7: Parameter initialization.
[0095] If you do not choose the fragment pasting method to fill the simulated target elements in the bill image with the target elements removed, you need to realize the text image writing by yourself. First, you need to initialize the parameters, such as font style, font position, font size, etc., and select the range according to the actual situation, and then discretize them into a list type.
[0096] Step 234-8: Random combination of algorithm parameters.
[0097] In step 234-7, for each parameter list, random extraction must be performed by programming to form a parameter combination.
[0098] Step 234-9: Function loading.
[0099] The parameter combination formed in step 234-8 is sent to functions such as ImageFont.truetype(), ImageDraw.Draw(), and ImageDraw.text().
[0100] Step 234-10: Function execution.
[0101] Text image writing implementation.
[0102] Step 234-11: Effect enhancement.
[0103] Program to independently implement functions such as pixel loss and interference line drawing, and randomly call a certain effect enhancement function to achieve effect enhancement.
[0104] Step 234-12: Image saving.
[0105] A sample image set is generated, wherein the sample images in the sample image set include bill images filled with simulated target elements and position labels of the target elements in the bill images. Fig.14 shown.
[0106] Among them, the sample image set generation process can also include an evaluation step of the number of sample images in the sample image set. Generally, the amount of data is proportional to the model accuracy, that is, the more data, the higher the model accuracy. Table 1 shows the relationship between the amount of data and the model accuracy determined by this solution in the overseas check scenario.
[0107] Table 1
[0108]
[0109] S440: Using a target detection algorithm to train sample images in the sample image set to obtain a target element position detection model, so as to identify target elements in the bill image to be identified based on the target element position detection model.
[0110] Object detection, also called object extraction, is an image segmentation based on the geometric and statistical features of the target. In the embodiments of this specification, algorithms such as CenterNet and FSAF can be used to train the sample images in the sample image set, so as to find the corresponding relationship between the sample image and the position of the target element, and obtain the target element position detection model.
[0111] After obtaining the target element position detection model, the bill image to be identified can be input into the target element position detection model, and the position coordinates of the target element in the bill image to be identified can be obtained based on the output result of the model, and then the target element in the bill image to be identified can be identified according to the position coordinates.
[0112] In some embodiments, the identifying of target elements in the bill image to be identified based on the target element position detection model includes: detecting the bill image to be identified using the target element position detection model to obtain the position coordinates of the target elements in the bill image to be identified; identifying the target elements in the bill image to be identified according to the position coordinates, and converting the target elements into structured information output.
[0113] Specifically, the image of the bill to be identified can be input into the target element position detection model, and the output of the target element position detection model can be used as the positioning result of the target element in the bill image to be identified, so as to obtain the position coordinates of the target element in the bill image to be identified. After obtaining the position coordinates of the target element in the bill image to be identified, the image within the position coordinate area can be identified, and the recognition result can be used as the recognition result of the target element in the bill image to be identified. The above-mentioned recognition of the target element in the bill image to be identified utilizes the positioning result of the target element in the bill image to be identified by the target element position detection model, which can accurately determine the position of the target element in the bill image to be identified, thereby improving the final recognition result.
[0114] In some embodiments, the recognition can be performed through a preset target element recognition model. The recognition of the target element in the to-be-recognized bill image according to the position coordinates and the conversion of the target element into structured information output include: obtaining the target image at the position coordinates in the to-be-recognized bill image; pixel expansion of the target image; inputting the expanded target image into the preset target element recognition model to obtain the recognition result of the target element in the to-be-recognized bill image; and converting the recognition result into structured information output. Specifically, the target image at the position coordinates in the to-be-recognized bill image can be obtained, and the target image includes the target element. By pixel expansion of the target image, the target image can be made clearer, thereby improving the recognition accuracy of the target element recognition model.
[0115] In some embodiments, the target element recognition model is trained in the following manner: inputting the sample image in the sample image set into the target element position detection model to obtain the position coordinates of the target element in the sample image; annotating the image at the position coordinates with text, and annotating the fragment image generated according to the characteristic information of the target element; using the image at the position coordinates annotated with text and the fragment image as training data to train the visual attention model to obtain the target element recognition model. Specifically, the data volume of the training sample of the target element recognition model is shown in Table 1. The source of the training data includes the above-mentioned fragment image and the image at the position coordinates obtained based on the position coordinates of the target element in the sample image output by the target element position detection model. These images are annotated with text to generate training data, and then the training data is used to train the visual attention recognition model (CNN+LSTM+Attention) to find the association between the pixels and texts of the image in the training data to obtain the target element recognition model. Furthermore, the image at the position coordinates and the fragment image can also be pixel-expanded, and the image at the position coordinates and the fragment image after pixel expansion can be used as training data to improve the recognition accuracy of the target element recognition model. The above training method includes both handwritten training data and printed training data in the training data, as well as both fragmented images and images output by the target element position detection model. This makes the training data diverse, further improves the scalability and versatility of the target element recognition model, and can also reduce GPU resource usage during the training process.
[0116] In some embodiments, in order to further improve the training efficiency of the target element recognition model, the ratio of the image at the position coordinates annotated with text and the fragment image as training data can be set to 4:1, so that the target element recognition model obtained after training is generalized.
[0117] The method provided in the embodiments of this specification can analyze a preset number of bill images to obtain the characteristic information of the target elements in the bill images; remove the target elements in the bill images to obtain the bill images with the target elements removed; fill the simulated target elements in the bill images with the target elements removed according to the characteristic information of the target elements to generate a sample image set; the sample images in the sample image set include bill images with the simulated target elements filled in and the position labels of the target elements in the bill images; train the sample images in the sample image set using the target detection algorithm to obtain a target element position detection model; detect the bill images to be identified using the target element position detection model to obtain the position coordinates of the target elements in the bill images to be identified; identify the target elements in the bill images to be identified according to the position coordinates, and convert the target elements into structured information output. The method provided in the embodiments of this specification expands the sample data through the data enhancement integration method, solves the problem of requiring a lot of real training data in the prior art, and improves the accuracy of bill element recognition.
[0118] Fig.15 This is a functional structure diagram of an electronic device according to an embodiment of the present specification. The electronic device may include a memory and a processor.
[0119] In some embodiments, the memory can be used to store the computer program and / or module, and the processor implements various functions of the method for identifying the elements of the bill by running or executing the computer program and / or module stored in the memory, and calling the data stored in the memory. The memory may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and at least one application required for a function; the data storage area may store data created according to the use of the user terminal. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0120] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc. The processor may execute the computer instructions to implement the following steps: analyzing a preset number of bill images to obtain feature information of target elements in the bill images; removing the target elements in the bill images to obtain bill images with target elements removed; filling simulated target elements in the bill images with target elements removed according to the feature information of the target elements to generate a sample image set; the sample images in the sample image set include bill images with simulated target elements filled in and position labels of the target elements in the bill images; training the sample images in the sample image set using a target detection algorithm to obtain a target element position detection model, so as to recognize the target elements in the bill images to be recognized based on the target element position detection model.
[0121] In the embodiments of this specification, the functions and effects specifically implemented by the electronic device can be explained in comparison with other embodiments and will not be repeated here.
[0122] Fig.16 This is a functional structural diagram of a bill element recognition device according to an embodiment of the present specification. The device may specifically include the following structural modules.
[0123] The analysis module 1610 is used to analyze a preset number of bill images to obtain feature information of target elements in the bill images;
[0124] A removal module 1620, configured to remove the target element from the bill image to obtain a bill image with the target element removed;
[0125] A filling module 1630 is used to fill in the simulated target element in the bill image with the target element removed according to the feature information of the target element, so as to generate a sample image set; the sample images in the sample image set include the bill image filled with the simulated target element and the position label of the target element in the bill image;
[0126] The recognition module 1640 is used to train the sample images in the sample image set using a target detection algorithm to obtain a target element position detection model, so as to recognize the target elements in the bill image to be recognized based on the target element position detection model.
[0127] The embodiments of the present specification also provide a computer-readable storage medium of a task scheduling method, wherein the computer-readable storage medium stores computer program instructions, which when executed implement the following: analyzing a preset number of bill images to obtain feature information of target elements in the bill images; removing the target elements in the bill images to obtain bill images with the target elements removed; filling simulated target elements in the bill images with the target elements removed according to the feature information of the target elements to generate a sample image set; the sample images in the sample image set include bill images with the simulated target elements filled in and position labels of the target elements in the bill images; and training the sample images in the sample image set using a target detection algorithm to obtain a target element position detection model, so as to identify the target elements in the bill images to be identified based on the target element position detection model.
[0128] In the embodiments of this specification, the above-mentioned storage medium includes but is not limited to random access memory (Random Access Memory, RAM), read-only memory (Read-Only Memory, ROM), cache (Cache), hard disk (Hard Disk Drive, HDD) or memory card (Memory Card). The memory can be used to store the computer program and / or module, and the memory can mainly include a storage program area and a storage data area, wherein the storage program area can store an operating system, at least one application required for a function, etc.; the storage data area can store data created according to the use of the user terminal, etc. In addition, the memory may include a high-speed random access memory and may also include a non-volatile memory. In the embodiments of this specification, the functions and effects specifically implemented by the program instructions stored in the computer-readable storage medium can be explained in comparison with other implementations, and will not be repeated here.
[0129] It should be noted that the method, device and storage medium for identifying elements of bills provided in the embodiments of this specification can be applied to the field of artificial intelligence technology. Of course, they can also be applied to the financial field, or any field other than the financial field. The embodiments of this specification do not limit the application fields of the method, device and storage medium for identifying elements of bills.
[0130] It should be noted that the various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment and the equipment embodiment, since they are basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0131] After reading this specification, those skilled in the art can conceive of any combination of some or all of the embodiments listed in this specification without creative work, and these combinations are also within the scope of disclosure and protection of this specification.
[0132] In the 1990s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the method flow). However, with the development of technology, many improvements to the method flow today can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog2. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.
[0133] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0134] It can be known from the above description of the implementation mode that the technicians in this field can clearly understand that the present specification can be implemented by means of software plus the necessary general hardware platform. Based on such an understanding, the technical solution of the present specification can be essentially or the part that contributes to the prior art can be embodied in the form of a software product, which can be stored in a storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present specification or some parts of the embodiments.
[0135] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0136] This specification can be used in many general or special computer system environments or configurations, such as personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, and distributed computing environments that include any of the above systems or devices.
[0137] This specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0138] Although the present specification is described through embodiments, those skilled in the art will appreciate that there are many modifications and changes to the present specification without departing from the spirit of the present specification, and it is intended that the appended claims include these modifications and changes without departing from the spirit of the present specification.
Claims
1. A method for identifying elements of a bill, characterized in that: The method comprises: Performing format analysis on a preset number of bill images to obtain feature information of target elements in the bill images; the feature information is used to generate simulated target elements; Removing the target element from the bill image to obtain a bill image with the target element removed; Generate multiple fragment images according to the characteristic information of the target element; the fragment images include simulated target elements; the size of the fragment images is adapted to the area where the target elements are located in the bill image; paste the fragment images to a preset area in the bill image with the target elements removed, generate a sample image set, and perform data enhancement on the preset number of bill images; the sample images in the sample image set include bill images filled with simulated target elements and position labels of the target elements in the bill images; The sample images in the sample image set are trained using a target detection algorithm to obtain a target element position detection model, so as to identify the target elements in the bill image to be identified based on the target element position detection model.
2. The method according to claim 1, characterized in that The target element includes at least one of currency, magnetic code, and date; the characteristic information of the target element includes at least one of font style, font size, font color, text position, and handwriting depth.
3. The method according to claim 1, characterized in that The step of removing the target element from the bill image to obtain the bill image with the target element removed comprises: Acquire the target element in the target area of the bill image; The target area is arbitrarily erased, or other background areas of the bill image are copied to replace the target area, so as to obtain a bill image with the target elements removed.
4. The method according to claim 1, characterized in that: The method further comprises: repairing the pasting boundary between the fragment image and the bill image with the target element removed by using an average color method.
5. The method according to claim 1, characterized in that The generating of a plurality of fragment images according to the characteristic information of the target element comprises: using a WGAN algorithm to generate a plurality of fragment images according to the characteristic information of the target element; the simulated target element included in the image is a handwritten target element.
6. The method according to claim 1, characterized in that Generating a plurality of fragment images according to the characteristic information of the target element comprises: Determine simulation parameters according to the characteristic information of the target element; the simulation parameters represent generation parameters of the simulated target element; According to the simulation parameters, simulated target elements are filled into an image template of a preset size to obtain a plurality of fragmented images; the simulated target elements included in the images are printed target elements.
7. The method according to claim 1, characterized in that The method further comprises: Analyze a preset number of bill images to obtain background noise close to the target element location; Correspondingly, the simulated target element is filled in the bill image from which the target element has been removed according to the characteristic information of the target element, and the background noise is introduced near the position of the simulated target element to generate a sample image set.
8. The method according to claim 1, characterized in that: The method also includes: performing effect enhancement processing on the bill image filled with the simulated target elements; the effect enhancement processing includes at least one of pixel deletion, text fading and blurring, solid line local interference, and salt and pepper noise processing.
9. The method according to claim 1, characterized in that: The identifying of the target element in the bill image to be identified based on the target element position detection model includes: Detect the bill image to be identified by using the target element position detection model to obtain the position coordinates of the target element in the bill image to be identified; The target elements in the to-be-identified bill image are identified according to the position coordinates, and the target elements are converted into structured information for output.
10. The method according to claim 9, characterized in that The step of identifying the target element in the to-be-identified bill image according to the position coordinates and converting the target element into structured information output comprises: Acquire a target image at the position coordinates in the to-be-recognized bill image; Performing pixel expansion on the target image; Inputting the expanded target image into a preset target element recognition model to obtain a recognition result of the target element in the bill image to be recognized; The recognition result is converted into structured information output.
11. The method according to claim 10, characterized in that The target element recognition model is trained in the following way: Inputting a sample image in the sample image set into the target element position detection model to obtain the position coordinates of the target element in the sample image; Performing text annotation on the image at the position coordinates, and performing text annotation on the fragment image generated according to the characteristic information of the target element; The image at the position coordinates annotated with text and the fragmented image are used as training data to train the visual attention model to obtain the target element recognition model.
12. The method according to claim 11, characterized in that The ratio of the image at the position coordinates annotated with text and the fragment image as training data is 4:
1.
13. A bill element recognition device, characterized in that: The device comprises: An analysis module, used to perform format analysis on a preset number of bill images to obtain feature information of target elements in the bill images; the feature information is used to generate simulated target elements; A removal module, used for removing the target element from the bill image to obtain a bill image with the target element removed; A filling module is used to generate a plurality of fragment images according to the characteristic information of the target element; the fragment images include simulated target elements; the size of the fragment images is adapted to the area where the target elements are located in the bill image; the fragment images are pasted to a preset area in the bill image with the target elements removed, and a sample image set is generated to perform data enhancement on the preset number of bill images; the sample images in the sample image set include bill images filled with simulated target elements and position labels of the target elements in the bill images; The recognition module is used to train the sample images in the sample image set using a target detection algorithm to obtain a target element position detection model, so as to recognize the target elements in the bill image to be recognized based on the target element position detection model.
14. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to execute the computer program to implement: performing format analysis on a preset number of bill images to obtain feature information of target elements in the bill images; The characteristic information is used to generate a simulated target element; the target element in the bill image is removed to obtain a bill image with the target element removed; a plurality of fragment images are generated according to the characteristic information of the target element; the fragment images include the simulated target element; the size of the fragment images is adapted to the area where the target element in the bill image is located; Paste the fragmented image to a preset area in the bill image with the target element removed, generate a sample image set, and perform data enhancement on the preset number of bill images; the sample images in the sample image set include bill images filled with simulated target elements and position labels of the target elements in the bill images; The sample images in the sample image set are trained using a target detection algorithm to obtain a target element position detection model, so as to identify the target elements in the bill image to be identified based on the target element position detection model.
15. A computer-readable storage medium, characterized in that: Computer instructions are stored thereon, and when the instructions are executed, the following are achieved: performing format analysis on a preset number of bill images to obtain feature information of target elements in the bill images; The characteristic information is used to generate a simulated target element; the target element in the bill image is removed to obtain a bill image with the target element removed; a plurality of fragment images are generated according to the characteristic information of the target element; the fragment images include the simulated target element; the size of the fragment images is adapted to the area where the target element in the bill image is located; Paste the fragmented image to a preset area in the bill image with the target element removed, generate a sample image set, and perform data enhancement on the preset number of bill images; the sample images in the sample image set include bill images filled with simulated target elements and position labels of the target elements in the bill images; The sample images in the sample image set are trained using a target detection algorithm to obtain a target element position detection model, so as to identify the target elements in the bill image to be identified based on the target element position detection model.