Industrial product defect detection method based on improved Faster RCNN
Through the improved Faster RCNN model, combined with adaptive feature recognition convolution AFRC and bidirectional feature pyramid BiFPN, the problem of inaccurate and insufficient robustness of irregular defect detection in the prior art is solved, and high-precision and efficient industrial product defect detection are achieved.
Patent Information
- Application Number
- CN202510380029.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2024-04-01
- Filing Date
- 2025-03-28
- Publication Date
- 2025-07-29
AI Technical Summary
The existing deep learning-based defect detection methods have poor performance when dealing with irregular defects, are inaccurate in detection of small objects, and are not robust enough in noisy environments, and are easily disturbed.
Using the improved Faster RCNN model, combining adaptive feature recognition convolution AFRC and bidirectional feature pyramid BiFPN, the model is improved by connecting multiple adaptive feature recognition convolution AFRCs in the ResNet50 feature extraction network for feature extraction, and feature enhancement is improved using bidirectional feature pyramid BiFPN.
While maintaining high accuracy, it reduces information loss, improves the robustness of the network, improves the ability to adapt to complex defect forms, enhances stability in interference environments, and achieves balanced optimization of accuracy and efficiency.
Smart Images

Figure CN120387983A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a defect detection method, in particular to an industrial product defect detection method based on improved Faster RCNN. Background Art
[0002] The performance of industrial products is closely related to the quality of their appearance. Due to different metallurgical methods and mechanical defects, various defects may form on the product surface, which will affect the appearance and physical properties of the product, and have a negative impact on the safety and reliability of users using the product. Traditional surface defect detection methods are mainly manual visual inspection, which has problems of low efficiency, high cost and large labor intensity in the actual production environment. Therefore, in recent years, with the development of artificial intelligence technology, deep learning has been widely applied to various industrial tasks, including defect detection, process monitoring and quality prediction, etc.
[0003] However, the existing defect detection methods based on deep learning still have problems in dealing with irregular defects, have poor detection performance for small objects, and are prone to information loss during the feature fusion process. In addition, most of the existing studies focus on improving the detection accuracy or speed, and pay insufficient attention to the impact of the noise environment on the robustness of the model. In the actual industrial production process, due to the interference of equipment manufacturing processes and environmental factors, the appearance of noise samples may make the training model based on deep learning vulnerable to interference, thus reducing the robustness of the network. Summary of the Invention
[0004] The technical problem to be solved by the present invention is to provide an industrial product defect detection method based on improved Faster RCNN, which improves the ability to maintain stability in an interference environment.
[0005] The technical solution adopted by the present invention to solve the above technical problem is: an industrial product defect detection method based on improved Faster RCNN, comprising the following steps:
[0006] Step ①, construct an industrial product surface defect image data set, divide it into a training set and a validation set according to a ratio, and label the training set and the validation set;
[0007] Step ②, construct an improved Faster RCNN model: in the ResNet50 feature extraction network, a plurality of Adaptive Feature Recognition Convolutions (AFRCs) are connected in the form of residual structures for feature extraction, and a Bidirectional Feature Pyramid Network (BiFPN) is used to replace the Feature Pyramid Network (FPN) for feature enhancement;
[0008] Step ③: Set training parameters and define the loss function. Train the improved Faster RCNN model with the labeled training set, and verify the improved Faster RCNN model with the labeled validation set to obtain the final Faster-RCNN detection model.
[0009] Step ④: Obtain the industrial product surface defect image to be detected, and input the industrial product surface defect image to be detected into the final Faster-RCNN detection model for detection to obtain the defect detection result.
[0010] Compared with the prior art, the advantages of the present invention are as follows: In the improved Faster RCNN model, the Adaptive Feature Recognition Convolution (AFRC) is connected to the ResNet50 feature extraction network in the form of a residual structure, which can automatically adjust its shape according to the features of the defects and capture multi-scale information. The Bidirectional Feature Pyramid Network (BiFPN) fuses higher-level features, thereby enhancing the features. This not only improves the accuracy of industrial part defect detection, but also reduces interference and information loss while ensuring the performance of industrial product defect detection, and improves the robustness of the network. Through experiments, it can be seen that compared with the YOLOv5 network, the method proposed in the present invention utilizes the refined localization advantage of the two-stage detection framework and combines the dynamic feature adaptation ability of the Adaptive Feature Recognition Convolution (AFRC). While maintaining a high inference speed, the mAP reaches 82.9%, which is 8.1% higher than that of YOLOv5. Compared with the original Faster RCNN network, the method proposed in the present invention solves the defect that its rigid convolution kernel cannot adapt to complex defect morphologies. In summary, the method proposed in the present invention realizes the balanced optimization of accuracy and efficiency in industrial scenarios.
[0011] Further, the ResNet50 feature extraction network includes an input layer, stage 0, stage 1, stage 2, stage 3, stage 4, an output layer, and three Adaptive Feature Recognition Convolutions (AFRC). Among them, stage 0 includes a convolutional layer (CONV) with 64 convolutional kernels of size 7×7 and a stride of 2, and a max-pooling layer (MAXPOOL) with a kernel size of 3×3 and a stride of 2. Stage 1, stage 2, stage 3, and stage 4 respectively contain three, four, six, and three bottleneck layers (BTNK).
[0012] The specific process of feature extraction in step ② is as follows:
[0013] Resize the size of the input image to 3×224×224 and input it into Stage 0 for processing. Stage 0 outputs a first feature map of 64×56×56 and inputs it into Stage 1 for processing. Stage 1 outputs a second feature map of 256×56×56 and inputs it into Stage 2 for processing. Stage 2 outputs a third feature map of 512×28×28 and inputs it into the first Adaptive Feature Recognition Convolution (AFRC) for processing. The third feature map processed by the first AFRC is fused with the third feature map output by Stage 2 and then input into Stage 3 for processing. Stage 3 outputs a fourth feature map of 1024×14×14 and inputs it into the second AFRC for processing. The fourth feature map processed by the second AFRC is fused with the fourth feature map output by Stage 3 and then input into Stage 4 for processing. Stage 4 outputs a fifth feature map of 2048×7×7 and inputs it into the third AFRC for processing. The fifth feature map processed by the third AFRC is fused with the fifth feature map output by Stage 4 as the finally output feature map. The AFRC is connected to the ResNet50 feature extraction network in the form of a residual structure, which can automatically adjust its shape according to the characteristics of defects, capture multi-scale information, and facilitate the feature learning of irregular defects.
[0014] Furthermore, the AFRC includes a Switchable Atrous Convolution (SAC) and a Deformable Convolution Network (DCN). The input feature map is processed by the SAC and the DCN respectively to obtain a first branch feature map and a second branch feature map. Subsequently, a learnable weight is used to perform weighted fusion on the first branch feature map and the second branch feature map to obtain an output feature map Output, where Output = α * SAC(F) + (1 - α) * DCN(F). Here, α represents the learnable weight, SAC(·) represents the switchable atrous convolution operation, F represents the input feature map, and DCN(·) represents the deformable convolution operation. The SAC adaptively adjusts the receptive field according to the local texture complexity of the feature map through a dynamic dilation rate selection mechanism. A small dilation rate is adopted in the dense defect area to enhance the detail capture ability, and a large dilation rate is switched in the background area to reduce redundant calculations. The DCN effectively models the geometric features of irregular defects and reduces the boundary localization error by constraining the offset range and introducing a residual connection. The parallel-serial hybrid structure of the SAC and the DCN weights and fuses the global context and local deformation information through a channel attention mechanism to achieve cross-scale feature complementarity.
[0015] Furthermore, in step ②, the specific operation process of feature enhancement is as follows:
[0016] Denote the feature map of the final output of 2048×7×7 as P2. Perform downsampling and convolution operations on P2 in sequence to obtain P4 of 256×56×56. Perform downsampling and convolution operations on P4 in sequence to obtain P6 of 256×28×28. Perform downsampling and convolution operations on P6 in sequence to obtain P8 of 256×14×14. Fuse the features of P6 and P8 to obtain Q2. Fuse the features of Q2 and P4 to obtain Q1. Fuse the features of P2 and Q1 to obtain R2. Fuse R2, Q1, and P4 to obtain R4. Fuse R4, Q2, and P6 to obtain R6. Fuse R6 and P8 to obtain R8, which is used as the output of the bidirectional feature pyramid BiFPN. In the bidirectional feature pyramid BiFPN, the original input feature map and the output feature map are at the same level. An additional edge is added between them. Each bidirectional (top-down and bottom-up) path is regarded as a feature network layer, and the same layer is repeated multiple times to achieve higher-level feature fusion, thereby enhancing the features.
[0017] Further, the specific operation process of step ① is as follows:
[0018] Collect at least 800 product images containing industrial product surface defects from the actual production line as the industrial product surface defect image dataset. Divide the industrial product surface defect image dataset into a training set and a validation set according to a ratio of 7:3.
[0019] Use pixel-level semantic segmentation masks and bounding box coordinates to label the industrial product surface defects in each image in the training set and the validation set, save the annotation information, and obtain the annotated training set and the annotated validation set.
[0020] Further, the specific operation process of step ③ is as follows:
[0021] Set the training parameters including: the initial learning rate is set to 0.005, the momentum is set to 0.9, the weight decay is set to 0.0001, the batch size is set to 8, the number of training epochs is set to 100, and the gradient threshold is set to 5.0.
[0022] Define the loss function L total = L cls + L bbox L cls represents the classification loss, and L bbox represents the bounding box regression loss;
[0023] Input the augmented and annotated training set into the improved Faster RCNN model for training;
[0024] According to the loss function L total, Use the stochastic gradient descent method with momentum to iteratively train the improved Faster RCNN model. After each round of training, use the labeled validation set to perform a performance evaluation on the improved Faster RCNN model. Stop training when the performance evaluation results are the same for fifteen consecutive times to obtain the final Faster-RCNN detection model. Description of the Drawings
[0025] Figure 1 It is a schematic diagram of the overall process of the present invention;
[0026] Figure 2 It is a schematic diagram of the network structure of the Faster RCNN before improvement;
[0027] Figure 3 It is a schematic diagram of the network structure of the improved Faster RCNN model in the present invention;
[0028] Figure 4 It is a schematic diagram of the network structure of the ResNet50 feature extraction network before improvement;
[0029] Figure 5 It is a schematic diagram of the network structure of the improved feature extraction network in the present invention;
[0030] Figure 6 It is a schematic diagram of the structure of the bidirectional feature pyramid BiFPN in the present invention;
[0031] Figure 7 It is a schematic diagram of the results of defect detection on the surface of the same industrial product by the method proposed in the present invention and other object detection methods in this embodiment. Detailed Embodiment
[0032] The following further describes the present invention in detail with reference to the embodiments of the drawings.
[0033] As Figure 1 shown, a method for industrial product defect detection based on improved Faster RCNN includes the following steps:
[0034] Step ①, construct an industrial product surface defect image dataset, divide it into a training set and a validation set according to a ratio, and label the training set and the validation set;
[0035] The specific operation process of step ① is as follows:
[0036] Collect 800 product images containing industrial product surface defects from the actual production line as the industrial product surface defect image dataset, and divide the industrial product surface defect image dataset into a training set and a validation set according to a ratio of 7:3; for small-sample defect categories, adopt a stratified sampling strategy to ensure the balanced distribution of each category;
[0037] Use pixel-level semantic segmentation masks and bounding box coordinates to label the industrial product surface defects in each image in the training set and the validation set, save the annotation information, and obtain the annotated training set and the annotated validation set;
[0038] Step ②, construct an improved Faster RCNN model: In the ResNet50 feature extraction network, multiple Adaptive Feature Recognition Convolutions (AFRCs) are connected in the form of residual structures for feature extraction, and the Bidirectional Feature Pyramid Network (BiFPN) is used to replace the Feature Pyramid Network (FPN) for feature enhancement; The network structure of the Faster RCNN before improvement is as Figure 2 shown, and the network structure of the improved Faster RCNN model is as Figure 3 shown, and the network structure of the ResNet50 feature extraction network before improvement is as Figure 4 shown;
[0039] As Figure 5 shown, the ResNet50 feature extraction network includes an input layer, stage 0, stage 1, stage 2, stage 3, stage 4, an output layer, and three Adaptive Feature Recognition Convolutions (AFRCs). Among them, stage 0 includes a convolutional layer (CONV) with 64 convolutional kernels of size 7×7 and a stride of 2, and a max pooling layer (MAXPOOL) with a kernel size of 3×3 and a stride of 2. Stage 1, stage 2, stage 3, and stage 4 each contain three, four, six, and three bottleneck layers (BTNKs);
[0040] The specific process of feature extraction in step ② is as follows:
[0041] Resize the input image to 3×224×224 and input it into Stage 0 for processing. Stage 0 outputs a first feature map of 64×56×56 and inputs it into Stage 1 for processing. Stage 1 outputs a second feature map of 256×56×56 and inputs it into Stage 2 for processing. Stage 2 outputs a third feature map of 512×28×28 and inputs it into the first Adaptive Feature Recognition Convolution (AFRC) for processing. The third feature map processed by the first AFRC is fused with the third feature map output by Stage 2 and then input into Stage 3 for processing. Stage 3 outputs a fourth feature map of 1024×14×14 and inputs it into the second AFRC for processing. The fourth feature map processed by the second AFRC is fused with the fourth feature map output by Stage 3 and then input into Stage 4 for processing. Stage 4 outputs a fifth feature map of 2048×7×7 and inputs it into the third AFRC for processing. The fifth feature map processed by the third AFRC is fused with the fifth feature map output by Stage 4 as the finally output feature map;
[0042] The Adaptive Feature Recognition Convolution (AFRC) includes the existing Switchable Atrous Convolution (SAC) and the existing Deformable Convolution Network (DCN). The input feature map is processed by the SAC and the DCN respectively to obtain a first-branch feature map and a second-branch feature map. Subsequently, a learnable weight is used to perform weighted fusion on the first-branch feature map and the second-branch feature map to obtain the output feature map Output, where Output = α * SAC(F) + (1 - α) * DCN(F). Here, α represents the learnable weight, SAC(·) represents the Switchable Atrous Convolution operation, F represents the input feature map, and DCN(·) represents the Deformable Convolution operation. The SAC introduces a dynamic dilation rate selection module based on the standard atrous convolution to dynamically allocate the dilation rate according to the local texture complexity of the feature map. The DCN introduces multi-scale offset constraints to limit the offset range within a 3×3 neighborhood to avoid extreme deformations. At the same time, a residual connection is added to the offset prediction branch to accelerate the training convergence;
[0043] As Figure 6 shown, in step ②, the specific operation process of feature enhancement is as follows:
[0044] Denote the feature map of the final output of 2048×7×7 as P2. Successively perform downsampling and convolution operations on P2 to obtain P4 of 256×56×56. Successively perform downsampling and convolution operations on P4 to obtain P6 of 256×28×28. Successively perform downsampling and convolution operations on P6 to obtain P8 of 256×14×14. Perform feature fusion on P6 and P8 to obtain Q2. Perform feature fusion on Q2 and P4 to obtain Q1. Perform feature fusion on P2 and Q1 to obtain R2. Perform feature fusion on R2, Q1, and P4 to obtain R4. Perform feature fusion on R4, Q2, and P6 to obtain R6. Perform feature fusion on R6 and P8 to obtain R8, which is used as the output of the bidirectional feature pyramid BiFPN.
[0045] Step ③: Set the training parameters and define the loss function. Train the improved Faster RCNN model using the labeled training set, and verify the improved Faster RCNN model using the labeled validation set to obtain the final Faster-RCNN detection model.
[0046] The specific operation process of Step ③ is as follows:
[0047] Set the training parameters as follows: the initial learning rate is set to 0.005, the momentum is set to 0.9, the weight decay is set to 0.0001, the batch size is set to 8, the number of training epochs is set to 100 rounds, and the gradient threshold is set to 5.0.
[0048] Define the loss function L total = L cls + L bbox where L cls represents the classification loss, and L bbox represents the bounding box regression loss.
[0049] Input the labeled training set after data augmentation into the improved Faster RCNN model for training, where the data augmentation includes operations such as random rotation (±15°) and brightness and contrast perturbation (±20%).
[0050] According to the loss function L total, the improved Faster RCNN model is iteratively trained using the Stochastic Gradient Descent method with momentum. After each round of training, the performance of the improved Faster RCNN model is evaluated once using the labeled validation set. When the performance evaluation results are the same for fifteen consecutive times, the training is stopped to obtain the final Faster-RCNN detection model; more efficient algorithm design and implementation are achieved, enabling the target defect detection task to be completed quickly and efficiently on devices with limited resources, ensuring that the improved Faster RCNN model pays more attention to normal and high-probability samples and less attention to outliers, thus obtaining more stable and efficient gradients throughout the training process.
[0051] Step ④, obtain the surface defect image of the industrial product to be detected, and input the surface defect image of the industrial product to be detected into the final Faster-RCNN detection model for detection to obtain the defect detection result.
[0052] In this embodiment, there are two types of bottleneck layers BTNK: BTNK1 and BTNK2; on the left side of BTNK2 are 3 conv+BN+ReLU convolutional blocks, and the result F(x) after convolution is added to the input x, that is, F(x)+x, and then passed through 1 ReLU activation function. The number of input and output channels of this module is the same; on the left side of BTNK1 are 3 conv+BN+ReLU convolutional blocks F(x), and on the right side is 1 conv+BN convolutional block G(x), which plays a role in matching the dimensionality difference between the input and output; since the number of channels of F(x) and G(x) is the same, then the sum F(x)+G(x) is performed, so the number of input and output channels of this module is different. The ResNet50 feature extraction network is exactly composed of multiple different types of bottleneck layers BTNK stacked together.
[0053] In this embodiment, the experiments are set as follows:
[0054] Baseline models: Original Faster RCNN (ResNet50-FPN), YOLOv5s;
[0055] Test environment: NVIDIA Tesla V100 GPU, PyTorch 1.9.0, CUDA 11.1;
[0056] Dataset: An industrial product surface defect image dataset containing 10 types of industrial product surface defects (such as scratches, cracks, dents, rust spots, bubbles, stains, uneven coatings, edge defects, holes, foreign object attachments). The images are sourced from image acquisition on actual production lines (resolution ≥ 1000×1000 pixels) and cover workpieces of various materials such as metal, plastic, and glass. It is divided into a training set and a validation set in a 7:3 ratio, and the annotation uses pixel-level semantic segmentation masks and bounding box coordinates (COCO format), including complex lighting, multi-angle shooting, and occlusion scenarios.
[0057] The performance comparison of the object detection models of the method proposed in this invention with other object detection methods is shown in Table 1. It can be seen that compared with Faster RCNN, the mAP of this invention has increased by 4.7%, the detection rate of small defects with an area < 32×32 pixels (AP_s) has increased by 7.5%, and the inference time has been reduced by 16 ms. Compared with YOLOv5s, the mAP of this invention has increased by 8.1%, and the detection rate of small defects with an area < 32×32 pixels (AP_s) has increased by 12.9%. This proves that the targeted optimization effect of this invention on small object detection is significant, it can capture the features of small objects more accurately, and while maintaining high precision, this invention has a faster detection speed and is suitable for scenarios with high real-time requirements.
[0058] Table 1 Performance comparison of the object detection models of the method proposed in this invention with other object detection methods
[0059] Model mAP AP_s Inference time Faster RCNN 78.2% 45.6% 68ms YOLOv5s 74.8% 40.2% 22ms The present invention 82.9% 53.1% 52ms
[0060] To verify the method proposed in this invention, ablation experiments as shown in Table 2 were thus conducted. It can be seen that in the single fusion adaptive feature recognition convolution AFRC or the bidirectional feature pyramid BiFPN, the mAP has increased by 2.5% and 3.1% respectively, proving a great improvement in the defect detection performance on the surface of industrial products. The method of this invention obtained by combining the adaptive feature recognition convolution AFRC or the bidirectional feature pyramid BiFPN has reached the optimal performance, with an mAP of 82.9% and an increase of 4.7%.
[0061] Table 2 Ablation experiments
[0062] Model configuration mAP Improvement rate Existing ResNet50 78.2% - Existing ResNet50+AFRC 80.7% +2.5% Existing ResNet50+BiFPN 81.3% +3.1% Existing ResNet50+AFRC+BiFPN 82.9% +4.7%
[0063] The defect detection results of the method proposed in this invention and other object detection methods on the surface of the same industrial product are as Figure 7 shown. Figure 7From left to right are the abnormal diagram of industrial products, the real diagram, the result diagram detected by Faster RCNN, the result diagram detected by YOLOv5s, and the result diagram detected by the present invention. It can be seen that the method proposed by the present invention is more accurate for defect detection on the surface of industrial products.
[0064] Explanation of terms in the present invention:
[0065] The reference for Deformable Convolution Network (DCN) is: https: / / blog.csdn.net / jiangqixing0728 / article / details / 126269423
[0066] The reference for Switchable Atrous Convolution (SAC) is: https: / / zhuanlan.zhihu.com / p / 676316605.
Claims
1. An industrial product defect detection method based on improved Faster RCNN, characterized in that It includes the following steps: Step ①: Construct an industrial product surface defect image dataset, divide it into a training set and a validation set according to a ratio, and label the training set and the validation set; Step ②: Construct an improved Faster RCNN model: In the ResNet50 feature extraction network, multiple Adaptive Feature Recognition Convolutions (AFRCs) are connected in the form of residual structures for feature extraction, and the Bidirectional Feature Pyramid Network (BiFPN) is used to replace the Feature Pyramid Network (FPN) for feature enhancement; Step ③: Set training parameters and define a loss function, train the improved Faster RCNN model with the labeled training set, and verify the improved Faster RCNN model with the labeled validation set to obtain the final Faster-RCNN detection model; Step ④: Obtain an industrial product surface defect image to be detected, input the industrial product surface defect image to be detected into the final Faster-RCNN detection model for detection, and obtain the defect detection result.
2. The industrial product defect detection method based on improved Faster RCNN according to claim 1, characterized in that The ResNet50 feature extraction network includes an input layer, stage 0, stage 1, stage 2, stage 3, stage 4, an output layer, and three Adaptive Feature Recognition Convolutions (AFRCs). Among them, stage 0 includes a convolutional layer (CONV) with 64 convolutional kernels of size 7×7 and a stride of 2 and a max pooling layer (MAXPOOL) with a kernel size of 3×3 and a stride of 2. Stage 1, stage 2, stage 3, and stage 4 each contain three, four, six, and three bottleneck layers (BTNKs); The specific process of feature extraction in step ② is as follows: Adjust the size of the input image to 3×224×224 and input it into stage 0 for processing. Stage 0 outputs a first feature map of 64×56×56 and inputs it into stage 1 for processing. Stage 1 outputs a second feature map of 256×56×56 and inputs it into stage 2 for processing. Stage 2 outputs a third feature map of 512×28×28 and inputs it into the first Adaptive Feature Recognition Convolution (AFRC) for processing. The third feature map processed by the first Adaptive Feature Recognition Convolution (AFRC) is fused with the third feature map output by stage 2 and input into stage 3 for processing. Stage 3 outputs a fourth feature map of 1024×14×14 and inputs it into the second Adaptive Feature Recognition Convolution (AFRC) for processing. The fourth feature map processed by the second Adaptive Feature Recognition Convolution (AFRC) is fused with the fourth feature map output by stage 3 and input into stage 4 for processing. Stage 4 outputs a fifth feature map of 2048×7×7 and inputs it into the third Adaptive Feature Recognition Convolution (AFRC) for processing. The fifth feature map processed by the third Adaptive Feature Recognition Convolution (AFRC) is fused with the fifth feature map output by stage 4 as the finally output feature map.
3. The industrial product defect detection method based on the improved Faster RCNN according to claim 2, characterized in that The described Adaptive Feature Recognition Convolution (AFRC) includes a Switchable Atrous Convolution (SAC) and a Deformable Convolution Network (DCN). The input feature map is processed by the Switchable Atrous Convolution (SAC) and the Deformable Convolution Network (DCN) respectively to obtain a first branch feature map and a second branch feature map. Subsequently, a learnable weight is used to perform weighted fusion on the first branch feature map and the second branch feature map to obtain an output feature map Output, where Output = α * SAC(F) + (1 - α) * DCN(F), where α represents the learnable weight, SAC(·) represents the Switchable Atrous Convolution operation, F represents the input feature map, and DCN(·) represents the Deformable Convolution operation.
4. The industrial product defect detection method based on improved Faster RCNN according to claim 2, wherein In step ②, the specific operation process of feature enhancement is as follows: The finally output feature map of 2048×7×7 is denoted as P2. P2 is successively downsampled and convolved to obtain P4 of 256×56×56. P4 is successively downsampled and convolved to obtain P6 of 256×28×28. P6 is successively downsampled and convolved to obtain P8 of 256×14×14. P6 and P8 are feature fused to obtain Q2. Q2 and P4 are feature fused to obtain Q1. P2 and Q1 are feature fused to obtain R2. R2, Q1, and P4 are feature fused to obtain R4. R4, Q2, and P6 are feature fused to obtain R6. R6 and P8 are feature fused to obtain R8, which is used as the output of the Bidirectional Feature Pyramid Network (BiFPN).
5. The industrial product defect detection method based on improved Faster RCNN according to claim 1, characterized in that The specific operation process of step ① is as follows: Collect at least 800 product images containing industrial product surface defects from the actual production line as the industrial product surface defect image dataset, and divide the industrial product surface defect image dataset into a training set and a validation set according to a ratio of 7:
3. Use pixel-level semantic segmentation masks and bounding box coordinates to label the industrial product surface defects in each image in the training set and the validation set, save the annotation information, and obtain the annotated training set and the annotated validation set.
6. The industrial product defect detection method based on improved Faster RCNN according to claim 1, characterized in that The specific operation process of step ③ is as follows: Set the training parameters including: the initial learning rate is set to 0.005, the momentum is set to 0.9, the weight decay is set to 0.0001, the batch size is set to 8, the number of training epochs is set to 100, and the gradient threshold is set to 5.
0. Define the loss function L total = L cls + L bbox , where L cls represents the classification loss, and L bbox represents the bounding box regression loss; Input the augmented and annotated training set into the improved Faster RCNN model for training. According to the loss function L total , the improved Faster RCNN model is iteratively trained using the stochastic gradient descent method with momentum. After each round of training, the performance of the improved Faster RCNN model is evaluated once using the labeled validation set. When the results of fifteen consecutive performance evaluations are the same, the training is stopped to obtain the final Faster-RCNN detection model.