A product defect intelligent detection method and system based on small sample learning

By combining the DINO and Swing Transformer algorithms, multi-scale feature maps are generated, which solves the problems of high data resource requirements and poor adaptability of transfer learning in industrial defect detection. It achieves efficient small-sample feature extraction and lightweight detection, which is suitable for quality control in fast-iterative production lines.

CN122335648APending Publication Date: 2026-07-03CHONGQING UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511902035.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-17
Publication Date
2026-07-03

Smart Images

  • Figure CN122335648A_ABST
    Figure CN122335648A_ABST
Patent Text Reader

Abstract

The application provides a product defect intelligent detection method and system based on small sample learning, comprising the following steps: acquiring a defect picture; calling a DINO algorithm to process the defect picture to obtain a first processing layer; calling a Swin Transformer algorithm to process the defect picture to obtain a plurality of down-sampling layers; replacing one layer in the plurality of down-sampling layers with the first processing layer to form a candidate layer group; selecting a plurality of layers including the first processing layer from the candidate layer group to form a to-be-processed layer group; and outputting the to-be-processed layer group to a small sample target detection learner for processing and detection. The application can effectively combine the advantages of the DINO algorithm and the Swin Transformer algorithm, and take into account the fine granularity and semantic information of image processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of defect detection, specifically to an intelligent product defect detection method and system based on few-sample learning. Background Technology

[0002] Intelligent inspection technology is a key means of industrial quality control, possessing advantages such as high efficiency, low cost, and sustainability. However, the diversity of industrial defects, their random distribution, and the differences in production line processes make it difficult to apply general inspection solutions. These problems often result in high false positive and false negative rates, limiting the practical effectiveness of traditional inspection methods (including models based on convolutional neural networks such as U-Net and YOLO). Although deep learning has made significant progress in the field of industrial inspection, the rapid iteration characteristics of production lines pose serious challenges to existing methods. For example, traditional networks such as U-Net and YOLO have high data resource requirements, requiring a large amount of labeled data and long training periods, making it difficult to adapt to the rapid launch of new products. In addition, while improved methods based on transfer learning can enhance generalization performance, they are constrained by the differences between the pre-training data domain and the distribution of industrial image features, and still face complex bottlenecks such as domain adaptability decay, feature representation bias, and limited real-time inference capabilities of domestically produced equipment in small-sample feature extraction and lightweight architecture design. Therefore, the industry needs a new defect detection technology solution. Summary of the Invention

[0003] The purpose of this invention is to provide a product defect intelligent detection method and system based on few-sample learning, which effectively combines the advantages of DINO and Swing Transformer, takes into account the semantic information and fine granularity of images, and achieves the acquisition of multi-scale features while improving feature extraction capabilities.

[0004] To achieve the above objectives, the present invention provides an intelligent product defect detection method, comprising the following steps: acquiring a defect image; processing the defect image using the DINO algorithm to obtain a first processing layer; processing the defect image using the Swing Transformer algorithm to obtain several downsampling layers; replacing one of the several downsampling layers with the first processing layer to form a candidate layer group; selecting several layers including the first processing layer from the candidate layer group to form a processing layer group; outputting the processing layer group to a feature map pyramid network for processing to generate a fused feature map; and outputting the fused feature map to a few-shot object detection learner for processing and detection.

[0005] Optionally, replacing one of the several downsampling layers with the first processing layer to form a candidate layer group specifically includes replacing the downsampling layer with the sampling multiple closest to the first processing layer with the first processing layer.

[0006] Optionally, replacing one of the several downsampling layers with the first processing layer to form a candidate layer group specifically includes replacing the downsampling layer with a sampling multiple of 16 times with the first processing layer.

[0007] Optionally, the few-sample object detection learner includes the DE-VIT algorithm model.

[0008] Optionally, the few-sample object detection learner has a region propagation network, and the region propagation network is adjusted as follows: the first convolutional layer of the region propagation network is replaced with a variable attention mechanism.

[0009] Optionally, the DINO algorithm includes the DINO V2 algorithm.

[0010] Optionally, selecting several layers including the first processing layer from the candidate layer group to form a candidate layer group specifically includes: sorting each layer in the candidate layer group from largest to smallest according to the sampling multiple, and selecting the layer ranked at the top preset number.

[0011] The present invention also provides an electronic device, the electronic device comprising: a memory storing a computer program; a processor communicatively connected to the memory, which executes the product defect intelligent detection method described above when the computer program is invoked; and a display communicatively connected to the processor and the memory, used to display a GUI interactive interface related to the product defect intelligent detection method.

[0012] The present invention also provides a readable storage medium storing a computer program that, when executed by a processor, implements the intelligent product defect detection method described in any of the preceding claims.

[0013] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the intelligent product defect detection method described in any of the above claims.

[0014] The intelligent product defect detection method and system based on few-sample learning provided by this invention have the following beneficial effects:

[0015] This invention provides an intelligent product defect detection method, comprising the following steps: acquiring a defect image; processing the defect image using the DINO algorithm to obtain a first processing layer; processing the defect image using the Swing Transformer algorithm to obtain several downsampling layers; replacing one of the several downsampling layers with the first processing layer to form a candidate layer group; selecting several layers including the first processing layer from the candidate layer group to form a processing layer group; outputting the processing layer group to a feature map pyramid network for processing to generate a fused feature map; and outputting the fused feature map to a few-shot object detection learner for processing and detection. The DINO algorithm has excellent feature extraction capabilities but cannot acquire multi-scale features. The Swing Transformer algorithm can acquire multi-scale features, but has fewer parameters and its feature quality is relatively poorer than that of the DINO algorithm. Based on this, the present invention replaces one layer in the Swing Transformer algorithm with the DINO processing layer, integrating the DINO algorithm into the Swing Transformer algorithm, thereby effectively combining the advantages of both DINO and Swing Transformer, improving feature extraction capabilities while acquiring multi-scale features, taking into account the semantic information and fine granularity of the image, and achieving effectiveness in small sample feature extraction and lightweight architecture design.

[0016] The present invention also provides an electronic device for performing the product defect intelligent detection method described in any one of the preceding claims. Therefore, the electronic device effectively combines the advantages of DINO and Swing Transformer, achieving improved feature extraction capabilities while acquiring multi-scale features, taking into account both semantic information and fine granularity of the image, and realizing effectiveness in small-sample feature extraction and a lightweight architecture design.

[0017] This invention also provides a readable storage medium for executing the product defect intelligent detection method described in any of the preceding claims. Therefore, the readable storage medium effectively combines the advantages of DINO and Swing Transformer, achieving improved feature extraction capabilities while acquiring multi-scale features, taking into account both semantic information and fine granularity of the image, and realizing effectiveness in small-sample feature extraction and a lightweight architecture design.

[0018] This invention also provides a computer program product for executing the intelligent product defect detection method described above. Therefore, the computer program product effectively combines the advantages of DINO and SwingTransformer, achieving improved feature extraction capabilities while acquiring multi-scale features, taking into account both semantic information and fine granularity of the image, and realizing effectiveness in small-sample feature extraction and a lightweight architecture design. Attached Figure Description

[0019] Figure 1 A flowchart illustrating an intelligent product defect detection method according to an embodiment of the present invention;

[0020] Figure 2 This is a block diagram of an electronic device provided according to an embodiment of the present invention;

[0021] The attached figures are labeled as follows:

[0022] 101-Processor; 102-Communication interface; 103-Memory; 104-Communication bus; 105-Display. Detailed Implementation

[0023] To make the objectives, advantages, and features of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that the drawings are all in a very simplified form and are not drawn to scale, and are only used to facilitate and clarify the explanation of the embodiments of this invention. Furthermore, the structures shown in the drawings are often part of the actual structures. In particular, different figures may emphasize different aspects and may sometimes use different scales.

[0024] It should be understood that when an element or layer is referred to as "on" or "connected to" other elements or layers, it may be directly on or connected to other elements or layers, or may include intervening elements or layers. Conversely, when an element is referred to as "directly on" or "directly connected to" other elements or layers, intervening elements or layers are not included. Although the terms first, second, third, etc., may be used to describe various elements, components, areas, layers, and / or portions, these elements, components, areas, layers, and / or portions should not be limited by these terms. These terms are only used to distinguish one element, component, area, layer, or portion from another element, component, area, layer, or portion. Therefore, without departing from the teachings of this invention, the first element, component, area, layer, or portion discussed below may be referred to as a second element, component, area, layer, or portion. Spatial relation terms such as "below," "under," "below," "above," "on top," "above," etc., may be used herein for convenience of description to describe the relationship between one element or feature shown in the figures and other elements or features. It should be understood that, in addition to the orientations shown in the figures, spatial relational terms are intended to also include different orientations of the devices in use and operation. For example, if the devices in the figures are flipped, then elements or features described as “below,” “under,” or “below” will be oriented “on” other elements or features. Devices may be oriented additionally (rotated 90 degrees or otherwise) and the spatial descriptive terms used herein will be interpreted accordingly. The terminology used herein is intended only to describe particular embodiments and is not intended to limit the invention. When used herein, the singular forms “a,” “an,” and “the” are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “comprising” is used to identify the inclusion of features, steps, operations, elements, and / or components, but does not exclude the inclusion or addition of one or more other features, steps, operations, elements, components, and / or groups. When used herein, the terms “and / or” include any and all combinations of the associated listed items.

[0025] The purpose of this invention is to provide a product defect intelligent detection method and system based on few-sample learning, which effectively combines the advantages of DINO and Swing Transformer, takes into account the semantic information and fine granularity of images, and achieves the acquisition of multi-scale features while improving feature extraction capabilities.

[0026] To achieve the above objectives, this invention provides an intelligent product defect detection method, please refer to... Figure 1 , Figure 1 This is a flowchart illustrating an embodiment of the intelligent product defect detection method provided by the present invention. Figure 1 As shown, the present invention includes the following steps:

[0027] Obtain defect images;

[0028] The defect image is processed using the DINO algorithm to obtain the first processing layer;

[0029] The defect image is processed using the Swin Transformer algorithm to obtain several downsampling layers;

[0030] Replace one of the several downsampling layers with the first processing layer to form a candidate layer group;

[0031] Select several layers including the first processing layer from the candidate layer group to form a candidate layer group;

[0032] The layers to be processed are output to Feature Pyramid Networks (FPN) for processing to generate fused feature maps.

[0033] The fused feature map is then output to a few-sample object detection learner for processing and detection.

[0034] The DINO algorithm boasts excellent feature extraction capabilities but cannot capture multi-scale features. The Swin Transformer algorithm can capture multi-scale features, but it has fewer parameters and its feature quality is relatively inferior to DINO. Therefore, this invention replaces one layer in the Swin Transformer algorithm with a DINO processing layer, integrating DINO into the Swin Transformer algorithm. This effectively combines the advantages of both DINO and Swin Transformer, improving image feature quality while considering semantic information and fine granularity. It achieves effectiveness in small-sample feature extraction and a lightweight architecture design, and uses a dynamic multi-scale image patch partitioning strategy to achieve joint modeling of local features and global semantics.

[0035] Specifically, replacing one of the several downsampling layers with the first processing layer to form a candidate layer group includes replacing the downsampling layer with the sampling multiple closest to that of the first processing layer with the first processing layer. In an exemplary embodiment, replacing one of the several downsampling layers with the first processing layer to form a candidate layer group specifically includes replacing the downsampling layer with a sampling multiple of 16 with the first processing layer. This is because, in the DINO algorithm, especially the DINO V2 algorithm, the sampling multiple of the first processing layer after DINO algorithm processing is 14 times. Therefore, replacing the closest layer in the Swin Transformer algorithm can improve the compatibility of the two after combination, and the sampling multiple of the closest layer in the Swin Transformer algorithm is generally 16 times.

[0036] When inputting the data into the few-sample object detection learner, the layers to be processed should be scientifically selected. Based on this, the present invention further provides the following technical solution: Selecting several layers, including the first processing layer, from the candidate layer group to form a candidate layer group specifically includes: sorting the layers in the candidate layer group from largest to smallest according to their sampling multiple, and selecting the layers with the highest ranking (a preset number of positions). In an exemplary embodiment, layers with sampling multiples of 32, 14 (i.e., a layer with a sampling multiple of 16 has been replaced by the first processing layer formed by the DINO algorithm), and 8 can be output to the feature map pyramid network. This setting is because if the sampling multiple is too small, it will not only increase the computational cost but also lead to a loss of fine-grained image data. It should be understood that any or all layers can also be output to the feature map pyramid network, as long as the replaced first processing layer is included.

[0037] Specifically, the few-shot object detection learner includes the DE-VIT algorithm model. The difference between this invention and existing technologies when calling few-shot object detection learners such as the DE-VIT algorithm lies in the fact that the few-shot object detection learner has a region propagation network. The region propagation network is adjusted as follows: the first convolutional layer of the region propagation network is replaced with a variable attention mechanism. It should be noted that other few-shot object detection learners may also have region propagation networks, and the adjustments made to the region propagation network in this invention are not limited to the DE-VIT algorithm. By dynamically adjusting the feature attention region through learnable sampling offsets, fine-grained edges of industrial defects (such as the elongated structure of scratches) and large-scale semantics (such as large label regions) can be accurately captured. Compared to the fixed window response of traditional convolution, deformable attention significantly reduces redundant computation through sparse sampling, accelerates model convergence, and its cross-scale feature modeling capability effectively alleviates the problem of missed detection of small targets (such as millimeter-level defects).

[0038] Based on the optimizations of this invention, it can be effectively applied to defect detection in small sample contexts. Based on industrial defect data feature analysis, open-source industrial defect datasets are searched, and a pre-training dataset containing industrial images (including typical defects such as surface scratches and label misalignment) is constructed. It should be noted that defect datasets with industrial scenes similar to the target detection object can be searched to achieve transfer training. Through the inventors' experiments,

[0039] In one exemplary embodiment, the encoder-decoder structure of the present invention may be specifically as follows:

[0040] 1. Encoder Section: The encoder extracts multi-scale features through the forward pass of a large industrial vision model, which effectively combines the DINO algorithm and the Swin Transformer. These features are then processed by a feature pyramid network to obtain a fused feature map containing rich semantic information and spatial details. This fused feature map is then input into the subsequent decoder for training, detection, and classification. Simultaneously, FPN fusion is performed on the multi-scale features to obtain a feature map with rich semantic information and details, which is used to generate region proposals.

[0041] 2. RPN part: Use the existing Region Proposal Network and train it separately on the supervised object detection task.

[0042] 3. Decoder section: The decoder utilizes the rich multi-scale features and region proposals generated by RPN, and uses the DE-VIT architecture optimized by this invention to expand and fine-tune the bounding boxes layer by layer, finally obtaining the detection results.

[0043] 4. Integration of the optimized DE-VIT algorithm model: At the encoder end, a cross-layer connection is established through a Feature Pyramid Network (FPN) to cascade and fuse the multi-scale features output from the large industrial vision model, resulting in a fused feature map. This fused feature map is then used as input to the RPN to obtain region proposal boxes. The decoder consists of multiple stacked object detection algorithm modules. The region proposals and multi-scale features are input into the decoder, and after layer-by-layer decoding, the final detection boxes / semantic segmentation masks and class scores are obtained.

[0044] 5. Loss Function Design: L1 loss and GIou loss are used as the target box regression losses to better guide the target box regression. Focal loss is used to calculate the classification loss, reducing the classification misclassification rate. Focal loss is also introduced to address the problem of imbalanced samples. BCE loss and Dice loss are used to calculate the loss for the output region.

[0045] The inventors conducted experiments based on this invention. Experimental results show that, validated using standard industrial defect datasets (including the NEU-DET steel defect dataset from Northeastern University and a self-built laptop defect dataset), this method outperforms baseline models such as Mask R-CNN in target detection mAP under 5-shot learning scenarios. It achieves industrial-grade real-time detection speed on an NVIDIA 4090 GPU hardware platform, with single-image inference time meeting online detection requirements. The untuned model maintains effective detection capabilities in cross-domain tasks such as laptop scratch defect detection. For typical defect types such as scratches and label misalignment, the bounding box regression accuracy is significantly improved compared to traditional methods. Therefore, this invention significantly outperforms existing networks in few-shot learning on multiple industrial defect detection datasets, while also improving inference speed. It performs particularly well in handling real-world scenarios with very few samples. Furthermore, this invention has good generalization ability, enabling it to adapt to few-shot industrial defect detection tasks in different domains without fine-tuning. This invention effectively addresses the challenges of diverse industrial defect morphologies and random distribution through a dynamic multi-scale modeling mechanism; deformable attention and feature fusion design significantly improve detection performance in small-sample scenarios; and lightweight design and probability integration strategy ensure real-time inference capabilities. Experimental results show that this method is particularly suitable for the quality control needs of rapidly iterating production lines such as 3C product manufacturing, providing a new technological paradigm for intelligent inspection in the Industry 4.0 era.

[0046] The present invention also provides an electronic device, the electronic device comprising: a memory storing a computer program; a processor communicatively connected to the memory, which executes the product defect intelligent detection method described above when the computer program is invoked; and a display communicatively connected to the processor and the memory, used to display a GUI interactive interface related to the product defect intelligent detection method.

[0047] The present invention also provides a readable storage medium storing a computer program that, when executed by a processor, implements the intelligent product defect detection method described in any of the preceding claims.

[0048] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the intelligent product defect detection method described in any of the above claims.

[0049] The intelligent product defect detection method and system based on few-shot learning provided by this invention has the following beneficial effects: Please refer to Figure 2 , Figure 2 This is a block diagram of an electronic device according to an embodiment of the present invention. Figure 2 As shown, the present invention also provides an electronic device, the electronic device comprising:

[0050] Memory 103 stores computer programs;

[0051] The processor 101 is communicatively connected to the memory and executes the product defect intelligent detection method described above when calling the computer program.

[0052] The display 105 is communicatively connected to the processor and the memory, and is used to display a GUI interactive interface related to the intelligent product defect detection method.

[0053] Since the electronic device is used to execute any of the above-described intelligent product defect detection methods, it effectively combines the advantages of DINO and Swin Transformer, thereby improving feature extraction capabilities while acquiring multi-scale features, taking into account the semantic information and fine granularity of the image, and achieving effectiveness in small-sample feature extraction and a lightweight architecture design.

[0054] like Figure 2 As shown, the electronic device also includes a communication interface 102 and a communication bus 104, wherein the processor 101, the communication interface 102, and the memory 103 communicate with each other via the communication bus 104. The communication bus 104 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus 104 can be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is used in the figure, but this does not indicate that there is only one bus or one type of bus. The communication interface 102 is used for communication between the aforementioned electronic device and other devices.

[0055] The processor 101 referred to in this invention can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor. The processor 101 is the control center of the electronic device, connecting various parts of the entire electronic device through various interfaces and lines.

[0056] The memory 103 can be used to store the computer program. The processor 101 implements various functions of the electronic device by running or executing the computer program stored in the memory 103 and calling the data stored in the memory 103.

[0057] The memory 103 may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.

[0058] The present invention also provides a readable storage medium storing a computer program that, when executed by a processor, implements the intelligent product defect detection method described in any of the preceding claims.

[0059] Since the readable storage medium is used to execute the product defect intelligent detection method described above, it effectively combines the advantages of DINO and Swing Transformer, thereby improving feature extraction capabilities while acquiring multi-scale features, taking into account the semantic information and fine granularity of the image, and achieving effectiveness in small sample feature extraction and a lightweight architecture design.

[0060] Since the readable storage medium provided by this invention belongs to the same inventive concept as the intelligent product defect detection method described above, the readable storage medium provided by this invention has all the advantages of the intelligent product defect detection method described above. Therefore, the beneficial effects of the readable storage medium provided by this invention will not be described in detail here.

[0061] The readable storage medium of embodiments of the present invention can be any combination of one or more computer-readable media. The readable medium can be a computer-readable signal medium or a computer-readable storage medium. Computer-readable storage media can be, for example, but not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: electrical connections having one or more wires, portable computer hard disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, apparatus, or device.

[0062] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which can transmit, propagate, or transfer a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wireline, optical fiber, RF, etc., or any suitable combination thereof.

[0063] It should also be noted that although the present invention has been disclosed above with reference to preferred embodiments, these embodiments are not intended to limit the present invention. For any person skilled in the art, many possible variations and modifications can be made to the technical solutions of the present invention based on the disclosed technical content, or equivalent embodiments can be modified accordingly, without departing from the scope of the present invention. Therefore, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention without departing from the content of the present invention shall still fall within the scope of protection of the present invention.

[0064] It should also be understood that, unless otherwise specified or indicated, the terms “first,” “second,” “third,” etc., in the specification are used only to distinguish the various components, elements, and steps in the specification, and not to indicate the logical or sequential relationships between the various components, elements, and steps.

[0065] Furthermore, it should be recognized that the terminology described herein is used only to describe particular embodiments and not to limit the scope of the invention. It must be noted that the singular forms “a” and “an” used herein and in the appended claims include plural bases unless the context clearly indicates otherwise. For example, a reference to “a step” or “an apparatus” means a reference to one or more steps or apparatuses, and may include secondary steps and secondary apparatuses. All conjunctions used should be understood in the broadest sense. And the word “or” should be understood to have the definition of logical “or” rather than logical “exclusive OR”, unless the context clearly indicates otherwise. Furthermore, implementation of embodiments of the invention may include performing selected tasks manually, automatically, or in combination.

Claims

1. A method for intelligent detection of product defects, characterized in that, Includes the following steps: Obtain defect images; The defect image is processed using the DINO algorithm to obtain the first processing layer; The defect image is processed using the Swin Transformer algorithm to obtain several downsampling layers; Replace one of the several downsampling layers with the first processing layer to form a candidate layer group; Select several layers including the first processing layer from the candidate layer group to form a candidate layer group; The layers to be processed are output to the feature map pyramid network for processing to generate a fused feature map; The fused feature map is then output to a few-sample object detection learner for processing and detection.

2. The intelligent product defect detection method as described in claim 1, characterized in that, The step of replacing one of the several downsampling layers with the first processing layer to form a candidate layer group specifically includes: Replace the downsampling layer whose sampling multiple is closest to that of the first processing layer with the first processing layer.

3. The intelligent product defect detection method as described in claim 1, characterized in that, The step of replacing one of the several downsampling layers with the first processing layer to form a candidate layer group specifically includes: Replace the downsampling layer with a sampling multiplier of 16 with the first processing layer.

4. The intelligent product defect detection method as described in claim 1, characterized in that, The few-sample object detection learner includes the DE-VIT algorithm model.

5. The intelligent product defect detection method as described in claim 1, characterized in that, The few-sample target detection learner has a region propagation network, which is adjusted as follows: The first convolutional layer of the region propagation network is changed to a variable attention mechanism.

6. The intelligent product defect detection method as described in claim 1, characterized in that, The DINO algorithm includes the DINOV2 algorithm.

7. The intelligent product defect detection method as described in claim 1, characterized in that, The step of selecting several layers, including the first processing layer, from the candidate layer group to form a candidate layer group specifically includes: Sort the layers in the candidate layer group from largest to smallest according to the sampling multiple, and select the layers with the highest ranking (preset number of positions).

8. An electronic device, characterized in that, The electronic device includes: Memory, which stores computer programs; The processor, which is communicatively connected to the memory, executes the intelligent product defect detection method as described in any one of claims 1-7 when the computer program is invoked. The display, which is communicatively connected to the processor and the memory, is used to display a GUI interactive interface related to the intelligent product defect detection method.

9. A readable storage medium storing a computer program, characterized in that: When the computer program is executed by the processor, it implements the intelligent product defect detection method as described in any one of claims 1-7.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the intelligent product defect detection method as described in any one of claims 1-7.