Handwriting identification method and device based on adversarial network, and electronic equipment
By using adversarial networks for two-way training in word identification, the low accuracy problem caused by insufficient data of convolutional neural networks is solved, and more efficient word identification is achieved.
Patent Information
- Application Number
- CN202411743696.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-30
- Publication Date
- 2025-02-25
AI Technical Summary
Convolutional neural networks have low performance and low accuracy in word identification tasks due to the need for a large amount of labeled data.
The word identification method based on adversarial network is adopted, and the word identification method is trained by the generator and discriminator in the adversarial network, and the word identification image belonging to the target object and the word identification image of other objects is trained in two-way. The generator and discriminator are optimized to improve the identification accuracy.
Through the training of the adversarial network, the generator can generate images more accurately, and the discriminator can more accurately determine whether the target handwriting image to be identified is close to the handwriting image of the target object, thereby improving the accuracy of handwriting identification.
Smart Images

Figure CN119516559A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a handwriting identification method, device and electronic device based on an adversarial network. Background Art
[0002] At present, deep learning networks can be used to implement handwriting identification. For example, convolutional neural networks are used to identify handwriting images.
[0003] However, convolutional neural networks usually require a large amount of annotated data for training, but it is difficult to obtain annotated data sets of sufficient size in handwriting identification tasks, which limits the performance of convolutional neural networks and leads to lower accuracy of handwriting identification. Summary of the invention
[0004] In view of the above problems, the present application provides a handwriting identification method, device and electronic device based on adversarial network to improve the accuracy of handwriting identification. The specific scheme is as follows:
[0005] The first aspect of the present application provides a handwriting identification method based on an adversarial network, the method comprising:
[0006] The target handwriting image to be identified is transmitted to the discriminator in the adversarial network;
[0007] Obtaining an identification result output by the discriminator, wherein the identification result indicates whether the target handwriting image belongs to a target object;
[0008] In which, the adversarial network also includes a generator, and the generator and the discriminator are trained using training samples, and the training samples include a first handwriting image belonging to the target object and a second handwriting image belonging to other objects; the generator is used to generate a third handwriting image for the first handwriting image, and the discriminator is used to determine whether the third handwriting image is close to the first handwriting image and whether the third handwriting image is far away from the second handwriting image to obtain a determination result, and the determination result is used to optimize the generator and the discriminator.
[0009] In one possible implementation, the adversarial network is trained in the following manner:
[0010] providing the first handwriting image to the generator so that the generator generates a third handwriting image;
[0011] The first handwriting image, the second handwriting image and the third handwriting image are provided to the discriminator, so that the discriminator generates a first high-dimensional feature vector, a second high-dimensional feature vector and a third high-dimensional feature vector; the first high-dimensional feature vector corresponds to the first handwriting image, the second high-dimensional feature vector corresponds to the second handwriting image, and the third high-dimensional feature vector corresponds to the third handwriting image;
[0012] Obtaining a contrast loss function value according to the first high-dimensional feature vector, the second high-dimensional feature vector and the third high-dimensional feature vector; the contrast loss function value represents the degree to which the third handwriting image is close to the first handwriting image and the degree to which the third handwriting image is far away from the second handwriting image;
[0013] The generator and the discriminator are optimized according to the contrast loss function value.
[0014] In a possible implementation, obtaining a contrast loss function value according to the first high-dimensional feature vector, the second high-dimensional feature vector, and the third high-dimensional feature vector includes:
[0015] according to Get the contrast loss function value;
[0016] Among them, L q is the contrast loss function value, q is the third high-dimensional feature vector corresponding to the third handwriting image, k + is the first high-dimensional feature vector corresponding to the first handwriting image, k i is the second high-dimensional feature vector corresponding to the ith second handwriting image, K is the total number of the second handwriting images, and τ is a preset coefficient.
[0017] In a possible implementation, while providing the first handwriting image, the second handwriting image and the third handwriting image to the discriminator, the method further includes:
[0018] Provide the handwriting speed information corresponding to the first handwriting image, the handwriting speed information corresponding to the second handwriting image, and the handwriting speed information corresponding to the third handwriting image to the discriminator, so that the discriminator generates the first high-dimensional feature vector according to the first handwriting image and the handwriting speed information corresponding to it, generates the second high-dimensional feature vector according to the second handwriting image and the handwriting speed information corresponding to it, and generates the third high-dimensional feature vector according to the third handwriting image and the handwriting speed information corresponding to it;
[0019] Wherein, while transmitting the target handwriting image to be identified to the discriminator in the adversarial network, the method further includes:
[0020] The handwriting speed information corresponding to the target handwriting image is transmitted to the discriminator, so that the discriminator outputs the identification result according to the target handwriting image and the handwriting speed information corresponding thereto.
[0021] In a possible implementation, the handwriting speed information represents the speed at which the handwriting in the corresponding handwriting image is input;
[0022] The handwriting speed information corresponding to the third handwriting image is consistent with the handwriting speed information corresponding to the first handwriting image.
[0023] A second aspect of the present application provides a training method for an adversarial network, comprising:
[0024] Transmitting a first handwriting image belonging to a target object in a training sample to a generator in the adversarial network, so that the generator generates a third handwriting image for the first handwriting image;
[0025] Transmitting the third handwriting image, the first handwriting image, and the second handwriting image belonging to other objects in the training sample to the discriminator in the adversarial network, so that the discriminator determines whether the third handwriting image is close to the first handwriting image, and determines whether the third handwriting image is far from the second handwriting image, so as to obtain a determination result;
[0026] According to the discrimination result, optimizing the generator and the discriminator;
[0027] The optimized discriminator is used to output an identification result of whether the target handwriting image belongs to the target object according to the target handwriting image to be identified.
[0028] A third aspect of the present application provides a confrontation network, including:
[0029] A generator, for generating a third handwriting image for a first handwriting image belonging to a target object in a training sample;
[0030] A discriminator, used to determine whether the third handwriting image is close to the first handwriting image, and to determine whether the third handwriting image is far away from the second handwriting image belonging to other objects in the training sample, so as to obtain a determination result; the determination result is used to optimize the generator and the discriminator;
[0031] The optimized discriminator is used to output an identification result of whether the target handwriting image belongs to the target object according to the target handwriting image to be identified.
[0032] A fourth aspect of the present application provides a handwriting identification device based on an adversarial network, comprising:
[0033] A target transmission unit, used for transmitting the target handwriting image to be identified to the discriminator in the adversarial network;
[0034] A result obtaining unit, used for obtaining the identification result output by the discriminator, wherein the identification result indicates whether the target handwriting image belongs to the target object;
[0035] In which, the adversarial network also includes a generator, and the generator and the discriminator are trained using training samples, and the training samples include a first handwriting image belonging to the target object and a second handwriting image belonging to other objects; the generator is used to generate a third handwriting image for the first handwriting image, and the discriminator is used to determine whether the third handwriting image is close to the first handwriting image and whether the third handwriting image is far away from the second handwriting image to obtain a determination result, and the determination result is used to optimize the generator and the discriminator.
[0036] A fifth aspect of the present application provides a training device for an adversarial network, comprising:
[0037] A first transmission unit, configured to transmit a first handwriting image belonging to a target object in a training sample to a generator in the adversarial network, so that the generator generates a third handwriting image for the first handwriting image;
[0038] a second transmission unit, used for transmitting the third handwriting image, the first handwriting image and the second handwriting image belonging to other objects in the training sample to the discriminator in the adversarial network, so that the discriminator determines whether the third handwriting image is close to the first handwriting image, and determines whether the third handwriting image is far from the second handwriting image, so as to obtain a determination result;
[0039] An optimization control unit, used for optimizing the generator and the discriminator according to the discrimination result;
[0040] The optimized discriminator is used to output an identification result of whether the target handwriting image belongs to the target object according to the target handwriting image to be identified.
[0041] The sixth aspect of the present application provides a computer program product, including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements the handwriting identification method based on the adversarial network of the above-mentioned first aspect or any implementation method of the first aspect, and also implements the training method of the adversarial network of the above-mentioned second aspect.
[0042] A seventh aspect of the present application provides an electronic device, comprising at least one processor and a memory connected to the processor, wherein:
[0043] The memory is used to store computer programs;
[0044] The processor is used to execute the computer program so that the electronic device can implement the handwriting identification method based on the adversarial network of the above-mentioned first aspect or any implementation method of the first aspect, and also implement the training method of the adversarial network of the above-mentioned second aspect.
[0045] In an eighth aspect, the present application provides a computer storage medium, which carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement the handwriting identification method based on the adversarial network of the above-mentioned first aspect or any implementation of the first aspect, and also implement the training method of the adversarial network of the above-mentioned second aspect.
[0046] By means of the above technical scheme, in a handwriting identification method, device and electronic device based on an adversarial network provided by the present application, for the adversarial network, a first handwriting image belonging to a target object and a second handwriting image belonging to other objects are used for training, so that the discriminator and the generator are not only positively trained with the first handwriting image as a positive sample, but also negatively trained with the second handwriting image as a negative sample. Therefore, after training in two directions, the generator can generate images more accurately, and the discriminator can more accurately determine whether the target handwriting image to be identified is closer to the first handwriting image and whether it is farther away from the second handwriting image. Therefore, without being limited to the labeled data set, the discriminator can perform handwriting identification more accurately, thereby improving the accuracy of the identification result output by the discriminator. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0048] Figure 1 A flowchart of a handwriting identification method based on an adversarial network provided in an embodiment of the present application;
[0049] Figure 2 An architecture diagram of an adversarial network in a handwriting identification method based on an adversarial network provided in an embodiment of the present application;
[0050] Figure 3 A data flow diagram of the adversarial network in an embodiment of the present application;
[0051] Figure 4 A training flow chart of an adversarial network in a handwriting identification method based on an adversarial network provided in an embodiment of the present application;
[0052] Figure 5 Another training flow chart of an adversarial network in a handwriting identification method based on an adversarial network provided in an embodiment of the present application;
[0053] Figure 6 Another data flow diagram of the adversarial network in the embodiment of the present application;
[0054] Figure 7 A flowchart of a training method for an adversarial network provided in an embodiment of the present application;
[0055] Figure 8 An architecture diagram of an adversarial network provided in an embodiment of the present application;
[0056] Fig. 9 A schematic diagram of the structure of a handwriting identification device based on an adversarial network provided in an embodiment of the present application;
[0057] Fig.10 A schematic diagram of the structure of a training device for an adversarial network provided in an embodiment of the present application;
[0058] Fig.11 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0059] Fig.12 This is a network overall structure diagram of a handwriting identification network in a handwriting identification scenario in the financial field applicable to this application;
[0060] Fig.13 This is a schematic diagram of the process of using a handwriting identification network to perform handwriting identification in a handwriting identification scenario in the financial field applicable to this application. DETAILED DESCRIPTION
[0061] The following describes the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation method section of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.
[0062] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0063] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0064] Reference Figure 1 , is a flowchart of a handwriting identification method based on an adversarial network provided in an embodiment of the present application. The method can be applied to electronic devices deployed with adversarial networks CAN (Generative Adversarial Networks), or electronic devices connected to a server deployed with an adversarial network, such as mobile phones, tablet computers, notebooks or servers. The technical solution in this embodiment is mainly used to improve the accuracy of handwriting identification.
[0065] Specifically, the method in this embodiment may include the following steps:
[0066] Step 101: Transmit the target handwriting image to be identified to the discriminator in the adversarial network.
[0067] The target handwriting image includes input handwriting to be identified, such as a handwriting image of a user's handwritten signature at a bank counter.
[0068] The adversarial network also includes generators, such as Figure 2 As shown in , the generator and the discriminator are trained using training samples, and the training samples include a first handwriting image belonging to a target object and a second handwriting image belonging to other objects.
[0069] It should be noted that the other objects here are different from the target object. For example, the target object is a user named "Zhang San", and the other objects are other users, such as "Li Si", "Wang Wu" and other users.
[0070] During the training process of the adversarial network, the generator is used to generate a third handwriting image for the first handwriting image, and the discriminator is used to determine whether the third handwriting image is close to the first handwriting image and whether the third handwriting image is far away from the second handwriting image to obtain a discrimination result. The discrimination result is used to optimize the generator and the discriminator, so that the discriminator can accurately output the corresponding identification result for the target handwriting image.
[0071] Step 102: Obtaining the identification result output by the discriminator, the identification result represents whether the target handwriting image belongs to the target object.
[0072] It can be seen from the above technical solution that in a handwriting identification method based on an adversarial network provided by the present application, for the adversarial network, a first handwriting image belonging to a target object and a second handwriting image belonging to other objects are used for training, so that the discriminator and the generator are not only positively trained with the first handwriting image as a positive sample, but also negatively trained with the second handwriting image as a negative sample. Therefore, after training in two directions, the generator can generate images more accurately, and the discriminator can more accurately determine whether the target handwriting image to be identified is closer to the first handwriting image and whether it is farther away from the second handwriting image. Therefore, without being limited to the labeled data set, the discriminator can perform handwriting identification more accurately, thereby improving the accuracy of the identification results output by the discriminator.
[0073] Specific, combined Figure 3 The data flow diagram shown in the figure, the adversarial network can be trained in the following ways, such as Figure 4 As shown in:
[0074] Step 401: Provide the first handwriting image to the generator so that the generator generates a third handwriting image.
[0075] Among them, the generator can be built based on a lightweight U-Net network. As shown in Table 1, the generator includes network layers such as input layer, convolution layer, pooling layer, upsampling layer, connection layer, and output layer. The output size of each network layer is small, such as lightweight sizes such as 256*256*4. Correspondingly, the number of parameters of each network layer is also lightweight. In this way, when the generator generates a third handwriting image similar to the first handwriting image, it can reduce the amount of data processing, thereby reducing power consumption.
[0076] Table 1 Network structure of the generator
[0077] Network Layer Output size Parameter quantity Input (None,256,256,4) 0 Conv2D (Convolutional Layer) (None,128,128,64) 1792 MaxPooling2D (Pooling layer) (None,64,64,64) 0 Conv2D (Convolutional Layer) (None,64,64,128) 73856 MaxPooling2D (Pooling layer) (None,32,32,128) 0 Conv2D (Convolutional Layer) (None,32,32,256) 295168 UpSampling2D (Upsampling layer) (None,64,64,256) 0 Concatenate (None,64,64,384) 0 Conv2D (Convolutional Layer) (None,64,64,128) 442496 UpSampling2D (Upsampling layer) (None,128,128,128) 0 Concatenate (None,128,128,192) 0 Conv2D (Convolutional Layer) (None,128,128,64) 110656 UpSampling2D (Upsampling layer) (None,256,256,64) 0 Concatenate (None,256,256,96) 0 Conv2D (Convolutional Layer) (None,256,256,4) 1731
[0078] Step 402: providing the first handwriting image, the second handwriting image and the third handwriting image to a discriminator, so that the discriminator generates a first high-dimensional feature vector, a second high-dimensional feature vector and a third high-dimensional feature vector.
[0079] The first high-dimensional feature vector corresponds to the first handwriting image, the second high-dimensional feature vector corresponds to the second handwriting image, and the third high-dimensional feature vector corresponds to the third handwriting image.
[0080] Specifically, the discriminator can be constructed based on the VGG (Visual Geometry Group) network. As shown in Table 2, the discriminator includes structures such as an input layer, a convolution layer, a pooling layer, a flattening layer, a fully connected layer, and an output layer. The output size of each network layer is relatively small. For example, the output size of the input layer is a lightweight size of 256*256*4. For another example, the high-dimensional feature vector of the penultimate fully connected layer is a lightweight high-dimensional vector of 512*1. Based on this, the high-dimensional feature vector corresponding to each handwriting image in this embodiment can be obtained in the fully connected layer of the discriminator.
[0081] Table 2 Network structure of the discriminator
[0082] Network Layer Output size Input (None,256,256,4) Conv2D (Convolutional Layer) (None,256,256,64) Conv2D (Convolutional Layer) (None,256,256,64) MaxPooling2D (Pooling layer) (None,128,128,64) Conv2D (Convolutional Layer) (None,128,128,128) Conv2D (Convolutional Layer) (None,128,128,128) MaxPooling2D (Pooling layer) (None,64,64,128) Conv2D (Convolutional Layer) (None,64,64,256) Conv2D (Convolutional Layer) (None,64,64,256) MaxPooling2D (Pooling layer) (None,32,32,256) Flatten (None,262144) Dense (fully connected) (None,512) Dense (fully connected) (None,1)
[0083] Step 403: Obtain a contrast loss function value according to the first high-dimensional feature vector, the second high-dimensional feature vector, and the third high-dimensional feature vector.
[0084] The contrast loss function value represents the degree to which the third handwriting image is close to the first handwriting image and the degree to which the third handwriting image is far away from the second handwriting image. For example, the smaller the contrast loss function value, the closer the third handwriting image is to the first handwriting image and the farther the third handwriting image is from the second handwriting image.
[0085] Specifically, in step 403, the contrast loss function value can be obtained according to formula (1):
[0086]
[0087] Among them, L q is the contrast loss function value, q is the third high-dimensional feature vector corresponding to the third handwriting image, k + is the first high-dimensional feature vector corresponding to the first handwriting image, k i is the second high-dimensional feature vector corresponding to the ith second handwriting image, K is the total number of second handwriting images, τ is a preset coefficient, τ can also be called a temperature coefficient, which can be set specifically based on experience.
[0088] Step 404: Optimize the generator and the discriminator according to the contrast loss function value.
[0089] Specifically, in step 404, the model parameters of the generator and the discriminator can be adjusted according to the contrast loss function value to optimize the generator and the discriminator until the contrast loss function value meets the optimization convergence condition.
[0090] The optimization convergence condition may include at least one of the following:
[0091] The difference between the contrast loss function values obtained twice in a row is less than the convergence threshold;
[0092] The contrast loss function value approaches the first value;
[0093] The contrast loss function value is less than or equal to the second value.
[0094] Therefore, in this embodiment, by comparing the loss function value, the handwriting image generated by the generator can be as close as possible to the first handwriting image in the feature space, and as far away as possible from the handwriting images of other objects. Based on this, the discriminator trained can output the identification result of the target handwriting image more accurately.
[0095] In one implementation, in step 402, while providing the first handwriting image, the second handwriting image, and the third handwriting image to the discriminator, the handwriting speed information corresponding to the first handwriting image, the handwriting speed information corresponding to the second handwriting image, and the handwriting speed information corresponding to the third handwriting image are also provided to the discriminator, so that the discriminator generates a first high-dimensional feature vector, a second high-dimensional feature vector, and a third high-dimensional feature vector, such as Figure 5 as shown in .
[0096] Specifically, the discriminator can generate a first high-dimensional feature vector based on the first handwriting image and its corresponding handwriting speed information, generate a second high-dimensional feature vector based on the second handwriting image and its corresponding handwriting speed information, and generate a third high-dimensional feature vector based on the third handwriting image and its corresponding handwriting speed information.
[0097] The handwriting speed information corresponding to the third handwriting image is consistent with the handwriting speed information corresponding to the first handwriting image.
[0098] For example, Figure 6As shown in , the handwriting images in the training samples all correspond to handwriting speed information, and the handwriting speed information represents the speed at which the handwriting in the corresponding handwriting image is input, such as the speed information of the user inputting the handwriting, and the handwriting speed information corresponding to the third handwriting image generated by the generator uses the handwriting speed information corresponding to the first handwriting image. After the generator generates the third handwriting image for the first handwriting image, the first handwriting image and its corresponding handwriting speed information, the second handwriting image and its corresponding handwriting speed information, and the third handwriting image and its corresponding handwriting speed information are respectively provided to the discriminator, and the discriminator generates a first high-dimensional feature vector according to the first handwriting image and its corresponding handwriting speed information, and generates a second high-dimensional feature vector according to the second handwriting image and its corresponding handwriting speed information, and generates a third high-dimensional feature vector according to the third handwriting image and its corresponding handwriting speed information. Based on this, in this embodiment, according to the first high-dimensional feature vector, the second high-dimensional feature vector and the third high-dimensional feature vector, the contrast loss function value can be obtained through the above formula (1), and then, according to the contrast loss function value, the generator and the discriminator are optimized until the contrast loss function value meets the optimization convergence condition.
[0099] Based on this, in step 101, while the target handwriting image to be identified is transmitted to the discriminator in the adversarial network, the handwriting speed information corresponding to the target handwriting image is also transmitted to the discriminator, so that the discriminator outputs the identification result according to the target handwriting image and its corresponding handwriting speed information.
[0100] The handwriting speed information corresponding to the target handwriting image can be obtained by input detection when the input handwriting in the target handwriting image is input. For example, when a user signs at a bank counter, the handwriting input speed of the user's handwriting signature on the writing board is detected, and the obtained handwriting speed information can be expressed by the length of the handwriting line input per unit time.
[0101] Therefore, in this embodiment, the handwriting speed information is also added to the input of the discriminator as a reference data for handwriting identification, thereby improving the accuracy of the handwriting identification performed by the discriminator.
[0102] refer to Figure 7 , is a flowchart of an implementation of a training method for an adversarial network provided in an embodiment of the present application, and the training method can be applied to electronic devices capable of data processing, such as computers or servers. The technical solution in this embodiment is mainly used to improve the accuracy of handwriting identification by the trained discriminator.
[0103] Specifically, the training method in this embodiment may include the following process:
[0104] Step 701: Transmit a first handwriting image belonging to a target object in a training sample to a generator in an adversarial network, so that the generator generates a third handwriting image for the first handwriting image.
[0105] Step 702: The third handwriting image, the first handwriting image, and the second handwriting image belonging to other objects in the training sample are transmitted to the discriminator in the adversarial network, so that the discriminator determines whether the third handwriting image is close to the first handwriting image, and determines whether the third handwriting image is far away from the second handwriting image, so as to obtain a determination result.
[0106] Step 703: Optimize the generator and the discriminator according to the discrimination result.
[0107] The optimized discriminator is used to output an identification result of whether the target handwriting image belongs to the target object according to the target handwriting image to be identified. In a specific implementation, the identification result can be represented by the contrast loss function value mentioned above.
[0108] In one implementation, in this embodiment, the first handwriting image can be provided to the generator so that the generator generates a third handwriting image; then, the first handwriting image, the second handwriting image and the third handwriting image are provided to the discriminator so that the discriminator generates a first high-dimensional feature vector, a second high-dimensional feature vector and a third high-dimensional feature vector; the first high-dimensional feature vector corresponds to the first handwriting image, the second high-dimensional feature vector corresponds to the second handwriting image, and the third high-dimensional feature vector corresponds to the third handwriting image; then, according to the first high-dimensional feature vector, the second high-dimensional feature vector and the third high-dimensional feature vector, a contrast loss function value is obtained; the contrast loss function value represents the degree to which the third handwriting image is close to the first handwriting image and the degree to which the third handwriting image is far away from the second handwriting image, for example, the contrast loss function value is obtained according to formula (1); finally, according to the contrast loss function value, the generator and the discriminator are optimized.
[0109] Furthermore, in this embodiment, while providing the first handwriting image, the second handwriting image and the third handwriting image to the discriminator, the handwriting speed information corresponding to the first handwriting image, the handwriting speed information corresponding to the second handwriting image and the handwriting speed information corresponding to the third handwriting image are also provided to the discriminator, so that the discriminator generates a first high-dimensional feature vector according to the first handwriting image and its corresponding handwriting speed information, generates a second high-dimensional feature vector according to the second handwriting image and its corresponding handwriting speed information, and generates a third high-dimensional feature vector according to the third handwriting image and its corresponding handwriting speed information; based on this, after obtaining the contrast loss function value, the generator and the discriminator are optimized according to the contrast loss function value.
[0110] Correspondingly, in this embodiment, while transmitting the target handwriting image to be identified to the discriminator in the adversarial network, the handwriting speed information corresponding to the target handwriting image is also transmitted to the discriminator, so that the discriminator outputs the identification result based on the target handwriting image and its corresponding handwriting speed information.
[0111] It should be noted that the specific training method of the adversarial network can refer to the corresponding technical content in the previous article and will not be described in detail here.
[0112] It can be seen from the above technical scheme that in a training method for an adversarial network provided by the present application, for the adversarial network, a first handwriting image belonging to a target object and a second handwriting image belonging to other objects are used for training, so that the discriminator and the generator are not only positively trained with the first handwriting image as a positive sample, but also negatively trained with the second handwriting image as a negative sample. Therefore, after training in two directions, the generator can generate images more accurately, and the discriminator can more accurately judge whether the target handwriting image to be identified is closer to the first handwriting image and whether it is farther away from the second handwriting image. Therefore, without being limited to the labeled data set, the discriminator can perform handwriting identification more accurately, thereby improving the accuracy of the identification results output by the discriminator.
[0113] refer to Figure 8 , is an architecture diagram of an adversarial network provided in an embodiment of the present application, and the adversarial network may include the following structure:
[0114] A generator 801 is used to generate a third handwriting image for a first handwriting image belonging to a target object in a training sample;
[0115] The discriminator 802 is used to determine whether the third handwriting image is close to the first handwriting image, and to determine whether the third handwriting image is far away from the second handwriting image belonging to other objects in the training sample, so as to obtain a determination result; the determination result is used to optimize the generator 801 and the discriminator 802;
[0116] The optimized discriminator 802 is used to output an identification result of whether the target handwriting image belongs to the target object according to the target handwriting image to be identified.
[0117] It should be noted that the training method of the adversarial network can refer to the corresponding technical content in the previous article and will not be described in detail here.
[0118] It can be seen from the above technical solution that in an adversarial network provided by the present application, the adversarial network is trained with a first handwriting image belonging to a target object and a second handwriting image belonging to other objects, so that the discriminator and the generator are not only positively trained with the first handwriting image as a positive sample, but also negatively trained with the second handwriting image as a negative sample. After training in two directions, the generator can generate images more accurately, and the discriminator can more accurately judge whether the target handwriting image to be identified is closer to the first handwriting image and whether it is farther away from the second handwriting image. Therefore, the discriminator can perform handwriting identification more accurately, thereby improving the accuracy of the identification result output by the discriminator.
[0119] A handwriting identification method based on an adversarial network provided in an embodiment of the present application is introduced above. A device for executing the handwriting identification method based on an adversarial network is introduced below.
[0120] See also Fig. 9 , is a schematic diagram of the structure of a handwriting identification device based on an adversarial network provided in an embodiment of the present application. The device can be configured in an electronic device deployed with an adversarial network, or configured in an electronic device connected to a server deployed with an adversarial network, such as a mobile phone, a tablet computer, a notebook or a server. The technical solution in this embodiment is mainly used to improve the accuracy of handwriting identification.
[0121] Specifically, the device in this embodiment may include the following units:
[0122] The target transmission unit 901 is used to transmit the target handwriting image to be identified to the discriminator in the adversarial network;
[0123] A result obtaining unit 902 is used to obtain the identification result output by the discriminator, wherein the identification result indicates whether the target handwriting image belongs to the target object;
[0124] In which, the adversarial network also includes a generator, and the generator and the discriminator are trained using training samples, and the training samples include a first handwriting image belonging to the target object and a second handwriting image belonging to other objects; the generator is used to generate a third handwriting image for the first handwriting image, and the discriminator is used to determine whether the third handwriting image is close to the first handwriting image and whether the third handwriting image is far away from the second handwriting image to obtain a determination result, and the determination result is used to optimize the generator and the discriminator.
[0125] It can be seen from the above technical solution that in a handwriting identification device based on an adversarial network provided by the present application, for the adversarial network, a first handwriting image belonging to a target object and a second handwriting image belonging to other objects are used for training, so that the discriminator and the generator are not only positively trained with the first handwriting image as a positive sample, but also negatively trained with the second handwriting image as a negative sample. Therefore, after training in two directions, the generator can generate images more accurately, and the discriminator can more accurately determine whether the target handwriting image to be identified is closer to the first handwriting image and whether it is farther away from the second handwriting image. Therefore, without being limited to the labeled data set, the discriminator can perform handwriting identification more accurately, thereby improving the accuracy of the identification result output by the discriminator.
[0126] The above introduces a training method for an adversarial network provided in an embodiment of the present application. The following will introduce a device for executing the above-mentioned training method for an adversarial network.
[0127] refer to Fig.10 , is a schematic diagram of the structure of a training device for an adversarial network provided in an embodiment of the present application, and the training device can be deployed in an electronic device capable of data processing, such as a computer or a server. The technical solution in this embodiment is mainly used to improve the accuracy of handwriting identification by the trained discriminator.
[0128] Specifically, the training device in this embodiment may include the following units:
[0129] A first transmission unit 1001 is used to transmit a first handwriting image belonging to a target object in a training sample to a generator in the adversarial network, so that the generator generates a third handwriting image for the first handwriting image;
[0130] The second transmission unit 1002 is used to transmit the third handwriting image, the first handwriting image and the second handwriting image belonging to other objects in the training sample to the discriminator in the adversarial network, so that the discriminator determines whether the third handwriting image is close to the first handwriting image, and determines whether the third handwriting image is far from the second handwriting image, so as to obtain a determination result;
[0131] An optimization control unit 1003, configured to optimize the generator and the discriminator according to the discrimination result;
[0132] The optimized discriminator is used to output an identification result of whether the target handwriting image belongs to the target object according to the target handwriting image to be identified.
[0133] In one implementation, the first transmission unit 1001 can provide the first handwriting image to the generator so that the generator generates the third handwriting image; then, the second transmission unit 1002 provides the first handwriting image, the second handwriting image and the third handwriting image to the discriminator, so that the discriminator generates the first high-dimensional feature vector, the second high-dimensional feature vector and the third high-dimensional feature vector; the first high-dimensional feature vector corresponds to the first handwriting image, the second high-dimensional feature vector corresponds to the second handwriting image, and the third high-dimensional feature vector corresponds to the third handwriting image; and according to the first high-dimensional feature vector, the second high-dimensional feature vector and the third high-dimensional feature vector, a contrast loss function value is obtained; the contrast loss function value represents the degree to which the third handwriting image is close to the first handwriting image and the degree to which the third handwriting image is far away from the second handwriting image, for example, the contrast loss function value is obtained according to formula (1); finally, the optimization control unit 1003 optimizes the generator and the discriminator according to the contrast loss function value.
[0134] Furthermore, the second transmission unit 1002, while providing the first handwriting image, the second handwriting image and the third handwriting image to the discriminator, also provides the handwriting speed information corresponding to the first handwriting image, the handwriting speed information corresponding to the second handwriting image and the handwriting speed information corresponding to the third handwriting image to the discriminator, so that the discriminator generates a first high-dimensional feature vector according to the first handwriting image and its corresponding handwriting speed information, generates a second high-dimensional feature vector according to the second handwriting image and its corresponding handwriting speed information, and generates a third high-dimensional feature vector according to the third handwriting image and its corresponding handwriting speed information; based on this, after obtaining the contrast loss function value, the optimization control unit 1003 optimizes the generator and the discriminator according to the contrast loss function value.
[0135] Correspondingly, in this embodiment, while transmitting the target handwriting image to be identified to the discriminator in the adversarial network, the handwriting speed information corresponding to the target handwriting image is also transmitted to the discriminator, so that the discriminator outputs the identification result based on the target handwriting image and its corresponding handwriting speed information.
[0136] It should be noted that the specific training method of the adversarial network can refer to the corresponding technical content in the previous article and will not be described in detail here.
[0137] It can be seen from the above technical scheme that in a training device for an adversarial network provided by the present application, for the adversarial network, a first handwriting image belonging to a target object and a second handwriting image belonging to other objects are used for training, so that the discriminator and the generator are not only positively trained with the first handwriting image as a positive sample, but also negatively trained with the second handwriting image as a negative sample. Therefore, after training in two directions, the generator can generate images more accurately, and the discriminator can more accurately judge whether the target handwriting image to be identified is closer to the first handwriting image and whether it is farther away from the second handwriting image. Therefore, without being limited to the labeled data set, the discriminator can perform handwriting identification more accurately, thereby improving the accuracy of the identification result output by the discriminator.
[0138] The present application also provides an electronic device, characterized in that it includes at least one processor and a memory connected to the processor, wherein:
[0139] The memory is used to store computer programs;
[0140] The processor is used to execute the computer program so that the electronic device can implement the handwriting identification method based on the adversarial network described above, and can also implement the adversarial network training method described above.
[0141] The present application also provides an electronic device in an embodiment. Fig.11 As shown, it shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present application. The electronic device in the embodiments of the present application may include but is not limited to fixed terminals such as mobile phones, notebook computers, PDAs (personal digital assistants), PADs (tablet computers), desktop computers, etc. Fig.11 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0142] like Fig.11 As shown, the electronic device may include a processing device (such as a central processing unit, a graphics processing unit, etc.) 1101, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1102 or a program loaded from a storage device 1108 to a random access memory (RAM) 1103, so as to implement the handwriting identification method based on an adversarial network and the training method of an adversarial network described above. When the electronic device is powered on, various programs and data required for the operation of the electronic device are also stored in RAM 1103. The processing device 1101, ROM 1102 and RAM 1103 are connected to each other via a bus 1104. An input / output (I / O) interface 1105 is also connected to the bus 1104.
[0143] Typically, the following devices may be connected to the I / O interface 1105: an input device 1106 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 1107 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 1108 including, for example, a memory card, a hard disk, etc.; and a communication device 1109. The communication device 1109 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although Fig.11 An electronic device having various devices is shown, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0144] Also provided in an embodiment of the present application is a computer program product including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device can implement any one of the handwriting identification methods based on the adversarial network provided in the embodiment of the present application, and can also implement the training method of the adversarial network provided in the embodiment of the present application.
[0145] A computer-readable storage medium is also provided in an embodiment of the present application. The storage medium carries one or more computer programs. When one or more computer programs are executed by an electronic device, the electronic device can implement any one of the handwriting identification methods based on the adversarial network provided in the embodiment of the present application, and can also implement the adversarial network training method provided in the embodiment of the present application.
[0146] Taking the handwriting identification scenario in the financial field as an example, the technical solution of this application is described below:
[0147] In the technical solution of this application, a handwriting identification method based on a contrastive learning network (i.e., adversarial network) can be designed for bank counter and machine business by integrating speed information, using a generative adversarial network (GAN) as the main framework, including a generator and a discriminator. The generator adopts a lightweight U-Net structure to achieve efficient feature extraction and image reconstruction, and the discriminator draws on the VGG network structure to determine whether the generated handwriting is a real signature. The generator and discriminator in the handwriting identification network (i.e., adversarial network) are introduced in detail below.
[0148] (I) Generator:
[0149] The generator is a key component in the handwriting identification network. Its task is to receive the input handwriting image and generate an image similar to the real signature. The technical solution of this application uses a lightweight U-Net network as a generator, which has the advantages of fast reasoning, low memory usage, and high flexibility. Due to the addition of signature speed data in the network input layer, the input size is set to 256×256×4, which is different from the three channels of traditional images. As shown in Table 1, it is the network structure of the generator.
[0150] The generator consists of a decoder and an encoder. The encoder is responsible for extracting the abstract feature representation of the input signature image (i.e., the handwriting image), while the decoder maps these features to the generated signature image. Through the deconvolution layer (i.e., upsampling layer) and the jump connection mechanism, the generator can effectively retain the details of the input image and generate a synthetic image similar to the real signature. In addition, since the generator adopts a lightweight structure, it can achieve efficient handwriting image generation by reducing the number of channels, layers, and parameters while keeping the basic structure unchanged.
[0151] (II) Discriminator:
[0152] The discriminator is another key component in the handwriting identification network. Its task is to determine whether the generated handwriting image is a real signature. In the technical solution of this application, the structure of the discriminator refers to the VGG network, using convolutional layers, pooling layers and fully connected layers to extract and discriminate image features. As shown in Table 2, this is the network structure of the discriminator.
[0153] In the network structure shown in Table 2, the discriminator gradually extracts the features of the input image through convolution and pooling layers, and finally outputs a scalar value to indicate whether the image is a real signature. The discriminator can identify the generated handwriting images, thereby driving the generator to continuously optimize and generate realistic signature images. This adversarial mechanism prompts the generator and the discriminator to continuously compete and learn, and ultimately enables the generator to accurately imitate the features of a real signature, while the discriminator can also more accurately distinguish between real and fake signatures.
[0154] The confrontation between the generator and the discriminator enables the handwriting identification network to be continuously optimized. The generator uses a lightweight U-Net structure to achieve efficient handwriting image generation, while the discriminator uses a VGG network structure to achieve accurate judgment of the generated image. Together, the two form an effective handwriting identification system.
[0155] 3. Contrastive learning strategy:
[0156] Contrastive learning aims to design a contrastive loss function so that the generated signature image is close to the positive sample and far away from the negative sample in the feature space. In the process of adversarial learning, the generator can generate signature images more realistically, and the discriminator's ability to identify forged signatures is gradually enhanced. Fig.12 The overall network structure diagram shown in the figure specifically includes the following steps:
[0157] (1) Positive and negative sample selection: During the training process, the real signature image is used as the positive sample, and the signature images of other individuals in the dataset are used as negative samples and passed into the discriminator network for processing.
[0158] (2) Contrastive loss function: Design a contrastive loss function for the generated signature image (i.e., anchor, the third handwriting image in the above text), the real signature image (i.e., the first handwriting image in the above text), and other individual signature images (i.e., the third handwriting image in the above text). The InfoNCE loss function can be used as the contrastive loss function in the technical solution of the present application, and its expression is shown in formula (1).
[0159] Among them, L q is the contrast loss function value, q is the third high-dimensional feature vector corresponding to the third handwriting image, k + is the first high-dimensional feature vector corresponding to the first handwriting image, k i is the second high-dimensional feature vector corresponding to the i-th second handwriting image, K is the total number of second handwriting images, and τ is a preset coefficient. The contrast loss function makes the generated signature image as close as possible to the real signature image in the feature space, while other individual signature images are as far away as possible.
[0160] (3) Network training: During the training process, the signature images in the training set are preprocessed by cropping and resizing, and then passed into the generator network together with the handwriting speed information to obtain the generated signature image. The generated signature image, the real signature image, and other individual signature images in the data set are then passed into the discriminator network.
[0161] By minimizing the contrast loss function and adjusting the parameters of the generator and discriminator, the generated signature image is closer to the real signature image. The discriminator can learn the difference in texture between the forged signature and the real signature, thereby achieving accurate identification of the signature.
[0162] (IV) Application of handwriting identification network:
[0163] After the network training is completed, the handwriting identification network can be applied in the fields of banking business processing, check verification, etc. In actual applications, only the discriminator part of the handwriting identification network is used. Fig.13 As shown in:
[0164] The customer's real and correct signature is read out from the handwriting database, and the handwriting image of the signature to be authenticated and its corresponding handwriting speed information are transmitted to the discriminator in the handwriting authentication network. The discriminator in the handwriting authentication network outputs the corresponding processing result, and the authentication result of whether the signature to be authenticated is true or false can be obtained.
[0165] It can be seen that this application constructs a handwriting identification system through a comparative learning network. In view of the characteristics of signature information stored in bank counters and machine services containing speed data, speed data is integrated in the training and application of the handwriting identification system, which has the following advantages:
[0166] 1. Solve the problem of insufficient samples: The contrastive learning network constructs positive and negative sample pairs, allowing the network to learn more robust feature representations from a small number of contrast samples. This is because in contrastive learning, the network needs to distinguish between sample pairs of the same category and sample pairs of different categories, so as to learn more discriminative feature representations. The handwriting identification task has the problem of difficult data annotation, and it is often impossible to build a large-scale data set. Even if there are fewer training samples, the handwriting identification network using contrastive learning can better utilize data for feature learning.
[0167] 2. Sufficient feature learning: Contrastive learning networks require the network to emphasize the similarities between samples of the same category and highlight the differences between samples of different categories. This constraint enables the network to learn more discriminative and robust feature representations, thereby improving the deficiencies of traditional convolutional neural networks in feature learning. Therefore, this application can achieve better results in distinguishing different fonts, handwriting styles, and specific writing features.
[0168] 3. Strong ability to resist interference: The positive and negative sample settings of contrastive learning force the network to learn to maintain the similarity of samples of the same category and the difference of samples of different categories when facing interference and noise. Interference factors such as rotation, scaling, and displacement are very common in handwriting identification tasks. This learning method makes the handwriting identification network more stable when resisting various interferences.
[0169] 4. Data labeling difficulties: Contrastive learning networks usually only require a small amount of labeling information, or even only a pair of specimen labeling information, to be effectively trained. This reduces the reliance on large-scale labeled data and alleviates the problem of data labeling difficulties.
[0170] 5. Integration of speed data: This application integrates speed information in the handwriting identification system, so that the network can learn and understand subtle changes in strokes, such as stroke strength, thereby improving the ability to capture the handwriting characteristics of different individuals. In addition, integrating speed information may promote the generalization ability of the network, allowing the network to better adapt to handwriting recognition under various writing styles and conditions, thereby improving its applicability in real scenarios. Finally, in actual application, speed information provides the network with more effective information and increases the accuracy of the model.
[0171] In general, the contrastive learning network emphasizes the similarities of samples in the same category and the differences of samples in different categories, as well as its advantages in capturing feature representation, so that the network can obtain better generalization ability, robustness and small sample learning ability in handwriting identification tasks. The ability to capture and generalize the subtle features of handwriting by integrating speed data in the handwriting identification system directly leads to the contrastive learning network that integrates speed information to perform better in dealing with many challenges in handwriting identification tasks. In contrast, the existing methods are limited by the shortcomings of insufficient samples, insufficient feature learning, weak anti-interference ability, and difficulty in data labeling, and their performance will be limited.
[0172] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.
[0173] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0174] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0175] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.
Claims
1. A handwriting identification method based on adversarial network, characterized in that: The method comprises: The target handwriting image to be identified is transmitted to the discriminator in the adversarial network; Obtaining an identification result output by the discriminator, wherein the identification result indicates whether the target handwriting image belongs to a target object; In which, the adversarial network also includes a generator, and the generator and the discriminator are trained using training samples, and the training samples include a first handwriting image belonging to the target object and a second handwriting image belonging to other objects; the generator is used to generate a third handwriting image for the first handwriting image, and the discriminator is used to determine whether the third handwriting image is close to the first handwriting image and whether the third handwriting image is far away from the second handwriting image to obtain a determination result, and the determination result is used to optimize the generator and the discriminator.
2. The method according to claim 1, characterized in that The adversarial network is trained in the following way: providing the first handwriting image to the generator so that the generator generates a third handwriting image; The first handwriting image, the second handwriting image and the third handwriting image are provided to the discriminator, so that the discriminator generates a first high-dimensional feature vector, a second high-dimensional feature vector and a third high-dimensional feature vector; the first high-dimensional feature vector corresponds to the first handwriting image, the second high-dimensional feature vector corresponds to the second handwriting image, and the third high-dimensional feature vector corresponds to the third handwriting image; Obtaining a contrast loss function value according to the first high-dimensional feature vector, the second high-dimensional feature vector and the third high-dimensional feature vector; the contrast loss function value represents the degree to which the third handwriting image is close to the first handwriting image and the degree to which the third handwriting image is far away from the second handwriting image; The generator and the discriminator are optimized according to the contrast loss function value.
3. The method according to claim 2, characterized in that Obtaining a contrast loss function value according to the first high-dimensional feature vector, the second high-dimensional feature vector, and the third high-dimensional feature vector, including: according to Get the contrast loss function value; Among them, L q is the contrast loss function value, q is the third high-dimensional feature vector corresponding to the third handwriting image, k + is the first high-dimensional feature vector corresponding to the first handwriting image, k i is the second high-dimensional feature vector corresponding to the ith second handwriting image, K is the total number of the second handwriting images, and τ is a preset coefficient.
4. The method according to claim 2, characterized in that: While providing the first handwriting image, the second handwriting image and the third handwriting image to the discriminator, the method further includes: Provide the handwriting speed information corresponding to the first handwriting image, the handwriting speed information corresponding to the second handwriting image, and the handwriting speed information corresponding to the third handwriting image to the discriminator, so that the discriminator generates the first high-dimensional feature vector according to the first handwriting image and the handwriting speed information corresponding to it, generates the second high-dimensional feature vector according to the second handwriting image and the handwriting speed information corresponding to it, and generates the third high-dimensional feature vector according to the third handwriting image and the handwriting speed information corresponding to it; Wherein, while transmitting the target handwriting image to be identified to the discriminator in the adversarial network, the method further includes: The handwriting speed information corresponding to the target handwriting image is transmitted to the discriminator, so that the discriminator outputs the identification result according to the target handwriting image and the handwriting speed information corresponding thereto.
5. The method according to claim 4, characterized in that The handwriting speed information represents the speed at which the handwriting in the corresponding handwriting image is input; The handwriting speed information corresponding to the third handwriting image is consistent with the handwriting speed information corresponding to the first handwriting image.
6. A training method for an adversarial network, characterized in that: include: Transmitting a first handwriting image belonging to a target object in a training sample to a generator in the adversarial network, so that the generator generates a third handwriting image for the first handwriting image; Transmitting the third handwriting image, the first handwriting image, and the second handwriting image belonging to other objects in the training sample to the discriminator in the adversarial network, so that the discriminator determines whether the third handwriting image is close to the first handwriting image, and determines whether the third handwriting image is far from the second handwriting image, so as to obtain a determination result; According to the discrimination result, optimizing the generator and the discriminator; The optimized discriminator is used to output an identification result of whether the target handwriting image belongs to the target object according to the target handwriting image to be identified.
7. An adversarial network, characterized in that: include: A generator, for generating a third handwriting image for a first handwriting image belonging to a target object in a training sample; A discriminator, used to determine whether the third handwriting image is close to the first handwriting image, and to determine whether the third handwriting image is far away from the second handwriting image belonging to other objects in the training sample, so as to obtain a determination result; the determination result is used to optimize the generator and the discriminator; The optimized discriminator is used to output an identification result of whether the target handwriting image belongs to the target object according to the target handwriting image to be identified.
8. A handwriting identification device based on adversarial network, characterized in that: include: A target transmission unit, used for transmitting the target handwriting image to be identified to the discriminator in the adversarial network; A result obtaining unit, used for obtaining the identification result output by the discriminator, wherein the identification result indicates whether the target handwriting image belongs to the target object; The adversarial network further includes a generator, the generator and the discriminator are trained using training samples, and the training samples include a first handwriting image belonging to the target object and a second handwriting image belonging to other objects; The generator is used to generate a third handwriting image based on the first handwriting image, and the discriminator is used to determine whether the third handwriting image is close to the first handwriting image and whether the third handwriting image is far away from the second handwriting image to obtain a determination result, and the determination result is used to optimize the generator and the discriminator.
9. A training device for an adversarial network, characterized in that: include: A first transmission unit, configured to transmit a first handwriting image belonging to a target object in a training sample to a generator in the adversarial network, so that the generator generates a third handwriting image for the first handwriting image; a second transmission unit, used for transmitting the third handwriting image, the first handwriting image and the second handwriting image belonging to other objects in the training sample to the discriminator in the adversarial network, so that the discriminator determines whether the third handwriting image is close to the first handwriting image, and determines whether the third handwriting image is far from the second handwriting image, so as to obtain a determination result; An optimization control unit, used for optimizing the generator and the discriminator according to the discrimination result; The optimized discriminator is used to output an identification result of whether the target handwriting image belongs to the target object according to the target handwriting image to be identified.
10. An electronic device, characterized in that: The method comprises at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program so that the electronic device can implement the handwriting identification method based on the adversarial network as described in any one of claims 1 to 5.