Lamp holder production process quality inspection method and system based on machine vision

By employing a machine vision-based lamp head quality inspection method, which utilizes multi-angle image acquisition, image preprocessing, and hybrid detection strategies, combined with a deep learning model and attention module, the method addresses the issues of insufficient accuracy and sensitivity in existing lamp head quality inspection technologies, achieving efficient and accurate lamp head detection.

CN121353191AActive Publication Date: 2026-01-16ZHEJIANG YIWEI PRECISION TECH CO LTD
View PDF 15 Cites 0 Cited by

Patent Information

Application Number
CN202511397288.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-28
Publication Date
2026-01-16
Estimated Expiration
2045-09-28

AI Technical Summary

Technical Problem

Existing machine vision-based lamp head quality inspection solutions are insufficient in terms of accuracy in detecting dimensional defects and sensitivity in recognizing appearance defects, and cannot meet the requirements of efficiently and accurately detecting minute dimensional deviations and small defects in lamp heads.

Method used

Triggered industrial cameras are used to acquire multi-angle images. Combined with image preprocessing and hybrid detection strategies, a U-Net variant deep learning segmentation model based on attention mechanism is used for defect identification. Synthetic data augmentation technology and multi-scale loss function are used to optimize the model. Combined with CBAM attention module and pyramid upsampling structure, the sensitivity to small defects is improved. Accurate judgment is made by calculating key size deviation coefficient and comprehensive deviation coefficient.

Benefits of technology

It enables comprehensive and accurate detection of lamp head size and appearance defects, improves detection efficiency and consistency, reduces reliance on manual inspection, avoids missed detections, and ensures product quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121353191A_ABST
    Figure CN121353191A_ABST
Patent Text Reader

Abstract

The invention relates to the field of quality supervision, and discloses a lamp holder production process quality inspection method and system based on machine vision, and the method comprises the steps: collecting a multi-angle image of a lamp holder on an assembly line through a trigger type industrial camera, carrying out the preprocessing of gray correction, ROI region extraction, noise filtering and the like, and analyzing the image through a mixed detection strategy; calculating a critical dimension deviation coefficient by using a first analysis model to detect dimension defects, and identifying appearance defects by means of a U-Net variant deep learning segmentation model based on an attention mechanism; triggering a sorting device according to a defect classification result and recording data to a production quality database; a deep learning segmentation model is trained by adopting a synthetic data enhancement technology and a multi-scale loss function, so that the small defect recognition capability is improved. The lamp cap quality inspection efficiency and accuracy can be effectively improved, the labor cost is reduced, the stability and adaptability of the detection system are enhanced, and the quality control requirement of large-scale lamp cap production is met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of quality supervision, specifically to a method and system for quality inspection of lamp holder production process based on machine vision. Background Technology

[0002] Quality control is crucial in the lamp holder manufacturing process. Traditional lamp holder quality inspection mainly relies on manual inspection, which has many drawbacks. First, manual inspection is inefficient and cannot meet the needs of modern large-scale production. With the acceleration of production speed, manual inspection is prone to missed or false positives. Second, the accuracy of manual inspection is greatly affected by the subjective factors of the inspectors. Different inspectors may have different judgment standards, resulting in inconsistent and unreliable test results.

[0003] With the development of machine vision technology, some companies have begun to try applying it to lamp holder quality inspection. However, existing machine vision-based lamp holder quality inspection solutions still have some shortcomings. For example, in terms of dimensional defect detection, the measurement accuracy and analysis methods for key dimensions are not perfect enough, making it difficult to accurately identify subtle dimensional deviations. For appearance defect detection, some deep learning models have low sensitivity to small defects, easily missing tiny scratches, stains, and other defects, affecting product quality control. Therefore, there is an urgent need for a machine vision-based quality inspection method and system for lamp holder production. Summary of the Invention

[0004] The purpose of this invention is to provide a quality inspection method and system for lamp head production based on machine vision, thereby solving the above-mentioned technical problems.

[0005] The objective of this invention can be achieved through the following technical solutions: A machine vision-based quality inspection method for lamp holder manufacturing process includes the following steps: S1. Acquire multi-angle images of lamp heads on the production line using a trigger-type industrial camera; S2. Preprocess the image, including grayscale correction, ROI region extraction, and noise filtering; S3. Analyze the preprocessed image using a hybrid detection strategy; the hybrid detection strategy includes: The detection strategy for dimensional defects is to calculate the critical dimension deviation coefficient through the first analysis model, and determine whether there is a dimensional abnormality based on the comparison between the critical dimension deviation coefficient and the preset deviation range. The detection strategy for appearance defects is to identify scratches, stains, and structural anomalies through a second analysis model; S4. Trigger the sorting device based on the defect classification results and record the defect data to the production quality database.

[0006] As a further technical solution, the second analysis model is a pre-trained deep learning segmentation model, which is a variant of U-Net based on an attention mechanism, and its training process includes: Defect samples are generated using synthetic data augmentation techniques, including random simulation of scratch morphology and stain distribution using GAN networks; The sensitivity of the model to small defects is optimized using a multi-scale loss function, which is: ; in, , Indicates weight, and The term "small defect" refers to a defect area with a diameter of <0.1mm. The Dice loss is expressed as: , Indicates the prediction mask. Indicates the true label, The Focal loss is expressed as: , Represents class probability, .

[0007] As a further technical solution, the encoder part of the deep learning segmentation model is embedded with a CBAM attention module, and the CBAM attention module performs weighted processing on the feature map obtained after the encoder convolution operation in both the channel and spatial dimensions. The decoder section adopts a pyramid upsampling structure to fuse feature maps of different scales. The feature maps are matrix data containing lamp head image feature information extracted during the convolution operation of each layer of the model.

[0008] As a further technical solution, the process of analyzing dimensional defects includes: The key dimensions include at least three of the following: major diameter of the thread, pitch diameter of the thread, contact height, outer diameter of the housing, and groove depth of the sealing ring. The expression for the first analytical model is: ; For the first Deviation coefficients for key dimensions; in, The first step is to calculate the contour curve obtained by least squares fitting after extracting the lamp head contour using an edge detection algorithm. Actual measured values ​​of each key dimension; For the first in the product design drawings Standard values ​​for key dimensions; If at least one critical dimension deviation coefficient exceeds the preset deviation range If so, then the current critical dimension is determined to be abnormal.

[0009] As a further technical solution, the process of analyzing dimensional defects also includes: The curve of the critical dimension deviation coefficient changing over time for a historical unit of time when a critical dimension anomaly exists is obtained by fitting. The cumulative change value of the critical dimension deviation coefficient over time is calculated by integration, and the cumulative change value is compared with the cumulative change warning value obtained based on historical data. If the cumulative change value is greater than or equal to the cumulative change warning value, it is determined that there is a comprehensive deviation in the current critical dimension, and further quality analysis is required.

[0010] As a further technical solution, the process of conducting further quality analysis is as follows: Through the formula: ; Calculate the first Comprehensive deviation coefficient of each key dimension ; in, For the first The reference values ​​for the deviations of each key dimension are calculated using the following formula: ; For a historical unit of time, the first Standard deviation of key dimensions; For the first Process capability index for each key dimension The uncertainty factor has a value range of [0.5, 2]. For measurement uncertainty; The first Comprehensive deviation coefficient of each key dimension With warning value The warning value is determined based on historical data analysis through comparison. when If a defect is detected in the current critical dimension, the machine should be stopped immediately for inspection.

[0011] As a further technical solution, the first Process capability index of key dimensions The calculation formula is: ; in, Represents the first historical unit of time. The average of the key dimensions.

[0012] As a further technical solution, the measurement uncertainty The calculation method is as follows: Identify the impact of measurement process on the first The sources of uncertainty in the measurement results of key dimensions include the accuracy of the measuring instrument, environmental factors, measurement methods, and operator factors, which are denoted as follows: , , , The environmental factor mentioned is the effect of temperature change on the first... The impact of key dimensions; Substitute into the formula: The measurement uncertainty was calculated. ; in, , This refers to the maximum permissible error obtained based on the accuracy specifications provided by the manufacturer of the current measuring instrument. For every 1 degree Celsius change in temperature, the current critical dimension changes. The temperature fluctuation range during the measurement process is: ; The standard deviation of the measured values ​​is obtained by repeatedly measuring the current critical dimension of the same lamp holder multiple times. The standard deviation of the measured values ​​is obtained by measuring the current critical dimensions of the same lamp head by multiple measuring personnel.

[0013] A machine vision-based quality inspection system for lamp holder production processes, comprising: The image acquisition module is used to acquire multi-angle images of lamp heads on the production line using a trigger-type industrial camera; The image preprocessing module is used to preprocess images, including grayscale correction, ROI region extraction, and noise filtering. The image analysis module employs a hybrid detection strategy to analyze the preprocessed image; the hybrid detection strategy includes: The detection strategy for dimensional defects is to calculate the critical dimension deviation coefficient through the first analysis model, and determine whether there is a dimensional abnormality based on the comparison between the critical dimension deviation coefficient and the preset deviation range. The detection strategy for appearance defects is to identify scratches, stains, and structural anomalies through a second analysis model; The defect classification and data recording module is used to classify defects based on the results of the image analysis module and trigger the sorting device, and record defect data to the production quality database.

[0014] The beneficial effects of this invention are: (1) Using a trigger-type industrial camera to acquire multi-angle images, combined with image processing and analysis technology, it can comprehensively and accurately detect the size defects and appearance defects of the lamp head; for size defects, by accurately calculating the key size deviation coefficient and conducting a comprehensive analysis of the key dimensions, it can accurately determine whether there are any abnormalities; for appearance defects, the U-Net variant deep learning segmentation model based on the attention mechanism, under the optimization of synthetic data augmentation technology and multi-scale loss function, has greatly improved the sensitivity of small defect identification, effectively avoiding the omission of small defects and ensuring product quality.

[0015] (2) Completely abandoning the traditional manual inspection method, the automated quality inspection system is used to complete the inspection task, which greatly improves the inspection efficiency and can meet the pace of large-scale production. At the same time, it reduces the reliance on a large number of manual inspection personnel, reduces labor costs, avoids inspection errors caused by factors such as human fatigue and subjective judgment differences, and improves the consistency and reliability of inspection results. Attached Figure Description

[0016] The invention will now be further described with reference to the accompanying drawings.

[0017] Figure 1 This is a diagram illustrating the method steps 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] Please see Figure 1 As shown, this invention is a quality inspection method for lamp holder production based on machine vision, comprising the following steps: S1. Acquire multi-angle images of the lamp heads on the production line using a trigger-type industrial camera; for example, the camera is installed directly above and on both sides of the production line, evenly distributed at 120°, with the distance between the camera and the lamp head maintained between 30-50cm, to obtain multi-angle images of the lamp head. To ensure that the camera triggering is synchronized with the operation of the production line, a photoelectric sensor is installed on one side of the production line. When the lamp head passes the sensor, the sensor sends a trigger signal to the camera, and the camera quickly acquires the image.

[0020] S2. Preprocess the image, including grayscale correction, ROI region extraction, and noise filtering; use histogram equalization algorithm to perform grayscale correction on the acquired color image; Based on the approximate position and shape of the lamp head in the image, a rectangular region is pre-defined as the region of interest (ROI). Using the coordinate information of the image, image data within this rectangular region is extracted, and background information unrelated to the lamp head is removed from the image, reducing the amount of data to be processed and improving the processing speed.

[0021] Median filtering is used to filter noise in the image. The filtering window size is set to 3×3. Pixel values ​​within the window are sorted from smallest to largest, and the median value is taken as the new value for the center pixel of the window. This process is applied to each pixel in the image sequentially, effectively removing discrete noise such as salt-and-pepper noise, smoothing image edges, and improving image quality.

[0022] S3. Analyze the preprocessed image using a hybrid detection strategy; the hybrid detection strategy includes: The detection strategy for dimensional defects involves calculating the critical dimension deviation coefficient using a first analysis model, and determining whether dimensional anomalies exist based on the comparison between the critical dimension deviation coefficient and a preset deviation range. The Canny operator in the edge detection algorithm is then used to extract the lamp head contour. First, Gaussian filtering is applied to the image to remove noise. Then, the gradient magnitude and direction of the image are calculated, and edges are refined using non-maximum suppression. Finally, double threshold detection and edge connection are used to obtain the precise contour of the lamp head. Next, the least squares method is used to fit the contour curve, and key dimensions such as the thread major diameter, thread pitch diameter, contact height, outer diameter of the housing, and sealing ring groove depth are calculated. For example, for measuring the thread major diameter, the diameter of the curve is calculated as the actual measured value by fitting the thread contour curve.

[0023] The detection strategy for appearance defects is as follows: a second analysis model is used to identify scratches, stains, and structural anomalies; a pre-trained U-Net variant deep learning segmentation model based on an attention mechanism is loaded; the training data of this model includes a large number of normal lamp head images and defective images with scratches, stains, and structural anomalies; during prediction, the pre-processed lamp head image is input into the model, the model outputs a prediction mask, and the presence of appearance defects is determined by comparing it with the real label.

[0024] S4. Trigger the sorting device based on the defect classification results and record the defect data to the production quality database. When a defect is detected in the lamp head, the sorting device is triggered based on the defect classification results. The sorting device uses a pneumatic pusher; when a defect signal is received, the pusher pushes the defective lamp head from the production line to the designated defective product collection area. Simultaneously, the image of the defective lamp head, detection time, defect type (e.g., size abnormality, scratches, stains, etc.), and critical size deviation coefficient (if it is a size defect) are recorded in the production quality database. The database uses a MySQL database, and a dedicated table is created to store the quality inspection data for easy subsequent querying and analysis.

[0025] The second analysis model is a pre-trained deep learning segmentation model, which is a variant of U-Net based on an attention mechanism. Its training process includes: Defect samples are generated using synthetic data augmentation techniques, including random simulation of scratch morphology and stain distribution via GAN networks; specifically: Building GAN networks: Generative Adversarial Networks (GANs) are used to randomly simulate scratch patterns and stain distributions. The GAN consists of a generator and a discriminator. The generator uses a Convolutional Neural Network (CNN) structure, taking a random noise vector as input and gradually generating images with specific sizes and number of channels through multiple transposed convolutional layers. These images simulate scratches and stains on a lamp holder. The discriminator, also based on a CNN, is used to determine whether the input image is a genuine defect image or a fake image generated by the generator.

[0026] Training the GAN network: A large number of real lamp holder defect images were collected as training data to train the GAN network. During training, the generator attempted to generate more realistic defect images to deceive the discriminator, while the discriminator tried to distinguish between real and generated images. Through continuous adversarial training, the scratch and stain images generated by the generator became increasingly closer to reality. For example, when generating scratch images, the generator was able to simulate scratches of different lengths, widths, shapes, and color depths, and the texture and distribution features were similar to those of real scratches.

[0027] Expanding the training dataset: After multiple rounds of training, a large number of defect samples are generated using the trained GAN network. These generated samples are then merged with the original real defect samples to form a new training dataset. The new dataset enriches the diversity of defects, covering various scratches and stains that may occur in actual production, providing more sufficient data for the subsequent training of deep learning segmentation models.

[0028] The sensitivity of the model to small defects is optimized using a multi-scale loss function, which is: ; in, , Indicates weight, and The term "small defect" refers to a defect area with a diameter of <0.1mm. The Dice loss is expressed as: , Indicates the prediction mask. Indicates the true label, The Focal loss is expressed as: , Represents class probability, For example, for a lamp holder image sample containing tiny scratches (defect area diameter less than 0.1mm), the model's predicted mask has a Dice loss of 0.2 and a Focal loss of 0.3, resulting in a total loss L = 0.6 × 0.2 + 0.4 × 0.3 = 0.24. During training, the newly expanded training dataset is input into the model, and the model outputs the predicted mask. .

[0029] The encoder portion of the deep learning segmentation model embeds a CBAM attention module, which performs weighted processing on the feature map obtained after the encoder convolution operation in both the channel and spatial dimensions. The decoder employs a pyramid upsampling structure to fuse feature maps of different scales. These feature maps are matrix data containing lamp head image feature information extracted during the convolutional operations of each layer of the model. The decoder uses a pyramid upsampling structure for feature map fusion, and the fusion method is element-wise addition, using the following formula: Alternatively, it can be a weighted sum, with the formula as follows: ; The weights are all greater than or equal to 0. Alternatively, it can be channel splicing, with the formula as follows: , This indicates a splicing operation. This represents the fused feature map. These represent input feature maps at different scales.

[0030] The CBAM attention module consists of a channel attention submodule and a spatial attention submodule. The channel attention submodule first performs global average pooling and global max pooling on the input feature map, generating two distinct feature descriptors. These two descriptors are then processed by a shared multilayer perceptron (MLP). The MLP contains one hidden layer with 1 / 16 the number of neurons in the input channels to reduce computation. Finally, the two MLP-processed feature descriptors are summed and activated using the sigmoid function to generate the channel attention weights. The spatial attention submodule then performs average pooling and max pooling on the channel-weighted feature map, respectively, along the channel dimension, generating two spatial feature descriptors. These two descriptors are concatenated, fused using a 7×7 convolutional layer, and then activated again using the sigmoid function to generate the spatial attention weights.

[0031] In the encoder part of a deep learning segmentation model, a CBAM attention module is embedded after each residual block. For example, in the encoder of a ResNet-50 backbone network, for the feature map output by each residual block, the attention weights are first calculated by the CBAM module, and then multiplied by the weights with the feature map to obtain an attention-enhanced feature map. Taking the feature map output by the first residual block as an example, its size is 256×56×56, that is, 256 channels, and 56 in height and width. After passing through the CBAM module, the generated channel attention weight size is 256×1×1, and the spatial attention weight size is 1×56×56. These two weights are multiplied by the feature map respectively to highlight the feature information of channels and spatial regions related to defects.

[0032] The decoder's pyramid upsampling structure consists of multiple upsampling modules, each processing feature maps at different scales. Starting with the deep features of the encoder, the feature map is first reduced in dimensionality using a 1×1 convolution to decrease the number of channels. Then, bilinear interpolation is used to upsample the feature map to the target size. In each upsampling stage, the upsampled feature map from the previous layer is fused with the corresponding scale feature map from the encoder. The fusion method uses element-wise addition, adding the upsampled feature map to the encoder feature map to preserve feature information at different levels. For example, in the first upsampling module, the feature map output from the last layer of the encoder (e.g., 2048×7×7) is reduced to 512 channels using a 1×1 convolution, then upsampled to 14×14, and added to the feature map output from the second-to-last layer of the encoder (512×14×14) to obtain the fused feature map.

[0033] The model was trained using the Stochastic Gradient Descent (SGD) algorithm, with an initial learning rate of 0.001. The learning rate was reduced to 0.9 every 50 training epochs. During training, the model parameters were continuously adjusted to gradually reduce the total loss. After 200 training epochs, the model's ability to identify small defects was significantly improved.

[0034] In this embodiment, a large number of defect samples are generated by randomly simulating scratch patterns and stain distributions using a GAN network, thus expanding the diversity of the training dataset. This allows the deep learning segmentation model to learn more different types and features of defects during training, improving the model's generalization ability and enabling it to more accurately identify various complex defect situations in actual detection. The U-Net variant model structure based on the attention mechanism and the application of multi-scale loss functions effectively enhance the model's sensitivity to small defects. The CBAM attention module allows the model to pay more attention to small defect regions in the image, highlighting the feature information of small defects. The multi-scale loss function comprehensively considers Dice loss and Focal loss. Dice loss focuses on the overlap between the predicted result and the true label, while Focal loss pays more attention to samples that are difficult to classify, such as small defects. The combination of the two allows the model to better learn the features of small defects during training, improving the accuracy of identifying defects such as small scratches and stains and reducing the occurrence of missed detections.

[0035] The process of analyzing dimensional defects includes: The key dimensions include at least three of the following: major diameter of the thread, pitch diameter of the thread, contact height, outer diameter of the housing, and groove depth of the sealing ring. The expression for the first analytical model is: ; For the first Deviation coefficients for key dimensions; in, The first step is to calculate the contour curve obtained by least squares fitting after extracting the lamp head contour using an edge detection algorithm. Actual measured values ​​of each key dimension; For the first in the product design drawings Standard values ​​for key dimensions; If at least one critical dimension deviation coefficient exceeds the preset deviation range If so, then the current critical dimension is determined to be abnormal.

[0036] Specifically, the edge detection algorithm includes: Canny operator parameter settings: The Canny operator is used for lamp head edge detection. First, the preprocessed image is subjected to Gaussian filtering with a Gaussian kernel size of 5×5 and a standard deviation σ=1.4 to effectively remove noise from the image. Then, the gradient magnitude and direction of the image are calculated, and the non-maximum suppression algorithm is used to refine the edges, suppressing points where the gradient magnitude is not a local maximum to zero. Next, a dual threshold is set, with the lower threshold being 1 / 3 of the higher threshold and the higher threshold being set to the 90th percentile of the image gradient magnitude. Through dual threshold detection and edge connection, the edge image of the lamp head is obtained.

[0037] Edge optimization processing: The edges detected by the Canny operator are optimized. Small gaps in the edges are filled using the closing operation (dilation followed by erosion) in morphological operations, with a structuring element size of 3×3. Then, a contour search algorithm is used to find all continuous contours in the image, and the contours are filtered based on their perimeter and area to remove false edges with too small an area or too short a perimeter, retaining the true edges related to the lamp head.

[0038] The acquisition process is as follows: For the selected lamp head contours, curve fitting is performed using the least squares method. For circular or cylindrical lamp head parts, such as threads and contacts, a circle fitting algorithm is used. Points on the contour are used as sample points, and the center coordinates and radius of the circle are determined by minimizing the sum of squared distances from the points to the fitted circle. For straight edges, such as the edges of the lamp head casing, a straight line fitting algorithm is used to determine the slope and intercept of the line.

[0039] Critical dimension calculation: Based on the fitted profile curve, calculate various critical dimensions. For the threaded portion, calculate the diameter of the fitted circle as the major diameter of the thread; calculate the pitch diameter of the thread by measuring the distance between specific points on the thread profile. For the contact, measure its height and diameter. For the lamp holder housing, measure its outer diameter and the depth of the sealing ring groove, etc. During the calculation process, consider the proportional relationship between the pixel size of the image and the actual physical size, and convert the pixel values ​​into actual physical dimensions.

[0040] In this embodiment, the least squares method is used for contour curve fitting, which can effectively fit various shapes of the lamp head and improve the accuracy of key dimension measurements. Converting pixel values ​​into actual physical dimensions ensures the practicality and comparability of the measurement results. Simultaneously, by calculating the deviation coefficient and comparing it with a preset deviation range, the dimensional deviation assessment is quantified, thereby enabling an objective and quantitative evaluation of the compliance of key dimensions of the lamp head. This avoids the subjectivity and uncertainty of manual judgment, improving the accuracy and consistency of quality inspection. In actual production, lamp heads that do not meet dimensional standards can be detected promptly, reducing the risk of defective products entering the market and improving product quality. (The formula is used to...) As can be seen, compared to traditional machine vision quality inspection which often uses threshold comparisons but does not consider the differences in the importance of parameters, this formula achieves this by introducing relative percentages: Differentiated parameter weights: For parameters with high accuracy requirements, such as the thread pitch diameter, a stricter deviation range, such as ±0.2%, can be set, while for secondary parameters such as the outer diameter of the housing, the tolerance can be relaxed to ±1%.

[0041] Multi-dimensional defect comprehensive assessment: When 10 key dimensions are inspected simultaneously, a more comprehensive quality score can be achieved by calculating a comprehensive deviation index.

[0042] The process of analyzing dimensional defects also includes: The curve of the critical dimension deviation coefficient changing over time for a historical unit of time when a critical dimension anomaly exists is obtained by fitting. The cumulative change value of the critical dimension deviation coefficient over time is calculated by integration, and the cumulative change value is compared with the cumulative change warning value obtained based on historical data. If the cumulative change value is greater than or equal to the cumulative change warning value, it is determined that there is a comprehensive deviation in the current critical dimension, and further quality analysis is required.

[0043] In this embodiment, the least squares method is used for curve fitting when obtaining the curve of the critical dimension deviation coefficient over time. For example, using 1 hour as the historical unit of time, critical dimension data is collected every 10 minutes and the deviation coefficient is calculated to obtain a series of deviation coefficient values. , ,..., The time points are t1, t2, ..., t6. Substituting the above data into the least squares formula, a curve of the form y = ax + b (where y is the deviation coefficient and x is time) is fitted.

[0044] When calculating the cumulative change value, the trapezoidal integral method from numerical integration is used. The time interval [t1, t6] is divided into multiple smaller intervals, and for each smaller interval... , The cumulative change value is approximately calculated as follows: The cumulative change value for a historical unit of time is obtained by summing the results of all intervals. The cumulative change warning value is calculated by statistically analyzing the cumulative change values ​​of the same time period each day over the past week and taking the 95th percentile as the warning value. By fitting the curve of the critical dimension deviation coefficient over time and calculating the cumulative change value, the changing trend of critical dimensions during the production process can be dynamically monitored. If the cumulative change value reaches the warning value, potential quality problems can be detected in advance, avoiding the production of a large number of defective products and improving product quality stability. By calculating the cumulative change value and comparing it with the warning value, it can serve as a basis for judging whether the production process is stable and whether there is a comprehensive deviation in the critical dimensions. It comprehensively considers the changes in the critical dimension deviation coefficient over a period of time, which is more comprehensive than judging by a single deviation coefficient and can detect abnormal fluctuations in the production process in a timely manner.

[0045] The process for further quality analysis is as follows: Through the formula: ; Calculate the first Comprehensive deviation coefficient of each key dimension ; in, For the first The reference values ​​for the deviations of each key dimension are calculated using the following formula: ; For a historical unit of time, the first Standard deviation of key dimensions; For the first Process capability index for each key dimension The uncertainty factor has a value range of [0.5, 2]. For measurement uncertainty; The first Comprehensive deviation coefficient of each key dimension With warning value The warning value is determined based on historical data analysis through comparison. when If a defect is detected in the current critical dimension, the machine should be stopped immediately for inspection.

[0046] In this embodiment, further quality analysis allows for a more comprehensive and in-depth assessment of the quality status of critical dimensions. Compared to judging solely based on the critical dimension deviation coefficient, this approach considers the dispersion of the data (standard deviation). Process capability index and measurement uncertainty Factors such as these can help identify potential quality problems more accurately. For example, there might be a moment when the deviation coefficient of a critical dimension does not exceed the preset range, but after taking other factors into account, the overall deviation coefficient may be higher. When the threshold is exceeded, potential quality issues can be detected in time, preventing defective products from entering the next production stage and improving overall product quality. This is achieved through the formula... The comprehensive deviation coefficient is calculated by integrating multiple factors to comprehensively assess the quality status of critical dimensions. The numerator reflects the relative magnitude of the current deviation and the reference deviation, the impact of the dispersion of measurement data on the deviation, and the impact of measurement uncertainty. The denominator... Normalization is performed to make the overall deviation coefficients of different key dimensions comparable.

[0047] The first Process capability index of key dimensions The calculation formula is: ; in, Represents the first historical unit of time. The average of the key dimensions.

[0048] The formula By comparing the average value of critical dimensions with a preset deviation range, and combining this with the standard deviation, the process capability index is calculated. This reflects the degree of matching between the actual capability of the production process and the specified requirements, helping companies assess whether the production process is stable and whether adjustments to the production process or equipment are needed. Process Capability Index This index is used to measure the stability and production capacity of the production process. By calculating this index, one can intuitively understand the extent to which the production process can produce products that meet specifications, providing a basis for optimizing the production process.

[0049] The measurement uncertainty The calculation method is as follows: Identify the impact of measurement process on the first The sources of uncertainty in the measurement results of key dimensions include the accuracy of the measuring instrument, environmental factors, measurement methods, and operator factors, which are denoted as follows: , , , The environmental factor mentioned is the effect of temperature change on the first... The impact of key dimensions; Substitute into the formula: The measurement uncertainty was calculated. ; in, , This refers to the maximum permissible error obtained based on the accuracy specifications provided by the manufacturer of the current measuring instrument. For every 1 degree Celsius change in temperature, the current critical dimension changes. The temperature fluctuation range during the measurement process is: ; The standard deviation of the measured values ​​is obtained by repeatedly measuring the current critical dimension of the same lamp holder multiple times. The standard deviation of the measured values ​​is obtained by measuring the current critical dimensions of the same lamp head by multiple measuring personnel.

[0050] In this embodiment, through The measurement uncertainty is calculated by taking the square root of the sum of the squares of the uncertainty components from different sources. Each component reflects the influence of instrument accuracy, environmental factors, measurement method, and operator operation on the measurement results. Used to measure the uncertainty of measurement results, providing an important reference for subsequent quality analysis.

[0051] A machine vision-based quality inspection system for lamp holder production processes, comprising: The image acquisition module is used to acquire multi-angle images of lamp heads on the production line using a trigger-type industrial camera; The image preprocessing module is used to preprocess images, including grayscale correction, ROI region extraction, and noise filtering. The image analysis module employs a hybrid detection strategy to analyze the preprocessed image; the hybrid detection strategy includes: The detection strategy for dimensional defects is to calculate the critical dimension deviation coefficient through the first analysis model, and determine whether there is a dimensional abnormality based on the comparison between the critical dimension deviation coefficient and the preset deviation range. The detection strategy for appearance defects is to identify scratches, stains, and structural anomalies through a second analysis model; The defect classification and data recording module is used to classify defects based on the results of the image analysis module and trigger the sorting device, and record defect data to the production quality database.

[0052] It should be noted that the calculation formulas and all parameters involved in the calculations in this invention have been dimensionless beforehand. The process of dimensionless processing is well known in the industry and will not be described here.

[0053] The foregoing has provided a detailed description of one embodiment of the present invention, but this description is merely a preferred embodiment and should not be construed as limiting the scope of the invention. All equivalent variations and modifications made within the scope of the claims of this invention should still fall within the patent coverage of this invention.

Claims

1. A machine vision-based method for quality inspection of a lamp cap production process, characterized in that, Includes the following steps: S1. Acquire multi-angle images of lamp heads on the production line using a trigger-type industrial camera; S2. Preprocess the image, including grayscale correction, ROI region extraction, and noise filtering; S3. Analyze the preprocessed image using a hybrid detection strategy; the hybrid detection strategy includes: The detection strategy for dimensional defects is to calculate the critical dimension deviation coefficient through the first analysis model, and determine whether there is a dimensional abnormality based on the comparison between the critical dimension deviation coefficient and the preset deviation range. The detection strategy for appearance defects is to identify scratches, stains, and structural anomalies through a second analysis model; S4. Trigger the sorting device based on the defect classification results and record the defect data to the production quality database.

2. The machine vision-based inspection method of lamp cap production process according to claim 1, characterized in that, The second analysis model is a pre-trained deep learning segmentation model, which is a variant of U-Net based on an attention mechanism. Its training process includes: Defect samples are generated using synthetic data augmentation techniques, including random simulation of scratch morphology and stain distribution using GAN networks; The sensitivity of the model to small defects is optimized using a multi-scale loss function, which is: ; wherein, , represents a weight, and , the small defects refer to defect regions with a diameter < 0.1 mm, represents a Dice loss, and the expression is: , represents a predicted mask, represents a true label, represents a Focal loss, and the expression is: , represents a class probability, .

3. The machine vision-based inspection method of lamp cap production process according to claim 2, characterized in that, The encoder portion of the deep learning segmentation model embeds a CBAM attention module, which performs weighted processing on the feature map obtained after the encoder convolution operation in both the channel and spatial dimensions. The decoder section adopts a pyramid upsampling structure to fuse feature maps of different scales. The feature maps are matrix data containing lamp head image feature information extracted during the convolution operation of each layer of the model.

4. The machine vision-based quality inspection method for lamp holder production process according to claim 3, characterized in that, The process of analyzing dimensional defects includes: The key dimensions include at least three of the following: major diameter of the thread, pitch diameter of the thread, contact height, outer diameter of the housing, and groove depth of the sealing ring. The expression for the first analytical model is: ; For the first Deviation coefficients for key dimensions; in, The first step is to calculate the contour curve obtained by least squares fitting after extracting the lamp head contour using an edge detection algorithm. Actual measured values ​​of each key dimension; For the first in the product design drawings Standard values ​​for key dimensions; If at least one critical dimension deviation coefficient exceeds the preset deviation range If so, then the current critical dimension is determined to be abnormal.

5. The machine vision-based quality inspection method for lamp holder production process according to claim 4, characterized in that, The process of analyzing dimensional defects also includes: The curve of the critical dimension deviation coefficient changing over time for a historical unit of time when a critical dimension anomaly exists is obtained by fitting. The cumulative change value of the critical dimension deviation coefficient over time is calculated by integration, and the cumulative change value is compared with the cumulative change warning value obtained based on historical data. If the cumulative change value is greater than or equal to the cumulative change warning value, it is determined that there is a comprehensive deviation in the current critical dimension, and further quality analysis is required.

6. The machine vision-based quality inspection method for lamp holder production process according to claim 5, characterized in that, The process for further quality analysis is as follows: Through the formula: ; Calculate the first Comprehensive deviation coefficient of each key dimension ; in, For the first The reference values ​​for the deviations of each key dimension are calculated using the following formula: ; For a historical unit of time, the first Standard deviation of key dimensions; For the first Process capability index for each key dimension The uncertainty factor has a value range of [0.5, 2]. For measurement uncertainty; The first Comprehensive deviation coefficient of each key dimension With warning value The warning value is determined based on historical data analysis through comparison. when If a defect is detected in the current critical dimension, the machine should be stopped immediately for inspection.

7. The machine vision-based quality inspection method for lamp holder production process according to claim 6, characterized in that, The first Process capability index of key dimensions The calculation formula is: ; in, Represents the first historical unit of time. The average of the key dimensions.

8. The machine vision-based quality inspection method for lamp holder production process according to claim 6, characterized in that, The measurement uncertainty The calculation method is as follows: Identify the impact of measurement process on the first The sources of uncertainty in the measurement results of key dimensions include the accuracy of the measuring instrument, environmental factors, measurement methods, and operator factors, which are denoted as follows: , , , The environmental factor mentioned is the effect of temperature change on the first... The impact of key dimensions; Substitute into the formula: The measurement uncertainty was calculated. ; in, , This refers to the maximum permissible error obtained based on the accuracy specifications provided by the manufacturer of the current measuring instrument. For every 1 degree Celsius change in temperature, the current critical dimension changes. The temperature fluctuation range during the measurement process is: ; The standard deviation of the measured values ​​is obtained by repeatedly measuring the current critical dimension of the same lamp holder multiple times. The standard deviation of the measured values ​​is obtained by measuring the current critical dimensions of the same lamp head by multiple measuring personnel.

9. A quality inspection system for lamp holder production process based on machine vision, characterized in that, This system is used to execute the machine vision-based quality inspection method for lamp holder production as described in claim 1, comprising: The image acquisition module is used to acquire multi-angle images of lamp heads on the production line using a trigger-type industrial camera; The image preprocessing module is used to preprocess images, including grayscale correction, ROI region extraction, and noise filtering. The image analysis module employs a hybrid detection strategy to analyze the preprocessed image; the hybrid detection strategy includes: The detection strategy for dimensional defects is to calculate the critical dimension deviation coefficient through the first analysis model, and determine whether there is a dimensional abnormality based on the comparison between the critical dimension deviation coefficient and the preset deviation range. The detection strategy for appearance defects is to identify scratches, stains, and structural anomalies through a second analysis model; The defect classification and data recording module is used to classify defects based on the results of the image analysis module and trigger the sorting device, and record defect data to the production quality database.

Citation Information

Patent Citations

  • Automatic detecting device and detection method for quality of lamp holder based on machine vision

    CN102221557A

  • Method for detecting double-soldering-lug lamp cap baldheaded defect

    CN103471515A

  • Lamp cap surface defect detecting device

    CN106645201A

  • A method for detecting that appearance defect on the top of a lamp holder of a bayonet type automobile bulb

    CN109544547A

  • Automatic detection method for automobile lamp defects

    CN116576948A