Identification method for adaptively reducing complex light and shadow interference and related device
1. An identification method for adaptively reducing complex light and shadow interference, comprising:
s1, inputting the original image into a noise generator for processing to obtain a noise image;
s2, inputting the original image and the noise image into a preset discrimination network with an original discrimination algorithm for discrimination to obtain a first output result;
s3, inputting the first output result and the original image into the noise generator for processing to obtain a second output result, replacing the second output result with the noise image, and returning to the step S2 for iteration until a preset iteration number is reached to obtain a final identification algorithm.
2. The adaptive complex light and shadow interference reduction recognition method of claim 1, wherein the preset discrimination network is composed of an image preprocessing module, a recognition layer, a convolution layer, a normalization layer and an activation function layer.
3. The adaptive identification method for reducing the complex light and shadow interference according to claim 2, wherein the inputting the original image and the noise image into a preset discrimination network with an original identification algorithm for identification to obtain a first output result specifically comprises:
s01, preprocessing the original image and the noise image through the image preprocessing module, inputting the preprocessed images into the recognition layer to be processed to obtain a one-dimensional vector, and removing the last layer of the one-dimensional vector;
and S02, taking the one-dimensional vector as an input of a convolution layer, and sequentially processing the convolution layer, the normalization layer and the activation function layer to obtain the first output result.
4. The adaptive reduction complex light and shadow interference identification method of claim 1, wherein the loss function of the noise generator is:
wherein F (x) represents a class probability vector calculated by using a softmax function, G (x) represents the noise interference degree of an input image, delta represents the gradient of the current class probability of the input image relative to a label, and cgIs a hyper-parameter.
5. The adaptive identification method for reducing the complex light and shadow interference according to claim 1, wherein the classifier of the preset discriminant network is a cross entropy function, and the cross entropy function is:
J(θf,x,y)=-logF(x;θf)y;
where x and y represent pixels of two pictures, respectively, and f (x) represents a category probability vector calculated using the softmax function.
6. An adaptive reduced complex light and shadow interference identification system, comprising:
the noise adding module is used for inputting the original image into the noise generator for processing to obtain a noise image;
the judging module is used for inputting the original image and the noise image into a preset judging network with an original identification algorithm for identification to obtain a first output result;
and the training module is used for inputting the first output result and the original image into the noise generator for processing to obtain a second output result, replacing the second output result with the noise image, and triggering the judging module to iterate until a preset iteration number is reached to obtain a final identification algorithm.
7. The adaptive identification system for reducing complex light and shadow interference of claim 1, wherein the determining module is specifically configured to:
s01, preprocessing the original image and the noise image through the image preprocessing module, inputting the preprocessed images into the recognition layer to be processed to obtain a one-dimensional vector, and removing the last layer of the one-dimensional vector;
and S02, taking the one-dimensional vector as an input of a convolution layer, and sequentially processing the convolution layer, the normalization layer and the activation function layer to obtain the first output result.
8. The adaptive reduction complex light and shadow interference identification system of claim 1, wherein the loss function of the noise generator is:
wherein F (x) represents a class probability vector calculated by using a softmax function, G (x) represents the noise interference degree of an input image, delta represents the gradient of the current class probability of the input image relative to a label, and cgIs a hyper-parameter.
9. An identification device for adaptively reducing complex light and shadow interference, the device comprising a processor and a memory:
the memory is used for storing program codes and transmitting the program codes to the processor;
the processor is configured to execute the identification method for adaptively reducing the complex light and shadow interference according to any one of claims 1 to 5 according to instructions in the program code.
10. A computer-readable storage medium for storing a program code for executing the adaptive complex light and shadow interference reduction identification method according to any one of claims 1 to 5.
Background
Deep learning has been widely used in various fields in recent years, such as self-driving automobiles, monitoring, malicious code detection, unmanned aerial vehicles and robots, voice instruction recognition, and the like. Although deep learning networks have increasingly high classification accuracy, they have also been found to be extremely susceptible to perturbations. For example, the image classification model is easily affected by complex light, which results in an error in the classification result.
The existing methods for improving the interference under the complex light and shadow conditions have different coping strategies according to different situations, researchers are required to specially study different characteristics of different situations so as to select different methods for improving the interference, such as a method for modifying a training process, data compression and data randomization, so that the working efficiency is not high enough, and the labor cost is high.
Therefore, a method for identifying a target object with reduced interference caused by complicated light and shadow under various scenes is needed.
Disclosure of Invention
The application provides an identification method and a related device for adaptively reducing complex light and shadow interference, which are used for solving the technical problem that the prior art cannot reduce the complex light and shadow interference under various scenes so as to keep a good identification effect.
In view of the above, a first aspect of the present application provides an identification method for adaptively reducing complex light and shadow interference, where the method includes:
s1, inputting the original image into a noise generator for processing to obtain a noise image;
s2, inputting the original image and the noise image into a preset discrimination network with an original discrimination algorithm for discrimination to obtain a first output result;
s3, inputting the first output result and the original image into the noise generator for processing to obtain a second output result, replacing the second output result with the noise image, and returning to the step S2 for iteration until a preset iteration number is reached to obtain a final identification algorithm.
Optionally, the preset discrimination network is composed of an image preprocessing module, an identification layer, a convolution layer, a normalization layer, and an activation function layer.
Optionally, the inputting the original image and the noise image into a preset discrimination network with an original recognition algorithm for recognition to obtain a first output result specifically includes:
s01, preprocessing the original image and the noise image through the image preprocessing module, inputting the preprocessed images into the recognition layer to be processed to obtain a one-dimensional vector, and removing the last layer of the one-dimensional vector;
and S02, taking the one-dimensional vector as an input of a convolution layer, and sequentially processing the convolution layer, the normalization layer and the activation function layer to obtain the first output result.
Optionally, the loss function of the noise generator is:
wherein F (x) represents a class probability vector calculated by using a softmax function, G (x) represents the noise interference degree of an input image, delta represents the gradient of the current class probability of the input image relative to a label, and cgIs a hyper-parameter.
Optionally, the classifier of the preset discriminant network is a cross entropy function, and the cross entropy function is:
J(θf,x,y)=-logF(x;θf)y;
where x and y represent pixels of two pictures, respectively, and f (x) represents a category probability vector calculated using the softmax function.
A second aspect of the present application provides an identification system for adaptively reducing complex light and shadow interference, the system comprising:
the noise adding module is used for inputting the original image into the noise generator for processing to obtain a noise image;
the judging module is used for inputting the original image and the noise image into a preset judging network with an original identification algorithm for identification to obtain a first output result;
and the training module is used for inputting the first output result and the original image into the noise generator for processing to obtain a second output result, replacing the second output result with the noise image, and triggering the judging module to iterate until a preset iteration number is reached to obtain a final identification algorithm.
Optionally, the determining module is specifically configured to:
s01, preprocessing the original image and the noise image through the image preprocessing module, inputting the preprocessed images into the recognition layer to be processed to obtain a one-dimensional vector, and removing the last layer of the one-dimensional vector;
and S02, taking the one-dimensional vector as an input of a convolution layer, and sequentially processing the convolution layer, the normalization layer and the activation function layer to obtain the first output result.
Optionally, the loss function of the noise generator is:
wherein F (x) represents a class probability vector calculated by using a softmax function, G (x) represents the noise interference degree of an input image, delta represents the gradient of the current class probability of the input image relative to a label, and cgIs a hyper-parameter.
A third aspect of the present application provides an identification device adapted to reduce complex light and shadow interference, the device comprising a processor and a memory:
the memory is used for storing program codes and transmitting the program codes to the processor;
the processor is configured to perform the steps of the method for adaptively reducing recognition of complex light and shadow interference according to the first aspect.
A fourth aspect of the present application provides a computer-readable storage medium for storing a program code for executing the identification method for adaptively reducing the complex light and shadow interference according to the first aspect.
According to the technical scheme, the method has the following advantages:
the application provides an identification method for adaptively reducing complex light and shadow interference, which comprises the following steps: s1, inputting the original image into a noise generator for processing to obtain a noise image; s2, inputting the original image and the noise image into a preset discrimination network with an original discrimination algorithm for discrimination to obtain a first output result; and S3, inputting the first output result and the original image into a noise generator for processing to obtain a second output result, replacing the second output result with a noise image, and returning to the step S2 for iteration until a preset iteration number is reached to obtain a final identification algorithm. The technical problem that in the prior art, the complex light and shadow interference cannot be reduced under various scenes, and therefore a good identification effect is kept is solved.
The application discloses an identification method for adaptively reducing complex light and shadow interference, which aims to find the optimal noise generator for a preset discrimination network and simultaneously find the optimal preset discrimination network (classifier) for each noise generator. Specifically, the preset discrimination network (original network) is trained directly along a generation network, and the generation network attempts to generate disturbance to the preset discrimination network (original network). In the training process, the preset discrimination network continuously tries to correctly classify the original image and the noise image. Through the training, the original recognition algorithm can adjust the network parameters of the original recognition algorithm, and the anti-interference capability is enough within the range of acceptable recognition effect (namely reaching the preset iteration times), so that the original recognition algorithm can cope with various different scenes, and the effect level of the original recognition algorithm can be kept. Therefore, the technical problem that the prior art cannot reduce the interference of complex light and shadow under various scenes so as to keep a good identification effect is solved.
Drawings
Fig. 1 is a schematic flowchart illustrating an identification method for adaptively reducing complex light and shadow interference according to an embodiment of the present application;
FIG. 2 is a general block diagram of an identification method for adaptively reducing complex light and shadow interference provided in an embodiment of the present application;
fig. 3 is a block diagram of a preset discrimination network provided in an embodiment of the present application;
fig. 4 is a block diagram of an identification system for adaptively reducing complex light and shadow interference according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions of the present application better understood, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Referring to fig. 1, fig. 2 and fig. 3, an identification method for adaptively reducing complex light and shadow interference according to an embodiment of the present application includes:
step 101, inputting the original image into a noise generator for processing to obtain a noise image.
It will be appreciated that the noise generator randomly generates noise and adds the noise to the original image so that the image is disturbed, resulting in a noisy image.
And 102, inputting the original image and the noise image into a preset discrimination network with an original discrimination algorithm for discrimination to obtain a first output result.
It should be noted that the preset discrimination network with the original recognition algorithm is formed by adding an additional network as a new classifier on the basis of the original recognition algorithm, and specifically, the preset discrimination network is formed by an image preprocessing module, a recognition layer (original recognition algorithm), a convolution layer, a normalization layer and an activation function layer.
It can be understood that, firstly, the original image and the noise image are preprocessed by the image preprocessing module, and then input to the recognition layer to be processed to obtain a one-dimensional vector, and the last layer of the one-dimensional vector is removed; and then, taking the one-dimensional vector as the input of the convolution layer, and sequentially processing the convolution layer, the normalization layer and the activation function layer to obtain the first output result.
The function of the method is that: in order to learn the base layer convolution layer of the additional network, self-updating is carried out through continuous self-confrontation classification, so that the additional network is obtained, and then the original recognition algorithm is combined, and finally the method can effectively avoid the interference of complex light and shadow under various scenes on the original recognition algorithm.
The recognition algorithm with the additional network added needs to have more dimension in the output of the additionally added convolutional layer than in the output of the original recognition algorithm, because the modified recognition algorithm can be used as a discriminator in the countermeasure generator and can also keep the function of the classifier of the original recognition algorithm.
As shown in fig. 2, the input of the noise image obtained by the noise generator to the preset discrimination network, and the addition of the original image to the preset discrimination network for identification are performed in order to maintain the accuracy of the original identification algorithm as much as possible, thereby obtaining a first output result, which is input to the noise generator.
And 103, inputting the first output result and the original image into a noise generator for processing to obtain a second output result, replacing the second output result with a noise image, and returning to the step 2 for iteration until a preset iteration number is reached to obtain a final identification algorithm.
It should be noted that, the preset iteration times of the present application are specifically set according to the following: the noise generator and the preset discrimination network finally reach a stable state, and those skilled in the art can set the number of iterations by this, which is not limited herein.
It should be noted that, in the process of iterative training, the purpose of training follows the following formula:
minGmaxD V(D,G)=E[log(D(x))+E[log(1-D(G(y))]]
the above D is the function of the preset discrimination network as a discriminator, and the objective is to determine whether the data is real data or "false data" generated by a noise generator. G represents the noise generated by the noise generator and the noise image after the original picture is added, data are generated through the depth model and conform to the characteristics of target data to be generated as much as possible, and the aim is to enable the discriminator to consider the data generated by the noise generator to be classified into the same type as the target data.
As shown in fig. 2, in the training process, it can be understood in colloquial terms that: in the first stage, the discriminator is first fixed and only the noise generator is trained. In this stage, we input a random vector to the noise generator, continuously generate the image with noise added, and then use the generated false data as the input of the discriminator, which determines whether it is the original image or the image with noise added.
Since the noise generator generates a noise image that is greatly different from the original image data at the beginning, even if the discriminator is not trained, it is possible to determine whether the data is the original image. With the training process being continued, the difference between the data generated by the noise generator and the original image is closer and closer, and at this time, the discriminator cannot judge whether the data is generated by the noise generator.
This time the second stage, the stationary noise generator, trains the arbiter. Only by increasing the discrimination ability of the discriminator, the false data (noise image) close to the real data (original image) can be discriminated. Through the two stages, the false data generated by the noise generator is close to the real data continuously, and meanwhile, the capacity of the discriminator is improved continuously. By continuously circulating the two stages, the noise generator and the preset judging network finally reach a stable state, so that the identification algorithm which is required by people and can be self-adaptive to the condition of various light and shadow interferences and still keep a good identification effect is obtained.
The application discloses an identification method for adaptively reducing complex light and shadow interference, which aims to find the optimal noise generator for a preset discrimination network and simultaneously find the optimal preset discrimination network (classifier) for each noise generator. Specifically, the preset discrimination network (original network) is trained directly along a generation network, and the generation network attempts to generate disturbance to the preset discrimination network (original network). In the training process, the preset discrimination network continuously tries to correctly classify the original image and the noise image. Through the training, the original recognition algorithm can adjust the network parameters of the original recognition algorithm, and the anti-interference capability is enough within the range of acceptable recognition effect (namely reaching the preset iteration times), so that the original recognition algorithm can cope with various different scenes, and the effect level of the original recognition algorithm can be kept. Therefore, the technical problem that the prior art cannot reduce the interference of complex light and shadow under various scenes so as to keep a good identification effect is solved.
In a specific embodiment, the preset discrimination network of the present application is composed of an image preprocessing module, an identification layer, a convolution layer, a normalization layer, and an activation function layer.
In one specific embodiment, the loss function of the noise generator of the present application is:
wherein F (x) represents a class probability vector calculated by using a softmax function, G (x) represents the noise interference degree of an input image, delta represents the gradient of the current class probability of the input image relative to a label, and cgIs a hyper-parameter.
In a specific embodiment, the classifier of the preset discrimination network of the present application is a cross entropy function, and the cross entropy function is:
J(θf,x,y)=-logF(x;θf)y;
where x and y represent pixels of two pictures, respectively, and f (x) represents a category probability vector calculated using the softmax function.
The foregoing provides an identification method for adaptively reducing complex light and shadow interference according to an embodiment of the present application, and the following provides an identification system for adaptively reducing complex light and shadow interference according to an embodiment of the present application.
Referring to fig. 4, an identification system for adaptively reducing complex light and shadow interference provided in an embodiment of the present application includes:
and the noise adding module 201 is used for inputting the original image into the noise generator for processing to obtain a noise image.
The judging module 202 is configured to input the original image and the noise image into a preset judging network with an original identifying algorithm for identification, so as to obtain a first output result.
And the training module 203 is used for inputting the first output result and the original image into the noise generator for processing to obtain a second output result, replacing the second output result with the noise image, and triggering the judging module to iterate until a preset iteration number is reached to obtain a final identification algorithm.
The self-adaptive identification system for reducing the complex light and shadow interference aims to find the optimal noise generator for the preset discrimination network and simultaneously find the optimal preset discrimination network (classifier) for each noise generator. Specifically, the preset discrimination network (original network) is trained directly along a generation network, and the generation network attempts to generate disturbance to the preset discrimination network (original network). In the training process, the preset discrimination network continuously tries to correctly classify the original image and the noise image. Through the training, the original recognition algorithm can adjust the network parameters of the original recognition algorithm, and the anti-interference capability is enough within the range of acceptable recognition effect (namely reaching the preset iteration times), so that the original recognition algorithm can cope with various different scenes, and the effect level of the original recognition algorithm can be kept. Therefore, the technical problem that the prior art cannot reduce the interference of complex light and shadow under various scenes so as to keep a good identification effect is solved.
Further, the present application provides an identification device for adaptively reducing complex light and shadow interference, wherein the device includes a processor and a memory:
the memory is used for storing program codes and transmitting the program codes to the processor;
the processor is configured to execute the identification method for adaptively reducing the complex light and shadow interference according to the method embodiments described above according to the instructions in the program code.
Further, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium is configured to store a program code, and the program code is configured to execute the identification method for adaptively reducing the complex light and shadow interference according to the foregoing method embodiment.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working process of the system described above may refer to the corresponding process in the foregoing method embodiment, and is not described herein again.
The terms "first," "second," "third," "fourth," and the like in the description of the present application and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are, for example, capable of operation in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be understood that in the present application, "at least one" means one or more, "a plurality" means two or more. "and/or" for describing an association relationship of associated objects, indicating that there may be three relationships, e.g., "a and/or B" may indicate: only A, only B and both A and B are present, wherein A and B may be singular or plural. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. "at least one of the following" or similar expressions refer to any combination of these items, including any combination of single item(s) or plural items. For example, at least one (one) of a, b, or c, may represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", wherein a, b, c may be single or plural.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.