Defect detection method and system for vehicle lamp LED

By using the Transformer-based Segformer model and data augmentation techniques, the problems of low efficiency and low accuracy in automotive LED defect detection are solved, achieving real-time and accurate defect detection and outputting visualized results.

CN121767285APending Publication Date: 2026-03-31GUANGDONG LAB OF ARTIFICIAL INTELLIGENCE & DIGITAL ECONOMY (SZ)
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-21
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

In existing technologies, the detection efficiency and accuracy of automotive LED defects are low. In particular, when facing the flexible production needs of multiple models and small batches, traditional methods have poor adaptability and are difficult to achieve real-time and accurate detection.

Method used

Semantic segmentation is performed using the Transformer-based Segformer model. Combined with X-AnyLabeling annotation software and data augmentation techniques, training and validation sets are constructed, and the imgviz library is used for visualization to achieve defect detection.

Benefits of technology

It improves the accuracy and efficiency of defect detection, enabling real-time and precise defect detection, and outputting visualized detection results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121767285A_ABST
    Figure CN121767285A_ABST
Patent Text Reader

Abstract

The invention discloses a defect detection method and system for a vehicle lamp LED, and relates to the technical field of machine vision, and the method comprises the steps: carrying out the preprocessing of a vehicle lamp LED image; constructing a data set by utilizing X-AnyLabeling labeling software based on the preprocessed vehicle lamp LED image, and dividing the data set into a training set and a verification set; performing data enhancement processing on the training set; training a semantic segmentation model based on the training set after data enhancement processing to obtain a trained semantic segmentation model; and carrying out defect detection on the verification set based on the trained semantic segmentation model to obtain defect detection information, and carrying out visualization processing on the LED defects of the vehicle lamp by utilizing an imgviz library based on the defect detection information. According to the invention, the accuracy and efficiency of defect detection can be improved, and real-time defect detection and display are achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of machine vision technology, and in particular to a defect detection method and system for automotive LED lights. Background Technology

[0002] As a crucial component of automotive function and exterior design, automotive lights not only need to meet basic lighting requirements but also undertake multiple tasks such as improving driving safety, enabling dynamic interaction, and enhancing the technological feel of the vehicle's appearance. Compared to traditional lighting technologies, LED automotive lights offer higher brightness, lower energy consumption, and a longer lifespan, while also enabling more flexible styling designs and complex lighting logic.

[0003] However, due to the complex structure and high optical requirements of automotive LED components, minute defects such as copper leakage, chip misalignment, and colloid contamination are easily encountered during the production process, directly affecting the lighting performance and lifespan of the automotive lights. Therefore, accurate inspection of automotive LEDs before they leave the factory is crucial. Currently, defect detection is generally carried out using manual visual inspection or traditional machine vision methods.

[0004] However, manual point-by-point inspection is inefficient and prone to inconsistencies due to human error. Traditional machine vision methods rely heavily on preset templates and rules, which are poorly adaptable to the flexible production demands of multiple models and small batches. Template creation is time-consuming, and detection performance is unsatisfactory when faced with a large number of defect categories. In recent years, the continuous development of deep learning has led to many algorithms gradually replacing traditional image processing methods, demonstrating superior performance in detecting defective images. Among these, defect detection algorithms mainly include classification and object detection algorithms. However, classification algorithms cannot solve the problem of multiple defect types coexisting, nor can they display the specific location of defects; while object detection algorithms are affected by the bounding box, making it difficult to accurately describe the shape of defects, thus hindering intuitive inspection by production line personnel. Summary of the Invention

[0005] The purpose of this invention is to overcome the shortcomings of the prior art. This invention provides a defect detection method and system for automotive LED lights, which can improve the accuracy and efficiency of defect detection and achieve real-time defect detection and display.

[0006] To address the aforementioned technical problems, this invention provides a defect detection method for automotive LED lights, the method comprising: Acquire images of the vehicle headlight LEDs and preprocess the images to obtain preprocessed vehicle headlight LED images; A dataset was constructed based on the preprocessed vehicle LED images using X-AnyLabeling annotation software, and the dataset was divided into a training set and a validation set. The training set is subjected to data augmentation processing to obtain a data-augmented training set; The semantic segmentation model is trained on the training set after data augmentation to obtain a trained semantic segmentation model. The semantic segmentation model adopts the Segformer model based on Transformer. The Segformer model includes a hierarchical Transformer encoder and a lightweight multilayer perceptron (MLP) decoder. Defect detection is performed on the validation set based on the trained semantic segmentation model to obtain defect detection information, and the defect detection information is then used to visualize the defects of the vehicle headlight LEDs using the imgviz library.

[0007] Optionally, the step of preprocessing the vehicle headlight LED image to obtain a preprocessed vehicle headlight LED image includes: The vehicle headlight LED image is subjected to noise reduction and scaling processing to obtain a preprocessed vehicle headlight LED image.

[0008] Optionally, the dataset based on the preprocessed vehicle LED images is constructed using X-AnyLabeling annotation software, and the dataset is divided into a training set and a validation set, including: X-AnyLabeling annotation software based on the Segmentation Model of All (SAM) performs semantic segmentation labeling on the preprocessed vehicle LED image to obtain a vehicle LED image with semantic segmentation labels. A dataset is constructed based on vehicle headlight LED images with semantic segmentation labels, and the dataset is divided into a training set and a validation set based on a preset ratio.

[0009] Optionally, performing data augmentation on the training set to obtain a data-augmented training set includes: The training set is horizontally flipped, vertically flipped, and randomly rotated using the Augmentor tool to obtain a data augmented training set.

[0010] Optionally, the loss function of the semantic segmentation model adopts the pixel-level cross-entropy loss function; The semantic segmentation model uses backpropagation and gradient descent to update parameter weights.

[0011] Optionally, the Transformer encoder includes several Transformer modules of different sizes, and the MLP decoder includes several MLP layers.

[0012] Optionally, the step of performing defect detection on the validation set based on the trained semantic segmentation model to obtain defect detection information includes: Based on the first Transformer module of the Transformer encoder in the trained semantic segmentation model, local information analysis is performed on the LED images of vehicle lights in the validation set to obtain target local information. The receptive field feature map is extracted using the target local information based on the second and third Transformer modules; Based on the fourth Transformer module, global context feature analysis is performed using the receptive field feature map to obtain global context feature information; Based on the first MLP layer, the global context feature information is upsampled and concatenated along the channel dimension to obtain the target feature information; Based on the second MLP layer, defect detection is performed using the target feature information to obtain defect detection information.

[0013] Optionally, the visualization processing of automotive LED defects using the imgviz library based on the defect detection information includes: The label_colormap function based on the imgviz library determines the label color mapping table; Based on the label color mapping table, the label color information corresponding to the defect detection information is determined, and the label color information is used to perform visualization processing of the vehicle headlight LED defects based on the putpalette function.

[0014] In addition, the present invention also provides a defect detection system for automotive LED lights, the system comprising: Image preprocessing module: used to acquire images of the vehicle headlight LEDs and preprocess the vehicle headlight LED images to obtain preprocessed vehicle headlight LED images; Dataset construction module: used to construct a dataset based on preprocessed vehicle LED images using X-AnyLabeling annotation software, and to divide the dataset into a training set and a validation set; Data augmentation module: used to perform data augmentation processing on the training set to obtain a data-augmented training set; Model training module: used to train the semantic segmentation model based on the training set after data augmentation to obtain the trained semantic segmentation model. The semantic segmentation model adopts the Segformer model based on Transformer. The Segformer model includes a hierarchical Transformer encoder and a lightweight multilayer perceptron MLP decoder. Defect detection module: Used to perform defect detection on the validation set based on the trained semantic segmentation model, obtain defect detection information, and perform visualization processing of vehicle LED defects using the imgviz library based on the defect detection information.

[0015] In this embodiment of the invention, the vehicle headlight LED images are preprocessed; a dataset is constructed based on the preprocessed vehicle headlight LED images using X-AnyLabeling annotation software, and the dataset is divided into a training set and a validation set; data augmentation processing is performed on the training set to obtain a data-augmented training set, making the dataset more reliable and improving the accuracy of model training. A semantic segmentation model is trained based on the data-augmented training set to obtain a trained semantic segmentation model. The semantic segmentation model adopts a Transformer-based Segformer model, which includes a hierarchical Transformer encoder and a lightweight MLP decoder. The model balances lightweightness and accuracy, enabling better precise defect detection of vehicle headlight LED images. Defect detection is performed on the validation set based on the trained semantic segmentation model to obtain defect detection information. Based on the defect detection information, the vehicle headlight LED defects are visualized using the imgviz library, outputting visualized detection results, achieving real-time defect detection and display. Attached Figure Description

[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0017] Figure 1 This is a flowchart illustrating the defect detection method for automotive LED lights in an embodiment of the present invention. Figure 2 This is a schematic diagram of the structural composition of a defect detection system for vehicle headlight LEDs according to an embodiment of the present invention; Figure 3 This is a diagram showing the acquisition effect of the vehicle headlight LED image in an embodiment of the present invention; Figure 4 This is a schematic diagram illustrating the semantic segmentation and labeling principle of the vehicle headlight LED image in an embodiment of the present invention; Figure 5 This is a schematic diagram of the structure of the Segformer model in an embodiment of the present invention; Figure 6 This is a diagram illustrating the effect of LED defect detection in a vehicle headlight according to an embodiment of the present invention. Detailed Implementation

[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0019] Example 1 Please see Figure 1 , Figure 1 This is a flowchart illustrating a defect detection method for automotive LED headlights according to an embodiment of the present invention. The method includes: S101: Acquire an image of the vehicle headlight LED and preprocess the image to obtain a preprocessed image of the vehicle headlight LED. In a specific implementation of the present invention, the step of preprocessing the vehicle headlight LED image to obtain a preprocessed vehicle headlight LED image includes: performing noise reduction processing and scaling processing on the vehicle headlight LED image to obtain a preprocessed vehicle headlight LED image.

[0020] Specifically, a high-precision vision acquisition device is used to acquire clear images of the vehicle headlight LED panel. Images of the incoming vehicle headlight LED material are captured at a rate of 10 images per second. An algorithm then stitches together the images corresponding to the entire material board to obtain the image of the entire material board, thus obtaining the image of the vehicle headlight LED. The acquired vehicle headlight LED image is shown below. Figure 3 As shown, the vehicle headlight LED image undergoes noise reduction and scaling. Noise reduction can be achieved using a mean filtering algorithm, and image scaling can be performed by proportionally scaling the vehicle headlight LED image to 512×256 to obtain a preprocessed vehicle headlight LED image.

[0021] S102: X-AnyLabeling annotation software based on the integrated segmentation model SAM performs semantic segmentation labeling on the preprocessed vehicle LED image to obtain a vehicle LED image with semantic segmentation labels; In the specific implementation of this invention, X-AnyLabeling annotation software, which integrates the Segmentation Model (SAM), is used to perform semantic segmentation labeling on the preprocessed vehicle headlight LED image, resulting in a vehicle headlight LED image with semantic segmentation labels, such as... Figure 4As shown, through the prompting and labeling mechanism of the segmentation model, the X-AnyLabeling annotation software performs pixel-level semantic segmentation labeling of preprocessed car headlight LED images by manually selecting boxes or points. During the annotation process, the car headlight LED image is also converted into a real segmentation mask used for model training and inference. X-AnyLabeling annotation software is an open-source industrial-grade image annotation tool that supports tasks such as object detection, image segmentation, and text recognition. It can integrate multiple deep learning models to achieve automatic annotation and is suitable for data preparation for computer vision projects. It also performs defect annotation processing on images by manually selecting boxes.

[0022] S103: Construct a dataset based on vehicle headlight LED images with semantic segmentation labels, and divide the dataset into a training set and a validation set based on a preset ratio; In the specific implementation of this invention, a dataset is constructed based on vehicle headlight LED images with semantic segmentation labels, and the dataset is divided into a training set and a validation set according to a preset ratio, which can be 4:1.

[0023] S104: Perform data augmentation on the training set to obtain a data-augmented training set; In a specific implementation of the present invention, the step of performing data augmentation processing on the training set to obtain a data-augmented training set includes: performing horizontal flipping, vertical flipping, and random rotation processing on the training set based on the Augmentor tool to obtain a data-augmented training set.

[0024] Specifically, the training set is horizontally flipped, vertically flipped, and randomly rotated using the Augmentor tool to obtain a data-augmented training set. Augmentor is a Python toolkit for image data augmentation in machine learning. Its main functions include image rotation, flipping, cropping, and elastic distortion. By using Augmentor to perform appropriate data augmentation on the training set, the overfitting problem caused by class imbalance in defective data can be improved.

[0025] S105: Train the semantic segmentation model based on the training set after data augmentation to obtain a trained semantic segmentation model. The semantic segmentation model adopts the Segformer model based on Transformer. The Segformer model includes a hierarchical Transformer encoder and a lightweight multilayer perceptron MLP decoder. In the specific implementation of this invention, the loss function of the semantic segmentation model adopts the pixel-level cross-entropy loss function; the semantic segmentation model uses backpropagation and gradient descent to update the parameter weights.

[0026] The Transformer encoder includes several Transformer modules of different sizes, and the MLP decoder includes several MLP layers.

[0027] Specifically, the semantic segmentation model is trained using a data-augmented training set to obtain a trained semantic segmentation model. The semantic segmentation model employs a Transformer-based Segformer model. The Segformer model is a lightweight segmentation model that combines the advantages of visual Transformers and convolutional neural networks, suitable for defect detection tasks. The Segformer model includes a hierarchical Transformer encoder and a lightweight multilayer perceptron (MLP) decoder, such as... Figure 5 As shown, the Transformer encoder employs pre-trained Transformer modules with multiple layers of the same architecture but different sizes. During training, an encoder with pre-trained weights is used to improve the model's convergence speed and training efficiency. The decoder uses two MLP layers for feature concatenation. This model performs semantic segmentation on the image, identifying multiple types of defects. For the Transformer encoder, the input image, as a feature, is first passed through multiple Transformer modules in the encoder, and then directly upsampled to the original image through the decoder layer. Figure 1 Regarding the output feature size, specifically in the encoding process, the feature size is first reduced to 1 / 4, 1 / 8, 1 / 16, and 1 / 32 of the input image size through cross-block embedding and four Transformer modules of different sizes, respectively. In the decoder, the output features of different Transformer modules are unified in channel dimension through an MLP layer, upsampled to 1 / 4 of the original image size, then concatenated in channel dimension, and finally output as a defect detection result through an MLP layer.

[0028] For the segmentation results, pixel-level cross-entropy loss is calculated with the real mask of the image as the training loss function. The backpropagation algorithm is used to calculate the derivative of the loss with respect to each parameter in the model network. The gradient descent algorithm is used to update the parameters in the model network to improve the model's ability to extract features and predict defects in defective images. The above process is repeated until the loss value converges, the model network pre-training is completed, and a trained semantic segmentation model is obtained.

[0029] S106: Based on the trained semantic segmentation model, perform defect detection on the validation set to obtain defect detection information, and use the imgviz library to visualize the defects of the vehicle headlight LEDs based on the defect detection information.

[0030] In the specific implementation of this invention, the step of performing defect detection on the validation set based on the trained semantic segmentation model to obtain defect detection information includes: performing local information analysis on the LED images of the vehicle lights in the validation set based on the first Transformer module of the Transformer encoder in the trained semantic segmentation model to obtain target local information; extracting receptive field feature maps based on the target local information using the second and third Transformer modules; performing global context feature analysis based on the receptive field feature maps using the fourth Transformer module to obtain global context feature information; performing upsampling and channel dimension concatenation processing on the global context feature information based on the first MLP layer to obtain target feature information; and performing defect detection based on the target feature information using the second MLP layer to obtain defect detection information.

[0031] Specifically, the first Transformer module of the Transformer encoder in the trained semantic segmentation model performs local information analysis on the LED images of vehicle lights in the validation set to obtain target local information. The first Transformer module processes high-resolution images and focuses on very local and detailed information.

[0032] Based on the second and third Transformer modules, the receptive field feature map is extracted using the target local information. The second and third Transformer modules fuse local information at progressively lower resolutions to form more complex component and contour feature information, and integrate the feature information into a feature map with a large receptive field.

[0033] The fourth Transformer module utilizes the receptive field feature map to perform global contextual feature analysis, obtaining global contextual feature information. This module processes feature maps with very low resolution but large receptive fields, possessing global contextual information and capable of understanding the scene layout and object categories of the entire image. The data flow through the four Transformer modules is a process from detail to semantics, from local to global. The feature space resolution decreases, but the receptive field of each pixel increases, containing stronger semantic information.

[0034] The first MLP layer upsamples and concatenates the global contextual features to obtain target feature information. It then unifies the channel dimensions of the feature information, upsamples it to 1 / 4 of the original image size, and concatenates the channels. The second MLP layer uses the target feature information for defect detection, obtaining defect detection information. This second MLP layer integrates information from different scales across multiple Transformer modules for information interaction and complementarity, resulting in a unified defect feature representation. Finally, the unified feature representation is enlarged to the original image size, generating a category prediction vector for each pixel to output the defect detection result.

[0035] Furthermore, the visualization processing of vehicle LED defects using the imgviz library based on the defect detection information includes: determining a label color mapping table based on the label_colormap function of the imgviz library; determining label color information corresponding to the defect detection information based on the label color mapping table; and performing visualization processing of vehicle LED defects using the label color information based on the putpalette function.

[0036] Specifically, the label color map is determined using the `label_colormap` function from the `imgviz` library. The `imgviz` library is an open-source image visualization tool based on Python, primarily used to transform complex image data into intuitive and aesthetically pleasing images. It supports various image processing functions, including color adjustment, scaling, stitching, and color mapping. The `label_colormap` function maps numerical values ​​to colors, and the label color map contains the numerical values ​​and label colors for each defect category.

[0037] Based on the label color mapping table, the label color information corresponding to the defect detection information is determined. Then, using the `putpalette` function (a function that adds color adjustments), the label color information is visualized and drawn onto the defect location in the LED image. The defect detection result for the LED headlights is as follows: Figure 6 As shown, by drawing colors on the LED images of each vehicle headlight, relevant personnel can intuitively see the corresponding defects in the images.

[0038] In this embodiment of the invention, the vehicle headlight LED images are preprocessed; a dataset is constructed based on the preprocessed vehicle headlight LED images using X-AnyLabeling annotation software, and the dataset is divided into a training set and a validation set; data augmentation processing is performed on the training set to obtain a data-augmented training set, making the dataset more reliable and improving the accuracy of model training. A semantic segmentation model is trained based on the data-augmented training set to obtain a trained semantic segmentation model. The semantic segmentation model adopts a Transformer-based Segformer model, which includes a hierarchical Transformer encoder and a lightweight MLP decoder. The model balances lightweightness and accuracy, enabling better precise defect detection of vehicle headlight LED images. Defect detection is performed on the validation set based on the trained semantic segmentation model to obtain defect detection information. Based on the defect detection information, the vehicle headlight LED defects are visualized using the imgviz library, outputting visualized detection results, achieving real-time defect detection and display.

[0039] Example 2 Please see Figure 2 , Figure 2 This is a schematic diagram of the structural composition of a defect detection system for automotive LED headlights according to an embodiment of the present invention. The system includes: Image preprocessing module 21: used to acquire images of vehicle headlight LEDs and preprocess the vehicle headlight LED images to obtain preprocessed vehicle headlight LED images; Dataset composition module 22: used to construct a dataset based on the preprocessed vehicle LED images using X-AnyLabeling annotation software, and to divide the dataset into a training set and a validation set; Data augmentation module 23: used to perform data augmentation processing on the training set to obtain a data-augmented training set; Model training module 24: used to train the semantic segmentation model based on the training set after data augmentation to obtain the trained semantic segmentation model. The semantic segmentation model adopts the Segformer model based on Transformer. The Segformer model includes a hierarchical Transformer encoder and a lightweight multilayer perceptron MLP decoder. Defect detection module 25: used to perform defect detection on the validation set based on the trained semantic segmentation model, obtain defect detection information, and perform visualization processing of vehicle LED defects using the imgviz library based on the defect detection information.

[0040] In the specific implementation of this invention, the specific implementation methods of the system items can be referred to the implementation methods of the above-mentioned method items, and will not be repeated here.

[0041] In this embodiment of the invention, the vehicle headlight LED images are preprocessed; a dataset is constructed based on the preprocessed vehicle headlight LED images using X-AnyLabeling annotation software, and the dataset is divided into a training set and a validation set; data augmentation processing is performed on the training set to obtain a data-augmented training set, making the dataset more reliable and improving the accuracy of model training. A semantic segmentation model is trained based on the data-augmented training set to obtain a trained semantic segmentation model. The semantic segmentation model adopts a Transformer-based Segformer model, which includes a hierarchical Transformer encoder and a lightweight MLP decoder. The model balances lightweightness and accuracy, enabling better precise defect detection of vehicle headlight LED images. Defect detection is performed on the validation set based on the trained semantic segmentation model to obtain defect detection information. Based on the defect detection information, the vehicle headlight LED defects are visualized using the imgviz library, outputting visualized detection results, achieving real-time defect detection and display.

[0042] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, which may include: read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk, etc.

[0043] Furthermore, the above provides a detailed description of a defect detection method and system for automotive LED lights provided by the embodiments of the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A method for defect detection of vehicle lamp LED, characterized in that, The method comprises: Collecting a vehicle lamp light-emitting diode (LED) image and preprocessing the vehicle lamp LED image to obtain a preprocessed vehicle lamp LED image; Based on the preprocessed vehicle lamp LED image, a data set is constructed using X-AnyLabeling labeling software, and the data set is divided into a training set and a validation set; Data augmentation processing is performed on the training set to obtain a data augmentation processed training set; Based on the data augmentation processed training set, a semantic segmentation model is trained to obtain a trained semantic segmentation model, wherein the semantic segmentation model adopts a Segformer model based on Transformer, and the Segformer model comprises a hierarchical Transformer encoder and a lightweight multi-layer perceptron (MLP) decoder; Based on the trained semantic segmentation model, defect detection is performed on the validation set to obtain defect detection information, and based on the defect detection information, visualization processing of vehicle lamp LED defects is performed using an imgviz library.

2. The vehicle lamp LED-oriented defect detection method according to claim 1, wherein The preprocessing of the vehicle lamp LED image to obtain the preprocessed vehicle lamp LED image comprises: The vehicle lamp LED image is subjected to noise reduction processing and scaling processing to obtain the preprocessed vehicle lamp LED image.

3. The vehicle lamp LED-oriented defect detection method according to claim 1, wherein Based on the preprocessed vehicle lamp LED image, a data set is constructed using X-AnyLabeling labeling software, and the data set is divided into a training set and a validation set, comprising: Based on the X-AnyLabeling labeling software of the integrated segmentation all model (SAM), the preprocessed vehicle lamp LED image is subjected to semantic segmentation label labeling processing to obtain a vehicle lamp LED image with semantic segmentation labels; Based on the vehicle lamp LED image with semantic segmentation labels, a data set is constructed, and based on a preset ratio, the data set is divided into a training set and a validation set.

4. The vehicle lamp LED-oriented defect detection method according to claim 1, wherein The data augmentation processing of the training set to obtain the data augmentation processed training set comprises: Based on the Augmentor tool, the training set is subjected to horizontal flipping, vertical flipping and random rotation processing to obtain the data augmentation processed training set.

5. The vehicle lamp LED-oriented defect detection method according to claim 1, wherein The loss function of the semantic segmentation model adopts a pixel-level cross-entropy loss function; The semantic segmentation model adopts a back propagation and gradient descent method to update the parameter weight.

6. The vehicle lamp LED-oriented defect detection method according to claim 1, wherein The Transformer encoder comprises a plurality of Transformer modules of different sizes, and the MLP decoder comprises a plurality of MLP layers.

7. The vehicle lamp LED-oriented defect detection method according to claim 1, wherein Based on the trained semantic segmentation model, defect detection is performed on the validation set to obtain defect detection information, comprising: Based on the first Transformer module of the Transformer encoder in the trained semantic segmentation model, local information analysis is performed on the vehicle lamp LED image in the validation set to obtain target local information; Based on the second Transformer module and the third Transformer module, receptive field feature maps are extracted using the target local information; The fourth Transformer module is used to analyze global context features based on the receptive field feature map, and obtain global context feature information; The first MLP layer is used to up-sample and perform channel dimension splicing on the global context feature information, and obtain target feature information; The second MLP layer is used to perform defect detection based on the target feature information, and obtain defect detection information.

8. The vehicle lamp LED-oriented defect detection method according to claim 1, wherein The imgviz library is used to perform visual processing on the LED defects of the vehicle lamp based on the defect detection information, including: A label color mapping table is determined based on the label_colormap function of the imgviz library; The label color information corresponding to the defect detection information is determined based on the label color mapping table, and the putpalette function is used to perform visual processing on the LED defects of the vehicle lamp based on the label color information.

9. A vehicle lamp LED oriented defect detection system, comprising: The system includes: An image preprocessing module is used to collect the LED image of the vehicle lamp and preprocess the LED image of the vehicle lamp, and obtain a preprocessed LED image of the vehicle lamp; A data set construction module is used to construct a data set based on the preprocessed LED image of the vehicle lamp using the X-AnyLabeling labeling software, and divide the data set into a training set and a validation set; A data enhancement module is used to perform data enhancement processing on the training set, and obtain a data enhancement processed training set; A model training module is used to train a semantic segmentation model based on the data enhancement processed training set, and obtain a trained semantic segmentation model, wherein the semantic segmentation model adopts a Segformer model based on Transformer, and the Segformer model includes a hierarchical Transformer encoder and a lightweight multi-layer perceptron MLP decoder; A defect detection module is used to perform defect detection on the validation set based on the trained semantic segmentation model, and obtain defect detection information, and use the imgviz library to perform visual processing on the LED defects of the vehicle lamp based on the defect detection information.