A method, system and medium for detecting microtext in bills
Through the improved YOLOv5 model and slice-assisted super-reasoning algorithm, combined with the Swin Transformer module, the automation problem of microtext detection of financial bills is solved, achieving fast and accurate detection results, and reducing the time and labor of manual verification.
Patent Information
- Application Number
- CN202410447119.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-15
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2044-04-15
AI Technical Summary
The existing technology lacks an effective automated method to quickly and accurately detect microtext on financial instruments, making manual verification time-consuming and laborious.
Using the improved YOLOv5 model combined with the slice-assisted super-inference algorithm and Swin Transformer module, the image to be detected is obtained for cropping and scaling, and the backbone network, neck network and head network are used for micro text detection, and through normalized attention Module and non-maximum suppression processing improve detection accuracy.
It achieves fast and accurate detection of microtext in bill images, reduces the time and labor of manual verification, and improves detection efficiency and accuracy.
Smart Images

Figure CN118053172B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of financial anti-counterfeiting, and in particular to a method, system, medium and terminal for detecting microtext on bills. Background Art
[0002] Financial bills are widely used in the market. In order to prevent bills from being forged by criminals, a large number of anti-counterfeiting measures are added during the printing process, such as fluorescent ink printing for anti-counterfeiting, micro-text anti-counterfeiting, etc. Micro-text printing on bills is an anti-counterfeiting process that is almost invisible to the naked eye and requires a magnifying glass to be clearly seen, thereby achieving the purpose of anti-counterfeiting.
[0003] Microtext anti-counterfeiting is one of the important anti-counterfeiting elements of financial bills. When financial institutions collect bills, they use the scanned bills to determine whether they have microtext features as one of the bill authentication points. Since microtext is too small, there is currently no effective and accurate method for microtext detection. Currently, the verification of microtext on bills requires manual processing, which is time-consuming and labor-intensive.
[0004] Therefore, there is an urgent need for a professional and automated method for detecting microtext. Summary of the invention
[0005] In order to solve the problems in the background technology, the present invention provides a method, system, medium and terminal for detecting microtext in bills, wherein the method can effectively identify the presence or absence of microtext in bills and quickly and accurately distinguish the authenticity of bills.
[0006] In a first aspect, the present invention provides a method for detecting microtext on bills, comprising:
[0007] S1: Obtain the image to be detected and crop it to obtain multiple sub-images;
[0008] S2: scaling the sub-image and inputting it into a micro-text detection model for prediction; wherein the micro-text detection model is based on annotating all printed micro-texts in the bill image to obtain a data set, and then inputting it into an improved YOLOv5 model for training;
[0009] S3: De-redundancy processing is performed on the prediction result of the sub-image and then converted back to the original image coordinates to obtain the detection coordinate position of the micro-text of the input original image.
[0010] Furthermore, the cropping adopts a slice-assisted hyper-inference algorithm to cut the original image into multiple slice images by setting the size and overlap rate of the slice images.
[0011] Furthermore, the prediction process of the micro-text detection model is:
[0012] S21: The backbone network module extracts low-level image features from the input sub-image and outputs them to the neck network module;
[0013] S22: Based on the low-level image features input by the backbone network, the neck network module performs upsampling, and after fusion with the input high-level image features, it is sent to the Swin Transformer module to obtain the integrated microtext data features; the Swin Transformer unit integrates the normalized attention module to adjust the weight of the feature information in the process of processing the input sequence data features;
[0014] S23: According to the integrated microtext data features, the head network module detects microtext on the input image through the detection head, and outputs the type and position information of the microtext;
[0015] Furthermore, the normalized attention module includes a channel attention submodule and a spatial attention submodule; wherein, in the channel attention submodule, the scaling factor in batch normalization is adopted:
[0016]
[0017] In the above formula, is the output of batch normalization; The input for batch normalization processing; To perform batch normalization on the input data; are trainable scale affine transformation parameters; is the mean of the mini-batch; A minimum constant added to avoid the denominator being zero; is the variance of the mini-batch; are trainable displacement affine transformation parameters;
[0018] The output of the channel attention submodule is:
[0019]
[0020] In the formula is the weight; is the scaling factor corresponding to channel i; is the scaling factor corresponding to channel j; Output feature values for the channel attention module; is the input feature;
[0021] The output of the spatial attention submodule is:
[0022]
[0023] In the formula is the weight; is the scaling factor corresponding to channel i; is the scaling factor corresponding to channel j; Output feature values for spatial attention; is the input feature;
[0024] Furthermore, the loss function of the microtext detection model is:
[0025]
[0026] In the formula, is the loss function; x is the input feature of the NAM attention module; is the network function; is the network loss function; y is the output feature of the output NAM attention module; W is the network weight; is the L1 norm penalty function; For balance and punishment.
[0027] Furthermore, the Lion optimizer is used to update the parameters during model training. The process is
[0028]
[0029] in, is the first-order momentum; , are attenuation rates; is the gradient at time step t; is the first-order momentum at time step t; is the first-order momentum at time step t-1; is the gradient of descent at the current moment; The parameters updated at the current moment; is the decoupled weight decay parameter.
[0030] Furthermore, the redundancy removal process adopts non-maximum suppression processing, and the specific process is as follows:
[0031] S31: sort the detection frames according to the original scores, and select the detection frame with the highest original score as the candidate frame;
[0032] S32: Compare the intersection-over-union ratio of the current frame to be detected and the candidate frame with the first threshold:
[0033] If the intersection-over-union ratio of the current frame to be detected and the candidate frame is less than the first threshold, the score of the current frame to be detected is the original score;
[0034] If the intersection-over-union ratio of the current frame to be detected and the candidate frame is greater than or equal to the first threshold and less than or equal to the second threshold, the score of the current frame to be detected is recalculated;
[0035] If the intersection-over-union ratio of the current frame to be detected and the candidate frame is greater than the second threshold, the score of the current frame to be detected is reset to zero.
[0036] Furthermore, the process of recalculating the score of the current frame to be detected in S32 is: multiplying the original score of the current frame to be detected by its corresponding weight; wherein the weight calculation formula is:
[0037]
[0038] in, Represents the weight of the current detection box; is the current detection frame; M is the candidate frame; is the current detection box The intersection-over-union ratio with the candidate box M.
[0039] In a second aspect, the present invention provides a bill microtext detection system, comprising:
[0040] Preprocessing module: used to obtain the image to be detected and crop it to obtain multiple sub-images;
[0041] Prediction module: used to scale the sub-image and input it into the micro-text detection model for prediction; wherein the micro-text detection model is based on annotating all printed micro-texts in the bill image to obtain a data set, and then inputting it into the improved YOLOv5 model for training;
[0042] Post-processing module: used to perform redundancy removal on the prediction results of the sub-image and convert them back to the original image coordinates to obtain the detection coordinate position of the micro-text in the input original image.
[0043] In a third aspect, the present invention provides a computer-readable storage medium storing a computer program, which, when called by a processor, executes the steps of the method for detecting microtext on bills as described above.
[0044] Beneficial Effects
[0045] The present invention proposes a method, system and medium for detecting microtext on bills, wherein the method can address the problem that microtext accounts for a very small proportion of the entire bill image and is difficult to detect, by cropping and cutting out the image to be detected to obtain multiple sub-images; then the sub-images are scaled and input into a microtext detection model for prediction, and the prediction results of the sub-images are de-redundanted and converted back to the original image coordinates to obtain the detection coordinate positions of the microtext input into the original image, thereby accurately and quickly detecting the microtext in the bill image. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the embodiments of the present invention 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 of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0047] Figure 1 It is a flow chart of a method for detecting microtext on bills provided by an embodiment of the present invention;
[0048] Figure 2 It is a network structure diagram of an improved YOLOv5 model provided by an embodiment of the present invention;
[0049] Figure 3 This is a diagram showing the effect of detecting micro-text provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0050] To make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be described in detail below. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other implementation methods obtained by ordinary technicians in this field without creative work belong to the scope of protection of the present invention.
[0051] Example 1
[0052] like Figure 1 As shown, the present invention provides a method for detecting microtext on bills, comprising:
[0053] S1: Obtain the image to be detected and crop it to obtain multiple sub-images.
[0054] Specifically, the cropping adopts the Slicing Aided Hyper Inference (SAHI) algorithm, and cuts the original image into multiple slice images by setting the size and overlap rate of the slice images. In the specific implementation, the method of acquiring the image to be detected can be acquired according to actual needs and is not limited. In this implementation, a 1200DPI scanning sensor CIS is used to scan the image of the bill, and then cropping is performed.
[0055] S2: Scale the sub-image and input it into the micro-text detection model for prediction; wherein, the micro-text detection model is based on annotating all printed micro-texts in the bill image to obtain a data set, and then inputting it into the improved YOLOv5 model for training.
[0056] Specifically, the microtext detection is obtained by annotating all printed microtexts in the microtext data set in the acquired bill image to obtain an annotated data set, and then inputting the annotated data set into the improved YOLOv5 model for training. In the specific implementation, the method of acquiring the image to be detected can be acquired according to actual needs, and is not limited. In this implementation, a 1200DPI scanning sensor CIS is used to scan the image of the bill, and the microtext of the scanned image is annotated to obtain the position information of the microtext. When annotating the microtext of the bill, some microtexts are composed of multiple words. For example, the microtext of the bill of XX Bank is "BANK OF XX". In order to detect the microtext more accurately in the subsequent sequence, the microtext can be segmented according to the needs. In this embodiment, the microtext is segmented into three independent labels: "BANK", "OF", and "XX" are three independent labels for annotation.
[0057] Specifically, the prediction process of the microtext detection model is:
[0058] The backbone network module extracts low-level image features from the input sub-image and outputs them to the neck network module;
[0059] Based on the low-level image features input by the backbone network, the neck network module performs upsampling and fusion with the input high-level image features before sending them to the Swin Transformer module to obtain the integrated microtext data features. The Swin Transformer unit integrates a normalized attention module to adjust the weight of the feature information in the process of processing the input sequence data features.
[0060] According to the integrated microtext data features, the head network module detects microtext on the input image through the detection head and outputs the type and location information of the microtext;
[0061] More specifically, the improved YOLOv5 model in this embodiment includes: a backbone network module, a neck network module, and a head network module;
[0062] The backbone network is used to extract low-level image features in the input image and output them to the neck network module. The type of backbone network can be selected according to actual needs and is not limited. In this embodiment, CSPDarkNet53 is used as the backbone network in the entire improved YoloV5 model to extract features in the image. CSPDarkNet53 is an efficient network structure that can effectively reduce the number of parameters and the amount of calculation while maintaining the accuracy of the network. In specific implementation, the Conv module in the backbone network is composed of convolution, Batch Normalization and SiLu activation layers, the C3 module is composed of 3 standard convolutional layers and multiple Bottleneck modules, which are mainly used to learn residual features, and the SPP module is mainly used for the fusion of local features and global features at the featherMap level. The entire backbone network is mainly used to extract features in the input image.
[0063] The neck network module fuses the input low-level image features with the input high-level features through upsampling. Through the normalized attention module NAM, when processing the input sequence data features, it gives higher weight to useful feature information and suppresses the weight of less visible information, so that the model pays more attention to important information. It is used to capture global information and rich contextual information. Figure 2 As shown in the SwinT module 17 in Figure 1, the neck network in the improved YOLOv5 model uses the swin transformer module to replace the original CSP2 structure and outputs it to the four detection heads in the head network module. The swin transformer module can capture global information and rich contextual information. Each of its Transformer encoder blocks contains two sublayers: the first sublayer is a multi-head attention block, which introduces multiple attention heads and divides the input information into multiple parts. Each attention head can independently learn and focus on different semantic information, so as to provide more information, increase the expressiveness of the model, and thus improve the performance of the model; the second sublayer is a feedforward neural network, which is used to perform nonlinear transformation on the vector of each position, thereby introducing more nonlinear capabilities and improving the expressiveness of the model. Residual connections are used between each sublayer in the SwinT module to reduce the complexity of the model to reduce overfitting and prevent gradient disappearance.
[0064] like Figure 2The NAM module in the improved YOLOv5 model integrates the normalized attention unit in the neck network model, which enables the Transformer encoder block to increase the ability to capture different local information. It can also use the self-attention mechanism to explore the potential of feature representation. Compared with the YOLOv5 model before the improvement, the transformer prediction heads can increase the ability to capture different local information. It can also use the self-attention mechanism to explore the potential of feature representation, which can effectively increase the detection effect of microtext. The normalized attention unit includes a channel attention submodule and a spatial attention submodule.
[0065] More specifically, the normalized attention module includes a channel attention submodule and a spatial attention submodule; wherein, in the channel attention submodule, the scaling factor in batch normalization is adopted:
[0066]
[0067] In the above formula, is the output of batch normalization; The input for batch normalization processing; To perform batch normalization on the input data; are trainable scale affine transformation parameters; is the mean of the mini-batch; A minimum constant added to avoid the denominator being zero; is the variance of the mini-batch; are trainable displacement affine transformation parameters;
[0068] The output of the channel attention submodule is:
[0069]
[0070] In the formula is the weight; is the scaling factor corresponding to channel i; is the scaling factor corresponding to channel j; Output feature values for the channel attention module; is the input feature;
[0071] The output of the spatial attention submodule is:
[0072]
[0073] In the formula is the weight; is the scaling factor corresponding to channel i; is the scaling factor corresponding to channel j; Output feature values for spatial attention; is the input feature;
[0074] Furthermore, the loss function of the microtext detection model is:
[0075]
[0076] In the formula, is the loss function; x is the input feature of the NAM attention module; is the network function; is the network loss function; y is the output feature of the output NAM attention module; W is the network weight; is the L1 norm penalty function; For balance and The normalized attention module gives higher weight to useful information when processing input sequence data. In order to suppress unimportant features, a regularization term is added to the loss function to suppress the weight of less significant information, so that the model can focus more on important information.
[0077] Furthermore, the Lion optimizer is used to update the parameters during model training. The process is
[0078]
[0079] in, is the first-order momentum; , are attenuation rates; is the gradient at time step t; is the first-order momentum at time step t; is the first-order momentum at time step t-1; is the gradient of descent at the current moment; The parameters updated at the current moment; To decouple the weight decay parameter
[0080] The Lion optimizer is used to update the parameters in the training model, which can update the parameters in the model in the direction of gradient descent. Compared with the mainstream optimizer AdamW, this optimizer has fewer parameters and does not have the division and square root operations that are the most computationally intensive in the AdamW update process. It has the characteristics of high memory efficiency and faster running speed.
[0081] The head structure module includes 4 detection heads for accurately detecting microtext on bills. The improved head structure is to add a new detection head to the original head structure; in this embodiment, the size of the newly added detection head is 20×20. By adding a detection head, the feature extraction capability of microtext is improved. In this embodiment, a high-definition bill image scanned at 1200DPI is used, so the network model input image size is 1280×1280, and the corresponding sizes of the 4 detection heads are 160×160, 80×80, 40×40, and 20×20 respectively. By adding a detection head of a new size, the detection accuracy of microtext is improved. An additional head structure is more conducive to detecting microtext of different sizes and improving the detection effect.
[0082] Specifically, the redundancy removal process adopts non-maximum suppression processing, and the specific process is as follows:
[0083] S31: sort the detection frames according to the original scores, and select the detection frame with the highest original score as the candidate frame;
[0084] S32: Compare the intersection-over-union ratio of the current frame to be detected and the candidate frame with the first threshold:
[0085] If the intersection-over-union ratio of the current frame to be detected and the candidate frame is less than the first threshold, the score of the current frame to be detected is the original score;
[0086] If the intersection-over-union ratio of the current frame to be detected and the candidate frame is greater than or equal to the first threshold and less than or equal to the second threshold, the score of the current frame to be detected is recalculated;
[0087] If the intersection-over-union ratio of the current frame to be detected and the candidate frame is greater than the second threshold, the score of the current frame to be detected is reset to zero.
[0088] More specifically, the process of recalculating the score of the current frame to be detected in S32 is: multiplying the original score of the current frame to be detected by its corresponding weight; wherein the weight calculation formula is:
[0089]
[0090] in, Represents the weight of the current detection box; is the current detection frame; M is the candidate frame; is the current detection box The intersection-over-union ratio with the candidate box M.
[0091] In order to more accurately detect the microtext in the input image, the image to be detected is cropped into multiple sub-images using the SAHI algorithm and scaled, and then all the sub-images are input into the optimized YOLOv5 model for detection, and the detection results of each sub-image can be obtained. In this process, because the sub-images are cropped and scaled, the detection result positions of the sub-images must be mapped to the original input image. In addition, the overlap ratio parameters of the sub-images are set in the original image, so after the detection results of all sub-images are mapped to the original input image, the detection frames must be merged again using the non-maximum suppression NMS algorithm.
[0092] In the specific implementation, the improved Soft-NMS is used to post-process the predicted frame, that is, to remove redundancy. The specific method of soft-NMS is:
[0093]
[0094] in, is the original score of the detection box, M is the candidate box with the highest score, is the frame to be detected, is the current detection box The intersection and union of M is, is the first preset threshold. The optimized soft-NMS sorts the detection boxes by score, with the first preset threshold The range adopts a weight penalty strategy: for the box M with the highest current score, give each box to be detected A corresponding weight, the size of which is and M The final score of each frame to be detected is determined by the product of the weight and the original score, thereby greatly reducing the probability of missed detection when the target is highly overlapped. , delete the part related to M Too large a detection frame. When M is too large, The possibility of being the same target is very high, which will increase the probability of repeated detection of the target. Therefore, the calculation formula for the score of the detection box is:
[0095]
[0096] In the formula, is the original score of the detection box, M is the candidate box with the highest score, is the frame to be detected, is the current detection box The intersection and union of M is, is a first preset threshold; is the second preset threshold.
[0097] like Figure 3 As shown, the method can solve the problem that microtext accounts for a very small proportion of the entire bill image and is difficult to detect. The image to be detected is cropped and sliced to obtain multiple sub-images; the sub-images are then scaled and input into the microtext detection model for prediction, and the prediction results of the sub-images are de-redundanted and converted back to the original image coordinates to obtain the detection coordinate position of the microtext input into the original image, which can accurately and quickly detect the microtext in the bill image.
[0098] Example 2
[0099] This embodiment provides a bill microtext detection system, including:
[0100] Preprocessing module: used to obtain the image to be detected and crop it to obtain multiple sub-images;
[0101] Prediction module: used to scale the sub-image and input it into the micro-text detection model for prediction; wherein the micro-text detection model is based on annotating all printed micro-texts in the bill image to obtain a data set, and then inputting it into the improved YOLOv5 model for training;
[0102] Post-processing module: used to convert the prediction results of the sub-image back to the original image coordinates after de-redundancy processing, and obtain the detection coordinate position of the micro-text input into the original image
[0103] Example 3
[0104] This embodiment provides a computer-readable storage medium storing a computer program, which, when called by a processor, executes the steps of the method for detecting microtext on bills as described above.
[0105] It should be understood that in the embodiments of the present invention, the processor may be a central processing unit (CPU), and the processor may also be 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. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The memory may include a read-only memory and a random access memory, and provide instructions and data to the processor. A portion of the memory may also include a non-volatile random access memory. For example, the memory may also store information about the type of device.
[0106] The readable storage medium is a computer-readable storage medium, which may be an internal storage unit of the controller described in any of the foregoing embodiments, such as a hard disk or memory of the controller. The readable storage medium may also be an external storage device of the controller, such as 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), etc. equipped on the controller. Furthermore, the readable storage medium may also include both an internal storage unit of the controller and an external storage device. The readable storage medium is used to store the computer program and other programs and data required by the controller. The readable storage medium may also be used to temporarily store data that has been output or is to be output.
[0107] Based on this understanding, the technical solution of the present invention, in essence or in other words, the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned readable storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., various media that can store program codes.
[0108] It can be understood that the same or similar parts of the above embodiments can be referenced to each other, and the contents not described in detail in some embodiments can refer to the same or similar contents in other embodiments.
[0109] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present invention.
Claims
1. A method for detecting microtext on bills, characterized in that: include: S1: Acquire the image to be detected and crop it to obtain multiple sub-images; the cropping adopts a slice-assisted super-inference algorithm to cut the original image into multiple slice images by setting the size and overlap rate of the slice images; S2: scaling the sub-image and inputting it into a micro-text detection model for prediction; wherein the micro-text detection model is based on annotating all printed micro-texts in the bill image to obtain a data set, and then inputting it into an improved YOLOv5 model for training; The prediction process of the microtext detection model is: S21: The backbone network module extracts low-level image features from the input sub-image and outputs them to the neck network module; S22: Based on the low-level image features output by the backbone network, the neck network module performs upsampling, and after fusion with the input high-level image features, it is sent to the Swin Transformer module to obtain the integrated microtext data features; the Swin Transformer unit integrates the normalized attention module to adjust the weight of the feature information in the process of processing the input sequence data features; S23: According to the integrated microtext data features, the head network module detects microtext on the input image through the detection head, and outputs the type and position information of the microtext; wherein the number of the detection heads is 4, and the sizes are 160×160, 80×80, 40×40, and 20×20 respectively; S3: de-redundanting the prediction results of the sub-images and converting them back to the original image coordinates to obtain the detection coordinate positions of the micro-text in the input original image; During the model training process, Lion optimizer is used to update parameters. The process is ; in, is the first-order momentum; , are attenuation rates; is the gradient at time step t; is the first-order momentum at time step t; is the first-order momentum at time step t-1; is the gradient of descent at the current moment; The parameters updated at the current moment; is the decoupled weight decay parameter; The redundancy removal process uses non-maximum suppression, and the specific process is as follows: S31: sort the detection frames according to the original scores, and select the detection frame with the highest original score as the candidate frame; S32: Compare the intersection-over-union ratio of the current frame to be detected and the candidate frame with the first threshold: If the intersection-over-union ratio of the current frame to be detected and the candidate frame is less than the first threshold, the score of the current frame to be detected is the original score; If the intersection-over-union ratio of the current frame to be detected and the candidate frame is greater than or equal to the first threshold and less than or equal to the second threshold, the score of the current frame to be detected is recalculated; If the intersection-over-union ratio of the current frame to be detected and the candidate frame is greater than the second threshold, the score of the current frame to be detected is reset to zero; The process of recalculating the score of the current frame to be detected in S32 is: multiplying the original score of the current frame to be detected by its corresponding weight; wherein the weight calculation formula is: ; in, Represents the weight of the current detection box; is the current detection frame; M is the candidate frame; is the current detection box The intersection-over-union ratio with the candidate box M.
2. The method for detecting microtext on bills according to claim 1, characterized in that: The normalized attention module includes a channel attention submodule and a spatial attention submodule; wherein, in the channel attention submodule, the scaling factor in batch normalization is adopted: ; In the above formula, is the output of batch normalization; Input for batch normalization processing; To perform batch normalization on the input data; are trainable scale affine transformation parameters; is the mean of the mini-batch; A minimum constant added to avoid the denominator being zero; is the variance of the mini-batch; are trainable displacement affine transformation parameters; The output of the channel attention submodule is: ; In the formula is the weight; is the transformation parameter corresponding to channel i; is the transformation parameter corresponding to channel j; Output feature values for the channel attention module; is the input feature; The output of the spatial attention submodule is: ; In the formula is the weight; is the scaling factor corresponding to channel i; is the scaling factor corresponding to channel j; Output feature values for spatial attention; is the input feature.
3. The method for detecting microtext on bills according to claim 1, characterized in that: The loss function of the microtext detection model is: ; In the formula, is the loss function; x is the input feature of the NAM attention module; is the network function; is the network loss function; y is the output feature of the output NAM attention module; W is the network weight; is the L1 norm penalty function; For balance and punishment.
4. A bill microtext detection system, characterized in that: include: Preprocessing module: used to obtain the image to be detected and crop it to obtain multiple sub-images; The cropping adopts a slice-assisted hyper-inference algorithm to cut the original image into multiple slice images by setting the size and overlap rate of the slice images; Prediction module: used to scale the sub-image and input it into the micro-text detection model for prediction; wherein the micro-text detection model is based on annotating all printed micro-texts in the bill image to obtain a data set, and then inputting it into the improved YOLOv5 model for training; The prediction process of the microtext detection model is: S21: The backbone network module extracts low-level image features from the input sub-image and outputs them to the neck network module; S22: Based on the low-level image features output by the backbone network, the neck network module performs upsampling, and after fusion with the input high-level image features, it is sent to the Swin Transformer module to obtain the integrated microtext data features; the Swin Transformer unit integrates the normalized attention module to adjust the weight of the feature information in the process of processing the input sequence data features; S23: According to the integrated microtext data features, the head network module detects microtext on the input image through the detection head, and outputs the type and position information of the microtext; wherein the number of the detection heads is 4, and the sizes are 160×160, 80×80, 40×40, and 20×20 respectively; Post-processing module: used to convert the prediction results of the sub-image back to the original image coordinates after de-redundancy processing, and obtain the detection coordinate position of the micro-text input into the original image; Among them, the Lion optimizer is used to update parameters during model training. The process is ; in, is the first-order momentum; , are attenuation rates; is the gradient at time step t; is the first-order momentum at time step t; is the first-order momentum at time step t-1; is the gradient of descent at the current moment; The parameters updated at the current moment; is the decoupled weight decay parameter; The redundancy removal process uses non-maximum suppression, and the specific process is as follows: S31: sort the detection frames according to the original scores, and select the detection frame with the highest original score as the candidate frame; S32: Compare the intersection-over-union ratio of the current frame to be detected and the candidate frame with the first threshold: If the intersection-over-union ratio of the current frame to be detected and the candidate frame is less than the first threshold, the score of the current frame to be detected is the original score; If the intersection-over-union ratio of the current frame to be detected and the candidate frame is greater than or equal to the first threshold and less than or equal to the second threshold, the score of the current frame to be detected is recalculated; If the intersection-over-union ratio of the current frame to be detected and the candidate frame is greater than the second threshold, the score of the current frame to be detected is reset to zero; The process of recalculating the score of the current frame to be detected in S32 is: multiplying the original score of the current frame to be detected by its corresponding weight; wherein the weight calculation formula is: ; in, Represents the weight of the current detection box; is the current detection frame; M is the candidate frame; is the current detection box The intersection-over-union ratio with the candidate box M.
5. A computer-readable storage medium, characterized in that: A computer program is stored, and when the computer program is called by a processor, it executes: the steps of the method for detecting microtext on bills as described in any one of claims 1-3.
Citation Information
Patent Citations
Universal object detection method and device, data processing device and terminal device
CN106557778A
Text detection method and device, computer equipment and storage medium
CN111310758A
Text recognition method and device, electronic equipment, medium and product
CN113903036A
Target detection positioning method, system and device, and storage medium
CN115187941A
Image template matching method, device, equipment and application
CN115588109A
