A vision-based automotive parts defect detection method and system
By combining the super-resolution model and the U-Net model, high-accuracy detection of automotive parts defects is achieved, the problems of low resolution and background interference of the image acquisition device are solved, and the robustness of detection is improved.
Patent Information
- Application Number
- CN202510334916.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-20
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2045-03-20
AI Technical Summary
In the existing technology, the resolution of image acquisition devices for industrial use is low, which makes it difficult to accurately detect subtle defects. In addition, the variable background of automotive parts interferes with the detection accuracy, and the detection method lacks universality.
A super-resolution model is used for end-to-end super-resolution reconstruction. Combined with the entity segmentation U-Net model and the defect detection U-Net model, high-accuracy detection of automotive parts is achieved through image segmentation and defect detection.
It solves the detection difficulties caused by the low resolution of the image acquisition device, achieves high-accuracy detection of defects in automotive parts, overcomes background interference, and improves the robustness of detection.
Smart Images

Figure CN120219347B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision, and in particular to a vision-based automobile parts defect detection method and system. Background Art
[0002] Today, automation and intelligent production lines are widely used in the production of automotive parts. The widespread adoption of these production lines can significantly improve production efficiency and reduce production costs. Among these processes, computer vision for quality inspection is a widely used technology.
[0003] However, when performing defect detection on automotive parts based on computer vision technology, the resolution of image acquisition devices for industrial use is usually low, making it difficult to accurately detect some subtle defects. In addition, when capturing images of automotive parts, the changing background of the auto parts will interfere with the accuracy of the detection, and the surface defects of auto parts vary in shape, requiring the detection method to have high robustness. Summary of the Invention
[0004] The purpose of the present invention is to provide a vision-based automotive parts defect detection method and system, aiming to solve the problem that some subtle defects are difficult to detect accurately due to the low resolution of image acquisition devices for industrial use. When capturing images of automotive parts, the changing background of the automotive parts will interfere with the accuracy of detection. In addition, the surface defects of automotive parts vary in morphology, and the detection method lacks universality.
[0005] In view of the above problems, the present application provides a vision-based automotive parts defect detection method and system.
[0006] The first aspect disclosed in the present application provides a method for detecting defects in automotive parts based on vision, the method comprising the following steps:
[0007] Step 1: Acquire an image of the surface of an automobile part through an image acquisition device, convert the image of the surface of the automobile part into grayscale, and generate an initial image;
[0008] Step 2: Input the initial image into the super-resolution model, which performs end-to-end super-resolution reconstruction on the initial image to generate a reconstructed image;
[0009] Step 3: Input the reconstructed image into the entity segmentation U-Net model. The entity segmentation U-Net model performs image segmentation on the reconstructed image, segments the auto part entity in the reconstructed image, and sets the grayscale value of pixels outside the auto part entity in the reconstructed image to 0 to generate an entity image.
[0010] Step 4: Input the entity image into the defect detection U-Net model. The defect detection U-Net model performs pixel-level defect area detection on the entity image, distinguishes and identifies the pixel grayscale values of the defective area and normal area of the auto parts in the entity image in the form of binary 1 and 0, respectively, and generates a binary defect image.
[0011] Step 5: Perform logical AND operations on each pixel of the defect binary image and the reconstructed image to finally obtain the surface defect area of the auto part and complete the auto part defect detection.
[0012] Preferably, the step 2 specifically includes the following steps:
[0013] Step 2.1: Using bicubic interpolation, the input initial image is enlarged to twice the size to generate an enlarged image;
[0014] Step 2.2: Use 64 convolution kernels of size 9×9 to perform convolution operation on the enlarged image to extract image features and generate the first feature map with 64 channels;
[0015] Step 2.3: Use 32 convolution kernels of size 1×1 to perform a convolution operation on the first feature map, perform nonlinear mapping, map the low-resolution features to the high-resolution feature space, and generate a second feature map with 32 channels;
[0016] Step 2.4: Use a convolution kernel of size 5×5 to perform a convolution operation on the second feature map to reconstruct the image and generate a reconstructed image.
[0017] Preferably, the step 3 specifically includes the following steps:
[0018] Step 3.1: Construct an entity segmentation U-Net model, where the entity segmentation U-Net model has an encoder, a decoder, and an output layer connected in sequence;
[0019] Step 3.2: Input the reconstructed image into the encoder, and extract features from the reconstructed image through four convolutional blocks stacked in sequence in the encoder to generate feature maps of corresponding scales. Each convolutional block includes two convolutional layers and one pooling layer.
[0020] Step 3.3: The decoder receives the feature map generated by the encoder and performs upsampling through the four deconvolution blocks stacked in sequence in the decoder to generate feature maps of corresponding scales. The feature maps generated by the encoder and decoder at the corresponding levels are fused through skip connections. Each deconvolution block consists of two convolutional layers and one deconvolution layer.
[0021] Step 3.4: The output layer classifies each pixel of the feature map output by the decoder to generate a segmented image. The output layer includes one convolutional layer, and the value of each pixel in the segmented image represents the probability of belonging to an auto part entity.
[0022] Step 3.5: Reset all pixels with values less than 0.5 in the segmented image to 0, and reset all pixels with values greater than or equal to 0.5 to 1, to generate the reset segmented image;
[0023] Step 3.6: Perform a logical AND operation on the reset segmented image and the reconstructed image to generate a solid image.
[0024] Preferably, step 4 specifically includes the following steps:
[0025] Step 4.1: Build a defect detection U-Net model, where the defect detection U-Net model has an encoder, a decoder, and an output layer connected in sequence;
[0026] Step 4.2: Input the entity image into the encoder, and extract features from the reconstructed image through the six convolutional blocks stacked in sequence in the encoder to generate feature maps of corresponding scales. Each convolutional block includes three convolutional layers and one pooling layer.
[0027] Step 4.3: The decoder receives the feature map generated by the encoder and performs upsampling through the six deconvolution blocks stacked in sequence in the decoder to generate feature maps of corresponding scales. The feature maps generated by the encoder and decoder at the corresponding levels are fused through skip connections. Each deconvolution block consists of three convolutional layers and one deconvolution layer.
[0028] Step 4.4: The output layer classifies each pixel of the feature map output by the decoder to generate a defect detection image. The output layer includes four convolutional layers. The value of each pixel in the defect detection image represents the probability of belonging to an automotive part entity.
[0029] Step 4.5: Reset all pixels with values less than 0.5 in the defect detection image to 0, and reset all pixels with values greater than or equal to 0.5 to 1 to generate a defect binary image.
[0030] The second aspect disclosed in the present application provides a vision-based automotive parts defect detection system, which is used in the above-mentioned vision-based automotive parts defect detection method. The system includes:
[0031] A preprocessing module, the preprocessing module is used to obtain an image of the surface of the automobile part through an image acquisition device, grayscale the image of the surface of the automobile part, and generate an initial image;
[0032] A reconstruction module, wherein the reconstruction module is used to input the initial image into the super-resolution model, and the super-resolution model performs end-to-end super-resolution reconstruction on the initial image to generate a reconstructed image;
[0033] An entity segmentation module, wherein the entity segmentation module is used to input the reconstructed image into an entity segmentation U-Net model. The entity segmentation U-Net model performs image segmentation on the reconstructed image, segments the automobile part entity in the reconstructed image, and sets the grayscale value of pixels other than the automobile part entity in the reconstructed image to 0 to generate an entity image;
[0034] a first defect detection module, wherein the first defect detection module is configured to input an entity image into a defect detection U-Net model. The defect detection U-Net model performs pixel-level defect area detection on the entity image, distinguishes and identifies pixel grayscale values of defective areas and normal areas of automotive parts in the entity image in the form of binary 1 and 0, respectively, to generate a binary defect image;
[0035] The second defect detection module is used to perform a logical AND operation on each pixel of the defect binary image and the reconstructed image, and finally obtain the surface defect area of the automobile part to complete the automobile part defect detection.
[0036] The third aspect disclosed in the present application provides a computer device including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above-mentioned vision-based automobile parts defect detection method when executing the computer program.
[0037] The fourth aspect disclosed in the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-mentioned vision-based automobile parts defect detection method.
[0038] The fifth aspect disclosed in the present application provides a computer program product, including a computer program or instructions, which, when executed by a processor, implement the steps of the above-mentioned vision-based automobile parts defect detection method.
[0039] The beneficial effects of the present invention are:
[0040] (1) End-to-end super-resolution reconstruction using a super-resolution model solves the problem of low-resolution industrial image acquisition devices making it difficult to accurately detect subtle defects, thereby achieving highly accurate computer vision detection of defects in automotive parts.
[0041] (3) Using the entity segmentation U-Net model, the auto parts entities in the image are first segmented through semantic segmentation, which solves the problem of background interference detection accuracy of auto parts in the image;
[0042] (2) By using the defect detection U-Net model and stacking more convolutional layers to increase the robustness of the method, the defects of various shapes that may appear on the surface of automotive parts can be accurately detected. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0044] Figure 1 This is an overall flow chart of a vision-based automotive parts defect detection method.
[0045] Figure 2 This is the overall structure diagram of a vision-based automotive parts defect detection system. DETAILED DESCRIPTION
[0046] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0047] Example 1:
[0048] like Figure 1 As shown, the embodiment of the present application provides a method for detecting defects in automobile parts based on vision, the method comprising the following steps:
[0049] Step 1: Acquire the surface image of the automobile part through an image acquisition device, convert the surface image of the automobile part into grayscale, and generate an initial image.
[0050] Specifically, the grayscale processing adopts the weighted average method, assigning different weights to the three color components of red, green and blue, and then calculating the weighted average as the grayscale value, where the weights of the three color components of red, green and blue are 0.299, 0.587 and 0.114 respectively.
[0051] Step 2: Input the initial image into the super-resolution model, which performs end-to-end super-resolution reconstruction on the initial image to generate a reconstructed image;
[0052] Step 2 specifically includes the following steps:
[0053] Step 2.1: Using bicubic interpolation, the input initial image is enlarged to twice the size to generate an enlarged image;
[0054] Step 2.2: Use 64 convolution kernels of size 9×9 to perform convolution operation on the enlarged image to extract image features and generate the first feature map with 64 channels;
[0055] Step 2.3: Use 32 convolution kernels of size 1×1 to perform a convolution operation on the first feature map, perform nonlinear mapping, map the low-resolution features to the high-resolution feature space, and generate a second feature map with 32 channels;
[0056] Step 2.4: Use a convolution kernel of size 5×5 to perform a convolution operation on the second feature map to reconstruct the image and generate a reconstructed image.
[0057] Specifically, the bicubic interpolation method has the following steps: first, determine the position of the interpolation point of the initial image in the original pixel grid coordinates, and find the nearest 4×4 known pixel points around it; then, construct a cubic interpolation function for the horizontal and vertical directions respectively, and calculate the coefficients of the cubic interpolation function based on these 16 known pixel points and their first-order and second-order partial derivatives in the two coordinate axis directions; finally, use the interpolation function in the horizontal direction to obtain 4 intermediate values, and then interpolate these 4 intermediate values in the vertical direction to obtain the final result of the interpolation point.
[0058] Step 3: Input the reconstructed image into the entity segmentation U-Net model. The entity segmentation U-Net model performs image segmentation on the reconstructed image, segments the auto part entity in the reconstructed image, and sets the grayscale value of pixels outside the auto part entity in the reconstructed image to 0 to generate an entity image.
[0059] Step 3 specifically includes the following steps:
[0060] Step 3.1: Construct an entity segmentation U-Net model, where the entity segmentation U-Net model has an encoder, a decoder, and an output layer connected in sequence;
[0061] Step 3.2: Input the reconstructed image into the encoder, and extract features from the reconstructed image through four convolutional blocks stacked in sequence in the encoder to generate feature maps of corresponding scales. Each convolutional block includes two convolutional layers and one pooling layer.
[0062] Step 3.3: The decoder receives the feature map generated by the encoder and performs upsampling through the four deconvolution blocks stacked in sequence in the decoder to generate feature maps of corresponding scales. The feature maps generated by the encoder and decoder at the corresponding levels are fused through skip connections. Each deconvolution block consists of two convolutional layers and one deconvolution layer.
[0063] Step 3.4: The output layer classifies each pixel of the feature map output by the decoder to generate a segmented image. The output layer includes one convolutional layer, and the value of each pixel in the segmented image represents the probability of belonging to an auto part entity.
[0064] Step 3.5: Reset all pixels with values less than 0.5 in the segmented image to 0, and reset all pixels with values greater than or equal to 0.5 to 1, to generate the reset segmented image;
[0065] Step 3.6: Perform a logical AND operation on the reset segmented image and the reconstructed image to generate a solid image.
[0066] Specifically, the model training steps of the entity segmentation U-Net model are as follows: (1) collect automobile parts image data, perform data annotation of automobile parts entities, and divide the training set and test set into a ratio of 8:2; (2) use the cross entropy loss function as the loss function, and use Adam as the optimizer, set the learning rate to 0.001, the number of training epochs to 200, and the batch size to 128; (3) input the training set into the entity segmentation U-Net model, and train it through backpropagation and gradient descent iteration until the value of the loss function converges; (4) use the test set to test the ability of the trained entity segmentation U-Net model.
[0067] Step 4: Input the entity image into the defect detection U-Net model. The defect detection U-Net model performs pixel-level defect area detection on the entity image, distinguishes and identifies the pixel grayscale values of the defective area and normal area of the auto parts in the entity image in the form of binary 1 and 0, respectively, and generates a binary defect image.
[0068] Step 4 specifically includes the following steps:
[0069] Step 4.1: Build a defect detection U-Net model, where the defect detection U-Net model has an encoder, a decoder, and an output layer connected in sequence;
[0070] Step 4.2: Input the entity image into the encoder, and extract features from the reconstructed image through the six convolutional blocks stacked in sequence in the encoder to generate feature maps of corresponding scales. Each convolutional block includes three convolutional layers and one pooling layer.
[0071] Step 4.3: The decoder receives the feature map generated by the encoder and performs upsampling through the six deconvolution blocks stacked in sequence in the decoder to generate feature maps of corresponding scales. The feature maps generated by the encoder and decoder at the corresponding levels are fused through skip connections. Each deconvolution block consists of three convolutional layers and one deconvolution layer.
[0072] Step 4.4: The output layer classifies each pixel of the feature map output by the decoder to generate a defect detection image. The output layer includes four convolutional layers. The value of each pixel in the defect detection image represents the probability of belonging to an automotive part entity.
[0073] Step 4.5: Reset all pixels with values less than 0.5 in the defect detection image to 0, and reset all pixels with values greater than or equal to 0.5 to 1 to generate a defect binary image.
[0074] Specifically, the model training steps of the defect detection U-Net model are as follows: (1) collect the entity images of automobile parts segmented by the entity segmentation U-Net model, and ensure that the number of defective samples and non-defective samples is the same to balance the positive and negative samples. Then, the data of the defective area of the automobile parts is labeled, and the training set and test set are divided into training set and test set according to the ratio of 8:2; (2) the cross entropy loss function is used as the loss function, and Adam is used as the optimizer, the learning rate is set to 0.001, the number of training epochs is 200, and the batch size is 64; (3) the training set is input into the defect detection U-Net model, and the training is performed through back propagation and gradient descent iteration until the value of the loss function converges; (4) the test set is used to test the ability of the trained defect detection U-Net model.
[0075] Step 5: Perform logical AND operations on each pixel of the defect binary image and the reconstructed image to finally obtain the surface defect area of the auto part and complete the auto part defect detection.
[0076] In summary, the vision-based automotive parts defect detection method provided by the embodiments of the present application has the following technical effects:
[0077] (1) End-to-end super-resolution reconstruction using a super-resolution model solves the problem of low-resolution industrial image acquisition devices making it difficult to accurately detect subtle defects, thereby achieving highly accurate computer vision detection of defects in automotive parts.
[0078] (3) Using the entity segmentation U-Net model, the auto parts entities in the image are first segmented through semantic segmentation, which solves the problem of background interference detection accuracy of auto parts in the image;
[0079] (2) By using the defect detection U-Net model and stacking more convolutional layers to increase the robustness of the method, the defects of various shapes that may appear on the surface of automotive parts can be accurately detected.
[0080] Example 2:
[0081] Based on the same inventive concept as the vision-based automobile parts defect detection method in Example 1, Figure 2 As shown, the present application provides a vision-based automotive parts defect detection system, the system comprising:
[0082] A preprocessing module, the preprocessing module is used to obtain an image of the surface of the automobile part through an image acquisition device, grayscale the image of the surface of the automobile part, and generate an initial image;
[0083] A reconstruction module, wherein the reconstruction module is used to input the initial image into the super-resolution model, and the super-resolution model performs end-to-end super-resolution reconstruction on the initial image to generate a reconstructed image;
[0084] An entity segmentation module, wherein the entity segmentation module is used to input the reconstructed image into an entity segmentation U-Net model. The entity segmentation U-Net model performs image segmentation on the reconstructed image, segments the automobile part entity in the reconstructed image, and sets the grayscale value of pixels other than the automobile part entity in the reconstructed image to 0 to generate an entity image;
[0085] a first defect detection module, wherein the first defect detection module is configured to input an entity image into a defect detection U-Net model. The defect detection U-Net model performs pixel-level defect area detection on the entity image, distinguishes and identifies pixel grayscale values of defective areas and normal areas of automotive parts in the entity image in the form of binary 1 and 0, respectively, to generate a binary defect image;
[0086] The second defect detection module is used to perform a logical AND operation on each pixel of the defect binary image and the reconstructed image, and finally obtain the surface defect area of the automobile part to complete the automobile part defect detection.
[0087] Through the above detailed description of a vision-based automobile parts defect detection method in this specification, those skilled in the art can clearly understand a vision-based automobile parts defect detection system in this embodiment. Since it corresponds to the method disclosed in the embodiment, the description is relatively simple. For relevant details, please refer to the method section.
[0088] Example 3:
[0089] In the third embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor implements the steps of the above-mentioned vision-based automobile parts defect detection method when executing the computer program.
[0090] Example 4:
[0091] In a fourth embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned vision-based automobile parts defect detection method are implemented.
[0092] Embodiment 5:
[0093] In the fifth embodiment, a computer program product is provided, including a computer program or instructions, which implement the steps of the above-mentioned vision-based automobile parts defect detection method when executed by a processor.
[0094] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0095] The above description of the disclosed embodiments is intended to enable one skilled in the art to implement or use the present application. Various modifications to these embodiments will be readily apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application is not limited to the embodiments shown herein, but is intended to conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A vision-based method for detecting defects in automotive parts, characterized in that: The method comprises: Step 1: Acquire an image of the surface of an automobile part through an image acquisition device, convert the image of the surface of the automobile part into grayscale, and generate an initial image; Step 2: Input the initial image into the super-resolution model, which performs end-to-end super-resolution reconstruction on the initial image to generate a reconstructed image; Step 3: Input the reconstructed image into the entity segmentation U-Net model. The entity segmentation U-Net model performs image segmentation on the reconstructed image, segments the auto part entity in the reconstructed image, and sets the grayscale value of pixels other than the auto part entity in the reconstructed image to 0 to generate an entity image. The specific steps include: Step 3.1: Construct an entity segmentation U-Net model, where the entity segmentation U-Net model has an encoder, a decoder, and an output layer connected in sequence; Step 3.2: Input the reconstructed image into the encoder, and extract features from the reconstructed image through four convolutional blocks stacked in sequence in the encoder to generate feature maps of corresponding scales. Each convolutional block includes two convolutional layers and one pooling layer. Step 3.3: The decoder receives the feature map generated by the encoder and performs upsampling through the four deconvolution blocks stacked in sequence in the decoder to generate feature maps of corresponding scales. The feature maps generated by the encoder and decoder at the corresponding levels are fused through skip connections. Each deconvolution block consists of two convolutional layers and one deconvolution layer. Step 3.4: The output layer classifies each pixel of the feature map output by the decoder to generate a segmented image. The output layer includes one convolutional layer, and the value of each pixel in the segmented image represents the probability of belonging to an auto part entity. Step 3.5: Reset all pixels with values less than 0.5 in the segmented image to 0, and reset all pixels with values greater than or equal to 0.5 to 1, to generate the reset segmented image; Step 3.6: Perform a logical AND operation on the reset segmented image and the reconstructed image to generate a solid image; Step 4: Input the entity image into the defect detection U-Net model. The defect detection U-Net model performs pixel-level defect area detection on the entity image, distinguishes and identifies the pixel grayscale values of the defective area and normal area of the auto parts in the entity image in the form of binary 1 and 0, respectively, and generates a defect binary image. The specific steps include: Step 4.1: Build a defect detection U-Net model, where the defect detection U-Net model has an encoder, a decoder, and an output layer connected in sequence; Step 4.2: Input the entity image into the encoder, and extract features from the reconstructed image through the six convolutional blocks stacked in sequence in the encoder to generate feature maps of corresponding scales. Each convolutional block includes three convolutional layers and one pooling layer. Step 4.3: The decoder receives the feature map generated by the encoder and performs upsampling through the six deconvolution blocks stacked in sequence in the decoder to generate feature maps of corresponding scales. The feature maps generated by the encoder and decoder at the corresponding levels are fused through skip connections. Each deconvolution block consists of three convolutional layers and one deconvolution layer. Step 4.4: The output layer classifies each pixel of the feature map output by the decoder to generate a defect detection image. The output layer includes four convolutional layers. The value of each pixel in the defect detection image represents the probability of belonging to an automotive part entity. Step 4.5: Reset all pixels with values less than 0.5 in the defect detection image to 0, and reset all pixels with values greater than or equal to 0.5 to 1, to generate a defect binary image; Step 5: Perform logical AND operations on each pixel of the defect binary image and the reconstructed image to finally obtain the surface defect area of the auto part and complete the auto part defect detection.
2. The method for detecting defects in automobile parts based on vision according to claim 1, wherein: The step 2 specifically includes the following steps: Step 2.1: Using bicubic interpolation, the input initial image is enlarged to twice the size to generate an enlarged image; Step 2.2: Use 64 convolution kernels of size 9×9 to perform convolution operation on the enlarged image to extract image features and generate the first feature map with 64 channels; Step 2.3: Use 32 convolution kernels of size 1×1 to perform a convolution operation on the first feature map, perform nonlinear mapping, map the low-resolution features to the high-resolution feature space, and generate a second feature map with 32 channels; Step 2.4: Use a convolution kernel of size 5×5 to perform a convolution operation on the second feature map to reconstruct the image and generate a reconstructed image.
3. A vision-based automotive parts defect detection system, comprising: A preprocessing module, the preprocessing module is used to obtain an image of the surface of the automobile part through an image acquisition device, grayscale the image of the surface of the automobile part, and generate an initial image; A reconstruction module, wherein the reconstruction module is used to input the initial image into the super-resolution model, and the super-resolution model performs end-to-end super-resolution reconstruction on the initial image to generate a reconstructed image; The entity segmentation module is used to input the reconstructed image into the entity segmentation U-Net model. The entity segmentation U-Net model performs image segmentation on the reconstructed image, segments the automobile part entity in the reconstructed image, and sets the grayscale value of pixels other than the automobile part entity in the reconstructed image to 0 to generate an entity image. The module specifically includes the following steps: Constructing an entity segmentation U-Net model, wherein the entity segmentation U-Net model has an encoder, a decoder, and an output layer connected in sequence; The reconstructed image is input into the encoder, and features of the reconstructed image are extracted through four convolutional blocks stacked in sequence in the encoder to generate feature maps of corresponding scales. Each convolutional block includes two convolutional layers and one pooling layer. The decoder receives the feature map finally generated by the encoder, performs upsampling through the four deconvolution blocks stacked in sequence in the decoder, generates feature maps of corresponding scales respectively, and fuses the feature maps generated by the corresponding layers in the encoder and decoder through skip connections. Each deconvolution block consists of two convolutional layers and one deconvolution layer. The output layer classifies each pixel of the feature map output by the decoder to generate a segmented image. The output layer includes one convolutional layer, and the value of each pixel in the segmented image represents the probability of belonging to an auto part entity. Reset all pixels with values less than 0.5 in the segmented image to 0, and reset all pixels with values greater than or equal to 0.5 to 1, to generate a reset segmented image; Perform a logical AND operation on the reset segmented image and the reconstructed image to generate a solid image; The first defect detection module is configured to input an entity image into a defect detection U-Net model. The defect detection U-Net model performs pixel-level defect area detection on the entity image, distinguishes and identifies pixel grayscale values of defective areas and normal areas of automobile parts in the entity image in the form of binary 1 and 0, respectively, and generates a defect binary image. The module specifically comprises the following steps: Constructing a defect detection U-Net model, wherein the defect detection U-Net model has an encoder, a decoder, and an output layer connected in sequence; The entity image is input into the encoder, and the reconstructed image is extracted through 6 convolution blocks stacked in sequence in the encoder to generate feature maps of corresponding scales. Each convolution block includes 3 convolution layers and 1 pooling layer. The decoder receives the feature map finally generated by the encoder, performs upsampling through the six deconvolution blocks stacked in sequence in the decoder, generates feature maps of corresponding scales respectively, and fuses the feature maps generated by the corresponding layers in the encoder and decoder through skip connections. Each deconvolution block includes three convolutional layers and one deconvolution layer. The output layer classifies each pixel of the feature map output by the decoder to generate a defect detection image. The output layer includes four convolutional layers. The value of each pixel in the defect detection image represents the probability of belonging to an automotive part entity. Reset all pixels with values less than 0.5 in the defect detection image to 0, and reset all pixels with values greater than or equal to 0.5 to 1 to generate a defect binary image; The second defect detection module is used to perform a logical AND operation on each pixel of the defect binary image and the reconstructed image, and finally obtain the surface defect area of the automobile part to complete the automobile part defect detection.
4. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the vision-based automobile parts defect detection method according to any one of claims 1 to 2 are implemented.
5. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of any one of the vision-based automobile parts defect detection methods of claims 1 to 2 are implemented.
6. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the steps of the vision-based automobile parts defect detection method according to any one of claims 1 to 2 are implemented.
Citation Information
Patent Citations
Gearbox component surface defect detection method and system
CN119417801A