Intelligent product defect detection method and device based on normalized feature synthesis and edge refinement reconstruction

By applying normalized feature synthesis and edge refinement reconstruction technology in product defect detection, combined with Faster R-CNN model, the problem of insufficient accuracy in complex image processing is solved, and high-precision and highly automated defect detection is achieved.

CN119648615AInactive Publication Date: 2025-03-18HUAIYIN INSTITUTE OF TECHNOLOGY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411493492.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-24
Publication Date
2025-03-18
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing automated defect detection methods are insufficient in processing complex or poor quality images, difficult to identify small or partially hidden defects, and are sensitive to noise and mutant reactions, requiring a large amount of labeled data and computing resources.

Method used

The product defect intelligent detection method based on normalized feature synthesis and edge refinement reconstruction is adopted. The image feature representation and edge detection process are optimized through the feature representation and edge optimization technology combined with normalized flow model and Canny edge detection, and defect detection is used using the Faster R-CNN model, and the defect region is finally accurately defined through pixel-by-pixel fusion technology.

Benefits of technology

It realizes high-precision detection and accurate definition of product defects, improves the accuracy and automation of defect detection, is suitable for complex and low-contrast environments, and reduces false detection and missed detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119648615A_ABST
    Figure CN119648615A_ABST
Patent Text Reader

Abstract

The invention discloses a product defect intelligent detection method and device based on normalized feature synthesis and edge refinement reconstruction. The method is suitable for general supervised product quality detection. The improved product defect detection algorithm is mainly based on constructed product feature data, a normalized feature synthesis technology and an edge refining reconstruction technology are combined, historical product image data are processed, firstly, an enhanced feature image is obtained by using a feature synthesis algorithm based on a normalized stream, and finally, the feature image is subjected to edge refining reconstruction. And extracting product edge features through an edge refining technology, querying historical data to obtain a product defect label, and performing deep learning model training on an enhanced feature image to obtain a final product defect detection result. Compared with the prior art, the method has the advantages that the accuracy and efficiency of product defect detection can be effectively improved, the product defect detection is more accurate, and the automation degree of product detection is increased.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of image processing and machine vision, and in particular relates to a product defect intelligent detection method and device based on normalized feature synthesis and edge refinement reconstruction. Background Art

[0002] In today's industrial manufacturing, product quality control is essential to ensure consumer satisfaction and maintain the reputation of manufacturers. Traditional product defect detection mainly relies on manual inspection, which is not only time-consuming, but also the results are often affected by personal experience and subjective judgment, with poor efficiency and consistency. With the advancement of technology, automated defect detection methods have been introduced to improve detection speed and accuracy, but these methods still have many challenges when processing highly complex images.

[0003] Existing automated techniques are usually based on traditional image processing algorithms, such as threshold segmentation, edge detection, or simple image filtering, which work well in simple scenes with high clarity and contrast. However, in practical applications, especially in complex backgrounds or poor image quality, these methods often fail to accurately locate or identify small or partially hidden defects. In addition, due to the lack of effective feature representation and the ability to handle inconsistencies, traditional methods have limited generalization capabilities on diverse products.

[0004] In response to these problems, deep learning technology has been applied to the field of defect detection in recent years, especially convolutional neural network (CNN) has become the mainstream choice due to its powerful feature learning ability. However, even deep learning-based methods need to fully consider the detailed features in the image and the accurate extraction of edge information to improve the accuracy and reliability of defect location. In addition, deep learning models usually require a large amount of labeled data for training, which may be costly and difficult to achieve in actual operation.

[0005] That is, traditional methods have the following problems: low efficiency; insufficient accuracy when processing complex or poor quality images; difficulty in accurately identifying tiny or partially hidden defects; sensitive to noise and variation in images; and the need for large amounts of labeled data and expensive computing resources in practical applications. Summary of the invention

[0006] Purpose of the invention: In response to the problems in the background technology, the present invention discloses a method and device for intelligent detection of product defects based on normalized feature synthesis and edge refinement and reconstruction. By comprehensively applying normalized feature synthesis and edge refinement and reconstruction technology, the feature representation and edge detection process of the image are optimized, thereby achieving high-precision detection and accurate definition of product defects.

[0007] Technical solution: The present invention proposes a product defect intelligent detection method based on normalized feature synthesis and edge refinement reconstruction, comprising the following steps:

[0008] Step 1: Obtain product images on the enterprise production line, preprocess the initial images, obtain the original image dataset G, and divide it into image dataset G1, verification dataset G_val and test dataset G_test in a ratio of 8:1:1;

[0009] Step 2: Process the image data set G1 through a normalized feature synthesis algorithm to perform feature synthesis to obtain an image data set G2 after feature synthesis;

[0010] Step 3: Edge refinement operation: After applying Canny edge detection, the image dataset G2 is eroded, expanded, and smoothed, and the edges are reconstructed using adaptive weights. Finally, the image quality is evaluated by calculating SSIM, and images that meet the threshold are retained and enter the dataset G3.

[0011] Step 4: Use the dataset G3 to train the FasterR-CNN model, use the trained FasterR-CNN model to perform defect determination on the test dataset G_test, and generate a test dataset G_test1 that identifies potential defect areas;

[0012] Step 5: Obtain the test data set G_test1 in which the potential defect area is identified in step 4, perform the normalized feature synthesis algorithm processing of step 2 and the edge refinement operation of step 3 on the test data set G_test1, and obtain the test data set G_test2; combine the test data set G_test1 with the test data set G_test2 through the pixel-by-pixel fusion technology, accurately define the image and shape of the defect area, and generate the final image data set G4.

[0013] Furthermore, the specific method of step 1 is:

[0014] Step 1.1: Collect product images on the company's production line, including normal products and defective products, and include different environmental conditions, lighting and angles;

[0015] Step 1.2: Use geometric transformation and color transformation to perform data enhancement on the collected product images;

[0016] Step 1.3: Use the labelimg annotation tool to accurately annotate the defective areas in the image by manual annotation, and divide it into the image dataset G1, the verification dataset G_val, and the test dataset G_test in a ratio of 8:1:1.

[0017] Furthermore, the specific method of step 2 is:

[0018] Step 2.1: Select the RealNVP normalized flow model, initialize the threshold parameter a, the original mean μ 原始 =120;

[0019] Step 2.2: Normalize the original image dataset G1 to fit the model input;

[0020] Step 2.3: Forward pass the standardized image data batches through the normalized flow model and map them to the latent space;

[0021] Step 2.4: Calculate the Jacobian of the transformation and the log-likelihood using the following formula: log p y (l) = log p(f θ (l))+log|detJ f,θ (l)|,f θ (l) is the output of the normalized flow model for the lth image under parameter θ, detJ f,θ (l) is the Jacobian of the l-th image transformation, detJ f,θ The value of (l) measures the local scaling factor of the normalized flow transform, p y (l) is the log-likelihood value of the lth image in the normalized flow model;

[0022] Step 2.5: If the log-likelihood value reaches the threshold, proceed to step 2.6; otherwise, proceed to step 2.3;

[0023] Step 2.6: Perform reverse mapping to transform the data from the latent space back to the original space to form a new dataset G2;

[0024] Step 2.7: Calculate the mean pixel intensity of each image in the image dataset G2: μ represents the mean pixel intensity of each image in the image dataset G2, p i represents the intensity value of the i-th pixel, and N represents the total number of pixels in the image;

[0025] Step 2.8: If μ∈(120,130), output the processed and optimized dataset G2; otherwise, execute step 2.6.

[0026] Furthermore, the specific method of step 3 is:

[0027] Step 3.1: Apply the Canny edge detection algorithm to each image in the data set G2 to perform edge detection, generate an edge detection result map for each image, set the edge width b, and the gradient amplitude threshold θ;

[0028] Step 3.2: Use a 3x3 square structure element for corrosion processing. After each corrosion, calculate the current edge width;

[0029] Step 3.3: If the edge width b ≤ 1 pixel, stop erosion and output the refined edge image; otherwise, execute step 3.2 and continue the erosion operation to shrink the edge inward by 1 pixel;

[0030] Step 3.4: Perform a dilation operation on the eroded edge map to enhance and connect the broken edges to generate a dilated map;

[0031] Step 3.5: Check whether the edges of the expanded image are continuous. If so, output the image; otherwise, execute step 3.4 and increase the number of expansion operations.

[0032] Step 3.6: Use Gaussian blur to smooth the edges of the expanded image. The formula for calculating the gradient amplitude is as follows: S represents the gradient magnitude of the image, and represents the partial derivatives of image I in the x and y directions;

[0033] Step 3.7: If S < θ, output the smoothed edge map; otherwise, execute step 3.6, increase the kernel size of the Gaussian blur, and repeat the smoothing process;

[0034] Step 3.8: Calculate edge strength and adaptive weight β(x,y)=exp(-a·E(x,y)), I edge Represents the image obtained after applying the edge detection algorithm, which contains the edge information of the image. Represents the first-order derivative of the edge image in the horizontal direction, that is, the x direction, It represents the first-order derivative of the edge image in the vertical direction, that is, the y direction. a is the weight adjustment coefficient, which is used to adjust the sensitivity of the adaptive weight. β(x,y) represents the adaptive weight of the point (x,y).

[0035] Step 3.9: Use edge strength and adaptive weight to reconstruct the image edge. The formula is as follows: recon =(x,y)=β(x,y)·I orig (x,y)+(1-β(x,y))·I edge (x,y),I orig (x, y) represents the intensity value of the original image at point (x, y), I edge (x, y) represents the intensity value of the edge image at point (x, y), I recon Represents the intensity value of the reconstructed image at point (x, y);

[0036] Step 3.10: Calculate the structural similarity index SSIM of the image. The formula is as follows: μ x and μ y are the mean of the points (x, y), σ xy represents the covariance of the point (x,y), and represents the variance of the point (x, y), C1 and C2 are constants used to stabilize the division operation, and SSIM(x, y) represents the structural similarity index of the point (x, y);

[0037] Step 3.11: If SSIM ≥ γ, output the image to form data set G3; otherwise, execute step 3.2, where γ is the threshold of the structural similarity index.

[0038] Furthermore, the specific method of step 4 is:

[0039] Step 4.1: Select and configure the Faster R-CNN model, define the model’s architecture parameters, anchor size, and aspect ratio;

[0040] Step 4.2: Train the Faster R-CNN model using the G3 dataset.

[0041] Step 4.3: If the Faster R-CNN model meets expectations on the validation dataset G_val, continue with the following steps; otherwise, proceed to step 4.2;

[0042] Step 4.4: Use the trained Faster R-CNN model to scan the test dataset G_test to automatically detect and identify potential defect areas;

[0043] Step 4.5: If the accuracy of the Faster R-CNN model on G_test is ≥ the preset threshold, continue to perform the following steps; otherwise, perform step 4.1;

[0044] Step 4.6: Compare the detection results of the model with the real data to generate a test data set G_test1 that identifies potential defect areas.

[0045] Furthermore, the specific method of step 5 is:

[0046] Step 5.1: Get the test data set G_test1 generated by the Faster R-CNN model on the test data set G_test to identify the defect area;

[0047] Step 5.2: Perform the normalized feature synthesis algorithm processing in step 2 and the edge refinement operation in step 3 on the test data set G_test to obtain the test data set G_test2, ensuring that the distribution of the test data is consistent with the data distribution during training;

[0048] Step 5.3: Fuse the test data set G_test1 and the test data set G_test2 pixel by pixel to accurately locate the defect edge;

[0049] Step 5.4: Smooth the edges and adjust the contrast of the fused image;

[0050] Step 5.5: If the image clarity, edge accuracy and defect identification meet the preset standards, the final image dataset G4 containing the defect area is output and the process ends; otherwise, execute step 5.4.

[0051] The present invention also discloses a product defect intelligent detection device based on normalized feature synthesis and edge thinning reconstruction, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the computer program is loaded into the processor, the product defect intelligent detection method based on normalized feature synthesis and edge thinning reconstruction is implemented.

[0052] Beneficial effects:

[0053] 1. The present invention analyzes and processes product images through advanced image processing technology and deep learning models, achieving high-precision product defect recognition and classification. By combining the normalized flow method and edge refinement technology, the feature representation of defects in the image is optimized, the contrast between defects and non-defective areas is enhanced, and the defect location and size are accurately detected through the Faster R-CNN model. In addition, the present invention also uses pixel-by-pixel fusion technology to refine and accurately define the image and shape of the defect area, effectively improving the accuracy and automation of defect detection, making its application in production quality control more reliable and efficient.

[0054] 2. The present invention not only improves the distinguishability of image features, but also greatly improves the definition accuracy of defect areas by finely processing image edges. Normalized feature synthesis enhances the model's perception of subtle defects and the expression of image features by structurally reshaping the image, so that the deep learning model can more effectively identify subtle defects from complex backgrounds. This technology is particularly suitable for defect detection in low-contrast or uneven lighting environments, effectively reducing false detections and missed detections. Edge refinement and reconstruction uses advanced edge optimization algorithms to accurately depict defect boundaries, which is particularly effective for complex or low-contrast images. This not only improves the accuracy of defect location, but also makes the final detection results more reliable, which facilitates subsequent quality assessment and processing. In addition, this technology effectively distinguishes real defects from image noise or non-related features by gradually optimizing the edge details in the image, thereby greatly improving the overall performance of the detection system.

[0055] 3. The present invention can adapt to various industrial environments, especially under high-speed and high-variability production conditions, and effectively improve the automation level and accuracy of product quality control. Through this technological innovation, manufacturers can significantly reduce economic losses caused by product defects, while improving consumers' trust and satisfaction with product quality. Through these technological innovations, the integration of automated testing into the enterprise production line is realized, making the entire production process more efficient and automated. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] Figure 1 It is the overall flow chart of the method of the present invention;

[0057] Figure 2 This is a flowchart of product image acquisition and preprocessing;

[0058] Figure 3 It is the flow chart of normalized feature synthesis;

[0059] Figure 4 Reconstruct the flow chart for edge refinement;

[0060] Figure 5 It is a defect detection and verification flow chart;

[0061] Figure 6 Flowchart for defect area refinement and confirmation. DETAILED DESCRIPTION

[0062] The present invention is further explained below in conjunction with specific embodiments. It should be understood that these embodiments are only used to illustrate the present invention and are not used to limit the scope of the present invention. After reading the present invention, various equivalent forms of modifications to the present invention by those skilled in the art all fall within the scope defined by the claims attached to this application.

[0063] The present invention discloses a product defect intelligent detection method based on normalized feature synthesis and edge refinement reconstruction, comprising the following steps:

[0064] Step 1: Obtain product images on the company's production line and preprocess the initial images, including adjusting the image size, normalization, denoising, etc., to obtain the product image dataset G1, which is divided into the image dataset G1, the verification dataset G_val, and the test dataset G_test in a ratio of 8:1:1. Figure 2 As shown:

[0065] Step 1.1: Collect product images on the company's production line, including normal products and products with defects, and under different environmental conditions, lighting, and angles.

[0066] Step 1.2: Use geometric transformation, color transformation and other techniques to enhance the data of the collected product images.

[0067] Step 1.3: Use the labelimg annotation tool to accurately annotate the defective areas in the image by manual annotation, and divide it into the image dataset G1, the verification dataset G_val, and the test dataset G_test in a ratio of 8:1:1.

[0068] Step 2: Process the image dataset G1 through the normalized flow method to obtain the image dataset G2. Figure 3 As shown:

[0069] Step 2.1: Select the RealNVP normalized flow model, initialize the threshold parameter a, the original mean μ 原始 =120.

[0070] Step 2.2: Normalize the original image dataset G1 to fit the model input.

[0071] Step 2.3: Pass the standardized image data batches forward through the normalized flow model and map them to the latent space.

[0072] Step 2.4: Calculate the Jacobian of the transformation and the log-likelihood using the following formula: log p y (l) = log p(f θ (l))+log|detJ f,θ (l)|,f θ (l) is the output of the normalized flow model for the lth image under parameter θ, detJ f,θ (l) is the Jacobian determinant of the l-th image transformation, detJ f,θ The value of (l) measures the local scaling factor of the normalized flow transform, p y(l) is the log-likelihood of the lth image in the normalized flow model.

[0073] Step 2.5: If the log-likelihood value reaches the threshold, proceed to step 2.6; otherwise, proceed to step 2.3.

[0074] Step 2.6: Perform a reverse mapping to transform the data from the latent space back to the original space to form a new dataset G2.

[0075] Step 2.7: Calculate the mean pixel intensity of each image in the image dataset G2: μ represents the mean pixel intensity of each image in the image dataset G2, p i represents the intensity value of the i-th pixel, and N represents the total number of pixels in the image.

[0076] Step 2.8: If μ∈(120,130), output the processed and optimized dataset G2; otherwise, execute step 2.6.

[0077] Step 3: Edge refinement operation: After applying Canny edge detection, the image dataset G2 is eroded, expanded, and smoothed, and the edges are reconstructed using adaptive weights. Finally, the image quality is evaluated by calculating SSIM, and the images that meet the threshold are retained and entered into the dataset G3. The specific details are as follows: Figure 4 As shown:

[0078] Step 3.1: Apply the Canny edge detection algorithm to each image in the dataset G2 to generate an edge detection result map for each image. Set the edge width b and the gradient amplitude threshold θ.

[0079] Step 3.2: Use a 3x3 square structure element for erosion. After each erosion, calculate the current edge width.

[0080] Step 3.3: If the edge width b ≤ 1 pixel, stop erosion and output the refined edge image; otherwise, execute step 3.2 and continue the erosion operation to shrink the edge inward by 1 pixel.

[0081] Step 3.4: Apply a dilation operation to the eroded edge map to enhance and connect broken edges.

[0082] Step 3.5: Check whether the edges of the expanded image are continuous. If they are, output the image; otherwise, execute step 3.4 and increase the number of expansion operations.

[0083] Step 3.6: Use Gaussian blur to smooth the enhanced edges. The gradient amplitude formula is as follows: S represents the gradient magnitude of the image, and represents the partial derivatives of image I in the x and y directions.

[0084] Step 3.7: If S < θ, output the smoothed edge map; otherwise, execute step 3.6, increase the kernel size of the Gaussian blur, and repeat the smoothing process.

[0085] Step 3.8: Calculate edge strength and adaptive weight β(x,y)=exp(-a·E(x,y)); I edge Represents the image obtained after applying the edge detection algorithm, which contains the edge information of the image. Represents the first-order derivative of the edge image in the horizontal direction, that is, the x direction, It represents the first-order derivative of the edge image in the vertical direction, that is, the y direction. a is the weight adjustment coefficient, which is used to adjust the sensitivity of the adaptive weight. β(x,y) represents the adaptive weight of the point (x,y).

[0086] Step 3.9: Use edge strength and adaptive weight to reconstruct the image edge. The formula is as follows: recon =(x,y)=β(x,y)·I orig (x,y)+(1-β(x,y))·i edge (x,y);I orig (x, y) represents the intensity value of the original image at point (x, y), I edge (x, y) represents the intensity value of the edge image at point (x, y), I recon Represents the intensity value of the reconstructed image at point (x, y).

[0087] Step 3.10: Calculate the structural similarity index SSIM of the image. The formula is as follows: μ x and μ y are the mean of the points (x, y), σ xy represents the covariance of the point (x,y), and represents the variance of the point (x, y), C1 and C2 are constants used to stabilize the division operation, and SSIM(x, y) represents the structural similarity index of the point (x, y).

[0088] Step 3.11: If SSIM ≥ γ, output the image to form dataset G3; otherwise, execute step 3.2.

[0089] Step 4: Use the dataset G3 to train the Faster R-CNN model, and use the trained Faster R-CNN model to perform defect determination on the test dataset G_test to generate a test dataset G_test1 that identifies potential defect areas. Figure 5 As shown:

[0090] Step 4.1: Select and configure the Faster R-CNN model, defining the model’s architecture parameters, anchor size, and aspect ratio.

[0091] Step 4.2: Train the Faster R-CNN model using the dataset G3.

[0092] Step 4.3: If the validation set performance meets expectations, continue to perform the following steps; otherwise, perform step 4.2. In this implementation, the validation set performance meets expectations if the accuracy of the Faster R-CNN model on the validation dataset G_val is ≥ 90% and the loss is ≤ 0.05.

[0093] Step 4.4: Use the trained Faster R-CNN model to scan the test dataset G_test to automatically detect and identify potential defect areas.

[0094] Step 4.5: If the model accuracy is ≥ the preset threshold, continue to perform the following steps; otherwise, perform step 4.1. In this implementation, if the accuracy Accuracy2 of the Faster R-CNN model on G_test is ≥ 85%, the model accuracy is ≥ the preset threshold.

[0095] Step 4.6: Compare the detection results of the model with the ground truth data and output the defect detection report.

[0096] Step 5: Obtain the test data set G_test1 that identifies the potential defect area in step 4, perform the normalized feature synthesis algorithm processing in step 2 and the edge refinement operation in step 3 on the test data set G_test1, and obtain the test data set G_test2; combine the test data set G_test1 with the test data set G_test2 through the pixel-by-pixel fusion technology, accurately define the image and shape of the defect area, generate the final image data set G4, and obtain the image and shape of the defined defect area, as shown in the following figure. Figure 5 As shown:

[0097] Step 5.1: Get the test dataset G_test1 generated by the Faster R-CNN model on the test dataset G_test to identify the defect area.

[0098] Step 5.2: Perform the normalized feature synthesis algorithm of step 2 and the edge refinement operation of step 3 on the test data set G_test to obtain the test data set G_test2, ensuring that the distribution of the test data is consistent with the data distribution during training.

[0099] Step 5.3: Fuse the test dataset G_test1 and the test dataset G_test2 pixel by pixel to accurately locate the defect edge.

[0100] Step 5.4: Smooth the edges and adjust the contrast of the fused image.

[0101] Step 5.5: If the image clarity, edge accuracy and defect identification meet the preset standards, the final image dataset G4 containing the defect area is output and the process ends; otherwise, execute step 5.4.

[0102] The present invention can be combined with a computer system to form a product defect intelligent detection device based on normalized feature synthesis and edge thinning reconstruction. The device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. The computer program includes codes for implementing the above steps. When the program is loaded into the processor, it can automatically execute the normalized flow technology and edge thinning technology to process and optimize the image.

[0103] The above embodiments are only for illustrating the technical concept and features of the present invention, and their purpose is to enable people familiar with the technology to understand the content of the present invention and implement it accordingly, and they cannot be used to limit the protection scope of the present invention. Any equivalent transformation or modification made according to the spirit of the present invention should be included in the protection scope of the present invention.

Claims

1. A product defect intelligent detection method based on normalized feature synthesis and edge refinement reconstruction, characterized in that: The steps include: Step 1: Obtain product images on the enterprise production line, preprocess the initial images, obtain the original image dataset G, and divide it into image dataset G1, verification dataset G_val and test dataset G_test in a ratio of 8:1:1; Step 2: Process the image data set G1 through a normalized feature synthesis algorithm to perform feature synthesis to obtain an image data set G2 after feature synthesis; Step 3: Edge refinement operation: After applying Canny edge detection, the image dataset G2 is eroded, expanded, and smoothed, and the edges are reconstructed using adaptive weights. Finally, the image quality is evaluated by calculating SSIM, and images that meet the threshold are retained and enter the dataset G3. Step 4: Use the dataset G3 to train the FasterR-CNN model, use the trained FasterR-CNN model to perform defect determination on the test dataset G_test, and generate a test dataset G_test1 that identifies potential defect areas; Step 5: Obtain the test data set G_test1 in which the potential defect area is identified in step 4, perform the normalized feature synthesis algorithm processing of step 2 and the edge refinement operation of step 3 on the test data set G_test1, and obtain the test data set G_test2; combine the test data set G_test1 with the test data set G_test2 through the pixel-by-pixel fusion technology, accurately define the image and shape of the defect area, and generate the final image data set G4.

2. The product defect intelligent detection method based on normalized feature synthesis and edge refinement reconstruction according to claim 1 is characterized in that: The specific method of step 1 is: Step 1.1: Collect product images on the company's production line, including normal products and defective products, and include different environmental conditions, lighting and angles; Step 1.2: Use geometric transformation and color transformation to perform data enhancement on the collected product images; Step 1.3: Use the labelimg annotation tool to accurately annotate the defective areas in the image by manual annotation, and divide it into the image dataset G1, the verification dataset G_val, and the test dataset G_test in a ratio of 8:1:

1.

3. The product defect intelligent detection method based on normalized feature synthesis and edge refinement reconstruction according to claim 1 is characterized in that: The specific method of step 2 is: Step 2.1: Select the RealNVP normalized flow model, initialize the threshold parameter a, the original mean μ 原始 =120; Step 2.2: Normalize the original image dataset G1 to fit the model input; Step 2.3: Forward pass the standardized image data batches through the normalized flow model and map them to the latent space; Step 2.4: Calculate the Jacobian of the transformation and the log-likelihood using the following formula: log p y (l) = logp(f θ (l))+log|detJ f,θ (l)|,f θ (l) is the output of the normalized flow model for the lth image under parameter θ, detJ f,θ (l) is the Jacobian of the l-th image transformation, detJ f,θ The value of (l) measures the local scaling factor of the normalized flow transform, p y (l) is the log-likelihood value of the lth image in the normalized flow model; Step 2.5: When the log-likelihood value reaches the threshold, proceed to step 2.6; Otherwise, proceed to step 2.3; Step 2.6: Perform reverse mapping to transform the data from the latent space back to the original space to form a new dataset G2; Step 2.7: Calculate the mean pixel intensity of each image in the image dataset G2: μ represents the mean pixel intensity of each image in the image dataset G2, p i represents the intensity value of the i-th pixel, and N represents the total number of pixels in the image; Step 2.8: If μ∈(120, 130), output the processed and optimized data set G2; Otherwise, proceed to step 2.

6.

4. The product defect intelligent detection method based on normalized feature synthesis and edge refinement reconstruction according to claim 1 is characterized in that: The specific method of step 3 is: Step 3.1: Apply the Canny edge detection algorithm to each image in the data set G2 to perform edge detection, generate an edge detection result map for each image, set the edge width b, and the gradient amplitude threshold θ; Step 3.2: Use a 3x3 square structure element for corrosion processing. After each corrosion, calculate the current edge width; Step 3.3: If the edge width b ≤ 1 pixel, stop erosion and output the refined edge image; otherwise, execute step 3.2 and continue the erosion operation to shrink the edge inward by 1 pixel; Step 3.4: Perform a dilation operation on the eroded edge map to enhance and connect the broken edges to generate a dilated map; Step 3.5: Check whether the edges of the expanded image are continuous. If so, output the image; otherwise, execute step 3.4 and increase the number of expansion operations. Step 3.6: Use Gaussian blur to smooth the edges of the expanded image. The formula for calculating the gradient amplitude is as follows: S represents the gradient magnitude of the image, and represents the partial derivatives of image I in the x and y directions; Step 3.7: If S < θ, output the smoothed edge map; otherwise, execute step 3.6, increase the kernel size of the Gaussian blur, and repeat the smoothing process; Step 3.8: Calculate edge strength and adaptive weight β(x, y) = exp(-a·E(x, y)), I edge Represents the image obtained after applying the edge detection algorithm, which contains the edge information of the image. Represents the first-order derivative of the edge image in the horizontal direction, that is, the x direction, It represents the first-order derivative of the edge image in the vertical direction, that is, the y direction. a is the weight adjustment coefficient, which is used to adjust the sensitivity of the adaptive weight. β(x, y) represents the adaptive weight of the point (x, y). Step 3.9: Use edge strength and adaptive weight to reconstruct the image edge. The formula is as follows: recon =(x, y) = β(x, y)·I orig (x, y)+(1-β(x, y))·I edge (x,y),I orig (x, y) represents the intensity value of the original image at point (x, y), I edge (x, y) represents the intensity value of the edge image at point (x, y), I recon Represents the intensity value of the reconstructed image at point (x, y); Step 3.10: Calculate the structural similarity index SSIM of the image. The formula is as follows: μ x and μ y are the mean of the points (x, y), σ xy represents the covariance of the point (x, y), and represents the variance of the point (x, y), C1 and C2 are constants used to stabilize the division operation, and SSIM(x, y) represents the structural similarity index of the point (x, y); Step 3.11: If SSIM ≥ γ, output the image to form data set G3; otherwise, execute step 3.2, where γ is the threshold of the structural similarity index.

5. The product defect intelligent detection method based on normalized feature synthesis and edge refinement reconstruction according to claim 1 is characterized in that: The specific method of step 4 is: Step 4.1: Select and configure the Faster R-CNN model, define the model’s architecture parameters, anchor size, and aspect ratio; Step 4.2: Train the Faster R-CNN model using the G3 dataset. Step 4.3: If the Faster R-CNN model meets expectations on the validation dataset G_val, continue with the following steps; otherwise, proceed to step 4.2; Step 4.4: Use the trained Faster R-CNN model to scan the test dataset G_test to automatically detect and identify potential defect areas; Step 4.5: If the accuracy of the Faster R-CNN model on G_test is ≥ the preset threshold, continue to perform the following steps; Otherwise, go to step 4.1; Step 4.6: Compare the detection results of the model with the real data to generate a test data set G_test1 that identifies potential defect areas.

6. The product defect intelligent detection method based on normalized feature synthesis and edge refinement reconstruction according to claim 1, characterized in that: The specific method of step 5 is: Step 5.1: Get the test data set G_test1 generated by the Faster R-CNN model on the test data set G_test to identify the defect area; Step 5.2: Perform the normalized feature synthesis algorithm processing in step 2 and the edge refinement operation in step 3 on the test data set G_test to obtain the test data set G_test2, ensuring that the distribution of the test data is consistent with the data distribution during training; Step 5.3: Fuse the test data set G_test1 and the test data set G_test2 pixel by pixel to accurately locate the defect edge; Step 5.4: Smooth the edges and adjust the contrast of the fused image; Step 5.5: If the image clarity, edge accuracy and defect identification meet the preset standards, the final image dataset G4 containing the defect area is output and the process ends; Otherwise, proceed to step 5.

4.

7. A product defect intelligent detection device based on normalized feature synthesis and edge thinning reconstruction, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the computer program is loaded into a processor, the method for intelligently detecting product defects based on normalized feature synthesis and edge refinement and reconstruction according to any one of claims 1 to 6 is implemented.