Stealth method and device for machine vision target detection
Through deep learning to generate adversarial networks and post-processing technology, the generation process of adversarial patches is optimized, which solves the problem of poor performance and unnaturalness of adversarial patches under unknown algorithms in the existing technology, and achieves efficient stealth in machine vision target detection. effect and application value.
Patent Information
- Application Number
- CN202410837816.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-26
- Publication Date
- 2024-10-29
AI Technical Summary
Existing stealth technology for machine vision target detection is difficult to perform well under unknown target detection algorithms, and the generated adversarial patches do not have image semantics in practical applications, causing them to appear abrupt and unnatural in real environments, affecting the stealth effect. .
Adopt an end-to-end training method based on deep learning to generate adversarial patterns with natural semantics through a generative adversarial network, and add confidence loss, image regularization loss and smoothing loss during the training and fine-tuning process to optimize the generation process of adversarial patches, combined with Post-processing techniques such as mask-offset transformation, mean pooling and random perturbation improve the migration ability and naturalness of adversarial patches.
It improves the stealth effect and application value of adversarial patches under unknown target detection algorithms, enhances the natural semantics of adversarial samples, ensures their robustness and stealth effects in different scenarios, and balances the differences between stealth effects and image semantics.
Smart Images

Figure CN118865014A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of machine vision and video stealth, and in particular relates to a stealth method for machine vision target detection. Background Art
[0002] In recent years, with the continuous development of machine vision technology, target detection has also been continuously applying deep learning methods and has achieved rapid development. Target detection-related algorithms have also been widely used in various fields, and related industries are also developing rapidly. The continuous development of target detection methods has brought new challenges to traditional stealth technology. For example, there are methods that use deep learning algorithms to detect people wearing camouflage uniforms that are difficult to distinguish with the naked eye, and have achieved good results.
[0003] Unlike stealth technology for human eyes, stealth technology for machine vision target detection does not make objects invisible, but makes them invisible to target detection algorithms in a specific way. At present, target detection algorithms are responsible for sensing and locating targets in massive image and video data. The goal of stealth technology for target detection is to minimize the probability of objects being detected by target detection algorithms. Stealth technology for target detection can be divided into black box methods and white box methods according to the degree of mastery of target detection algorithms. In the white box method, all knowledge of the model in the target detection algorithm is understood, including structure, parameters, training data, etc. The black box method can only observe its input and output, but knows nothing about the actual process of the algorithm.
[0004] At present, the existing technology mainly changes the local image semantics of the object by applying a specific pattern in front of the object, so that the captured image or video cannot be recognized by the target detection algorithm. Generally speaking, this specific pattern is called an adversarial patch. For adversarial patches, they are generally obtained through deep learning-based methods, after the target detection algorithm is selected and trained under a specific data set.
[0005] At present, existing methods often train adversarial patches based on a selected white-box target detection algorithm. In the training process of adversarial patches, since more iterations are required to achieve a better convergence effect, the adversarial patches obtained through training often have a certain degree of overfitting, which is specifically manifested as a better stealth effect on the network trained to obtain this patch, but a poor migration effect in networks with other structures. However, in actual scenarios, for users of adversarial patches, they cannot understand what target detection algorithm the collected images will be sent to. If it only has a good effect under a specific target detection algorithm, but the effect is not ideal under other methods, the probability of being detected is still high, and the adversarial patch does not have practical application value.
[0006] In addition, during the generation of adversarial patches and the updating of pixel values, there are no constraints on the patterns of adversarial patches at the semantic level, which makes the generated adversarial patches look messy and unnatural, which is quite different from the patterns that may appear in the real world. In real environments, wearing an abrupt pattern can achieve the effect of invisibility under the deep learning-based detection system, but it will attract more attention from the surrounding humans, which is contrary to the original intention of invisibility technology. Summary of the invention
[0007] The purpose of the present invention is to solve the problem that the adversarial pattern has poor performance under unknown target detection algorithms and does not have image semantics in actual application, and proposes a stealth method for target detection. The method provides an end-to-end training method based on deep learning, which can make the adversarial patch have image semantics while improving the stealth effect under unknown target detection algorithms, thereby improving the application effect and practical value of the adversarial patch.
[0008] like Figure 5 As shown, the present invention proposes a stealth method for machine vision target detection, which includes:
[0009] In the initial step, a generative adversarial network is constructed, which generates an image with natural semantics as an adversarial pattern according to multi-dimensional input variables; a plurality of training images are obtained, and the training images have detection objects and their corresponding target category labels;
[0010] A training step, adding the adversarial pattern to the detection object of each training image to obtain a sample-added image, inputting the sample-added image into a machine vision target detection model to obtain a target prediction category of the sample-added image, and constructing a first confidence loss function according to the target prediction category and the target category label to train and update the input variable;
[0011] The fine-tuning step is to input the input variable after training into the generative adversarial network to obtain a basic pattern, add the basic pattern to the detection object of each training image to obtain an adversarial image, input the adversarial image into the machine vision target detection model, obtain the target prediction category and construct a second confidence loss function according to the target category label; construct an image regularization loss function according to the pixel tensor value of the adversarial image; construct a smoothing loss according to the difference in the change between the pixel tensor values of the adversarial image; update and modify the adversarial image at a specified learning rate according to the second confidence loss function, the image regularization loss function, and the smoothing loss to obtain a perfect pattern; post-process the perfect pattern to obtain a stealth pattern; add the stealth pattern to the detection object of the image to be invisible to obtain an invisible image with a stealth effect.
[0012] The stealth method for machine vision target detection, wherein the construction process of the generative adversarial network includes: selecting an object category, obtaining multiple image data belonging to the object category, training the image generation network, and obtaining the generative adversarial network for generating images of the object category.
[0013] The stealth method for machine vision target detection, wherein the post-processing includes:
[0014] The perfected pattern is subjected to mask-shift transformation, and / or mean pooling, and / or random perturbation, and / or random rotation, and / or random scale change.
[0015] like Figure 6 As shown, the present invention also proposes a stealth device for machine vision target detection, which includes:
[0016] The initial module constructs a generative adversarial network, which generates images with natural semantics as adversarial patterns based on multi-dimensional input variables; obtains multiple training images, which have detection objects and their corresponding target category labels;
[0017] A training module, adding the adversarial pattern to the detection object of each training image to obtain a sample-added image, inputting the sample-added image into a machine vision target detection model to obtain a target prediction category of the sample-added image, and constructing a first confidence loss function according to the target prediction category and the target category label to train and update the input variable;
[0018] The fine-tuning module inputs the input variable after training into the generative adversarial network to obtain a basic pattern, adds the basic pattern to the detection object of each training image to obtain an adversarial image, inputs the adversarial image into the machine vision target detection model, obtains the target prediction category and constructs a second confidence loss function according to the target category label; constructs an image regularization loss function according to the pixel tensor value of the adversarial image; constructs a smoothing loss according to the difference in the change between the pixel tensor values of the adversarial image; updates and modifies the adversarial image at a specified learning rate according to the second confidence loss function, the image regularization loss function, and the smoothing loss to obtain a perfect pattern; post-processes the perfect pattern to obtain a stealth pattern; and adds the stealth pattern to the detection object of the image to be invisible to obtain an invisible image with a stealth effect.
[0019] The stealth device for machine vision target detection, wherein the construction process of the generative adversarial network includes: selecting an object category, obtaining multiple image data belonging to the object category, training the image generation network, and obtaining the generative adversarial network for generating images of the object category.
[0020] The stealth device for machine vision target detection, wherein the post-processing includes:
[0021] The perfected pattern is subjected to mask-shift transformation, and / or mean pooling, and / or random perturbation, and / or random rotation, and / or random scale change.
[0022] The present invention also proposes an electronic device, which includes the stealth device for machine vision target detection.
[0023] The electronic device is connected to an information display device, and the information display device is used to display the invisible image according to display parameters and attributes set by the user or through an artificial intelligence model.
[0024] The present invention also proposes a storage medium for storing a computer program for executing the stealth method for machine vision target detection.
[0025] It can be seen from the above scheme that the advantages of the present invention are:
[0026] Through the adversarial patch enhancement method based on the transfer effect, the stealth effect of the network under the black box method is improved, and the practical application value of the network is improved. Through the image semantics enhancement method based on the generative adversarial network, the natural semantics of the adversarial sample is improved, the problem of its unnaturalness is improved, and the occasions where the adversarial pattern can be applied are increased. The adversarial patch generation method based on training and fine-tuning divides the entire adversarial patch generation process into two parts: training and fine-tuning. The training process is used to improve the stealth effect of the adversarial sample while ensuring the image semantics. Although the fine-tuning stage will lose some image semantics, it can greatly improve the stealth effect of the adversarial sample. By reasonably allocating the training and fine-tuning processes, a better balance can be achieved between the stealth effect of the adversarial sample and the image semantics. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 It is the overall flow chart of the present invention;
[0028] Figure 2 This is an example diagram of the mask-offset method;
[0029] Figure 3 This is the framework diagram of the training phase and fine-tuning phase;
[0030] Figure 4 An example diagram of the adversarial patch fine-tuning process;
[0031] Figure 5 is a flow chart of the method of the present invention;
[0032] Figure 6 It is a module diagram of the device of the present invention;
[0033] Figure 7 This is a schematic diagram of the structure of a first electronic device of the present invention;
[0034] Figure 8 This is a schematic diagram of the application environment structure of the first electronic device of the present invention;
[0035] Fig. 9 It is a schematic diagram of the structure of a second electronic device of the present invention.
[0036] Reference numerals:
[0037] A-First electronic device;
[0038] B- Stealth device for machine vision target detection;
[0039] C-data acquisition equipment;
[0040] D-information display device;
[0041] 1000 - second electronic device;
[0042] Ⅰ-computational unit;
[0043] II-ROM;
[0044] III-RAM;
[0045] IV-bus;
[0046] V-interface;
[0047] VI - input unit;
[0048] VII-output unit;
[0049] VIII- Storage medium;
[0050] Ⅸ-Communication unit. DETAILED DESCRIPTION
[0051] It should be noted that the processor described in the present invention is the control center of the electronic device, which can be a processor or a general term for multiple processing elements. For example, it can be one or more central processing units (CPUs), or application specific integrated circuits (ASICs), or one or more integrated circuits configured to implement the embodiments of the present invention, such as one or more microprocessors (digital signal processors, DSPs), or one or more field programmable gate arrays (FPGAs).
[0052] Optionally, the processor can perform various functions of the electronic device by running or executing a software program stored in the memory, and calling data stored in the memory.
[0053] In a specific implementation, as an embodiment, the processor may include one or more CPUs. Each of these processors may be a single-core processor (single-CPU) or a multi-core processor (multi-CPU). The processor here may refer to one or more devices, circuits, and / or processing cores for processing data (such as computer program instructions). Electronic devices may include: servers, desktop computers, laptops, smart phones, tablet computers, embedded computers, etc., wherein the embedded computers include vehicles and robots, etc.
[0054] The memory is used to store the software program for executing the solution of the present invention, and the execution is controlled by the processor. The specific implementation method can refer to the above method embodiment, which will not be repeated here.
[0055] It should be noted that the structure of the electronic device shown in the drawings of the present invention does not constitute a limitation thereto, and the actual knowledge structure recognition device may include more or fewer components than shown in the drawings, or a combination of certain components, or a different arrangement of components.
[0056] The above embodiments can be implemented in whole or in part by software, hardware (such as circuits), firmware or any other combination. When implemented by software, the above embodiments can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can 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 can be transmitted from one website, computer, server or data center to another website, computer, server or data center by wired (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that contains one or more available media sets. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a tape), an optical medium (for example, a DVD), or a semiconductor medium. The semiconductor medium can be a solid-state hard disk.
[0057] It should also be understood that the term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. A and B can be singular or plural. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship, but it may also indicate an "and / or" relationship. Please refer to the context for specific understanding.
[0058] In the present invention, "at least one" means one or more, and "more than one" means two or more. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can be represented by: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.
[0059] It should also be understood that in various embodiments of the present invention, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0060] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the 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 device, 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.
[0061] 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.
[0062] 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.
[0063] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0064] When the inventors investigated the stealth technology of mainstream target detection methods, they found that the adversarial patches obtained by these methods do not have image semantics and the ability to migrate under different algorithms, making it difficult to apply adversarial patches in real scenarios. By adopting the migration enhancement method of adversarial patches during the training process, the migration ability and robustness of the network can be improved, and the stealth effect of the network under different detection methods can be improved. At the same time, a generative adversarial network is added to the training process, and the image semantic knowledge learned by the generator part of the generative adversarial network is used to make the generated adversarial patches have image semantics, minimizing the difference in visual effects between the adversarial patches and the real images.
[0065] To this end, the present invention proposes an adversarial patch generation method based on training and fine-tuning. The whole process can be divided into a training phase and a fine-tuning phase. In the training phase, a generative adversarial network is applied and its parameter updates are frozen. In the update process of the adversarial patch, the input vector of the generative adversarial network is directly updated to ensure the natural semantics of the adversarial patch. In the fine-tuning phase, the adversarial patch is decoupled from the generative adversarial network, and the patch is directly updated at the pixel level. In the fine-tuning phase, there are no restrictions on the image semantic level during the update process, so the adversarial sample will lose part of the image semantics. By selecting reasonable training rounds and fine-tuning rounds, a balance between stealth effect and image semantics is achieved.
[0066] The present invention also proposes an image semantic enhancement method based on a generative adversarial network in the training stage. By adding a generative adversarial network during the training process, the pixel value update method of the adversarial patch during the training process is constrained. The generative adversarial network is pre-trained on a selected data set so that the generative adversarial network learns the semantic information of the image. During the training process, based on the pre-trained generative adversarial network, the input variables of the generative adversarial network generator are updated instead of updating the pixel values of the pattern, and the network parameters of the generative adversarial network are fixed, thereby ensuring the image semantics of the adversarial patch during the entire training process, reducing the difference between the adversarial patch and the image in the real world, and improving the problem that the adversarial patch is not natural enough and appears abrupt.
[0067] The present invention also proposes an adversarial patch enhancement method based on the migration effect in the fine-tuning stage. The method includes three components, a mask-offset transformation method, a regularization method based on image pixels, and a hybrid enhancement method. The mask-offset transformation method adopts a method similar to random discarding in a neural network to improve the overfitting problem of adversarial patterns. The regularization method based on image pixels adopts a method similar to the regularization term of a neural network to avoid pixel values from moving toward two extremes. The hybrid enhancement method includes mean pooling, random perturbation, random rotation, and random scale change to improve the robustness of adversarial patches in different application scenarios. Through the above three points, the stealth effect of adversarial patches under black box target detection algorithms is improved.
[0068] In order to make the above features and effects of the present invention more clearly and understandably described, embodiments are given below and described in detail with reference to the accompanying drawings. This specification discloses one or more embodiments that include the features of the present invention. The disclosed embodiments are only for illustration. The scope of protection of the present invention is not limited to the disclosed embodiments, and the present invention is defined by the attached claims.
[0069] 1. Generator pre-training
[0070] Before actual training, the weights of the generative adversarial network need to be pre-trained to ensure that the generator of the generative adversarial network can generate images with natural semantics. The generative adversarial network can generate a specified picture based on a multi-dimensional input variable. For example, the picture generated as shown in 3 is a pattern containing a cat. In this method, the generative adversarial network is selected as the StyleGAN2-ada network. First, an object that exists in the real world is selected, and a certain number of image data of the object are collected using a public image dataset and a crawler method. In this method, the data scale needs to be more than 10,000. Use the collected image data to pre-train the StyleGAN2-ada network. After the training, the generator of StyleGAN2-ada is used as the generation unit to generate images of objects of this category.
[0071] 2. Training phase
[0072] In the training phase, a generative adversarial network is used to constrain the pixel value update of the adversarial sample at the semantic level. An input variable is randomly generated, and the value range of each dimension of the input variable is set to [-τ, τ], where τ is a pre-set truncation threshold, such as τ = 10. After initialization, the adversarial sample update steps in each training round in the training phase are as follows:
[0073] 2.1 Input the variable into the generator of StyleGAN2-ada to obtain an adversarial pattern that conforms to natural semantics.
[0074] 2.2 Randomly select a fixed number of training data, such as a pedestrian detection data set. Each image in the pedestrian detection data set is annotated with a corresponding pedestrian label. In this data batch, the adversarial pattern is randomly rotated and scaled, and then added to the corresponding object (pedestrian) in each image to obtain the image data after adding the sample. The size of the adversarial sample during the adding process is based on the length and width of the detection box. According to the pre-set scale factor s, the side length len that each stealth pattern needs to be scaled to before adding is calculated:
[0075]
[0076] Among them, w represents the width of the annotation box, and h represents the height of the annotation box.
[0077] 2.3 Input the obtained image into the target detection network. According to the output of the detection network, the confidence loss function L of the detection process is obtained conf Here L conf It is chosen as the mean of the confidence scores of the detection boxes with the highest confidence in each image in a batch.
[0078] 2.4 Update the values of each dimension of the input variable by back propagation. Since the generator of StyleGAN2-ada has a better generation effect only when the input is within a specific range, in order to generate higher quality patterns, after updating the input variable, a truncation operation is used to limit the values of each dimension of the input variable z to a specific range [-τ,τ]. In the truncation operation, if the pixel value after the update is greater than the agreed upper limit, it is set to the value of the upper limit. Similarly, if the pixel value after the update is less than the agreed lower limit, it is set to the value of the lower limit. The truncation process can be described as follows:
[0079] z′ i ={z i |z i ←min(max(z i ,-τ),τ),zi ~z}
[0080] 3. Fine-tuning stage
[0081] After the training phase reaches the set number of rounds, the fine-tuning phase begins. In the fine-tuning phase, a stealth pattern is selected from the stealth patterns obtained in each iteration of the training phase. Based on this pattern, the way of adding adversarial patches to the input data and the calculation method of confidence loss are the same as before. According to the actual configuration scheme, adjust the learning rate. L updates the pattern (fine-tuning phase) and the vector (training phase) by backpropagation. The learning rate controls the magnitude of each update. The steps of the fine-tuning phase are as follows:
[0082] 3.1 Change the learning rate to cosine annealing learning rate to optimize the convergence process of adversarial samples. The calculation method is:
[0083]
[0084] Among them, a max ,α min are the predefined maximum and minimum learning rates respectively. T is the predefined maximum number of iterations. When the iteration number is 0, the learning rate is a max , and then in T rounds, the learning rate decays in a cosine manner, and finally at the Tth round value, the learning rate value is α min .
[0085] 3.2 Modify the overall loss function. The overall loss function L is the confidence loss function L conf , image regularization loss function L p And the smoothing loss L tv The weighted sum of the three parts. The role of the regularization loss function is to improve the overfitting problem of the entire pattern, and make the pixel values of the pattern as close to the value boundary as possible. The smoothing loss is to make the adjacent pixel values close and look more natural. If the smoothing loss is not added, the pattern will look like garbled code.
[0086] L=L conf +λL p +μL tv
[0087] Among them, L conf It is consistent with the definition in the training process. p , which is calculated as:
[0088]
[0089] Among them, x is the tensor value of the pixel point at a specific position in the image, W is the width of the adversarial pattern, H is the height of the adversarial pattern, and I k,i,jIndicates the value of the i-th pixel in the width direction and the j-th pixel in the height direction in the k-th dimension. Since the image is converted into a tensor here, its value changes from an integer between 0 and 255 to a floating point number between 0 and 1. The purpose of setting g(x) is to avoid the pixel values from being close to the two extremes as much as possible, and to avoid overfitting of the adversarial pattern to a certain extent.
[0090] For L tv The calculation method is:
[0091]
[0092] Among them, p i,j Represents the value of the pixel at position (i, j) in the adversarial pattern.
[0093] 3.3 Perform mask-offset transformation on the samples. For the mask-offset transformation, the working method is: divide the entire adversarial pattern into 6×6 cells by rows and columns. For each cell, there is a probability of 0<θ<1 for masking. If the cell is masked, it will not act on the object in the image. Here we select θ=0.2. In addition, for the entire adversarial pattern, it may be randomly offset in the four directions of up, down, left and right. The maximum offset is the size of a cell. After the offset, the part that exceeds the original adversarial pattern area will be discarded, and the part that is vacated due to the offset will not act on the object in the image.
[0094] 3.4 Perform image hybrid enhancement on samples. Image hybrid enhancement methods include mean pooling, random perturbation, random rotation, and random scale change.
[0095] Mean pooling changes the pixel value to the median of all pixel values within a 7×7 rectangle centered on the current pixel, and pads the edges of the image to keep the scale of the image consistent before and after the operation. The mean pooling method can be described as follows:
[0096] I i,j ′=median(I[i-3:i+3][j-3:j+3])
[0097] Among them, I'[i][j] represents the value of the point at position (i, j) after mean pooling. median represents the median operation. I[i-3:i+3][j-3:j+3] represents a 7×7 submatrix centered at position (i, j). The random perturbation method adds random perturbations to each pixel of the image to enhance the robustness of the image. The random perturbation includes three parts: proportional random perturbation, illumination random perturbation, and target random perturbation. The proportional random perturbation is to multiply each pixel by a randomly obtained proportional coefficient α, and the value range of α is (0.9, 1.1). The illumination random β perturbation is a random vector, and the value range of each dimension is (-0.05, 0.05). In the same image data, the illumination random perturbation added to each adversarial pattern is the same. The target random perturbation γ is a random vector, and the value range of each dimension is (-0.05, 0.05). The illumination random perturbation added to each adversarial pattern is generated independently. Therefore, the value of the adversarial pattern at position (i, j) can be described as:
[0098] I i,j ′=α i,j I i,j ′+β i,j +γ i,j
[0099] For each stealth pattern that needs to be added, a randomly generated rotation is applied, and the angle value of the rotation angle ranges from (-5,5). For each stealth pattern that needs to be added, a perturbation of ±5% is added to the corresponding scale ratio of the target.
[0100] 3.5 Randomly select a fixed number of training data. In this data batch, add the enhanced adversarial sample to the corresponding object in each image to obtain the image data after adding the sample. Input the obtained image into the detection network. Calculate the loss function L based on the output of the detection network and the pixel value of the adversarial sample.
[0101] 3.6 Update the pixel value of the adversarial sample according to the obtained loss function value. Since the pixel value of the image converted into a vector has a value interval of [0,1], if the updated value is greater than 1, it is set to 1, and if the updated pixel value is less than 0, it is set to 0.
[0102] In summary, this system provides a scalable and lightweight embedded target detection network. In order to solve the problems of large number of network parameters, large amount of calculation, and difficulty in adaptive deployment, the network design module makes the backbone network more lightweight, speeds up the model training and reasoning process, and adopts a more efficient feature fusion network based on multi-scale channel attention to fuse the multi-scale features extracted by the network to improve the detection ability of the network. Finally, according to the actual computing power of the edge embedded device where the network needs to be deployed, the actual structure of the network is automatically adjusted and the network parameters are adjusted to meet the needs of the actual detection task.
[0103] The following is a system embodiment corresponding to the above method embodiment. This embodiment can be implemented in conjunction with the above embodiment. The relevant technical details mentioned in the above embodiment are still valid in this embodiment. In order to reduce repetition, they are not repeated here. Accordingly, the relevant technical details mentioned in this embodiment can also be applied in the above embodiment.
[0104] like Figure 6 As shown, the present invention also proposes a stealth device for machine vision target detection, which includes:
[0105] The initial module constructs a generative adversarial network, which generates images with natural semantics as adversarial patterns based on multi-dimensional input variables; obtains multiple training images, which have detection objects and their corresponding target category labels;
[0106] A training module, adding the adversarial pattern to the detection object of each training image to obtain a sample-added image, inputting the sample-added image into a machine vision target detection model to obtain a target prediction category of the sample-added image, and constructing a first confidence loss function according to the target prediction category and the target category label to train and update the input variable;
[0107] The fine-tuning module inputs the input variable after training into the generative adversarial network to obtain a basic pattern, adds the basic pattern to the detection object of each training image to obtain an adversarial image, inputs the adversarial image into the machine vision target detection model, obtains the target prediction category and constructs a second confidence loss function according to the target category label; constructs an image regularization loss function according to the pixel tensor value of the adversarial image; constructs a smoothing loss according to the difference in the change between the pixel tensor values of the adversarial image; updates and modifies the adversarial image at a specified learning rate according to the second confidence loss function, the image regularization loss function, and the smoothing loss to obtain a perfect pattern; post-processes the perfect pattern to obtain a stealth pattern; and adds the stealth pattern to the detection object of the image to be invisible to obtain an invisible image with a stealth effect.
[0108] The stealth device for machine vision target detection, wherein the construction process of the generative adversarial network includes: selecting an object category, obtaining multiple image data belonging to the object category, training the image generation network, and obtaining the generative adversarial network for generating images of the object category.
[0109] The stealth device for machine vision target detection, wherein the post-processing includes:
[0110] The perfected pattern is subjected to mask-shift transformation, and / or mean pooling, and / or random perturbation, and / or random rotation, and / or random scale change.
[0111] like Figure 7 As shown, the present invention further proposes a first electronic device A in another embodiment, which includes the stealth device for machine vision target detection.
[0112] like Figure 8 As shown, the first electronic device A can also be connected to the data acquisition device C and the information display device D through a wired or wireless information transmission scheme. The data acquisition device C is used to collect and obtain the image to be invisible, and the information display device D is used to display the invisible image analyzed by the present invention.
[0113] The information display device D can sort and process the data output by the first electronic device A based on the information display mechanism to improve the readability of the data output by the first electronic device A. The information display mechanism can be manually preset, for example, the data output by the first electronic device A is visually displayed, which can be based on the display parameters and / or attributes set by the user. The display parameters can be, for example, the display data range, and the display attributes can be, for example, the display font, color, whether to scroll and play, etc. The user is presented with the key information specified by the user, such as invisible pictures and their invisible effects, etc. The user can understand this information more timely without having to access the secondary page or scroll the page, saving the user's operation. Or the information display mechanism can be an artificial intelligence AI display model, which can learn the user's key information based on the user's previous usage habits, such as viewing time, number of clicks, number of edits, etc., and then automatically present rich and necessary key information to the user.
[0114] The present invention also proposes a storage medium VIII in another embodiment, which is used to store a computer program for executing the stealth method for machine vision target detection. It should be understood that the storage medium in the embodiment of the present invention can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM) or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of random access memory (RAM) are available, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM), and direct rambus RAM (DRRAM).
[0115] Fig. 9 A schematic block diagram of a second electronic device 1000 that can be used to implement an embodiment of the present invention is shown. The second electronic device 1000 electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The second electronic device 1000 can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples, and are not intended to limit the implementation of the present invention described and / or required herein. The second electronic device 1000 may be the same or different from the first electronic device A.
[0116] The second electronic device 1000 includes a computing unit I, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory II (ROM) or a computer program loaded from a storage medium VIII into a random access memory (RAM) III. In RAM III, various programs and data required for the operation of the device 1000 can also be stored. The computing unit I, ROM II, and RAM III are connected to each other via a bus IV. An input / output (I / O) interface V is also connected to the bus IV.
[0117] A plurality of components in the second electronic device 1000 are connected to the I / O interface V, including: an input unit VI, such as a keyboard, a mouse, etc.; an output unit VII, such as various types of displays, speakers, etc.; a storage medium VIII, such as a disk, an optical disk, etc.; and a communication unit IX, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit IX allows the second electronic device 1000 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0118] The computing unit I may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of computing unit I include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit I performs the various methods and processes described above, such as method steps 1-6 and steps 7-9. For example, in some embodiments, the method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage medium VIII. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 1000 via ROM II and / or a communication unit IX. When the computer program is loaded into RAM III and executed by the computing unit I, one or more steps of the method described above may be performed. Alternatively, in other embodiments, the computing unit I may be configured to execute the method in any other appropriate manner (e.g., by means of firmware).
[0119] Although the embodiments of the present invention have been disclosed as above, they are not limited to the applications listed in the specification and the implementation modes, and they can be fully applied to various fields suitable for the present invention. For those familiar with the art, additional modifications can be easily implemented. Therefore, without departing from the general concept defined by the claims and the scope of equivalents, the present invention is not limited to the specific details and the illustrations shown and described herein.
Claims
1. A stealth method for machine vision target detection, characterized in that: include: In the initial step, a generative adversarial network is constructed, which generates an image with natural semantics as an adversarial pattern according to multi-dimensional input variables; Obtain multiple training images, each of which has detection objects and their corresponding target category labels; A training step, adding the adversarial pattern to the detection object of each training image to obtain a sample-added image, inputting the sample-added image into a machine vision target detection model to obtain a target prediction category of the sample-added image, and constructing a first confidence loss function according to the target prediction category and the target category label to train and update the input variable; The fine-tuning step is to input the input variable after training into the generative adversarial network to obtain a basic pattern, add the basic pattern to the detection object of each training image to obtain an adversarial image, input the adversarial image into the machine vision target detection model, obtain the target prediction category and construct a second confidence loss function according to the target category label; construct an image regularization loss function according to the pixel tensor value of the adversarial image; construct a smoothing loss according to the difference in the change between the pixel tensor values of the adversarial image; update and modify the adversarial image at a specified learning rate according to the second confidence loss function, the image regularization loss function, and the smoothing loss to obtain a perfect pattern; post-process the perfect pattern to obtain a stealth pattern; add the stealth pattern to the detection object of the image to be invisible to obtain an invisible image with a stealth effect.
2. The stealth method for machine vision target detection according to claim 1, characterized in that: The construction process of the generative adversarial network includes: selecting an object category, obtaining a plurality of image data belonging to the object category, training an image generation network, and obtaining the generative adversarial network for generating images of the object category.
3. The stealth method for machine vision target detection as claimed in claim 1, characterized in that: This post-processing includes: The perfected pattern is subjected to mask-shift transformation, and / or mean pooling, and / or random perturbation, and / or random rotation, and / or random scale change.
4. A stealth device for machine vision target detection, characterized in that: include: The initial module constructs a generative adversarial network, which generates images with natural semantics as adversarial patterns based on multi-dimensional input variables; Obtain multiple training images, each of which has detection objects and their corresponding target category labels; A training module, adding the adversarial pattern to the detection object of each training image to obtain a sample-added image, inputting the sample-added image into a machine vision target detection model to obtain a target prediction category of the sample-added image, and constructing a first confidence loss function according to the target prediction category and the target category label to train and update the input variable; The fine-tuning module inputs the input variable after training into the generative adversarial network to obtain a basic pattern, adds the basic pattern to the detection object of each training image to obtain an adversarial image, inputs the adversarial image into the machine vision target detection model, obtains the target prediction category and constructs a second confidence loss function according to the target category label; constructs an image regularization loss function according to the pixel tensor value of the adversarial image; constructs a smoothing loss according to the difference in the change between the pixel tensor values of the adversarial image; updates and modifies the adversarial image at a specified learning rate according to the second confidence loss function, the image regularization loss function, and the smoothing loss to obtain a perfect pattern; post-processes the perfect pattern to obtain a stealth pattern; and adds the stealth pattern to the detection object of the image to be invisible to obtain an invisible image with a stealth effect.
5. The stealth device for machine vision target detection according to claim 1, characterized in that: The construction process of the generative adversarial network includes: selecting an object category, obtaining a plurality of image data belonging to the object category, training an image generation network, and obtaining the generative adversarial network for generating images of the object category.
6. The stealth device for machine vision target detection according to claim 1, characterized in that: This post-processing includes: The perfected pattern is subjected to mask-shift transformation, and / or mean pooling, and / or random perturbation, and / or random rotation, and / or random scale change.
7. An electronic device, characterized in that: It includes a stealth device for machine vision target detection as described in claims 4-7.
8. The electronic device according to claim 9, characterized in that: The electronic device is connected to an information display device, which is used to display the invisible image according to display parameters and attributes set by a user or through an artificial intelligence model.
9. A storage medium for storing a computer program for executing the stealth method for machine vision target detection as described in claims 1-3.
