Banknote detection method, device, equipment, medium and program product
By constructing and training a banknote detection model containing multiple modules, the problem of low manual judgment accuracy in the prior art is solved, efficient identification and recycling of problem banknotes is achieved, and the cleanliness and safety of banknotes are improved.
Patent Information
- Application Number
- CN202510077395.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-17
- Publication Date
- 2025-04-18
AI Technical Summary
In the prior art, the recycling of problematic banknotes is manually judged, with low accuracy and recognition rate, resulting in disputes between the two parties using the banknote.
A banknote detection model including backbone module, BotNet module, neck module, head module and efficient multi-scale attention module is constructed. The banknote sample data set is trained through the training model to generate an image processing model for identifying and recycling problem banknotes.
It improves the detection efficiency of defiled banknotes, enhances the ability to identify banknotes that are not suitable for circulation, improves the neatness of banknotes, and reduces disputes between the two parties.
Smart Images

Figure CN119851394A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of financial technology, and specifically to a banknote detection method, device, equipment, medium and program product. Background Art
[0002] Banknotes are a form of currency with wide circulation. In the process of banknote circulation, we often encounter banknotes with stains, defects, tape, etc. that may be unusable, which leads to unnecessary disputes between the parties using the banknotes.
[0003] In the related art, the recycling of problematic banknotes is often done by manual evaluation, however, the accuracy and recognition rate of manual evaluation are both low. Summary of the invention
[0004] In view of the above problems, the present disclosure provides a banknote detection method, device, equipment, medium and program product.
[0005] According to a first aspect of the present disclosure, there is provided a banknote detection method, comprising:
[0006] Constructing a banknote detection model to be trained, wherein the banknote detection model includes a backbone module, a BotNet module, a neck module, a head module, and an efficient multi-scale attention module;
[0007] Based on the collected banknote sample data set, the banknote detection model to be trained is trained to obtain a trained banknote detection model;
[0008] The image of the banknote to be identified is input into the trained banknote detection model, and the recovery result of the banknote to be identified is output.
[0009] According to an embodiment of the present disclosure, the step of constructing a banknote detection model to be trained includes:
[0010] Construct the backbone module, neck module and head module in sequence;
[0011] Introducing a BotNet module at the end of the backbone module;
[0012] An efficient multi-scale attention module is added at the end of the head module.
[0013] According to an embodiment of the present disclosure, the introducing of the BotNet module at the end of the backbone module includes:
[0014] Obtain at least one bottleneck block at the end of the backbone module;
[0015] The spatial convolution layers in the at least one bottleneck block are replaced by multi-head self-attention layers.
[0016] According to an embodiment of the present disclosure, before inputting the image of the banknote to be identified into the trained banknote detection model and outputting the recovery result of the banknote to be identified, it also includes:
[0017] Obtaining the accuracy, recall, harmonic mean and mean precision of the trained banknote detection model;
[0018] The trained banknote detection model is optimized by taking at least one of the accuracy rate, the recall rate, the harmonic mean value and the evaluation precision mean value as an evaluation index.
[0019] According to an embodiment of the present disclosure, the banknote sample data set includes banknote samples of all denominations, and each banknote sample of each denomination has at least one of the types of damage: damage, stain, and fold.
[0020] According to an embodiment of the present disclosure, the method further includes:
[0021] Calculating a classification loss function and a regression loss function of the banknote detection model to be trained;
[0022] The banknote detection model to be trained is trained with minimizing the classification loss function and the regression loss function as the training goal.
[0023] According to an embodiment of the present disclosure, the classification loss function of the banknote detection model to be trained is :
[0024]
[0025] Among them, q is the label of the banknote sample, p is the predicted probability value, r is an adjustable factor that controls the balance of positive and negative samples during the learning process, and a is the weight of the banknote sample, which is set according to the importance of the sample.
[0026] According to an embodiment of the present disclosure, the regression loss function includes a first loss function, and the regression loss function of the banknote detection model to be trained includes:
[0027] Calculate the ratio of the intersection area to the union area between the predicted box and the true box;
[0028] Calculate the width and height of the minimum rectangular box surrounding the predicted box and the real box, and the distance between the center points of the predicted box and the real box;
[0029] The first loss function is calculated according to the ratio, the width and height of the minimum rectangular frame, and the center point distance.
[0030] According to an embodiment of the present disclosure, the regression loss function includes a second loss function, which is a distribution focus loss function.
[0031] A second aspect of the present disclosure provides a banknote detection device, comprising:
[0032] A construction module, used to construct a banknote detection model to be trained, wherein the banknote detection model includes a backbone module, a BotNet module, a neck module, a head module, and an efficient multi-scale attention module;
[0033] A training module is used to train the banknote detection model to be trained based on the collected banknote sample data set to obtain a trained banknote detection model;
[0034] The input module is used to input the image of the banknote to be identified into the trained banknote detection model and output the recovery result of the banknote to be identified.
[0035] A third aspect of the present disclosure provides an electronic device, comprising: one or more processors; and a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the above method.
[0036] The fourth aspect of the present disclosure further provides a computer-readable storage medium having a computer program or instructions stored thereon, which implements the steps of the above method when the above computer program or instructions are executed by a processor.
[0037] The fifth aspect of the present disclosure further provides a computer program product, including a computer program or instructions, which implement the steps of the above method when the above computer program or instructions are executed by a processor. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The above contents and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:
[0039] Figure 1 A diagram schematically shows an application scenario of a banknote detection method, device, equipment, medium, and program product according to an embodiment of the present disclosure;
[0040] Figure 2A The structure diagram of the banknote detection device according to the embodiment of the present disclosure is schematically shown;
[0041] Figure 2B The following schematically shows a logical structure diagram of a detection module according to an embodiment of the present disclosure;
[0042] Figure 3 A flow chart of a banknote detection method according to an embodiment of the present disclosure is schematically shown;
[0043] Figure 4 A flowchart of performing banknote detection using a trained banknote detection model according to an embodiment of the present disclosure is schematically shown;
[0044] Figure 5 A schematic diagram of a structure of a banknote detection device according to an embodiment of the present disclosure is shown; and
[0045] Figure 6 A block diagram of an electronic device suitable for implementing a banknote detection method according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0046] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.
[0047] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise", "include", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.
[0048] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.
[0049] When using expressions such as "at least one of A, B, and C, etc.", they should generally be interpreted according to the meaning of the expression commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).
[0050] It should be noted that the banknote detection method, device, equipment, medium and program product provided by the present disclosure can be used in the financial field, and can also be used in any field other than the financial field. The application field of the banknote detection method, device, equipment, medium and program product provided by the present disclosure is not limited.
[0051] In the technical solution of the present disclosure, the user information (including but not limited to user personal information, user image information, user device information, such as location information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data comply with relevant laws, regulations and standards, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0052] In the scenario of using personal information for automated decision-making, the methods, devices, and systems provided by the embodiments of the present disclosure provide users with corresponding operation portals for users to choose to agree or reject the automated decision-making results; if the user chooses to reject, the expert decision-making process will be entered. The expression "automated decision-making" here refers to the activity of automatically analyzing and evaluating a person's behavioral habits, interests and hobbies, or economic, health, credit status, etc. through computer programs, and making decisions. The expression "expert decision-making" here refers to the activity of making decisions by people who specialize in a certain field, have specialized experience, knowledge and skills, and have reached a certain level of professionalism.
[0053] The embodiment of the present disclosure provides a banknote detection method, including: constructing a banknote detection model to be trained, the banknote detection model including a backbone module, a BotNet module, a neck module, a head module and an efficient multi-scale attention module; training the banknote detection model to be trained based on a collected banknote sample data set to obtain a trained banknote detection model; inputting an image of a banknote to be identified into the trained banknote detection model, and outputting a recovery result of the banknote to be identified. By introducing the BotNet module and the efficient multi-scale attention module, the constructed banknote detection model can be made more accurate in small target detection.
[0054] Compared with traditional detection methods, it can improve the detection efficiency of damaged banknotes, further improve the cleanliness of banknotes in circulation, effectively enhance the ability to identify banknotes that are not suitable for circulation, actively fulfill social responsibilities, and provide customers with efficient financial services.
[0055] The disclosed embodiments provide a paper money detection method, device, equipment, medium and program product. The paper money recognition device can be integrated into an electronic device, which can be a terminal or a server.
[0056] Figure 1 The application scenario diagram of the banknote detection method, device, equipment, medium and program product according to the embodiments of the present disclosure is schematically shown.
[0057] like Figure 1As shown, the application scenario 100 of the embodiment of the present disclosure may include a terminal device 110 and a banknote detection device 120. The terminal device 110 and the banknote detection device 120 are connected via a network, for example, via a wired or wireless network connection, and the wireless network may be the fifth generation mobile communication technology (5th Generation, 5G), a wireless local area network, or Bluetooth, etc.
[0058] The terminal device 110 may send a recovery detection request to the banknote detection device 120, wherein the recovery detection request includes an image of the banknote to be detected photographed or scanned by the terminal device 110. Optionally, the terminal device 110 may be an electronic device with a photographing function or a scanning function, such as a smart phone, a personal computer, or a tablet computer.
[0059] After receiving the recycling detection request, the banknote detection device 120 can identify and process the image of the banknote to be detected in the recycling detection request, obtain the recycling detection result of the banknote to be detected, and return the recycling detection result to the terminal device 110. The recycling detection result is used to determine whether the banknote to be detected can be recycled.
[0060] In some embodiments, the structure of the banknote detection device 120 is as follows: Figure 2A The banknote detection device 120 includes a banknote input module 101 , a detection module 102 , a conveying module 103 , a banknote receiving module 104 , and a controller 105 .
[0061] The banknote input module 101 is used for storing banknotes to be input. The opening design facilitates the banknotes to be input and wait for processing. At the same time, driven by the transmission shaft, the banknotes pass through this position and enter the detection module 102.
[0062] The detection module 102 is used to check the condition of the banknotes. The image of the banknotes can be obtained by a high-speed infrared camera, and the image of the banknotes is input into a pre-trained banknote detection model to output the recovery result of the banknotes, and different signals are transmitted to the conveying module 103 according to different recovery results.
[0063] The conveying module 103 is used to process the signal transmitted by the banknote according to the above steps and transmit it to different banknote storage ports.
[0064] The coin receiving module 104 is used to store the banknotes that have been processed and tested, mainly including banknotes suitable for circulation, unsuitable for circulation, and awaiting confirmation. The staff will perform corresponding subsequent processing according to different banknotes.
[0065] The controller 105 controls the coin input module 101, the detection module 102, the conveying module 103, and the coin receiving module 104, and controls identification, transmission signals, etc.
[0066] The logical structure diagram of the detection module 102 included in the banknote detection device 120 is as follows: Figure 2B As shown, the detection module 102 includes a sensing unit 201, an identification unit 202, an image collection unit 203, a detection unit 204, and a communication unit 205. In some examples, the sensing unit 201 senses that a banknote has been introduced, transmits a signal to other modules that a banknote has arrived, and prepares for processing; the identification unit 202 identifies whether it is a banknote, and handles abnormalities if it is not a banknote; the image collection unit 203 uses an infrared high-definition camera to collect banknote images, and the collected banknote images are transmitted in real time; the detection unit 204 obtains whether it is a damaged banknote detection situation. The communication unit 205 transmits the detection result of the banknote to the conveying device, which can respond quickly and obtain accurate results.
[0067] The following will be based on Figure 1 The scene described by Figure 3~Figure 6 The banknote detection method of the disclosed embodiment is described in detail.
[0068] Figure 3 The flowchart of the banknote detection method according to the embodiment of the present disclosure is schematically shown.
[0069] like Figure 3 As shown, the banknote detection method of this embodiment includes operations S310 to S330.
[0070] In operation S310, a banknote detection model to be trained is constructed, and the banknote detection model includes a backbone module, a BotNet module, a neck module, a head module, and an efficient multi-scale attention module.
[0071] In operation S320, the banknote detection model to be trained is trained based on the collected banknote sample data set to obtain a trained banknote detection model.
[0072] In operation S330, the image of the banknote to be identified is input into the trained banknote detection model, and the recovery result of the banknote to be identified is output.
[0073] In some embodiments, the banknote sample dataset includes banknote samples of all denominations, and each banknote sample of each denomination has at least one of the types of damage, such as damage, stain, and fold.
[0074] Obtain banknotes with different stain sizes, different colors, and different damage conditions. The banknotes should include multiple denominations. Each banknote sample data set contains banknote samples with the same characteristics. Banknotes that are not suitable for circulation have 12 types of characteristics, such as dirt, stains, de-inking, missing, pasted, torn, spliced, deformed, written, wrinkled, soft, and carbonized. Banknote samples should contain as many samples of the above characteristics as possible. Banknote samples can be obtained from banknotes circulating on the market. The face image of the sample banknote is obtained by shooting. The banknote sample group can contain one or more sample banknotes with the same characteristics. The banknote samples are preprocessed into images of specified sizes.
[0075] In some optional implementations, after the banknote sample data set is collected, the collected image set can be preprocessed, and the accuracy of defect detection can be improved by removing noise, enhancing contrast, and adjusting brightness. The relevant feature information of the set defects is extracted, including size, color, texture, etc.
[0076] Figure 4 The flowchart of performing banknote detection using a trained banknote detection model according to an embodiment of the present disclosure is schematically shown.
[0077] In some embodiments, the above-mentioned construction of the banknote detection model to be trained includes: constructing a backbone module, a neck module and a head module in sequence; introducing a BotNet module at the end of the backbone module; and adding an efficient multi-scale attention module (EMA attention mechanism) at the end of the head module.
[0078] The backbone module is the Backbone network, which is a feature extraction structure based on a deep convolutional neural network. It mainly extracts feature structural information such as edges, textures, and shapes at different abstract levels through the stacking and downsampling of multiple convolutional layers. The Backbone network is used to extract features from the input image. The feature extraction process is usually accompanied by a decrease in the resolution of the feature map and an increase in the number of channels. The Backbone network can include CBS modules, C2f modules, and SPPF modules. The CBS module represents a convolution group consisting of Conv, BN, and SILU, which is used for the next step. The C2F module is used for deep feature extraction, which can ensure a lightweight structure and help obtain richer gradient flow information during the convolution process. The SPPF module can introduce different pooling strategies to process feature maps of different sizes to capture feature information at different levels.
[0079] The neck module is a Neck network, which is used to perform feature fusion on the feature maps output by the backbone module. The Neck network uses multi-scale feature fusion technology to fuse feature maps from different stages of the backbone to enhance feature representation. In some embodiments, the Neck network may include an SPPF module, a PAA module, and two PAN modules.
[0080] The head module is the Head network, which is responsible for the final object detection and classification tasks. It consists of a detection head and a classification head. The detection head contains a series of convolution and deconvolution layers to generate detection results, while the classification head uses global average pooling to classify each feature map.
[0081] BotNet (Bottleneck Transformers for Visual Recognition) is a backbone architecture that combines the self-attention mechanism with a convolutional neural network. The end of the backbone module can be introduced into the BotNet module by replacing the spatial convolutional layers in at least one bottleneck block at the end of the backbone module with multi-head self-attention layers. This enables the BotNet module to significantly capture global information and model long-distance dependencies in the image. This replacement enables the backbone module to not only capture local features, but also extract global features more effectively, thereby improving the overall understanding of the banknote detection model for the image.
[0082] The EMA (Exponential Moving Average) attention mechanism is a technology used to improve the performance of deep learning models, especially the attention mechanism in the field of natural language processing. The disclosed embodiment solves the problem of drastic weight changes by introducing the exponential moving average through the EMA attention mechanism. Specifically, a new EMA weight is calculated in each training step and combined with the current attention weight. The EMA weight is made relatively smooth, and the drastic changes in weight are reduced, thereby improving the robustness of the model. The disclosed embodiment integrates the EMA attention mechanism into the end of the head module, which can significantly improve the performance of the model in detecting soiled banknotes.
[0083] In some embodiments, Figure 3 The banknote detection method shown also includes: calculating the classification loss function and the regression loss function of the banknote detection model to be trained; and training the banknote detection model to be trained with minimizing the classification loss function and the regression loss function as the training goal.
[0084] The loss function of the banknote detection model provided by the embodiment of the present disclosure includes two parts: classification loss function and regression loss function. The classification loss function is used to deal with the situation of class imbalance. It automatically adjusts the weights of positive and negative samples by introducing focus parameters, so that the model pays more attention to difficult samples during training, thereby improving the detection accuracy of the banknote detection model.
[0085] Since the loss function of the banknote detection model provided by the embodiment of the present disclosure does not include object loss, the output no longer includes "object confidence". Therefore, directly outputting the "confidence score" of each category and then selecting the maximum value as the "confidence" of the anchor box can improve the efficiency of the algorithm.
[0086]
[0087] Among them, q is the label of the banknote sample. For positive samples, q is the overlap between the predicted box and the real box. For negative samples, q=0. When the prediction result is a positive sample, the focal loss function (FL) is not used, but the ordinary binary cross-entropy (BCE), but with an additional adaptive overlap weighting to highlight the main sample. For negative samples, it is the standard FL. It can be clearly seen that its main features are asymmetric weighting of positive and negative samples and highlighting positive samples as the main samples. r is an adjustable factor that controls the balance of positive and negative samples during the learning process. a is the weight of the banknote sample, which can be set according to the importance of the sample.
[0088] The regression loss includes a first loss function CUL and a second loss function. The first loss function may be a fair loss function (CUL). The second loss function may be a distribution focal loss function (DFL).
[0089] CUL is a loss function used for regression. When calculating the overlap between the predicted box and the true box, it can consider more factors such as shape and scale. Compared with traditional loss functions, it can more accurately measure the difference between the predicted box and the true box. It calculates the overlap rate of the "predicted box" and the "true box", that is, the ratio of their intersection area to their union area.
[0090]
[0091]
[0092]
[0093] Among them, x, y are the coordinates of the center point of the prediction box, and is the center point coordinate of the real frame, and are the width and height of the smallest rectangular box formed by the predicted box and the real box, is a hyperparameter, and are the width and height of the prediction box respectively. and are the width and height of the real frame respectively, It is the intersection-over-union ratio, which is used to measure the overlap between the predicted box and the true box.
[0094] DFL calculates the bounding box information of the target by predicting a discrete distribution, so that the model can focus on high-quality prediction boxes more accurately during training. DFL enables the network to focus on values near the target position more quickly and increase their probability. By using a loss function in the form of cross entropy, the probabilities of the two positions closest to the label are optimized. This allows the network to focus on learning the distribution around the target position more quickly.
[0095]
[0096] Among them, i represents different positions in this discrete distribution, is the probability that the coordinate value falls in the ith discrete distribution, is the probability that the coordinate value falls in the i+1th discrete distribution, is the real coordinate, is the probability of the coordinate value in the i-th discrete distribution, is the probability of the coordinate value in the i+1th discrete distribution.
[0097] Area is one of the basic features inside the feature histogram in image processing. It represents the number of all pixels within the target connected domain. Represents the area of the target connected domain o, and the horizontal coordinate x and vertical coordinate y values of any pixel point within the connected domain represent any pixel point within the connected domain:
[0098]
[0099] In some embodiments, before operation S33, the accuracy, recall, harmonic mean and average precision of the trained banknote detection model are obtained; and the trained banknote detection model is optimized using at least one of the accuracy, recall, harmonic mean and evaluation precision as an evaluation indicator.
[0100] The accuracy rate P refers to the proportion of all objects detected as positive samples that are actually positive samples. It can reflect the model's ability to avoid false positives, that is, the proportion of objects predicted by the model as positive samples that are actually positive samples. In object detection, the higher the accuracy rate, the more reliable the model's prediction results.
[0101]
[0102] Among them, T p is the number of positive samples of banknotes, F p is the number of false positive samples of banknotes.
[0103] Recall rate R refers to the proportion of objects that are correctly detected among all objects that are actually positive samples. It measures the ability of the model to detect all instances of a certain class. The higher the recall rate, the more positive samples the model can detect and the fewer missed detections.
[0104]
[0105] Among them, F N is the number of false negative samples of banknotes
[0106] The harmonic mean F1 is the harmonic mean of precision and recall, which comprehensively considers the performance of the model in terms of precision and recall. The higher the F1 value, the better the balance between precision and recall is achieved.
[0107]
[0108] The mean average precision (mAP) is one of the most commonly used evaluation indicators in the field of object detection. It measures the average accuracy of the model on all target categories. The average precision (AP) is the area under the precision-recall curve of a certain category. It is the average value of AP of all categories, which can be used to evaluate the detection performance of the model for all categories. The closer it is to 1, the better the detection performance of the model.
[0109]
[0110] Among them, P K is the accuracy of the Kth class, R K is the recall rate of the Kth category, S represents the number of banknote categories, and N is the number of categories. According to the indicator optimization, the optimal accuracy value is obtained.
[0111] In some embodiments, transfer learning is used to reduce the total training time and improve the accuracy of the training model. Therefore, the training process can adopt a transfer learning strategy, select standardized weights to initialize the banknote detection model, and use the similarity between data, tasks or models to transfer knowledge between the source domain and the target domain so that the machine learning model trained in the source domain can be applied to the target domain. Transfer learning is introduced during model training to reduce training time and improve the accuracy of the training model.
[0112] Based on the above-mentioned banknote detection method, the present disclosure also provides a banknote detection device. Figure 5 The device is described in detail.
[0113] Figure 5 The structural block diagram of the banknote detection device according to the embodiment of the present disclosure is schematically shown.
[0114] like Figure 5 As shown, the banknote detection device 500 of this embodiment includes a construction module 510 , a training module 520 and an input module 530 .
[0115] The construction module 510 is used to construct a banknote detection model to be trained, and the banknote detection model includes a backbone module, a BotNet module, a neck module, a head module, and an efficient multi-scale attention module. In one embodiment, the construction module 510 can be used to perform the operation S310 described above, which will not be repeated here.
[0116] The training module 520 is used to train the banknote detection model to be trained based on the collected banknote sample data set to obtain a trained banknote detection model. In one embodiment, the training module 520 can be used to perform the operation S320 described above, which will not be repeated here.
[0117] The input module 530 is used to input the image of the banknote to be identified into the trained banknote detection model and output the recovery result of the banknote to be identified. In one embodiment, the input module 530 can be used to perform the operation S330 described above, which will not be repeated here.
[0118] According to an embodiment of the present disclosure, the construction of the banknote detection model to be trained includes: constructing a backbone module, a neck module and a head module in sequence; introducing a BotNet module at the end of the backbone module; and adding an efficient multi-scale attention module at the end of the head module.
[0119] According to an embodiment of the present disclosure, introducing the BotNet module at the end of the backbone module includes: obtaining at least one bottleneck block at the end of the backbone module; replacing the spatial convolution layers in the at least one bottleneck block with multi-head self-attention layers.
[0120] According to an embodiment of the present disclosure, the step of inputting the image of the banknote to be identified into the trained banknote detection model and outputting the recovery result of the banknote to be identified also includes: obtaining the accuracy, recall, harmonic mean and average precision mean of the trained banknote detection model; and optimizing the trained banknote detection model using at least one of the accuracy, recall, harmonic mean and evaluation precision mean as an evaluation indicator.
[0121] According to an embodiment of the present disclosure, the banknote sample data set includes banknote samples of all denominations, and each banknote sample of each denomination has at least one of the types of damage: damage, stain, and fold.
[0122] According to an embodiment of the present disclosure, the device 500 also includes: a calculation module, used to calculate the classification loss function and the regression loss function of the banknote detection model to be trained; the training module is also used to train the banknote detection model to be trained with minimizing the classification loss function and the regression loss function as the training goal.
[0123] According to an embodiment of the present disclosure, the classification loss function of the banknote detection model to be trained is :
[0124]
[0125] Among them, q is the label of the banknote sample, p is the predicted probability value, r is an adjustable factor that controls the balance of positive and negative samples during the learning process, and a is the weight of the banknote sample, which is set according to the importance of the sample.
[0126] According to an embodiment of the present disclosure, the regression loss function includes a first loss function, and the regression loss function of the banknote detection model to be trained includes: calculating the ratio of the intersection area to the union area between the prediction box and the real box; calculating the width and height of the minimum rectangular box enclosing the prediction box and the real box, and the distance between the center points of the prediction box and the real box; calculating the first loss function based on the ratio, the width and height of the minimum rectangular box, and the center point distance.
[0127] According to an embodiment of the present disclosure, the regression loss function includes a second loss function, which is a distribution focus loss function.
[0128] According to an embodiment of the present disclosure, any multiple modules of the building module 510, the training module 520 and the input module 530 can be combined into one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module. According to an embodiment of the present disclosure, at least one of the building module 510, the training module 520 and the input module 530 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application-specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware and firmware or in any appropriate combination of any of them. Alternatively, at least one of the building module 510, the training module 520 and the input module 530 can be at least partially implemented as a computer program module, and when the computer program module is run, the corresponding function can be performed.
[0129] Figure 6 A block diagram of an electronic device suitable for implementing a banknote detection method according to an embodiment of the present disclosure is schematically shown.
[0130] like Figure 6 As shown, the electronic device 600 according to the embodiment of the present disclosure includes a processor 601, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 602 or the program loaded from the storage part 608 to the random access memory (RAM) 603. The processor 601 may include, for example, a general-purpose microprocessor (such as a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (for example, an application-specific integrated circuit (ASIC)), etc. The processor 601 may also include an onboard memory for caching purposes. The processor 601 may include a single processing unit or multiple processing units for performing different actions of the method flow according to the embodiment of the present disclosure.
[0131] In RAM 603, various programs and data required for the operation of electronic device 600 are stored. Processor 601, ROM 602 and RAM 603 are connected to each other via bus 604. Processor 601 performs various operations of the method flow according to the embodiment of the present disclosure by executing the program in ROM 602 and / or RAM 603. It should be noted that the program can also be stored in one or more memories other than ROM 602 and RAM 603. Processor 601 can also perform various operations of the method flow according to the embodiment of the present disclosure by executing the program stored in the one or more memories.
[0132] According to an embodiment of the present disclosure, the electronic device 600 may further include an input / output (I / O) interface 605, which is also connected to the bus 604. The electronic device 600 may further include one or more of the following components connected to the I / O interface 605: an input portion 606 including a keyboard, a mouse, etc.; an output portion 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 608 including a hard disk, etc.; and a communication portion 609 including a network interface card such as a LAN card, a modem, etc. The communication portion 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage portion 608 as needed.
[0133] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.
[0134] According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, it may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, an apparatus or a device. For example, according to an embodiment of the present disclosure, the computer-readable storage medium may include the ROM 602 and / or RAM 603 described above and / or one or more memories other than ROM 602 and RAM 603.
[0135] The embodiment of the present disclosure also includes a computer program product, which includes a computer program, and the computer program contains program code for executing the method shown in the flowchart. When the computer program product is run in a computer system, the program code is used to enable the computer system to implement the banknote detection method provided by the embodiment of the present disclosure.
[0136] The above functions defined in the system / device of the embodiment of the present disclosure are performed when the computer program is executed by the processor 601. According to the embodiment of the present disclosure, the system, device, module, unit, etc. described above can be implemented by a computer program module.
[0137] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices, magnetic storage devices, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of signals on a network medium, and downloaded and installed through the communication part 609, and / or installed from a removable medium 611. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0138] In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the processor 601, the above functions defined in the system of the embodiment of the present disclosure are performed. According to the embodiment of the present disclosure, the system, device, apparatus, module, unit, etc. described above can be implemented by a computer program module.
[0139] According to an embodiment of the present disclosure, the program code for executing the computer program provided by the embodiment of the present disclosure can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level process and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, Java, C++, python, "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using an Internet service provider to connect through the Internet).
[0140] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0141] It will be appreciated by those skilled in the art that the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways, even if such combinations and / or combinations are not explicitly described in the present disclosure. In particular, the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways without departing from the spirit and teachings of the present disclosure. All of these combinations and / or combinations fall within the scope of the present disclosure.
[0142] The embodiments of the present disclosure are described above. However, these embodiments are only for illustrative purposes and are not intended to limit the scope of the present disclosure. Although the embodiments are described above separately, this does not mean that the measures in the various embodiments cannot be used in combination to advantage. The scope of the present disclosure is defined by the attached claims and their equivalents. Without departing from the scope of the present disclosure, those skilled in the art may make a variety of substitutions and modifications, which should all fall within the scope of the present disclosure.
Claims
1. A banknote detection method, characterized in that: The method comprises: Constructing a banknote detection model to be trained, wherein the banknote detection model includes a backbone module, a BotNet module, a neck module, a head module, and an efficient multi-scale attention module; Based on the collected banknote sample data set, the banknote detection model to be trained is trained to obtain a trained banknote detection model; The image of the banknote to be identified is input into the trained banknote detection model, and the recovery result of the banknote to be identified is output.
2. The method according to claim 1, characterized in that The step of constructing a banknote detection model to be trained includes: Construct the backbone module, neck module and head module in sequence; Introducing a BotNet module at the end of the backbone module; An efficient multi-scale attention module is added at the end of the head module.
3. The method according to claim 2, characterized in that The introduction of the BotNet module at the end of the backbone module includes: Obtain at least one bottleneck block at the end of the backbone module; The spatial convolution layers in the at least one bottleneck block are replaced by multi-head self-attention layers.
4. The method according to claim 1, characterized in that: Before inputting the image of the banknote to be identified into the trained banknote detection model and outputting the recovery result of the banknote to be identified, the method further includes: Obtaining the accuracy, recall, harmonic mean and mean precision of the trained banknote detection model; The trained banknote detection model is optimized by taking at least one of the accuracy rate, the recall rate, the harmonic mean value and the evaluation precision mean value as an evaluation index.
5. The method according to claim 1, characterized in that The banknote sample data set includes banknote samples of all denominations, and each banknote sample of each denomination has at least one of the types of damage, namely, damage, stain and fold.
6. The method according to claim 1, characterized in that The method further comprises: Calculating a classification loss function and a regression loss function of the banknote detection model to be trained; The banknote detection model to be trained is trained with minimizing the classification loss function and the regression loss function as the training goal.
7. The method according to claim 1, characterized in that The classification loss function of the banknote detection model to be trained : Among them, q is the label of the banknote sample, p is the predicted probability value, r is an adjustable factor, and a is the weight of the banknote sample.
8. The method according to claim 1, characterized in that The regression loss function includes a first loss function, and the regression loss function of the banknote detection model to be trained includes: Calculate the ratio of the intersection area to the union area between the predicted box and the true box; Calculate the width and height of the minimum rectangular box surrounding the predicted box and the real box, and the distance between the center points of the predicted box and the real box; The first loss function is calculated according to the ratio, the width and height of the minimum rectangular frame, and the center point distance.
9. The method according to claim 1, characterized in that: The regression loss function includes a second loss function, which is a distribution focus loss function.
10. A banknote detection device, characterized in that: The device comprises: A construction module, used to construct a banknote detection model to be trained, wherein the banknote detection model includes a backbone module, a BotNet module, a neck module, a head module, and an efficient multi-scale attention module; A training module is used to train the banknote detection model to be trained based on the collected banknote sample data set to obtain a trained banknote detection model; The input module is used to input the image of the banknote to be identified into the trained banknote detection model and output the recovery result of the banknote to be identified.
11. An electronic device, comprising: one or more processors; a memory for storing one or more computer programs, It is characterized in that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 9.
12. A computer-readable storage medium having a computer program or instruction stored thereon, characterized in that: When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.
13. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.