A robust detection method for corrugated box trademarks with anti-attack function
Through AI defense means and adversarial attack style transfer module, corrugated carton trademark image data is processed, and the weight fusion is used to solve the problem of difficult, low efficiency and low accuracy of corrugated carton trademark detection, achieving efficient and accurate Detection effect.
Patent Information
- Application Number
- CN202210516002.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-12
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2042-05-12
AI Technical Summary
In the prior art, corrugated carton trademark inspection has problems such as difficult, low efficiency and low accuracy, mainly due to the complexity caused by unique appearance, diversity of examples, large-scale object detection, scalable network and brand similarity.
Using AI defense means and adversarial attack style transfer module to process the image data of corrugated carton trademark names and tail category image data to generate a robust enhanced training set, and build an object detection model based on the YOLOv5xB model to improve detection accuracy through weight fusion .
The accuracy of corrugated carton trademark inspection is improved, the ease and efficiency of inspection are realized, and the problems of high detection difficulty, low efficiency and low accuracy in the prior art are solved.
Smart Images

Figure CN114882510B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of visual inspection technology, and in particular to a method, system and device for robustly detecting corrugated paper box trademarks with anti-attack function. Background Art
[0002] With the development of global e-commerce platforms, more and more corrugated carton brands have entered e-commerce platforms, and the number of corrugated carton uses has continued to grow. At the same time, the intellectual property rights of corrugated carton have received more and more attention. In the packaging production of corrugated carton, the intellectual property rights of corrugated carton include the pattern design and brand of the product. Therefore, the identification and detection of corrugated carton trademarks is an important part and effective means of protecting the intellectual property rights of corrugated carton, which will protect the hard-earned creations and ideas of entrepreneurs and business owners from unfair competition.
[0003] Most of the existing research on corrugated box recognition and detection is based on small-scale data sets, which is not comprehensive enough when exploring emerging deep learning technologies. Corrugated paper trademark detection is a special case of general object detection in computer vision. Corrugated paper has a unique appearance, instance diversity, large-scale object detection, scalable network and brand similarity, which leads to the problems of difficulty, low efficiency and low accuracy in the detection of corrugated paper. Specifically, the unique appearance of corrugated paper refers to the unique and novel shape of the corrugated box, which can attract the attention of customers. For example, the shape of wine bottles is generally cylindrical. Some wine bottles use imitation shapes and are planned into complex anchor shapes or human shapes. Among a group of wine bottles with cylindrical and rectangular shapes, they will appear very prominent and beautiful. However, the unique appearance of corrugated boxes will bring complexity to detection. The trademark of a corrugated box may exist under multiple appearances, which increases the difficulty of detection.
[0004] Instance diversity refers to boxes that are mainly used to set off corrugated box trademarks and fully display the characteristics of corrugated box trademarks, which will enable customers to immediately recognize the product from the packaging, and the eye-catching trademarks on the packaging can immediately attract customers. The craft packaging cartons with elegant textures are more artistic than ordinary paper box packaging. The same corrugated box trademark may be very different in the real world due to different sizes, rotations, lighting, coloring, and occlusion. In addition, the same corrugated box trademark may have different trademark forms, such as icons, English words, Chinese, and cartoon pictures, all of which lead to the diversity of the corrugated box trademark dataset.
[0005] Large-scale detection methods require specific filter groups for each category, which makes them very complex and difficult to implement in the detection of a large number of categories. For example, R-FCN / DeformableR-FCN requires 49 / 197 filters at specific locations for each class, and RetinaNet requires 9 filters for each class on each convolutional feature map. For billions of products and millions of corrugated box logos in e-commerce databases, using the above methods requires hundreds of millions of filters to detect huge corrugated box logos, which makes them very slow and difficult in practical applications.
[0006] A scalable network means that the number of categories is fixed when detecting on datasets such as PASCAL VOC, MS COCO, and OpenImages. However, in reality, corrugated box trademarks will change dynamically with market changes, so dynamic expansion of categories is a necessary condition for corrugated box trademark detection.
[0007] Brand similarity means that some corrugated box trademarks are very similar, and similar images are misleading, which will lead to an increase in the error rate of the model and poor results when using a general detection network. Summary of the invention
[0008] The embodiments of the present invention provide a method, system and device for robustly detecting trademarks on corrugated cardboard boxes with anti-attack functions, which are used to solve the technical problems of existing corrugated cardboard box trademark detection, such as high difficulty, low efficiency and low accuracy.
[0009] In order to achieve the above purpose, the embodiment of the present invention provides the following technical solutions:
[0010] A robust detection method for corrugated box trademarks with anti-attack function comprises the following steps:
[0011] Acquire a corrugated paper box brand name and image data and tail category image data corresponding to the corrugated paper box brand name;
[0012] Processing the tail category image data corresponding to each of the corrugated box brand names to generate a pseudo-label training set;
[0013] The image data, the tail category image data and the pseudo-label training set are processed using AI defense means and an adversarial attack style transfer module to obtain a robust enhancement training set;
[0014] Constructing a model training set and a model test set according to the image data, the tail category image data, the pseudo-label training set and the robust enhancement training set;
[0015] Construct a YOLOv5xB model, based on the first training model, the second training model and the third training model obtained by training the YOLOv5xB model and the model training set;
[0016] Perform fusion processing according to the weights of the first training model, the second training model and the third training model to obtain optimal weights, and load the optimal weights into the YOLOv5xB model to obtain a target detection model;
[0017] The target detection model is used to perform reasoning detection on the model test set and output the detection result.
[0018] Preferably, constructing the YOLOv5xB model includes: based on YOLO v5x as a basic model, replacing the neck of the basic model with ASFF with an adaptive spatial feature fusion function to construct the YOLOv5xB model.
[0019] Preferably, processing the tail category image data corresponding to each of the corrugated box brand names to generate a pseudo-label training set includes: cropping, mapping, and radially fitting the tail category image data corresponding to each of the corrugated box brand names through Poisson fusion, median filter fusion, and spatial fusion generative adversarial network methods to generate a pseudo-label training set; or
[0020] The tail category image data corresponding to each corrugated box brand name are processed using traditional methods and spatial fusion generative adversarial networks to generate a pseudo-label training set.
[0021] Preferably, the weights of the first training model, the second training model and the third training model are fused to obtain the optimal weight, which includes: averaging the weights of the first training model, the second training model and the third training model, and taking the obtained average weight as the optimal weight.
[0022] Preferably, the first training model, the second training model and the third training model obtained by training based on the YOLOv5xB model and the model training set include: using the YOLOv5xB model to train the image data and the tail category image data to obtain the first training model; using the YOLOv5xB model to train the image data, the tail category image data and the pseudo-label training set of the model training set to obtain the second training model; using the neural network of the YOLOv5xB model to train the image data, the tail category image data, the pseudo-label training set and the robust enhancement training set of the model training set to obtain the third training model.
[0023] Preferably, the target detection model is used to perform inference detection on the model test set, and outputting the detection results includes: in the target detection model, multi-scale detection and non-maximum suppression by dynamically adjusting the threshold are used to output the detection results as a target image position point coordinate tensor.
[0024] The present invention also provides a corrugated box trademark robust detection system with anti-attack function, comprising a data acquisition module, a first processing module, a second processing module, a model data module, a model building module, a weight analysis module and an output module;
[0025] The data acquisition module is used to acquire the corrugated paper box brand name and the image data and tail category image data corresponding to the corrugated paper box brand name;
[0026] The first processing module is used to process the tail category image data corresponding to each of the corrugated box brand names to generate a pseudo-label training set;
[0027] The second processing module is used to process the image data, the tail category image data and the pseudo-label training set using AI defense means and an adversarial attack style transfer module to obtain a robust enhancement training set;
[0028] The model data module is used to construct a model training set and a model test set according to the image data, the tail category image data, the pseudo-label training set and the robust enhancement training set;
[0029] The model building module is used to build a YOLOv5xB model, based on the first training model, the second training model and the third training model obtained by training the YOLOv5xB model and the model training set;
[0030] The weight analysis module is used to perform fusion processing according to the weights of the first training model, the second training model and the third training model to obtain the optimal weight, and load the optimal weight into the YOLOv5xB model to obtain the target detection model;
[0031] The output module is used to use the target detection model to perform reasoning detection on the model test set and output the detection result.
[0032] Preferably, the robust detection system for corrugated box trademarks with anti-attack function includes a model building module, which is used to build a YOLOv5xB model based on YOLO v5x as a basic model, replacing the neck of the basic model with ASFF with adaptive spatial feature fusion function.
[0033] Preferably, the first processing module is further used to perform cropping, mapping, and radial bonding on the tail category image data corresponding to each of the corrugated box brand names by means of Poisson fusion, median filter fusion, and spatial fusion generative adversarial network to generate a pseudo-label training set; or
[0034] The tail category image data corresponding to each corrugated box brand name are processed using traditional methods and spatial fusion generative adversarial networks to generate a pseudo-label training set.
[0035] The present invention also provides a corrugated paper box trademark robust detection device with anti-attack function, including a processor and a memory;
[0036] The memory is used to store program codes and transmit the program codes to the processor;
[0037] The processor is used to execute the above-mentioned robust detection method for corrugated box trademarks with anti-attack function according to the instructions in the program code.
[0038] It can be seen from the above technical scheme that the embodiments of the present invention have the following advantages: the robust detection method, system and device for corrugated cardboard box trademarks with anti-attack function, the method includes obtaining the corrugated cardboard box trademark name and the image data and tail category image data corresponding to the corrugated cardboard box trademark name; processing the tail category image data corresponding to each corrugated cardboard box trademark name to generate a pseudo-label training set; processing the image data, tail category image data and pseudo-label training set using AI defense means and adversarial attack style transfer modules to obtain a robust enhancement training set; constructing a model training set and a model test set based on the image data, tail category image data, pseudo-label training set and robust enhancement training set; constructing a YOLOv5xB model, and obtaining a first training model, a second training model and a third training model based on the YOLOv5xB model and the model training set; performing fusion processing according to the weights of the first training model, the second training model and the third training model to obtain the optimal weight, and loading the optimal weight into the YOLOv5xB model to obtain a target detection model; using the target detection model to perform inference detection on the model test set and output the detection result. This robust detection method for corrugated cardboard trademarks with anti-attack function processes the image data of the corrugated cardboard trademark name and the tail category image data through AI defense means and adversarial attack style transfer modules to obtain stylized and attacked model training sets and model test sets. The target detection model is constructed based on the YOLOv5xB model with adaptive spatial feature fusion of the model training set, thereby improving the model detection accuracy. The target detection model is used to detect corrugated cardboard trademarks, which makes detection easy, efficient and accurate, and solves the technical problems of existing corrugated cardboard trademark detection, such as high difficulty, low efficiency and low accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0040] Figure 1 This is a flowchart of the steps of the robust detection method for corrugated box trademarks with anti-attack function according to an embodiment of the present invention;
[0041] Figure 2 It is a flow chart of the adversarial attack style transfer module in the robust detection method for corrugated box trademarks with anti-attack function according to an embodiment of the present invention;
[0042] Figure 3 It is a flow chart of the adversarial attack style transfer module in the robust detection method for corrugated box trademarks with anti-attack function according to an embodiment of the present invention;
[0043] Figure 4 This is a framework diagram of the robust detection system for corrugated box trademarks with anti-attack function described in an embodiment of the present invention. DETAILED DESCRIPTION
[0044] In order to make the purpose, features and advantages of the present invention more obvious and easy to understand, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described below are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0045] In an embodiment of the present application, corrugated paper trademark detection can adopt a special case of general object detection in computer vision. Corrugated paper trademark detection is challenging in the following aspects, such as unique appearance, instance diversity, large-scale object detection, scalable network and brand similarity.
[0046] The embodiments of the present application provide a method, system and device for robustly detecting trademarks on corrugated cardboard boxes with anti-attack functions, which are used to solve the technical problems of existing corrugated cardboard box trademark detection, such as high difficulty, low efficiency and low accuracy.
[0047] Embodiment 1:
[0048] Figure 1 The present invention is a flowchart of the steps of the robust detection method for corrugated box trademarks with anti-attack function described in an embodiment of the present invention.
[0049] like Figure 1 As shown, the embodiment of the present invention provides a method for robustly detecting corrugated box trademarks with anti-attack function, comprising the following steps:
[0050] S1. Obtain a corrugated paper box brand name and image data and tail category image data corresponding to the corrugated paper box brand name.
[0051] It should be noted that the tail category of the balanced corrugated box is mainly obtained based on the corrugated box trademark data. The corrugated box trademark data includes: the name of the corrugated box trademark, the distribution of the corrugated box trademark categories, the number of each tail category, the relationship between the image length and width ratio in each image data, and the number of detection boxes. In this embodiment, the tail category refers to the fact that the number of samples in this category is too small; for example, there are only dozens of samples in the brand categories such as Porsche, MaxMara, and Panerai in the public open brands data set, which belong to the tail category. Among them, the tail category in the corrugated box trademark data can be determined according to the actual situation based on the specific brand category needs.
[0052] In this embodiment, the image data may be 50,486 pictures of original corrugated boxes obtained from an existing database Open brands.
[0053] S2. Process the tail category image data corresponding to each corrugated box brand name to generate a pseudo-label training set.
[0054] In the embodiment of the present application, the tail category image data corresponding to each corrugated box brand name is cropped, mapped, and radially fitted through Poisson fusion, median filter fusion, and spatial fusion generative adversarial network methods to generate a pseudo-label training set. The generated pseudo-label training set augments and enhances the tail category image data.
[0055] It should be noted that the tail category image data contains the logo image of the corrugated box. In the process of processing the tail category image data, the images in the tail category image data are first cropped and then mapped through Poisson fusion, median filter fusion and spatial fusion generative adversarial network. Secondly, in the process of fusion mapping, the image processing methods such as cropping and radial transformation of the image size and edges are used to fit the image, and sufficiently diverse image data is obtained to construct a pseudo-label training set, thereby enhancing the tail category image data.
[0056] In an embodiment of the present application, a traditional method and a spatial fusion generative adversarial network are used to process the tail category image data corresponding to each corrugated box brand name to generate a pseudo-label training set.
[0057] It should be noted that the traditional method includes at least one of the following: adding rain, fog, jigsaw shading, color jitter, radial blur, Gaussian blur noise, and then using the basic methods of stylization and cartoonization in OpenCV image processing; and the generative adversarial model method of stylization injection through deep learning. The spatial fusion generative adversarial network method combines the geometry generator and the appearance generator to achieve the simultaneous generation of geometry and appearance space. The geometry generator learns the contextual content of the background image to transform the foreground object into the background image. The appearance synthesizer adjusts the color, brightness and style of the foreground object and embeds them harmoniously into the background image, where a guided filter is introduced to retain details. The geometry generator and the appearance synthesizer are interconnected, and they can be trained end-to-end without supervision to improve detection efficiency.
[0058] S3. The image data, tail category image data and pseudo-label training set are processed using AI defense methods and adversarial attack style transfer modules to obtain a robust enhanced training set.
[0059] It should be noted that the data of step S2 and step S1 are processed mainly through AI defense means and adversarial attack style transfer modules to obtain a robust enhanced training set with enhanced anti-interference.
[0060] In the embodiment of the present application, the AI defense means is to use self-adversarial training gradients when training the network to prevent FGSM attacks. The robust detection method for corrugated cardboard trademarks with anti-attack function increases adversarial samples through AI defense means, enhances the data in the robust enhancement training set, provides diversified data for subsequent model construction, and improves the accuracy of robust detection of corrugated cardboard trademarks with anti-attack function.
[0061] It should be noted that the AI defense means enhancement is mainly for reverse engineering after observing the test samples of the model test set in the subsequent step S4. The AI defense means increase the anti-interference factors mainly including adding rain, fog, light conditions, ISO noise, ColorJitter, Medium blur, Gaussian blur and occlusion, which can make the acquired image data avoid the interference of rain, fog, ISO early, various blur and lighting factors. In this embodiment, the transformation in albumentations is used in the training code of the model, and the data enhancement is completed in combination with the mosaic enhancement method.
[0062] Figure 2 The present invention is a flowchart of the adversarial attack style transfer module in the robust detection method for corrugated box trademarks with anti-attack function described in an embodiment of the present invention.
[0063] In the embodiment of the present application, the adversarial attack style transfer module is mainly composed of an automatic encoder of a stylized image based on Adain or perceptual loss to form an adversarial attack style transfer module. Figure 2 As shown in the figure, the adversarial attack style transfer module generates some adversarial stylized images, which can be used to deceive the detector in the YOLOv5xB model used in the subsequent step to detect the trademark name of the corrugated box. The detector in the YOLOv5xB model can learn from these "poisoned" images (such as adversarial stylized images) and continuously improve the detection accuracy of the YOLOv5xB model.
[0064] It should be noted that the adversarial attack style transfer module includes a content image and a style image. The features of the content image and the style image are extracted by the adversarial attack style transfer module through a pre-trained image encoder to obtain content features and style features. The content features and style features are fused through a style projection module and decoded by a learnable image decoder to generate a stylized image. The adversarial attack style transfer module is learned under the supervision of style loss, perceptual loss and KL divergence loss, and is also calculated in the image feature space. Among them, pre-training refers to the network that extracts features by the adversarial attack style transfer module. The calculation formula of the loss parameter in the adversarial attack style transfer module obtains the content loss and style loss in the adversarial attack style transfer module. The loss refers to the difference between the original image (such as image data, tail category image data or images in the pseudo-label training set) and the adversarial stylized image. The loss is calculated to minimize the difference between the images and achieve style transfer. The calculation formula of the loss parameter in the adversarial style transfer module is:
[0065]
[0066]
[0067]
[0068]
[0069] Where, L s , L p are style loss function and content loss function respectively, L KL , L PG are the KL divergence loss function and the total loss, μ and σ are the mean and variance, λ is a hyperparameter, i is the number of convolutional network layers in the adversarial attack style transfer module, N is the total number of convolutional network layers in the adversarial attack style transfer module, E(c) is the original image feature, is the feature of adversarial stylized image, is the feature of the stylized reference image at the i-th layer of the image encoder, is the feature of the stylized image at the i-th layer of the image encoder.
[0070] S4. Construct a model training set and a model test set based on the image data, the tail category image data, the pseudo-label training set and the robust enhancement training set. Specifically, 80% of the image data, the tail category image data, the pseudo-label training set and the robust enhancement training set are used as the model training set, and the remaining 20% of the image data, the tail category image data, the pseudo-label training set and the robust enhancement training set are used as the model test set.
[0071] It should be noted that the image data obtained from step S1 to step S3, the tail category image data, the pseudo-label training set and the robust enhancement training set constitute a data set, 80% of the data in the data set, and 20% of the data in the data set constitute a model test set. In this embodiment, both the model test set and the model training set contain a large amount of adversarial sample data (abnormal textures and irregular changes), and the adversarial data is mainly obtained through the pseudo-label training set and the robust enhancement training set. Adversarial training is used in training to enhance the smoothness of the classifier boundary of the subsequent step YOLOv5xB model detector; when using the I-GSM attack, noise is iteratively added to each training sample; then, the attack sample continues to be added to the training as an enhancement, and after each back propagation, the adversarial sample is obtained for a second back propagation. In order to speed up the training speed, the training images in the model training set maintain the aspect ratio and padding to obtain a size of 640x640.
[0072] S5. Build a YOLOv5xB model, and obtain a first training model, a second training model, and a third training model based on the YOLOv5xB model and the model training set.
[0073] In this embodiment, the YOLOv5xB model is used to train the image data and tail category image data of the model training set to obtain a first training model; the YOLOv5xB model is used to train the image data, tail category image data and pseudo-label training set of the model training set to obtain a second training model; the neural network of the YOLOv5xB model is used to train the image data, tail category image data, pseudo-label training set and robust enhancement training set of the model training set to obtain a third training model.
[0074] It should be noted that the three new training models are obtained mainly by training on the YOLOv5xB model based on different data in the model training set.
[0075] S6. Perform fusion processing according to the weights of the first training model, the second training model and the third training model to obtain the optimal weight, load the optimal weight into the YOLOv5xB model, and obtain the target detection model.
[0076] It should be noted that the weights of the first training model, the second training model and the third training model obtained in step S5 are mainly used to obtain the optimal weights, and then the optimal weights are loaded into the YOLOv5xB model to construct the target detection model.
[0077] S7. Use the target detection model to perform inference detection on the model test set and output the detection results.
[0078] It should be noted that the data in the model test set is input into the target detection model for reasoning detection, and the detection results of the corrugated box target are output.
[0079] The present invention provides a method for robustly detecting corrugated cardboard box trademarks with an anti-attack function, comprising: obtaining a corrugated cardboard box trademark name and image data and tail category image data corresponding to the corrugated cardboard box trademark name; processing the tail category image data corresponding to each corrugated cardboard box trademark name to generate a pseudo-label training set; processing the image data, the tail category image data and the pseudo-label training set using an AI defense method and an adversarial attack style transfer module to obtain a robust enhancement training set; constructing a model training set and a model test set according to the image data, the tail category image data, the pseudo-label training set and the robust enhancement training set; constructing a YOLOv5xB model, and obtaining a first training model, a second training model and a third training model based on the YOLOv5xB model and the model training set; performing fusion processing according to the weights of the first training model, the second training model and the third training model to obtain an optimal weight, and loading the optimal weight into the YOLOv5xB model to obtain a target detection model; and performing inference detection on the model test set using the target detection model to output a detection result. This robust detection method for corrugated cardboard trademarks with anti-attack function processes the image data of the corrugated cardboard trademark name and the tail category image data through AI defense means and adversarial attack style transfer modules to obtain stylized and attacked model training sets and model test sets. The target detection model is constructed based on the YOLOv5xB model with adaptive spatial feature fusion of the model training set, thereby improving the model detection accuracy. The target detection model is used to detect corrugated cardboard trademarks, which makes detection easy, efficient and accurate, and solves the technical problems of existing corrugated cardboard trademark detection, such as high difficulty, low efficiency and low accuracy.
[0080] Figure 3 This is a flow chart of the adversarial attack style transfer module in the robust detection method for corrugated box trademarks with anti-attack function according to an embodiment of the present invention. Figure 3In the figure, a and b are the neck structures of the basic model, and c and d are the neck structures of the YOLOv5xB model.
[0081] In one embodiment of the present invention, the robust detection method for corrugated box trademarks with anti-attack function includes: based on YOLO v5x as a basic model, the neck of the basic model is replaced with ASFF with adaptive spatial feature fusion function to construct a YOLOv5xB model.
[0082] It should be noted that the YOLOv5xB model is mainly constructed based on Yolov5 as the base model (Baseline model). V5x and a resolution of 640px are used to construct the YOLOv5xB model on the base model, so that the constructed YOLOv5xB model continues to retain the enhancement of mosaic data. GIOU Loss is used to supervise the detection frame during the construction of the YOLOv5xB model. The main structure of the constructed YOLOv5xB model is as follows Figure 3 As shown in the figure, in order to achieve different results from the YOLOV5 architecture of the base model, the backbone structure of the YOLOv5xB model includes an additional bottleneck layer and a fourth anchor layer for feature maps of 1 / 64 scale. The YOLOv5xB model adjusts the structure of the neck, which only concentrates the feature maps of different scales in the original base model, and uses ASFF instead of the neck. ASFF uses a weighted sum method to combine features of different scales, improves the integration of anchors of different scales, and also improves the detection performance of the YOLOv5x network in the YOLOv5xB model for multi-scale targets.
[0083] In one embodiment of the present invention, a target detection model is used to perform inference detection on a model test set, and outputting the detection results includes: in the target detection model, multi-scale detection and non-maximum suppression by dynamically adjusting the threshold are used to output the detection results as a target image position point coordinate tensor.
[0084] It should be noted that the target detection model is used to perform network reasoning detection on the model test set. During the process of network reasoning, the images of the model test set will be multi-scale detected to improve the recall and accuracy of the target detection model. The target image position point coordinate tensor output by the target detection model will output the final target image position point coordinate tensor through the non-maximum suppression method with dynamically adjusted thresholds. The target detection model adopts the non-maximum suppression method with dynamically adjusted thresholds. On the basis of the non-maximum suppression algorithm, different types of images are taken into account, so that normal images are processed according to the original threshold, and images with low confidence due to the addition of adversarial forces can be automatically adjusted, and the threshold is appropriately lowered, thereby improving the detection accuracy. Among them, multi-scale detection refers to detection at each scale once at scales such as 128x128, 256x256, 384x384, 512x512, 640x640, and 1024x1024. The target image is the corrugated box trademark image to be detected.
[0085] In the embodiment of the present application, the non-maximum suppression method of dynamically adjusting the threshold can firstly predict the maximum confidence of the prediction result in the image of the model test set. Then this maximum confidence Subtract δ as the new dynamic threshold and use and For maximum confidence Subtract δ to perform interval clipping constraint operation. The interval clipping constraint expression in this target detection model is:
[0086]
[0087] in, is 0.25, is 0.15 and δ is 0.08.
[0088] In an embodiment of the present application, the non-maximum suppression method of dynamically adjusting the threshold mainly relies on using a classifier to obtain multiple candidate detection frames for the target to be detected, as well as the probability values of belonging to the category in the candidate detection frames, sorting the scores of all frames, and selecting the highest score and its corresponding detection frame; then traversing the remaining detection frames, if the overlapping area with the current highest score detection frame is greater than a certain dynamic adjustment threshold, the detection frame is deleted; finally, the highest score is selected from the unprocessed candidate detection frames, and the above process is repeated.
[0089] Embodiment 2:
[0090] Figure 4 It is a framework diagram of a robust detection system for corrugated box trademarks with anti-attack function according to an embodiment of the present invention.
[0091] like Figure 4As shown, the embodiment of the present invention also provides a corrugated box trademark robust detection system with anti-attack function, including a data acquisition module 10, a first processing module 20, a second processing module 30, a model data module 40, a model building module 50, a weight analysis module 60 and an output module 70;
[0092] The data acquisition module 10 is used to acquire the corrugated paper box brand name and the image data and tail category image data corresponding to the corrugated paper box brand name;
[0093] The first processing module 20 is used to process the tail category image data corresponding to each corrugated box brand name to generate a pseudo-label training set;
[0094] A second processing module 30 is used to process the image data, the tail category image data and the pseudo-label training set using AI defense means and an adversarial attack style transfer module to obtain a robust enhanced training set;
[0095] A model data module 40, for constructing a model training set and a model test set according to the image data, the tail category image data, the pseudo-label training set and the robust enhancement training set;
[0096] The model building module 50 is used to use the YOLOv5xB model to train the image data and tail category image data of the model training set to obtain a first training model; use the YOLOv5xB model to train the image data, tail category image data and pseudo-label training set of the model training set to obtain a second training model; use the neural network of the YOLOv5xB model to train the image data, tail category image data, pseudo-label training set and robust enhancement training set of the model training set to obtain a third training model;
[0097] A weight analysis module 60 is used to perform fusion processing according to the weights of the first training model, the second training model and the third training model to obtain an optimal weight, and load the optimal weight into the YOLOv5xB model to obtain a target detection model;
[0098] The output module 70 is used to use the target detection model to perform reasoning detection on the model test set and output the detection results.
[0099] In an embodiment of the present application, the robust detection system for corrugated box trademarks with anti-attack function includes a model building module, which is used to build a YOLOv5xB model based on YOLO v5x as the basic model, replacing the neck of the basic model with ASFF with adaptive spatial feature fusion function.
[0100] In the embodiment of the present application, the first processing module 20 is further used to crop, map, and radially fit the tail category image data corresponding to each corrugated box brand name through Poisson fusion, median filter fusion, and spatial fusion generative adversarial network methods to generate a pseudo-label training set; or
[0101] The tail category image data corresponding to each corrugated box brand name are processed using traditional methods and spatial fusion generative adversarial networks to generate a pseudo-label training set.
[0102] It should be noted that the modules in the system of Example 2 correspond to the steps in the method of Example 1. The content of the robust detection method for corrugated box trademarks with anti-attack function has been explained in detail in Example 1, and the content of the modules in the system will not be explained in detail in this Example 2.
[0103] Embodiment three:
[0104] The embodiment of the present invention provides a corrugated box trademark robust detection device with anti-attack function, including a processor and a memory;
[0105] A memory, used for storing program codes and transmitting the program codes to a processor;
[0106] The processor is used to execute the above-mentioned robust detection method for corrugated box trademarks with anti-attack function according to the instructions in the program code.
[0107] It should be noted that the processor is used to execute the steps in the above embodiment of a robust detection method for corrugated box trademarks with anti-attack function according to the instructions in the program code. Alternatively, the processor implements the functions of each module / unit in the above embodiments of each system / device when executing the computer program.
[0108] Exemplarily, the computer program may be divided into one or more modules / units, one or more modules / units are stored in a memory and executed by a processor to complete the present application. One or more modules / units may be a series of computer program instruction segments capable of completing a specific function, and the instruction segments are used to describe the execution process of the computer program in a terminal device.
[0109] The terminal device may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The terminal device may include, but is not limited to, a processor and a memory. Those skilled in the art will appreciate that this does not constitute a limitation on the terminal device, and may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the terminal device may also include input and output devices, network access devices, buses, etc.
[0110] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0111] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices 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. 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 an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0112] 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.
[0113] 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.
[0114] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A robust detection method for corrugated box trademarks with anti-attack function, characterized in that: The following steps are involved: Acquire a corrugated paper box brand name and image data and tail category image data corresponding to the corrugated paper box brand name; Processing the tail category image data corresponding to each of the corrugated box brand names to generate a pseudo-label training set; The image data, the tail category image data and the pseudo-label training set are processed using AI defense means and an adversarial attack style transfer module to obtain a robust enhancement training set; Constructing a model training set and a model test set according to the image data, the tail category image data, the pseudo-label training set and the robust enhancement training set; Construct a YOLOv5xB model, based on a first training model, a second training model, and a third training model obtained by training the YOLOv5xB model and the model training set; Perform fusion processing according to the weights of the first training model, the second training model and the third training model to obtain optimal weights, and load the optimal weights into the YOLOv5xB model to obtain a target detection model; The target detection model is used to perform reasoning detection on the model test set, and the detection result is output.
2. The robust detection method for corrugated box trademarks with anti-attack function according to claim 1 is characterized in that: Building the YOLOv5xB model includes: based on YOLO v5x as a basic model, replacing the neck of the basic model with ASFF with an adaptive spatial feature fusion function to build the YOLOv5xB model.
3. The robust detection method for corrugated box trademarks with anti-attack function according to claim 1 is characterized in that: Processing the tail category image data corresponding to each of the corrugated paper box brand names to generate a pseudo-label training set includes: cropping, mapping, and radially fitting the tail category image data corresponding to each of the corrugated paper box brand names through Poisson fusion, median filter fusion, and spatial fusion generative adversarial network methods to generate a pseudo-label training set; or The tail category image data corresponding to each corrugated box brand name are processed using traditional methods and spatial fusion generative adversarial networks to generate a pseudo-label training set.
4. The robust detection method for corrugated box trademarks with anti-attack function according to claim 1 is characterized in that: The weights of the first training model, the second training model and the third training model are fused to obtain the optimal weight, which includes: averaging the weights of the first training model, the second training model and the third training model, and obtaining the average weight value as the optimal weight.
5. The robust detection method for corrugated box trademarks with anti-attack function according to claim 1 is characterized in that: The first training model, the second training model and the third training model obtained by training based on the YOLOv5xB model and the model training set include: using the YOLOv5xB model to train the image data and the tail category image data to obtain the first training model; using the YOLOv5xB model to train the image data, the tail category image data and the pseudo-label training set of the model training set to obtain the second training model; using the neural network of the YOLOv5xB model to train the image data, the tail category image data, the pseudo-label training set and the robust enhancement training set of the model training set to obtain the third training model.
6. The robust detection method for corrugated box trademarks with anti-attack function according to claim 1 is characterized in that: The target detection model is used to perform inference detection on the model test set, and the output detection result includes: in the target detection model, multi-scale detection is used and the detection result is output as a target image position point coordinate tensor by non-maximum suppression method with dynamically adjusted thresholds.
7. A robust detection system for corrugated box trademarks with anti-attack function, characterized in that: It includes a data acquisition module, a first processing module, a second processing module, a model data module, a model building module, a weight analysis module and an output module; The data acquisition module is used to acquire the corrugated paper box brand name and the image data and tail category image data corresponding to the corrugated paper box brand name; The first processing module is used to process the tail category image data corresponding to each of the corrugated box brand names to generate a pseudo-label training set; The second processing module is used to process the image data, the tail category image data and the pseudo-label training set using AI defense means and an adversarial attack style transfer module to obtain a robust enhancement training set; The model data module is used to construct a model training set and a model test set according to the image data, the tail category image data, the pseudo-label training set and the robust enhancement training set; The model building module is used to build a YOLOv5xB model, based on the first training model, the second training model and the third training model obtained by training the YOLOv5xB model and the model training set; The weight analysis module is used to perform fusion processing according to the weights of the first training model, the second training model and the third training model to obtain the optimal weight, and load the optimal weight into the YOLOv5xB model to obtain the target detection model; The output module is used to use the target detection model to perform reasoning detection on the model test set and output the detection result.
8. The robust detection system for corrugated paper box trademarks with anti-attack function according to claim 7 is characterized in that: The invention comprises a model building module, wherein the model building module is used to build a YOLOv5xB model based on YOLO v5x as a basic model and replace the neck of the basic model with ASFF with an adaptive spatial feature fusion function.
9. The robust detection system for corrugated paper box trademarks with anti-attack function according to claim 7 is characterized in that: The first processing module is further used to perform cropping, mapping, and radial bonding on the tail category image data corresponding to each of the corrugated box brand names by means of Poisson fusion, median filter fusion, and spatial fusion generative adversarial network to generate a pseudo-label training set; or The tail category image data corresponding to each corrugated box brand name are processed using traditional methods and spatial fusion generative adversarial networks to generate a pseudo-label training set.
10. A robust detection device for corrugated box trademarks with anti-attack function, characterized in that: including a processor and a memory; The memory is used to store program codes and transmit the program codes to the processor; The processor is used to execute the robust detection method for corrugated box trademarks with anti-attack function as described in any one of claims 1-6 according to the instructions in the program code.
Citation Information
Patent Citations
Unmanned express package type paper product recycling and transporting trailer and using method
CN112550524A
Two-stage trademark detection method based on computer vision robustness target detection
CN113591850A