Filter surface defect detection system and equipment based on small sample training set
The virtual data set is generated through small sample training set and image expansion methods, and the YOLOv7 network structure is optimized, which solves the problems of low manual detection efficiency and difficult training of small sample data sets in filter surface defect detection, and realizes efficient and accurate filtering Detection of surface defect of cleaner.
Patent Information
- Application Number
- CN202411082190.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-08
- Publication Date
- 2024-12-06
AI Technical Summary
The prior art relies on manual detection and traditional image processing in filter surface defect detection, which is cost-effective and inefficient, making it difficult to quickly and accurately identify small target defects, and small sample data sets are difficult to train deep networks.
The filter surface defect detection system based on a small sample training set is adopted to generate a realistic data set through image acquisition, labeling and expansion modules, and the adversarial network model is generated using StyleGAN3, the YOLOv7 network structure is optimized, attention mechanism is added and loss function is modified. Improve detection accuracy.
It realizes efficient identification of filter surface defects under small sample data sets, improving detection accuracy and speed, especially for small target defects.
Smart Images

Figure CN119090814A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the technical field of filter surface defect detection, and in particular to a filter surface defect detection system and device based on a small sample training set. Background Art
[0002] The filter is one of the important components in the automobile engine system. Its main function is to filter impurities of liquid or gas type, prevent fuel system blockage, reduce mechanical wear, and thus ensure the stable operation of the engine. In the actual production process of the filter surface, due to factors such as processing equipment, production process, and production raw materials, it will inevitably cause surface defects such as rust and primer scratches. These defects will damage product performance and affect commercial use. At present, the appearance defects of filters are mainly detected by manual inspection and traditional image processing methods. The method of manual sampling is costly, not only labor-intensive, but also unable to accurately judge surface defects in a timely manner. At the same time, there is a high probability of errors, and the efficiency of quality inspection is difficult to control. In recent years, image recognition technology has made significant progress, but traditional image recognition is often limited by network structure and algorithm efficiency in defect detection, and it is difficult to achieve fast and accurate recognition. Although YOLOv7 has made breakthroughs in the field of target detection, there is still room for improvement in small target recognition. In addition, it is difficult to collect large-scale data sets for model training in actual industrial applications, and small-scale data sets cannot achieve effective training and optimization of deep networks. Therefore, developing a filter surface defect detection system and equipment based on a small sample training set that can effectively overcome the defects in the above-mentioned related technologies has become a technical problem that needs to be urgently solved in the industry. Summary of the invention
[0003] In view of the above problems existing in the prior art, an embodiment of the present invention provides a filter surface defect detection system and device based on a small sample training set.
[0004] In the first aspect, an embodiment of the present invention provides a filter surface defect detection system based on a small sample training set, including: an image acquisition module for collecting filter defect image data; an image labeling module for annotating the acquired images; an image expansion module for training a StyleGAN3 generative adversarial network model using defect images, generating defect images using the trained model, fusing the defect images with intact images, and expanding a predetermined number of sample data sets; and a target detection model for identifying defective filter products on a filter production line.
[0005] Based on the content of the above system embodiment, the filter surface defect detection system based on a small sample training set provided in the embodiment of the present invention, the target detection model network structure is: image input-Backbone module-Head module-prediction output; the Backbone module is composed of a CBS module, an ELAN module and an MP module, and the structure is CBS-CBS-CBS-CBS-ELAN-MP-ELAN-MP-ELAN-MP-ELAN; the Head module is composed of a PAFPN module, a REP module, a Conv module and a Biformer module, and the structure is PAFPN-Biformer-REP-Conv; the PAFPN module is composed of a CBS module, an ELAN-H module, a SPPCSPC module, an MP module, a UPSample module and a Concat module, and the structure is two branches: SPPCSPC-CBS-UPSample-Concat-ELAN-H-CBS-UPSample-Concat-ELAN-H and MP-Concat-ELAN-H-MP-Concat-ELAN-H.
[0006] Based on the contents of the above system embodiments, in the filter surface defect detection system based on a small sample training set provided in the embodiments of the present invention, the CBS module is composed of Conv, BN and SiLU modules, and the structure is: Conv-BN-SiLU, and the modules are connected in sequence; the ELAN module is composed of a CBS module and a Concat module, and the structure is two one-layer CBS modules, one three-layer CBS module and five CBS modules superimposed and connected to the Concat layer respectively.
[0007] Based on the contents of the above system embodiments, the filter surface defect detection system based on a small sample training set provided in the embodiments of the present invention, the MP module is composed of a MaxPool module, a CBS module, and a Concat module, and the structure is that MaxPool-CBS and CBS-CBS are respectively connected to the Concat layer.
[0008] Based on the contents of the above system embodiments, the filter surface defect detection system based on a small sample training set provided in the embodiments of the present invention, the REP module is composed of a Conv module, a BN module and an add module, and the structure is two Conv-BN and BN branches respectively connected to the add layer.
[0009] Based on the contents of the above system embodiments, in the filter surface defect detection system based on a small sample training set provided in the embodiments of the present invention, the Biformer module uses a two-level routing attention mechanism to clearly identify the predetermined target defects and reach the predetermined computational amount. The Biformer module is composed of a DWConv module, an LN module, a Bi-level Routing Attention module and an MLP module, and the structure is DWConv-LN-Bi-level Routing Attention-MLP.
[0010] Based on the content of the above system embodiment, in the filter surface defect detection system based on a small sample training set provided in the embodiment of the present invention, the BN module is used for batch normalization, and the calculation formula is:
[0011]
[0012] Where yi is the normalized and scaled output, γ and β are learnable scaling and offset parameters, and a i is the input value, μ B is the mean of the mini-batch, is the variance of the minimum batch, and ε is a constant used to stabilize the value.
[0013] Based on the content of the above system embodiment, the filter surface defect detection system based on a small sample training set provided in the embodiment of the present invention, the SiLU module activation function module, the calculation formula is:
[0014]
[0015] Among them, x is the input of the activation function, expressed as a vector; exp is the exponential function.
[0016] In a second aspect, an embodiment of the present invention provides an electronic device, including:
[0017] At least one processor, at least one memory, a communication interface and a bus; wherein,
[0018] The processor, memory, and communication interface communicate with each other via the bus;
[0019] The memory stores program instructions that can be executed by the processor. The processor calls the program instructions to execute the filter surface defect detection system based on a small sample training set provided by any one of the various implementations of the first aspect.
[0020] In the third aspect, an embodiment of the present invention provides a non-transitory computer-readable storage medium, which stores computer instructions, and the computer instructions enable a computer to implement a filter surface defect detection system based on a small sample training set provided by any one of the various implementation methods of the first aspect.
[0021] The filter surface defect detection system and device based on a small sample training set provided by the embodiment of the present invention uses an image expansion method to generate a realistic image expansion data set for the small sample problem, so that the deep learning model can be effectively trained. Secondly, the YOLOv7 network structure is optimized, the attention mechanism is added, and the loss function is modified, thereby improving the detection accuracy while maintaining the detection speed, especially for the detection of small target defects. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, a brief introduction is given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0023] Figure 1 A schematic diagram of the structure of a filter surface defect detection system based on a small sample training set provided by an embodiment of the present invention;
[0024] Figure 2 A schematic diagram of the physical structure of an electronic device provided by an embodiment of the present invention;
[0025] Figure 3 A schematic diagram of the target detection model structure provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0026] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, 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 described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in 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. In addition, the technical features in the various embodiments or single embodiments provided by the present invention can be arbitrarily combined with each other to form a feasible technical solution. This combination is not subject to the constraints of the sequence of steps and / or the structural composition mode, but must be based on the ability of ordinary technicians in this field to achieve. When the combination of technical solutions is contradictory or cannot be achieved, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention.
[0027] The embodiment of the present invention provides a filter surface defect detection system based on a small sample training set, see Figure 1 The system includes: an image acquisition module for collecting filter defect image data; an image labeling module for annotating the acquired images; an image expansion module for training the StyleGAN3 generative adversarial network model using defect images, generating defect images using the trained model, fusing the defect images with intact images, and expanding a predetermined number of sample data sets; and a target detection model for identifying defective filter products on the filter production line.
[0028] It should be noted that StyleGAN3 is a generative adversarial network model that can generate specific images based on a random set of vectors. Image expansion first crops the collected defective images, then makes the collected defective images into a defective dataset, trains the StyleGAN3 model, and then uses the trained StyleGAN3 model to generate realistic defective images, and uses image fusion to synthesize the defective images onto the non-defective filter images to obtain the filter images with defects.
[0029] The filter surface defect detection system based on a small sample training set provided in the present application is improved on the basis of YOLOv7 by adding an attention mechanism, modifying the network structure, and replacing the loss function, thereby achieving efficient recognition of surface defects of industrial filters. At the same time, a small sample data set expansion method is used to generate realistic sample images when the samples are limited, which can realize effective training of deep learning models.
[0030] See also Figure 3Based on the content of the above system embodiment, as an optional embodiment, the filter surface defect detection system based on a small sample training set provided in the embodiment of the present invention, the target detection model network structure is: image input-Backbone module-Head module-prediction output; the Backbone module is composed of a CBS module, an ELAN module and an MP module, and the structure is CBS-CBS-CBS-CBS-ELAN-MP-ELAN-MP-ELAN-MP-ELAN; the Head module is composed of a PAFPN module, a REP module, a Conv module and a Biformer module, and the structure is PAFPN-Biformer-REP-Conv; the PAFPN module is composed of a CBS module, an ELAN-H module, a SPPCSPC module, a MP module, a UPSample module and a Concat module, and the structure is two branches: SPPCSPC-CBS-UPSample-Concat-ELAN-H-CBS-UPSample-Concat-ELAN-H and MP-Concat-ELAN-H-MP-Concat-ELAN-H. The Conv module is a convolutional layer used for image convolution. There are two Biformer module branches in the Head module, which are used to extract different image depths.
[0031] The target detection model modifies the YOLOv7 branch prediction structure, changing the original three-branch prediction model into a two-branch model to improve the training and detection speed; adds an attention mechanism in each branch to improve the model's perception of predetermined target defects; uses the Wise-IoU loss function to replace the original YOLOv7 loss function to improve the generalization ability of the model; trains the target detection model through the training set to train the network parameters; uses the validation set to tune the parameters of the target detection model to obtain the trained target detection model; uses the test set to test the trained target detection model to obtain the output, and the model that passes the test is used in the filter production line to identify filter products with defects.
[0032] Based on the content of the above system embodiment, as an optional embodiment, the filter surface defect detection system based on a small sample training set provided in the embodiment of the present invention, the CBS module is composed of Conv, BN and SiLU modules, and the structure is: Conv-BN-SiLU, and the modules are connected in sequence; the ELAN module is composed of a CBS module and a Concat module, and the structure is two one-layer CBS modules, one three-layer CBS module and five CBS modules are superimposed and connected to the Concat layer respectively.
[0033] Based on the content of the above system embodiment, as an optional embodiment, the filter surface defect detection system based on a small sample training set provided in the embodiment of the present invention, the MP module is composed of a MaxPool module, a CBS module, and a Concat module, and the structure is that MaxPool-CBS and CBS-CBS are connected to the Concat layer respectively. The MaxPool module is a maximum pooling layer that can remove redundant information and expand the perception field. The Concat module is a fusion module that merges and superimposes channels of the same size but inconsistent parameters.
[0034] Based on the content of the above system embodiment, as an optional embodiment, the filter surface defect detection system based on a small sample training set provided in the embodiment of the present invention, the REP module is composed of a Conv module, a BN module and an add module, and the structure is two Conv-BN and BN branches respectively connected to the add layer.
[0035] Based on the content of the above system embodiment, as an optional embodiment, the filter surface defect detection system based on a small sample training set provided in the embodiment of the present invention, the Biformer module uses a two-level routing attention mechanism to clearly identify the predetermined target defects and reach the predetermined calculation amount. The Biformer module is composed of a DWConv module, an LN module, a Bi-levelRoutingAttention module and an MLP module, and the structure is DWConv-LN-Bi-level RoutingAttention-MLP. The DWConv module is a deep convolution layer used to perform deep convolution on the image.
[0036] Based on the content of the above system embodiment, as an optional embodiment, in the filter surface defect detection system based on a small sample training set provided in the embodiment of the present invention, the BN module is used for batch normalization, and the calculation formula is:
[0037]
[0038] Where yi is the normalized and scaled output, γ and β are learnable scaling and offset parameters, and a i is the input value, μ B is the mean of the mini-batch, is the variance of the minimum batch, and ε is a constant used to stabilize the value.
[0039] Based on the content of the above system embodiment, as an optional embodiment, the filter surface defect detection system based on a small sample training set provided in the embodiment of the present invention, the SiLU module activation function module, the calculation formula is:
[0040]
[0041] Among them, x is the input of the activation function, expressed as a vector; exp is the exponential function. The characteristic of the SiLU function is that when the input value is close to 0, its output is close to the input value, and when the input value is far from 0, its output is close to the sign of the input value. This characteristic makes SiLU perform very well when processing small input values.
[0042] The filter surface defect detection system and device based on a small sample training set provided by the embodiment of the present invention uses an image expansion method to generate a realistic image expansion data set for the small sample problem, so that the deep learning model can be effectively trained. Secondly, the YOLOv7 network structure is optimized, the attention mechanism is added, and the loss function is modified, thereby improving the detection accuracy while maintaining the detection speed, especially for the detection of small target defects.
[0043] The system of the embodiment of the present invention is implemented by relying on electronic devices, so it is necessary to introduce the relevant electronic devices. Based on this purpose, the embodiment of the present invention provides an electronic device, such as Figure 2 As shown, the electronic device includes: at least one processor, a communication interface, at least one memory and a communication bus, wherein at least one processor, the communication interface and at least one memory communicate with each other through the communication bus. At least one processor can call the logic instructions in at least one memory to implement various systems provided in the system embodiment.
[0044] In addition, the logic instructions in the at least one memory mentioned above can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the system described in each embodiment 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.
[0045] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0046] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to implement the methods or systems described in each embodiment or some parts of the embodiments.
[0047] The flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the systems, methods and computer program products according to multiple embodiments of the present invention. Based on this understanding, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and sometimes in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or the flowchart, and the combination of the boxes in the block diagram and / or the flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0048] It should be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "includes..." do not exclude the existence of other identical elements in the process, method, article or device including the elements. Any "predetermined threshold", "preset threshold" and other similar expressions that do not indicate specific values can be determined by a person of ordinary skill in the art through simple experiments or corresponding debugging.
[0049] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. 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 filter surface defect detection system based on a small sample training set, It is characterized in that include: An image acquisition module, used for collecting filter defect image data; The image labeling module annotates the collected images; the image expansion module uses defect images to train the StyleGAN3 generative adversarial network model, uses the trained model to generate defect images, merges the defect images with intact images, and expands the predetermined number of sample data sets; Object detection model for identifying defective filters on a filter production line.
2. The filter surface defect detection system based on a small sample training set according to claim 1, It is characterized in that The network structure of the target detection model is: image input-Backbone module-Head module-prediction output; the Backbone module is composed of a CBS module, an ELAN module and an MP module, and the structure is CBS-CBS-CBS-CBS-ELAN-MP-ELAN-MP-ELAN-MP-ELAN; the Head module is composed of a PAFPN module, a REP module, a Conv module and a Biformer module, and the structure is PAFPN-Biformer-REP-Conv; the PAFPN module is composed of a CBS module, an ELAN-H module, a SPPCSPC module, an MP module, a UPSample module and a Concat module, and the structure is two branches: SPPCSPC-CBS-UPSample-Concat-ELAN-H-CBS-UPSample-Concat-ELAN-H and MP-Concat-ELAN-H-MP-Concat-ELAN-H.
3. The filter surface defect detection system based on a small sample training set according to claim 2, It is characterized in that The CBS module is composed of Conv, BN and SiLU modules, and the structure is: Conv-BN-SiLU, and the modules are connected in sequence; the ELAN module is composed of CBS modules and Concat modules, and the structure is two one-layer CBS modules, one three-layer CBS module and five CBS modules superimposed and connected to the Concat layer respectively.
4. The filter surface defect detection system based on a small sample training set according to claim 3, It is characterized in that The MP module consists of the MaxPool module, the CBS module, and the Concat module, and the structure is that the MaxPool-CBS and CBS-CBS are connected to the Concat layer respectively.
5. The filter surface defect detection system based on a small sample training set according to claim 4, It is characterized in that The REP module consists of a Conv module, a BN module and an add module, and its structure is that two Conv-BN and BN branches are connected to the add layer respectively.
6. The filter surface defect detection system based on a small sample training set according to claim 5, It is characterized in that The Biformer module uses a two-level routing attention mechanism to clearly identify the predetermined target defects and achieve the predetermined computational amount. The Biformer module consists of a DWConv module, an LN module, a Bi-level Routing Attention module, and an MLP module, with a structure of DWConv-LN-Bi-level Routing Attention-MLP.
7. The filter surface defect detection system based on a small sample training set according to claim 6, It is characterized in that The BN module is used for batch normalization, and the calculation formula is: Where yi is the normalized and scaled output, γ and β are learnable scaling and offset parameters, and a i is the input value, μ B is the mean of the mini-batch, is the variance of the minimum batch, and ε is a constant used to stabilize the value.
8. The filter surface defect detection system based on a small sample training set according to claim 7, It is characterized in that SiLU module activation function module, the calculation formula is: Among them, x is the input of the activation function, expressed as a vector; exp is the exponential function.
9. An electronic device, It is characterized in that include: At least one processor, at least one memory, a communication interface and a bus; wherein, The processor, memory, and communication interface communicate with each other via the bus; The memory stores program instructions that can be executed by the processor, and the processor calls the program instructions to implement the system according to any one of claims 1 to 8.
10. A non-transitory computer-readable storage medium, It is characterized in that The non-transitory computer-readable storage medium stores computer instructions, which enable a computer to implement the system of any one of claims 1 to 8.
Citation Information
Cited By
Composite material plate pit and dirt detection method based on machine vision
CN119901747A
