A banknote special feature training method, device, equipment and medium
By using a generative adversarial network to generate banknote features in the sorting machine, the problem of the sorting machine having difficulty obtaining new banknote samples was solved, and the training efficiency and recognition accuracy of the banknote recognition model were improved.
Patent Information
- Application Number
- CN202211130805.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-16
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2042-09-16
AI Technical Summary
Existing sorting machines require a lot of manpower and material resources to collect data when identifying and classifying banknotes that are not suitable for circulation, and are unable to obtain new banknote samples in a timely manner, resulting in recognition results that do not meet quality requirements.
A generative adversarial network is used to collect images of existing feature banknotes under white light, and features are generated onto featureless banknotes through the generative adversarial network, simulating the features gradually generated by new banknotes during circulation and increasing the diversity of banknote samples.
It solves the problems of difficulty in sample collection and low efficiency of algorithm update iteration, and improves the training efficiency and recognition accuracy of the banknote recognition model.
Smart Images

Figure CN115497217B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of big data processing technology, and in particular relates to a method, device, equipment and medium for training special characteristics of banknotes. Background Art
[0002] After a period of circulation, banknotes issued on the market gradually become old and develop features such as damage, holes, and graffiti. The People's Bank of China issued the "Notice on RMB Banknotes Not Suitable for Circulation" on May 25, 2017, requiring that banknotes that do not meet the standards be sorted and recycled.
[0003] Sorting machines are primarily used for counterfeit detection and sorting of banknotes. Through their sorting capabilities, they can isolate banknotes deemed unsuitable for circulation. To improve the algorithm's performance in identifying different banknotes and establish a recognition and classification model, it is often necessary to collect samples of both new and various types of unsuitable banknotes. Training with a large amount of calibration data, these models are then generated based on the characteristics of different denominations to accurately identify and classify banknotes deemed unsuitable for circulation.
[0004] Currently, the training data for the algorithm models used by banknote sorting machines to identify banknotes is collected from banknotes that have been in circulation for a long time. This data is then collected to iterate the algorithms and models. This, on the one hand, requires a significant amount of manpower and material resources to collect data, making algorithm updates inefficient. On the other hand, it is impossible to obtain timely sample banknotes and image data for newly issued banknotes that are not suitable for circulation. As a result, the banknote sorting machine's recognition performance does not meet the quality requirements of the People's Bank of China for sorting banknotes that are not suitable for circulation.
[0005] Therefore, a new method, device, equipment and medium for training special characteristics of banknotes are generated. Summary of the Invention
[0006] The purpose of the present invention is to provide an algorithm system for generating special features of banknotes. By collecting existing feature banknotes under white light, the features are generated onto featureless banknotes through a generative adversarial network, so that the banknotes also have the same features, thereby solving the problem of requiring a large number of samples in the existing technology.
[0007] The first aspect of an embodiment of the present application provides a method for training special features of banknotes, including: separating three domains, namely, a new genuine banknote domain, a damaged banknote domain, and a counterfeit banknote domain; collecting a target image of an existing banknote under white light, and mapping the target image from a source domain to a target domain based on a generative adversarial network algorithm; marking the characteristic attributes of the existing banknote according to the target image, and judging the domain into which the existing banknote falls based on the characteristic attributes, wherein the latent variables of the generative adversarial network are normalized and nonlinearly mapped and projected into a latent space, and the transformed latent space is used as style information on spatial data; training the style and features of the target image, obtaining a style encoding corresponding to the target style and attributes, and forming a generated image with new features based on the style encoding, wherein the latent space needs to be scaled and biased for affine transformation before being used as spatial information, and in the generative network of the generative adversarial network, each convolution layer is followed by controlled adaptive instance normalization.
[0008] Furthermore, the brand new genuine banknote domain does not contain any special attributes, the characteristic attributes of the damaged banknote domain include holes, water washing and graffiti, and the characteristic attributes of the counterfeit banknote domain include lack of security thread and serial number.
[0009] Furthermore, the style and features of the target image are trained to obtain the style encoding corresponding to the target style and attributes. Specifically, a mapping network is used to obtain the style encoding corresponding to the target style and attributes through convolution, average pooling and fully connected layers.
[0010] Furthermore, training the style and features of the target image to obtain a style code corresponding to the target style and attributes, and forming a generated image with new features based on the style code further includes: calculating the adversarial loss, which is calculated as follows: The distance between the style encoding of the generated image and the style encoding of the target image is used as the loss function to calculate the loss of style reconstruction in the style encoding. The calculation formula is as follows: The loss of style reconstruction is added to the conditional variables of the generative adversarial network, and the calculation formula is as follows: The overall loss of the generated image is calculated based on different weights. The calculation formula is as follows: L total =min E,G max D L adv +λ sty L sty +λ dis L dis ; Select the generated image with overall loss lower than the threshold as the suitable generated image.
[0011] A second aspect of the embodiments of the present application provides a banknote special feature training device, comprising:
[0012] The storage module separates three domains, namely the new genuine banknote domain, the damaged banknote domain and the counterfeit banknote domain; the acquisition module collects the target image of the existing banknote under white light, and maps the target image from the source domain to the target domain based on the generative adversarial network algorithm; the classification module marks the characteristic attributes of the existing banknote according to the target image, and determines the domain into which the existing banknote falls based on the characteristic attributes, wherein the latent variables of the generative adversarial network are normalized and nonlinearly mapped into a latent space, and the transformed latent space will act on the spatial data as style information; the generation module trains the style and features of the target image, obtains the style encoding corresponding to the target style and attributes, and forms a generated image with new features based on the style encoding, wherein the latent space (Z) needs to be scaled and biased before being used as spatial information to perform affine transformation, and in the generation network of the generative adversarial network, each convolution layer is followed by controlled adaptive instance normalization.
[0013] Furthermore, the generation module also includes a calculation unit and a judgment unit. The calculation unit calculates the adversarial loss, uses the distance between the style encoding of the generated image and the style encoding of the target image as the loss function to calculate the loss of style reconstruction in the style encoding, adds the loss of style reconstruction to the conditional variables of the generative adversarial network, and calculates the overall loss of the generated image based on different weights. The judgment unit selects the generated image with an overall loss lower than the threshold as a suitable generated image.
[0014] The third aspect of the embodiments of the present application provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the computer device. When the processor executes the computer program, the steps of the banknote special feature training method provided in the first solution are implemented.
[0015] A fourth aspect of the embodiments of the present application provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the banknote special feature training method provided in the first solution.
[0016] Implementing a method, apparatus, computer device, and computer-readable storage medium provided by the embodiments of the present application has the following beneficial effects:
[0017] By using the generative adversarial network to generate features onto featureless banknotes collected under white light, the features are generated onto the banknotes without features, so that the banknotes also have the same features, avoiding the inconvenience of requiring a large number of different types of samples for training and learning; it can simulate the actual effect of the gradual depreciation of new banknotes during circulation, forming the special features of old banknotes, and through the generated noise, randomly generate the position, size, and shape, thereby increasing the diversity of banknote samples and solving the problems of difficulty in collecting samples required for banknote recognition model training and lagging algorithm updates and iterations. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. 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 any creative work.
[0019] Figure 1 A flowchart of a banknote special feature training method provided by an embodiment of the present invention;
[0020] Figure 2 Schematic diagram of a latent variable mapping network in an embodiment of the present invention;
[0021] Figure 3 2 is a network diagram of a style encoder according to an embodiment of the present invention;
[0022] Figure 4 Provides a network diagram of an image generator for an embodiment of the present invention;
[0023] Figure 5 A structural block diagram of a banknote special feature training device provided by an embodiment of the present invention;
[0024] Figure 6 This is a structural block diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0025] In order to make the technical problems, technical solutions and beneficial effects to be solved by the present invention more clearly understood, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0026] Reference Figure 1 As shown, Figure 1 A method for training banknote special features is shown in the flowchart of an implementation method provided by an embodiment of the present application.
[0027] Step S1: Separate three domains: a brand new genuine banknote domain, a damaged banknote domain, and a counterfeit banknote domain;
[0028] Specifically, the first domain is brand new banknotes, which are brand new genuine banknotes and do not contain any special attributes. The second domain is feature banknotes, which contain special attributes such as holes, water washing, graffiti, etc. The third domain is counterfeit banknotes, which lack special features such as security threads and serial numbers. By drawing on the algorithms of style transfer and feature generation, an alternative generator architecture for generative adversarial networks is proposed. This architecture can intuitively and scalably control image synthesis, so that banknote images can be transformed from domain to domain.
[0029] Step S2: collecting a target image of an existing banknote under white light, and mapping the target image from a source domain to a target domain based on a generative adversarial network algorithm;
[0030] Specifically, this algorithm architecture is based on the Generative Adversarial Network (GAN) algorithm, which attempts to map features from a source domain X to a target domain Y. In a traditional GAN algorithm architecture, two networks are involved. One network, called the generator network, attempts to generate realistic data G(z). The z in the expression can be broken down into noise data or interpretable latent variables, which are disguised as real data X through the generator network G. The other network attempts to distinguish between real data and data generated by the generator network, reaching a so-called equilibrium point where the data created by the generator appears sufficiently realistic that the discriminator can only make random guesses, i.e., D(G(z)) = 0.5. Furthermore, an additional parameter c is typically added to the generator network, i.e., G(z,c). c is a conditional variable, which is semantically known through manual classification and labeling. As the network progresses, the role of z gradually disappears.
[0031] Step S3: Label the characteristic attributes of the existing banknotes according to the target image, and determine the domain into which the existing banknotes fall based on the characteristic attributes. The latent variables of the generative adversarial network are normalized and nonlinearly projected into a latent space (W). The transformed latent space (W) is used as style information to act on the spatial data.
[0032] Specifically, at the beginning of training, the characteristic attributes of the existing banknotes will be labeled to indicate which domain the banknote belongs to and whether it contains or lacks any special attributes.
[0033] In this algorithm structure, the latent variables are not directly used as the input of the network. Instead, the latent variables are normalized and nonlinearly mapped, projected into a latent space w. The transformed latent space w will act as style information on the spatial data. For simplicity, the latent variable z and the latent space are both set to 512 dimensions. In other algorithms, this is achieved by using a fully connected layer. However, since the fully connected layer requires more parameters and computation, a 1*1 convolution kernel is used here instead. PReLu is used to introduce nonlinearity and Conditional Instance Normalization to ensure that the data distribution is normally distributed. Conditional Instance Normalization normalizes a single channel of a single image. See the following formula:
[0034]
[0035] Among them, s represents the style, μ(x) represents the mean of the current channel, σ(x) represents the variance of the current channel, and γ s and β s Need to learn through samples, a group (γ s , β s ) corresponds to a set of styles. The network first performs upsampling, and the specific network is as follows Figure 2 .
[0036] Step S4: Train the style and features of the target image, obtain a style encoding corresponding to the target style and attributes, and form a generated image with new features based on the style encoding, wherein the latent space (Z) needs to be scaled and biased before being used as spatial information to perform an affine transformation, and in the generative network of the generative adversarial network, each convolutional layer is followed by controlled adaptive instance normalization.
[0037] Specifically, a style encoder is needed to learn the style and features of the target image. The style encoder here is a mapping network that obtains the style encoding corresponding to the target style and attributes through operations such as convolution, average pooling, and fully connected layers. For the specific network, see Figure 3 The network will eventually output a 512-dimensional code, and each convolution operation in the network is followed by a Batch Normalization layer and a PRelu layer operation.
[0038] In the image generator, the latent space Z needs to be scaled and biased before being used as spatial information, y s ,y bDenote the scaling value and bias value, respectively. In the subsequent generative network g, each convolutional layer needs to be followed by adaptive instance normalization (AdaIN). Unlike IN, AdaIN does not require learning other parameters. See the following formula:
[0039]
[0040] Each convolutional layer is normalized and scaled and biased by , so the image features generated by the generator are controlled by the scaling and bias values. If noise is added to the generator, it provides a method for random (diversity) details. The noise input is a single-channel data composed of uncorrelated Gaussian noise, thus achieving random changes. The noise does not affect the overall composition, and finally an image with new features is obtained. Figure 4 .
[0041] Step S4 further includes:
[0042] Step S41: Calculate the adversarial loss. The calculation formula is as follows:
[0043]
[0044] in, Indicates the expectation of the input data x after passing through the discriminator D under style y, G(x, S y ) indicates that the input data x is added with style code S y , the output after passing through generator G.
[0045] Step S42: Encode the style of the generated image and target image style code S y The distance is used as the loss function to calculate the loss of style reconstruction in style encoding. The calculation formula is as follows:
[0046]
[0047] Step S43: Add the style reconstruction loss to the conditional variables of the generative adversarial network. The calculation formula is as follows:
[0048] Among them, x represents the original image, Represents an image generated by a generative adversarial network.
[0049] Step S44: Calculate the overall loss of the generated image based on different weights. The calculation formula is as follows: L total =min E,G max D L adv +λ sty L sty +λdis L dis ;
[0050] Step S45: Selecting an image with an overall loss lower than a threshold as a suitable generated image.
[0051] In detail, in order to make the trained image as close to the real image as possible, the loss function will be calculated to make the loss function as small as possible, so as to obtain the best result and complete the training; the distance between the style code of the generated image and the style code is used as the loss function L sty , to evaluate the requirement that the generated image obtains the same encoding after passing through the style encoding network. In order to retain the attribute features of the original image, the distance loss function L between the generated image and the original image is added dis , by performing two image generation steps using style encoding and inverse encoding, the image is generated as close to the original image as possible; based on different weights λ sty and λ dis The sum of the overall losses is calculated and made as small as possible, so as to determine that the generated image is as close to the real state as possible.
[0052] In this way, the invention can simulate the actual effect of the gradual depreciation of new banknotes during the circulation process, forming the special characteristics of old banknotes. By generating noise, random generation is carried out in terms of position, size, and shape, thereby increasing the diversity of banknote samples and solving the problems of difficulty in collecting samples required for banknote recognition model training and lagging algorithm update iterations.
[0053] Corresponding to the above method embodiment, the embodiment of the present invention also provides a banknote special feature training device, such as Figure 5 As shown, the device may include the following modules:
[0054] The storage module is divided into three domains: a new genuine banknote domain, a damaged banknote domain, and a counterfeit banknote domain;
[0055] The acquisition module collects the target image of the existing banknote under white light and maps the target image from the source domain to the target domain based on the generative adversarial network algorithm;
[0056] The classification module labels the characteristic attributes of the existing banknotes according to the target image and determines the domain into which the banknotes fall based on the characteristic attributes. The latent variables of the generative adversarial network are normalized and nonlinearly projected into a latent space. The transformed latent space is used as style information to act on the spatial data.
[0057] The generation module trains the style and features of the target image, obtains the style encoding corresponding to the target style and attributes, and forms a generated image with new features based on the style encoding. The latent space (Z) needs to be scaled and biased before being used as spatial information, and in the generation network of the generative adversarial network, each convolutional layer is followed by controlled adaptive instance normalization.
[0058] Specifically, the generation module also includes a calculation unit and a judgment unit. The calculation unit calculates the adversarial loss, uses the distance between the style encoding of the generated image and the style encoding of the target image as the loss function to calculate the loss of style reconstruction in the style encoding, adds the loss of style reconstruction to the conditional variables of the generative adversarial network, and calculates the overall loss of the generated image based on different weights. The judgment unit selects the generated image with an overall loss lower than a threshold as a suitable generated image.
[0059] It should be understood that Figure 5 In the structural block diagram of the device shown, each module is used to execute Figure 1 The steps in the corresponding embodiments, and Figure 1 Each step in the corresponding embodiment has been explained in detail in the above embodiment. Figure 1 The relevant descriptions in the corresponding embodiments will not be repeated here.
[0060] Figure 6 This is a block diagram of a computer device provided in one embodiment of the present application. The computer device of this embodiment includes: a processor, a memory, and a computer program stored in the memory and executable on the processor, such as a program for a banknote special feature training method. When the processor executes the computer program, the steps in each embodiment of the banknote special feature training method described above are implemented. Alternatively, when the processor executes the computer program, the steps in each embodiment of the banknote special feature training method described above are implemented. Figure 5 For details on the functions of each module in the corresponding embodiment, please refer to Figure 5 The relevant descriptions in the corresponding embodiments are not repeated here.
[0061] Exemplarily, the computer program may be divided into one or more modules, which are stored in the memory and executed by the processor to complete the present application. The one or more modules may be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program in the computer device.
[0062] The turntable device may include, but is not limited to, a processor and a memory. It will be understood by those skilled in the art that Figure 6It is only an example of a computer device and does not constitute a limitation of the computer device. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the turntable device may also include input and output devices, network access devices, buses, etc.
[0063] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.
[0064] The memory may be an internal storage unit of the computer device, such as a hard disk or memory of the computer device. The memory may also be an external storage device of the computer device, such as a plug-in hard disk equipped on the computer device, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, etc. Furthermore, the memory may include both an internal storage unit of the computer device and an external storage device. The memory is used to store the computer program and other programs and data required by the turntable device. The memory may also be used to temporarily store data that has been output or is to be output.
[0065] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the banknote special feature training method in the above embodiment is implemented.
[0066] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other computer-readable storage medium used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0067] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A banknote special feature training method, characterized in that: include: Separate three domains: brand new genuine banknote domain, damaged banknote domain and counterfeit banknote domain; Collect the target image of the existing banknote under white light, and map the target image from the source domain to the target domain based on the generative adversarial network algorithm; The characteristic attributes of the existing banknotes are labeled according to the target image, and the domain into which the existing banknotes fall is determined based on the characteristic attributes. The latent variables of the generative adversarial network are normalized and nonlinearly projected into a latent space (W). The transformed latent space (W) is used as style information to act on the spatial data. The style and features of the target image are trained to obtain a style encoding corresponding to the target style and attributes, and a generated image with new features is formed based on the style encoding, wherein the latent space (Z) needs to be affine transformed by scaling and adding bias before being used as spatial information, and in the generative network of the generative adversarial network, each convolutional layer is followed by controlled adaptive instance normalization.
2. The banknote special feature training method according to claim 1, characterized in that: The brand new genuine banknote domain does not contain any special attributes, the characteristic attributes of the damaged banknote domain include holes, water washing and graffiti, and the characteristic attributes of the counterfeit banknote domain include lack of security thread and serial number.
3. The banknote special feature training method according to claim 1, characterized in that: Training the style and features of the target image and obtaining the style encoding corresponding to the target style and attributes is specifically a mapping network that obtains the style encoding corresponding to the target style and attributes through convolution, average pooling and fully connected layers.
4. The banknote special feature training method according to claim 1, characterized in that: Training the style and features of the target image to obtain a style code corresponding to the target style and attributes, and generating a generated image with new features based on the style code further includes: Calculate the adversarial loss, the calculation formula is as follows: The distance between the style encoding of the generated image and the style encoding of the target image is used as the loss function to calculate the loss of style reconstruction in the style encoding. The calculation formula is as follows: The loss of style reconstruction is added to the conditional variables of the generative adversarial network, and the calculation formula is as follows: The overall loss of the generated image is calculated based on different weights. The calculation formula is as follows: L total =min E,G max D L adv +λ sty L sty +λ dis L dis ; Select the generated image whose overall loss is lower than the threshold as the suitable generated image.
5. A banknote special feature training device, characterized in that: include: The storage module is divided into three domains: a new genuine banknote domain, a damaged banknote domain, and a counterfeit banknote domain; The acquisition module collects the target image of the existing banknote under white light and maps the target image from the source domain to the target domain based on the generative adversarial network algorithm; The classification module labels the characteristic attributes of the existing banknotes according to the target image and determines the domain into which the banknotes fall based on the characteristic attributes. The latent variables of the generative adversarial network are normalized and nonlinearly projected into a latent space. The transformed latent space is used as style information to act on the spatial data. The generation module trains the style and features of the target image, obtains the style encoding corresponding to the target style and attributes, and forms a generated image with new features based on the style encoding. The latent space (Z) needs to be scaled and biased before being used as spatial information, and in the generation network of the generative adversarial network, each convolutional layer is followed by controlled adaptive instance normalization.
6. The banknote special feature training device according to claim 5, characterized in that: The generation module also includes a calculation unit and a judgment unit. The calculation unit calculates the adversarial loss, uses the distance between the style encoding of the generated image and the style encoding of the target image as a loss function to calculate the loss of style reconstruction in the style encoding, adds the loss of style reconstruction to the conditional variables of the generative adversarial network, and calculates the overall loss of the generated image based on different weights. The judgment unit selects the generated image with an overall loss lower than a threshold as a suitable generated image.
7. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.
8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Bill identification method and apparatus
CN107862785A
Image conversion method and device, electronic equipment and readable storage medium
CN110276811A