Method, device, readable storage medium and terminal for interfering with image recognition system
By constructing and training an interference model, the confidence of the feature map of the image recognition system is reduced, which solves the problem of the vulnerability of deep neural networks in adversarial environments, and achieves improved robustness of adversarial samples and effective interference of the image recognition system.
Patent Information
- Application Number
- CN202011529605.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-22
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2040-12-22
AI Technical Summary
Existing deep neural networks are vulnerable to attacks in adversarial environments, and it is difficult for terminal devices to intuitively judge the existence of adversarial samples, affecting system robustness.
By constructing an interference model, randomly initializing it and superimposing it in the image recognition neural network, and using a preset loss function to train the interference model, the confidence of the feature map is reduced, so that the image recognition system cannot recognize the target object.
It achieves effective interference to the image recognition system, is simple to operate, has a small amount of calculation, is easy to achieve attack effects, and enhances the robustness of adversarial samples.
Smart Images

Figure CN112949675B
Abstract
Description
[Technical field]
[0001] The present invention relates to the field of neural network technology, and in particular to a method, device, readable storage medium and terminal for interfering with an image recognition system. [Background technology]
[0002] As a type of machine learning method, deep neural networks have gained widespread attention in recent years due to their remarkable results in many fields such as speech recognition, image classification, and object detection. However, deep neural network models that can achieve high accuracy in many tasks are very vulnerable to attacks in adversarial environments. In adversarial environments, deep neural networks are fed with malicious adversarial samples based on normal samples, such as images or voice information. These adversarial samples are easily misclassified by deep learning models, but it is difficult for human observers to find the difference between adversarial samples and normal samples. Since adversarial samples can measure the robustness of different deep learning-based systems, studying the generation of adversarial samples has become an important research field. At the same time, these adversarial samples can also be used as a data enhancement method to train more robust neural networks.
[0003] However, existing adversarial samples are usually based on normal samples, which are difficult for humans to distinguish. Therefore, during the adversarial process in the terminal device design phase, due to the reliability issues of the terminal devices, it is difficult for staff to intuitively judge whether the adversarial samples are effective.
[0004] In view of this, it is necessary to provide a method, device, readable storage medium and terminal for interfering with an image recognition system to overcome the shortcomings of the prior art. [Summary of the invention]
[0005] The purpose of the present invention is to provide a method for interfering with an image recognition system, which is used to attack the image recognition system of a robot, making the image recognition system unable to work, and further improving the image recognition system based on this.
[0006] In order to achieve the above object, the present invention provides a method for interfering with an image recognition system, comprising the following steps:
[0007] Randomly collect a number of data images with target objects to establish an attack sample set;
[0008] Construct an interference model, and superimpose the randomly initialized interference model with the data image of the attack sample set and input it into the image recognition neural network. Train the interference model according to the preset loss function to obtain the interference model parameters for reducing the confidence of the feature map.
[0009] The interference model parameters obtained through training are input into the working image recognition neural network.
[0010] As an improvement of the method of interfering with the image recognition system of the present invention, the following steps are included when establishing the attack sample set:
[0011] Randomly collect multiple data images with target objects in business scenarios;
[0012] Input the collected data images into the image recognition neural network to obtain the location of the target object;
[0013] Generate the box coordinates [x1, y1, x2, y2] of the target object, and establish an attack sample set by matching the box coordinates [x1, y1, x2, y2] with the data images one by one.
[0014] As an improvement of the method of the interference image recognition system of the present invention, the interference model is composed of k*k*3, where k*k is the size of the interference model, 3 corresponds to the three RGB channels of the image, and K is defined as follows according to the box coordinates of the target object:
[0015]
[0016] H and W are the sizes of the corresponding data images.
[0017] As an improvement of the method of the interference image recognition system of the present invention, the interference model is randomly initialized and superimposed on the center of the corresponding target object, and the center coordinates (block_x, block_y) of the interference model are positioned as follows:
[0018]
[0019] H and W are the sizes of the corresponding data images.
[0020] As an improvement of the method of the interference image recognition system of the present invention, when training the interference model, the preset loss function is defined as:
[0021] Loss t =sum(score*(score>0.1))
[0022] Loss block =sum(||noise||)
[0023] Loss=Loss block +Loss t
[0024] Among them, Loss is the preset loss function, score is the confidence of the feature map, Loss_block is the penalty term for the interference model, and noise is the interference model parameter.
[0025] As an improvement of the method of the interference image recognition system of the present invention, when training the interference model, the parameters of the image recognition neural network are not changed, the batch normalization layer is set to the inference mode, and the loss gradient calculated by the back propagation algorithm is fed back to the interference model according to the calculated loss function to update the interference model parameters. The formula is as follows:
[0026] noise update =noise+lr*Δ noise
[0027] mask=||noise update ||>T
[0028] noise=mask*T+(1-mask)*noise update
[0029] Wherein, noise is the interference model parameter, noise_update is the updated interference model parameter, lr is the learning rate and lr=1e-1, mask is the value of the updated interference model parameter that exceeds T, and T is the constraint threshold and is equal to 1.0.
[0030] The present invention also provides a device for interfering with an image recognition system, which is used to execute the above method for interfering with an image recognition system, and the device includes an attack sample construction module, a training module and an attack module;
[0031] The attack sample construction module is used to randomly collect a number of data images with target objects, input the data images into the image recognition neural network to obtain the location of the target object, and then establish an attack sample set based on the location of the target object and the corresponding data images;
[0032] A training module is used to construct an interference model, and superimpose the randomly initialized interference model with the data image of the attack sample set and input it into the image recognition neural network, train the interference model according to a preset loss function, and obtain interference model parameters for reducing the confidence of the feature map;
[0033] The attack module is used to input the interference model parameters obtained through training into the working image recognition neural network.
[0034] As an improvement of the method of interfering with the image recognition system of the present invention, the training module includes:
[0035] A preprocessing unit, used for constructing an interference model and randomly initializing the interference model;
[0036] A confidence extraction unit is used to superimpose the randomly initialized interference model and the attack sample set and then input them into the image recognition neural network to obtain the confidence of the feature map;
[0037] The training unit is used to repeatedly return the interference model through the loss gradient calculated by the back propagation algorithm according to the preset loss function, and update the interference model parameters until the preset iteration stop condition is reached, and save the interference model parameters after training.
[0038] The present invention also provides a readable storage medium storing a computer program, and when the computer program is executed by a processor, the steps of the method for interfering with the image recognition system are implemented.
[0039] The present invention also provides a terminal including the above-mentioned readable storage medium and a processor, and the processor implements the steps of the above-mentioned method for interfering with the image recognition system when executing the computer program on the readable storage medium.
[0040] Compared with the prior art, the beneficial effects of the method and electronic device for interfering with the image recognition system of the present invention are: by superimposing the trained interference model on the picture perceived by the image recognition system, the image recognition system is unable to recognize the target object, thereby achieving the purpose of interfering with target recognition. The interference model is a simple block picture, which is simple to operate, has a small amount of calculation, and is easy to achieve the attack effect.
Brief Description of the Drawings
[0041] Figure 1 A schematic flow chart of a method for interfering with an image recognition system provided by an embodiment of the present invention.
[0042] Figure 2 A schematic diagram of the structure of an interference image recognition system provided by an embodiment of the present invention. [Specific implementation method]
[0043] In order to make the purpose, technical scheme and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0044] It should be noted that, if there is no conflict, the various features in the embodiments of the present invention can be combined with each other, and all are within the protection scope of the present invention. In addition, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in a different order from the module division in the device or the order in the flow chart.
[0045] The robot according to the embodiment of the present invention may be constructed into any suitable shape to implement specific business function operations. For example, the robot according to the embodiment of the present invention may be a delivery robot, a handling robot, a nursing robot, and the like.
[0046] A first aspect of the present invention provides a method for interfering with an image recognition system, which is used to interfere with the image recognition system of a robot.
[0047] Please refer to Figure 1 In one embodiment of the present invention, the method for interfering with the image recognition system comprises the following steps:
[0048] Step 101, randomly collect a number of data images with target objects to establish an adversarial sample set.
[0049] The role of the adversarial sample set is to provide the location of the target object so that the interference model has the training target. To this end, establishing the adversarial sample set includes the following steps:
[0050] In the business scenario, multiple data images with target objects are randomly collected. Here, data images can be collected through the camera on the robot;
[0051] Input the collected data images into the image recognition neural network to obtain the location of the target object. The image recognition neural network here is a neural network built based on algorithms such as YOLO and SSD and has been trained for image recognition;
[0052] Generate the box coordinates [x1, y1, x2, y2] of the target object, and establish an adversarial sample set by corresponding the box coordinates [x1, y1, x2, y2] to the data image one by one. That is, the box coordinates [x1, y1, x2, y2] are used to represent the position of the target object on the corresponding data image.
[0053] Step 102, construct an interference model, and superimpose the randomly initialized interference model with the data image of the adversarial sample set and input it into the image recognition neural network, and then train the interference model according to the preset loss function to obtain the interference model parameters for reducing the confidence of the feature map.
[0054] Specifically, the interference model is composed of k*k*3, where k*k is the size of the interference model, and 3 corresponds to the three RGB channels of the image, that is, the interference model is a square image with a certain size, and k is defined according to the box coordinates of the target object as follows:
[0055]
[0056] Among them, H and W are the sizes of the corresponding data images.
[0057] Here, after the interference model is randomly initialized, the constraint parameter value does not exceed T, T is the constraint threshold, and T = 1.0. It can be understood that the process of superimposing the interference model and the data image is the process of adding block noise to the data image, thereby achieving the purpose of interference image recognition.
[0058] In a preferred embodiment, since the image recognition neural network obtains the position of the target object in the data image through the position response of the target object, specifically, corresponding to the target object in the data image, the image recognition neural network will generate a response at the center of the target object. Therefore, the interference model is randomly initialized and superimposed on the center of the corresponding target object to play the maximum interference role. That is, the center coordinates (block_x, block_y) of the interference model can be located as follows:
[0059]
[0060] Next, define the preset loss function, because the image recognition neural network identifies the target object through the feature map confidence. Specifically, the value of the feature map confidence is between 0-1. The higher the feature map confidence, the greater the probability of obtaining the target object. For example, when the feature map confidence of the data image is 0.99, it indicates that the probability of the target object appearing in the data image is 99%. At this time, the image recognition neural network can identify the target object. When the feature map confidence of the data image is 0.17, it indicates that the probability of the target object appearing in the data image is 17%. At this time, the image recognition neural network cannot recognize the target object.
[0061] Based on this, the preset loss function is defined as:
[0062] Loss t =sum(score*(score>0.1))
[0063] Loss block =sum(||noise||)
[0064] Loss=Loss block +Loss t
[0065] Among them, Loss is the preset loss function, score is the feature map confidence, Loss_block is the penalty term for the interference model, and noise is the interference model parameter.
[0066] Then, when training the interference model, the parameters of the image recognition neural network are not changed, the batch normalization layer is set to the inference mode, and the loss gradient calculated by the back propagation algorithm is propagated back to the interference model according to the calculated loss function, and the interference model parameters are updated until the preset iteration stop condition is reached, and the interference model parameters used to reduce the confidence of the feature map are obtained. The interference model parameters are defined as:
[0067] noise update =noise+lr*Δ noise
[0068] mask=||noise update ||>T
[0069] noise=mask*T+(1-mask)*noise update
[0070] Wherein, noise_update is the updated interference model parameter, lr is the learning rate and lr=1e-1, and mask is the value exceeding T in the updated interference model parameter.
[0071] Step 103, input the interference model parameters obtained through training into the working image recognition neural network, so that after the image recognition neural network captures the target object, it cannot recognize the target object because the confidence of the feature map is too small, thereby achieving the purpose of attacking the image recognition neural network.
[0072] For example, when the robot needs to enter the elevator, before the image recognition neural network inputs the interference model parameters obtained in training, the confidence of the image recognition neural network for the feature map of the elevator door should be 0.99. At this time, the robot can recognize the elevator door and proceed to the next step through the elevator door. However, after the image recognition neural network inputs the interference model parameters obtained in training, the confidence of the image recognition neural network for the feature map of the elevator door drops to 0.17. At this time, the robot cannot recognize the elevator door, causing the robot to be unable to continue working.
[0073] In summary, the method for interfering with the image recognition system provided by the present invention superimposes the trained interference model on the picture perceived by the image recognition system, making the image recognition system unable to recognize the target object, thereby achieving the purpose of interfering with target recognition. The interference model is a simple block picture with simple operation and small amount of calculation, and it is easy to achieve the attack effect.
[0074] A second aspect of the present invention provides a device 100 for interfering with an image recognition system, which is used to attack the image recognition system (i.e., the image recognition neural network) of a robot by using the above-mentioned method of interfering with the image recognition system. Therefore, the implementation principle of the device for interfering with the image recognition system is consistent with the method of interfering with the image recognition system, so it will not be described in detail below.
[0075] Please refer to Figure 2 In one embodiment of the present invention, the device 100 for interfering with the image recognition system includes an adversarial sample construction module 10, a training module 20 and an attack module 30, as follows:
[0076] The adversarial sample construction module 10 is used to randomly collect a number of data images with target objects, input the data images into the image recognition neural network to obtain the position of the target object, and then establish an adversarial sample set according to the position of the target object and the corresponding data images.
[0077] The training module 20 is used to construct an interference model, and superimpose the randomly initialized interference model with the data image of the attack sample set and input it into the image recognition neural network, train the interference model according to the preset loss function, and obtain the interference model parameters for reducing the confidence of the feature map.
[0078] The attack module 30 is used to input the interference model parameters obtained through training into the working image recognition neural network.
[0079] Furthermore, the training module 20 includes:
[0080] A preprocessing unit, used for constructing an interference model and randomly initializing the interference model;
[0081] The confidence extraction unit is used to superimpose the randomly initialized interference model with the attack sample set and input it into the image recognition neural network to obtain the feature map confidence
[0082] The training unit is used to repeatedly return the interference model through the loss gradient calculated by the back propagation algorithm according to the preset loss function, and update the interference model parameters until the preset iteration stop condition is reached, and save the interference model parameters after training.
[0083] Another aspect of the present invention is to provide a readable storage medium (not shown in the figure), which stores a computer program for implementing the steps of the method of interfering with the image recognition system as described in any of the above embodiments.
[0084] The present invention also provides a terminal (not shown in the figure), which includes a readable storage medium and a processor of the above-mentioned embodiment, and when the processor executes the computer program on the readable storage medium, it implements the steps of the method of interfering with the image recognition system as in any of the above-mentioned embodiments.
[0085] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0086] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0087] Those of ordinary skill in the art will appreciate that the units and method steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0088] In the embodiments provided by the present invention, it should be understood that the disclosed systems or devices / terminal equipment and methods can be implemented in other ways. For example, the system or device / terminal equipment embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0089] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0090] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0091] The present invention is not limited to what is described in the specification and implementation modes, and therefore additional advantages and modifications can be easily realized by those skilled in the art. Therefore, without departing from the spirit and scope of the general concept defined by the claims and their equivalents, the present invention is not limited to the specific details, representative devices, and illustrative examples shown and described herein.
Claims
1. A method for interfering with an image recognition system, characterized in that: The following steps are involved: Randomly collect a number of data images with target objects to establish an attack sample set; Construct an interference model, and superimpose the randomly initialized interference model with the data image of the attack sample set and input it into the image recognition neural network. Train the interference model according to the preset loss function to obtain the interference model parameters for reducing the confidence of the feature map. Input the interference model parameters obtained through training into the working image recognition neural network; The following steps are included when establishing an attack sample set: Randomly collect multiple data images with target objects in business scenarios; Input the collected data images into the image recognition neural network to obtain the location of the target object; Generate the box coordinates [x1, y1, x2, y2] of the target object, and establish an attack sample set by matching the box coordinates [x1, y1, x2, y2] with the data image one by one; The interference model is composed of k*k*3, where k*k is the size of the interference model, 3 corresponds to the three RGB channels of the image, and k is defined according to the box coordinates of the target object as follows: H and W are the sizes of the corresponding data images; When training the interference model, the default loss function is defined as: Loss t =sum(score*(score>0.1)) Loss block =sum(||noise||) Loss=Loss block +Loss t Among them, Loss is the preset loss function, score is the confidence of the feature map, and Loss block is the penalty term for the interference model, and noise is the interference model parameter; When training the interference model, the parameters of the image recognition neural network are not changed. The batch normalization layer is set to the inference mode, and the loss gradient calculated by the back propagation algorithm is propagated back to the interference model according to the calculated loss function to update the interference model parameters. The formula is as follows: noise update =noise+lr*Δ noise mask=||noise update ||>T noise=mask*T+(1-mask)*noise update Among them, noise is the interference model parameter, noise update is the updated interference model parameter, lr is the learning rate and lr=1e-1, mask is the value of the updated interference model parameter that exceeds T, T is the constraint threshold and is equal to 1.
0.
2. The method for interfering with an image recognition system according to claim 1, characterized in that: The interference model is randomly initialized and superimposed on the center of the corresponding target object. The center coordinates of the interference model (block x , block y ) is positioned as:
3. A device for interfering with an image recognition system, used to execute the method for interfering with an image recognition system according to claim 1 or 2, characterized in that: The device includes an attack sample construction module, a training module and an attack module; The attack sample construction module is used to randomly collect a number of data images with target objects, input the data images into the image recognition neural network to obtain the location of the target object, and then establish an attack sample set according to the location of the target object and the corresponding data images; A training module is used to construct an interference model, and superimpose the randomly initialized interference model with the data image of the attack sample set and input it into the image recognition neural network, train the interference model according to a preset loss function, and obtain interference model parameters for reducing the confidence of the feature map; An attack module, used to input the interference model parameters obtained through training into the working image recognition neural network; The following steps are included when establishing an attack sample set: Randomly collect multiple data images with target objects in business scenarios; Input the collected data images into the image recognition neural network to obtain the location of the target object; Generate the box coordinates [x1, y1, x2, y2] of the target object, and establish an attack sample set by matching the box coordinates [x1, y1, x2, y2] with the data image one by one; The interference model is composed of k*k*3, where k*k is the size of the interference model, 3 corresponds to the three RGB channels of the image, and k is defined according to the box coordinates of the target object as follows: H and W are the sizes of the corresponding data images; When training the interference model, the default loss function is defined as: Loss t =sum(score*(score>0.1)) Loss block =sum(||noise||) Loss=Loss block +Loss t Among them, Loss is the preset loss function, score is the confidence of the feature map, and Loss block is the penalty term for the interference model, and noise is the interference model parameter; When training the interference model, the parameters of the image recognition neural network are not changed. The batch normalization layer is set to the inference mode, and the loss gradient calculated by the back propagation algorithm is propagated back to the interference model according to the calculated loss function to update the interference model parameters. The formula is as follows: noise update =noise+lr*Δ noise mask=||noise update ||>T noise=mask*T+(1-mask)*noise update Among them, noise is the interference model parameter, noise update is the updated interference model parameter, lr is the learning rate and lr=1e-1, mask is the value of the updated interference model parameter that exceeds T, T is the constraint threshold and is equal to 1.
0.
4. The device for interfering with the image recognition system according to claim 3, characterized in that: The training modules include: A preprocessing unit, used for constructing an interference model and randomly initializing the interference model; A confidence extraction unit is used to superimpose the randomly initialized interference model and the attack sample set and then input them into the image recognition neural network to obtain the confidence of the feature map; The training unit is used to repeatedly return the interference model through the loss gradient calculated by the back propagation algorithm according to the preset loss function, and update the interference model parameters until the preset iteration stop condition is reached, and save the interference model parameters after training.
5. A readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method for interfering with an image recognition system described in any one of claims 1 to 2 are implemented.
6. A terminal, characterized in that: The method comprises the readable storage medium and a processor as described in claim 5, and when the processor executes the computer program on the readable storage medium, the steps of the method for interfering with the image recognition system as described in any one of claims 1-2 are implemented.
