Vehicle lamp lampshade surface scratch detection system and method based on AI vision
Through the AI vision-based car lampshade surface scratch detection system, the image acquisition technology combined with low angle light source and high angle light source is used, combined with convolutional neural network and support vector machine, efficient and accurate automated detection is achieved, solving the problems of low efficiency and poor accuracy of traditional manual detection, and is suitable for lampshades of different shapes and materials.
Patent Information
- Application Number
- CN202510504716.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-22
- Publication Date
- 2025-08-01
AI Technical Summary
Traditional car light lampshade scratch detection relies on manual visual inspection, which is inefficient and poorly accurate, and has problems such as subjectivity and fatigue missed inspection.
The surface scratch detection system of the headlight lampshade based on AI vision is adopted, including an image acquisition module, an image preprocessing module, a feature extraction module and a scratch detection module. The image is collected in time using low-angle light sources and high-angle light sources, and combined with a convolutional neural network and a support vector machine to extract and classify scratch features.
It realizes efficient and accurate automated inspection, and can complete a large number of lampshade detection in a short time, identify small scratches, have high detection accuracy and strong objectivity. It is suitable for lampshades of different shapes and materials, reducing detection costs.
Smart Images

Figure CN120411029A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of machine vision technology, and in particular to a system and method for detecting scratches on the surface of a vehicle lampshade based on AI vision. Background Art
[0002] During the automotive manufacturing process, scratches on headlight covers are a common defect, severely impacting the appearance quality and market competitiveness of headlights. Traditionally, headlight cover scratch detection relies primarily on manual visual inspection, which suffers from low efficiency, high subjectivity, and the tendency for fatigue and missed inspections. Therefore, an efficient, accurate, and automated headlight cover scratch detection system is necessary to replace manual visual inspection. Summary of the Invention
[0003] The problem to be solved by the present invention is to provide a system and method for detecting scratches on the surface of a vehicle lampshade based on AI vision, so as to solve the problems of low efficiency and poor accuracy of manual detection in the prior art.
[0004] In view of the shortcomings of the existing technology, the present invention solves the technical problems by adopting a technical solution: an AI vision-based vehicle lampshade surface scratch detection system, comprising the following modules:
[0005] Image acquisition module: configured to collect images of the lampshade surface through low-angle light source and high-angle light source in a time-sharing manner;
[0006] Image preprocessing module: used to grayscale, filter, denoise and edge enhance the collected images;
[0007] Feature extraction module: uses convolutional neural network (CNN) algorithm to extract scratch features from preprocessed images;
[0008] Scratch detection module: classifies the extracted features based on the support vector machine (SVM) classifier to determine the scratch category;
[0009] Result output module: used to output the location, length, and width information of the scratch, and trigger sound and light alarms or sorting operations.
[0010] Preferably, the image acquisition module is designed to use a low-angle light source in an annular distribution around the lampshade to be tested, and eliminates shadow interference through time-sharing exposure.
[0011] Preferably, the feature extraction module uses a convolutional neural network (CNN) to automatically learn scratch features on a lampshade dataset with scratches annotated through multiple layers of convolution, pooling and fully connected layers.
[0012] Preferably, the scratch detection module uses a classifier such as a support vector machine (SVM), a decision tree, or directly uses the output of a deep learning model to judge scratches.
[0013] Preferably, the result output module includes scratch information output and audible and visual alarm output.
[0014] A method for detecting scratches on the surface of a car headlight cover based on AI vision includes the following steps:
[0015] Step 1: Image acquisition. Use the image acquisition module to separately acquire images of the surface of the headlight cover at low-angle light sources and high-angle light sources at different times.
[0016] Step 2: Image preprocessing. Transmit the acquired images to the image preprocessing module for preprocessing operations such as grayscale conversion, filtering and denoising, and edge enhancement.
[0017] Step 3: Feature extraction. Input the preprocessed images into the feature extraction module to extract scratch features through deep learning algorithms. The deep learning algorithm can use a convolutional neural network (CNN). The convolutional neural network (CNN) extracts scratch features from the preprocessed images.
[0018] Step 4: Scratch characteristic detection. Send the extracted scratch features to the scratch detection module, use a support vector machine (SVM) classifier for scratch detection and classification, and determine whether there are scratches on the surface of the headlight cover.
[0019] Step 5: Output the detection result. Output relevant information through the result output module and perform corresponding subsequent operations.
[0020] Preferably, in Step 2, grayscale conversion includes assigning different weights to the red (R), green (G), and blue (B) channels. The grayscale conversion formula is:
[0021] Gray = 0.299R + 0.587G + 0.114B.
[0022] Preferably, in Step 3, the convolutional neural network (CNN) extracting scratch features from the preprocessed images specifically includes:
[0023] Convolution operation: The convolutional layer uses multiple convolutional kernels to slide on the input image and extracts local features through the convolution operation.
[0024] Activation function: After the convolution operation, a non-linear activation function is used to increase the non-linear ability of the model, enabling the network to learn more complex features.
[0025] Pooling operation: The pooling operation includes max pooling and average pooling. Max pooling takes the maximum value in each pooling window, while average pooling takes the average value.
[0026] Feature vector: After multiple convolutional and pooling operations, the feature map is flattened into a one-dimensional vector and input into the fully connected layer; the fully connected layer maps the extracted features to the final output space through linear combination and non-linear activation functions;
[0027] Optimization objective: The difference between the predicted output of the model and the true label is measured by defining a loss function.
[0028] Preferably, the convolutional operation is expressed as:
[0029]
[0030] Wherein, the two-dimensional matrix I(x,y) is the input image, K(u, v) is the convolution kernel, O(x,y) is the output image, (x,y) are the pixel coordinates of the output image, and (u,v) are the summation variables.
[0031] Preferably, the pooling operation is expressed as:
[0032]
[0033] Wherein, X is the input feature map, with a size of H×W (height is H, width is W), k h ×k w is the size of the pooling window, (height is k h , width is k w ), the stride is (S h ,S w )(vertical stride is S h , horizontal stride is S w ), the output feature map is Y, and the value range of i is from 0 to the value range of j is from 0 to represents the floor operation.
[0034] The beneficial effects of the present invention are as follows:
[0035] 1. High detection efficiency: High degree of automation, capable of completing the scratch detection of a large number of lamp shades in a short time, greatly improving the production efficiency;
[0036] 2. High detection accuracy: Using deep learning algorithms to extract scratch features, capable of accurately identifying various types of scratches, including micro-scratches and soft scratches, with high detection accuracy;
[0037] 3. Strong objectivity: Avoids the subjectivity of manual detection, and the detection results are more objective and stable, not affected by human factors;
[0038] 4. Strong adaptability: Applicable to the scratch detection of lamp shades with different shapes and different materials, with wide applicability;
[0039] 5. Cost Optimization: Reduce manual dependency and lower long-term detection costs. Description of the Drawings
[0040] Figure 1 It is a system structure block diagram of the present invention;
[0041] Figure 2 It is a flowchart of the detection method related to the present invention. Detailed Description of the Invention
[0042] The present invention will be further described in detail below in conjunction with the drawings and specific embodiments. The embodiments of the present invention are given for purposes of illustration and description, and are not exhaustive or limit the present invention to the disclosed form. Many modifications and variations are obvious to those of ordinary skill in the art. The embodiments are selected and described to better illustrate the principles and practical applications of the present invention, and enable those of ordinary skill in the art to understand the present invention and thus design various embodiments with various modifications suitable for specific purposes.
[0043] To solve the problems raised in the background art, the present invention provides a headlight lens surface scratch detection system based on AI vision, as Figure 1 shown, which includes an image acquisition module, an image preprocessing module, a feature extraction module, a scratch detection module, and a result output module. The functions of each module are as follows:
[0044] Image Acquisition Module: The image of the lens surface is acquired by combining a low-angle light source and a high-angle light source. The low-angle light source uses eight strip light sources to expose the workpiece by time-sharing, and is designed as a ring light source, divided into eight channels for control, exposed by time-sharing, and eight images are continuously acquired to highlight the scratch features; the high-angle light source, according to the law of light reflection, adopts a specific lighting method to form a specular reflection effect to highlight soft scratches.
[0045] The basic formula of light reflection:
[0046] θi = θr
[0047] where θi represents the angle of incidence (the angle between the incident light and the normal), θr represents the angle of reflection (the angle between the reflected light and the normal), and the normal is a virtual straight line perpendicular to the reflection surface.
[0048] The vector form of light reflection:
[0049] R = I - 2(I · N)N,
[0050] where R is the reflected light direction vector, I is the incident light direction vector (pointing to the reflection surface), and N is the normal direction vector (pointing to the outside of the medium).
[0051] Image preprocessing module: Preprocess the acquired images. The preprocessing methods include grayscale conversion, filtering for noise reduction, and edge enhancement operations to improve the image quality and enhance the visibility of scratch features.
[0052] For grayscale conversion, different weights are assigned to the red (R), green (G), and blue (B) channels. The formula is:
[0053] Gray = 0.299R + 0.587G + 0.114B,
[0054] Filtering for noise reduction: For a template of size m×n, the new value f′(i,j) of the central pixel (i,j) of the template after mean filtering is calculated by the formula:
[0055] f′(i,j) = 1mn∑(x,y)∈Sf(x,y),
[0056] where S represents the set of pixels covered by the template, and f(x,y) is the value of the pixel (x,y) within the template.
[0057] The edge enhancement operation adopts the Phong reflection model. The Phong reflection model combines specular reflection and diffuse reflection, and its formula is:
[0058] I = Iaka + Idkd(L·N) + Isks(R·V)n,
[0059] where Ia, Id, and Is are the ambient light, diffuse light, and specular light intensity respectively; ka, kd, and ks are the reflection coefficients; L is the light source direction, V is the viewing direction, and n is the specular exponent.
[0060] Law of refraction:
[0061] n1sinθi = n2sinθt,
[0062] where n1 and n2 are the refractive indices of the media, and θt is the angle of refraction.
[0063] Formula for the critical angle of total reflection:
[0064] θc = arcsin(n1n2),
[0065] where n1 is the refractive index of the optically denser medium, n2 is the refractive index of the optically thinner medium, and θc is the critical angle of total reflection. When light travels from an optically denser medium to an optically thinner medium, total reflection occurs when the angle of incidence is greater than or equal to the critical angle.
[0066] Feature extraction module: Use the convolutional neural network ResNet-18 to extract scratch features from the preprocessed images. By training a large number of lamp shade image data with scratch annotations, the network can automatically learn the feature representation of scratches.
[0067] Convolutional neural networks automatically extract meaningful features from raw images through multiple convolutional and pooling operations. The following is the specific workflow of deep learning algorithms in feature extraction:
[0068] Convolution operation: The convolutional layer slides multiple convolutional kernels (filters) over the input image and extracts local features through the convolution operation. Each convolutional kernel is responsible for extracting a specific feature, such as edges, textures, etc. The convolution operation can be expressed as:
[0069]
[0070] where the two-dimensional matrix I(x, y) is the input image, K(u, v) is the convolutional kernel, O(x, y) is the output image, (x, y) are the pixel coordinates of the output image, and (u, v) are the summation variables.
[0071] Activation function: After the convolution operation, a non-linear activation function (such as ReLU) is used to increase the non-linearity of the model, enabling the network to learn more complex features. The ReLU function is defined as:
[0072] f(x) = max(0, x),
[0073] where x is the input of the function and f(x) is the corresponding output.
[0074] Pooling operation: The pooling layer is used to reduce the size of the feature map, reduce computational complexity, and at the same time retain important features. Common pooling operations include max pooling and average pooling. Max pooling takes the maximum value in each pooling window, while average pooling takes the average value. The pooling operation can be expressed as:
[0075]
[0076] where X is the input feature map with a size of H×W (height is H, width is W), k h ×k w is the size of the pooling window (height is k h , width is k w ), the stride is (S h , S w ) (vertical stride is S h , horizontal stride is S w ), the output feature map is Y, the value range of i is from 0 to the value range of j is from 0 to Here represents the floor operation.
[0077] Feature vector: After multiple convolutional and pooling operations, the feature map is flattened into a one-dimensional vector and input into the fully connected layer. The fully connected layer maps the extracted features to the final output space through linear combination and non-linear activation functions. The output of the fully connected layer can be expressed as:
[0078] output = σ(input × weights + bias),
[0079] where σ is the activation function, input is the input variable, weights is the weight matrix, and bias is the bias vector.
[0080] Optimization objective: During the training process, the difference between the predicted output of the model and the true label is measured by defining a loss function. Common loss functions include mean squared error (MSE) and cross-entropy loss. Through the backpropagation algorithm, the weights and biases of the network are updated according to the gradient of the loss function, enabling the model to gradually learn the optimal feature representation.
[0081] The network structure of ResNet-18 consists of three parts: stem (input processing), body (stack of residual blocks), and head (classification output). Its network structure is as follows:
[0082] 1. Stem (input processing)
[0083] · 7×7 convolutional layer: Input a 3-channel image, output 64 channels, stride 2, padding 3.
[0084] · Batch normalization (BN) + ReLU activation.
[0085] · 3×3 max pooling: Stride 2, padding 1, further reducing the size.
[0086] Output size: When the input is 224×224, the output is 56×56×64.
[0087] 2. Body (stack of residual blocks)
[0088] It consists of 4 layers, and each layer contains 2 residual blocks (8 residual blocks in total). Each residual block adds the input directly to the output through a skip connection to avoid gradient vanishing.
[0089] Types of residual blocks
[0090] Solid connection (BasicBlock): The input and output have the same size and number of channels, and are directly added.
[0091] Dashed connection (BasicBlock + 1×1 convolution): When the number of channels or size changes, the input is adjusted by a 1×1 convolution to match the output.
[0092] The structure of each layer is as follows:
[0093] 1. layer1:
[0094] Input: 56×56×64;
[0095] Output: 56×56×64;
[0096] Operation: 2 BasicBlocks, no downsampling.
[0097] 2. layer2:
[0098] Input: 56×56×64;
[0099] Output: 28×28×128;
[0100] Operation: The first residual block is downsampled with a stride of 2 + 1×1 convolution, and the second BasicBlock maintains the size.
[0101] 3. layer3:
[0102] Input: 28×28×128;
[0103] Output: 14×14×256;
[0104] Operation: The first residual block is downsampled with a stride of 2 + 1×1 convolution, and the second BasicBlock maintains the size.
[0105] 4. layer4:
[0106] Input: 14×14×256;
[0107] Output: 7×7×512;
[0108] Operation: The first residual block is downsampled with a stride of 2 + 1×1 convolution, and the second BasicBlock maintains the size.
[0109] 3. Head (classification output):
[0110] Global average pooling: Compress 7×7×512 to 1×1×512;
[0111] Fully connected layer (FC): Output 1000 dimensions (corresponding to ImageNet categories).
[0112] Scratch detection module: According to the extracted features, use a classifier to detect scratches on the image and determine whether there are scratches on the surface of the lampshade; Classifiers such as support vector machines (SVM) and decision trees can be used, or the output of the deep learning model can be directly used for judgment.
[0113] Result output module: Output and display the detection results, including information such as the location, length, and width of scratches, and can perform audible and visual alarms or automatic sorting operations as required.
[0114] A method for a surface scratch detection system of a car headlight lamp cover based on AI vision includes the following steps:
[0115] Step 1, Image acquisition: Use the image acquisition module to separately acquire the images of the lamp cover surface at low-angle light sources and high-angle light sources at different times.
[0116] Step 2, Image preprocessing: Transmit the acquired images to the image preprocessing module for preprocessing operations such as grayscale conversion, filtering and denoising, and edge enhancement.
[0117] Step 3, Feature extraction: Input the preprocessed images into the feature extraction module to extract scratch features through deep learning algorithms; the deep learning algorithms can adopt convolutional neural networks (CNNs), and the convolutional neural networks (CNNs) extract scratch features from the preprocessed images.
[0118] Step 4, Scratch characteristic detection: Send the extracted scratch features to the scratch detection module, use a support vector machine (SVM) classifier for scratch detection and classification, and determine whether there are scratches on the lamp cover surface.
[0119] Step 5, Output the detection results: Output relevant information through the result output module and perform corresponding subsequent operations.
[0120] Training data: The dataset size is 5000 labeled images, and the labeled standard scratch length is ≥0.1 mm.
[0121] Comparison experiment: The missed detection rate of the present invention is ≤0.5%, and the missed detection rate of manual detection is ≥5%.
[0122] Efficiency improvement data: The single-piece detection time is ≤2 seconds, while the traditional method requires 30 seconds; the detection efficiency is increased by 15 times, which is suitable for the detection of tens of thousands of lamp covers per day; the recognition accuracy for micro-scratches (≤0.1 mm) reaches 99.2%.
[0123] The present invention provides a surface scratch detection system and method for a car headlight lamp cover based on AI vision. Through an innovative light source design (low-angle annular time-sharing exposure and high-angle specular reflection) combined with deep learning technology, it realizes the automatic and high-precision detection of scratches on the car headlight lamp cover surface. The system adopts a modular design, covering image acquisition, preprocessing, feature extraction, classification detection, and result output, significantly improving the detection efficiency and accuracy. Compared with traditional manual detection, the present invention has outstanding advantages in terms of detection speed, accuracy, stability, and applicability, and can be widely applied in the automotive manufacturing field to improve product quality and market competitiveness.
Claims
1. An AI vision-based scratch detection system for the surface of a car headlight lamp cover, characterized in that: Includes the following modules: Image acquisition module: configured to collect images of the lampshade surface through low-angle light source and high-angle light source in a time-sharing manner; Image preprocessing module: used to grayscale, filter, denoise and edge enhance the collected images; Feature extraction module: uses convolutional neural network (CNN) algorithm to extract scratch features from preprocessed images; Scratch detection module: classifies the extracted features based on the support vector machine (SVM) classifier to determine the scratch type; Result output module: used to output the location, length, and width information of the scratch, and trigger sound and light alarms or sorting operations.
2. The scratch detection system for the surface of a vehicle headlight lens based on AI vision according to claim 1, wherein: The image acquisition module is designed to surround the lampshade to be tested by an annular distribution of low-angle light sources, and eliminates shadow interference through time-sharing exposure.
3. The headlight lens surface scratch detection system based on AI vision according to claim 1, characterized in that: The feature extraction module uses a convolutional neural network (CNN) to automatically learn scratch features on a dataset of lampshades with scratches annotated through multiple layers of convolution, pooling, and fully connected layers.
4. The AI vision-based headlight lens surface scratch detection system according to claim 1, characterized in that: The scratch detection module uses classifiers such as support vector machines (SVMs) and decision trees, or directly uses the output of deep learning models to judge scratches.
5. The AI vision-based headlight lens surface scratch detection system according to claim 1, characterized in that: The result output module includes scratch information output and sound and light alarm output.
6. A method for detecting scratches on the surface of a car headlight lamp cover based on AI vision, characterized in that: The following steps are included: Step 1: Image acquisition: using an image acquisition module to collect images of the lampshade surface under low-angle light source and high-angle light source respectively; Step 2: Image preprocessing: The collected image is transferred to the image preprocessing module for grayscale conversion, filtering and denoising, edge enhancement and other preprocessing operations; Step 3: Feature extraction: input the pre-processed image into the feature extraction module and extract the scratch features through the deep learning algorithm; The deep learning algorithm may adopt a convolutional neural network (CNN), which extracts scratch features from the preprocessed image; Step 4: Scratch feature detection: the extracted scratch features are sent to the scratch detection module, and a support vector machine (SVM) classifier is used to perform scratch detection and classification, and determine whether there are scratches on the lampshade surface; Step 5: Output the test results, output relevant information through the result output module, and perform corresponding subsequent operations.
7. The method for detecting scratches on the surface of a vehicle headlight lens based on AI vision according to claim 6, wherein: In step 2, grayscale conversion involves assigning different weights to the three channels of red (R), green (G), and blue (B). The grayscale conversion formula is: Gray=0.299R+0.587G+0.114B.
8. The method for detecting scratches on the surface of a headlight lamp cover based on AI vision according to claim 6, characterized in that: In step 3, the convolutional neural network (CNN) extracts scratch features from the preprocessed image, specifically including: Convolution operation: The convolution layer uses multiple convolution kernels to slide on the input image and extract local features through convolution operation; Activation function: After the convolution operation, a nonlinear activation function is used to increase the nonlinear ability of the model, enabling the network to learn more complex features; Pooling operation: Pooling operation includes maximum pooling and average pooling. Maximum pooling takes the maximum value in each pooling window, while average pooling takes the average value. Feature vector: After multiple layers of convolution and pooling, the feature map is flattened into a one-dimensional vector and input to the fully connected layer. The fully connected layer maps the extracted features to the final output space through linear combination and nonlinear activation function. Optimization objective: Define a loss function to measure the difference between the predicted output of the model and the true label.
9. The method for detecting scratches on the surface of a headlight lens based on AI vision according to claim 8, wherein: The convolution operation is expressed as: Among them, the two-dimensional matrix I(x, y) is the input image, K(u, v) is the convolution kernel, O(x, y) is the output image, (x, y) are the pixel coordinates of the output image, and (u, v) are the summation variables.
10. The method for detecting scratches on the surface of a headlight lamp cover based on AI vision according to claim 8, characterized in that: The pooling operation is expressed as: Among them, X is the input feature map, with a size of H×W (height is H, width is W), k h ×k w is the size of the pooling window, (height is k h , width is k w ), the stride is (S h , S w )(vertical stride is S h , horizontal stride is S w ), the output feature map is Y, the value range of i is from 0 to the value range of j is from 0 to represents the floor operation.