A medical rubber stopper defect detection system based on machine vision
By acquiring images before and after transmission light source based on machine vision and using a preset defect detection model, the problem of difficult identification of latent defects in medical rubber stoppers was solved, and high-precision defect detection was achieved.
Patent Information
- Application Number
- CN202611097335.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-23
- Publication Date
- 2026-08-25
AI Technical Summary
Existing technologies for detecting defects in medical rubber stoppers are insufficient to identify hidden flaws, resulting in low accuracy. In particular, for semi-transparent rubber stoppers, the internal hidden defects cannot be accurately identified due to their light transmission and scattering characteristics.
A machine vision-based inspection system is adopted to acquire images of the base surface without light and through-transmission imaging under transmitted light by acquiring dual-sequence images before and after the transmitted light source. Combined with image stability verification and a preset defect detection model, the system can achieve quantitative judgment and qualitative identification of defects.
It improves the accuracy of rubber stopper defect detection, can accurately identify hidden defects, dynamically optimize transportation conditions, improve the imaging environment, and enhance detection precision and efficiency.
Smart Images

Figure CN122631659A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of medical rubber stopper technology, and in particular to a machine vision-based defect detection system for medical rubber stoppers. Background Technology
[0002] Medical rubber stoppers are an indispensable core component in the pharmaceutical packaging field, mainly used for sealing various pharmaceutical products such as injections, infusions, and lyophilized drugs. Defects in these stoppers can easily lead to significant safety hazards such as drug leakage and contamination. Therefore, the pharmaceutical industry places extremely high demands on the quality testing of medical rubber stoppers. Medical rubber stoppers are mostly made of semi-transparent halogenated butyl rubber. This material has good elasticity, sealing properties, and biocompatibility. However, during the manufacturing process, it is prone to developing hidden defects such as internal micropores, microbubbles, and closed microcracks. Because these defects are tiny and obscured by the semi-transparent material, they cannot be directly identified by the naked eye, making them a key focus and challenge in the testing process.
[0003] Currently, defect detection in medical rubber stoppers mainly involves three methods: manual inspection, traditional optical inspection, and conventional machine vision inspection. Manual inspection relies on the experience and visual judgment of the inspectors, resulting in extremely low efficiency, making it difficult to adapt to the high-speed, mass production demands of modern production lines. It is also susceptible to visual fatigue and subjective judgment differences, leading to high rates of missed and false detections. Traditional optical inspection methods often use a single light source to illuminate the stopper, judging defects through simple image comparison. However, due to the strong light transmission and scattering characteristics of semi-transparent stoppers, the optical signal in the defect area is easily obscured by the scattered light from the normal material, making it impossible to accurately identify internal hidden defects, resulting in low detection accuracy. Existing machine vision inspection systems mostly only acquire images of the stopper in a single state for defect analysis, failing to distinguish the imaging differences before and after transmitted light emission. This leads to poor image stability, further affecting defect detection.
[0004] Chinese Patent Publication No. CN120198363B discloses a method, device, and storage medium for detecting defects in capacitor plugs based on visual features, comprising the following steps: performing grayscale image processing on a capacitor plug image to obtain a grayscale image, which is marked as a capacitor plug grayscale image; performing binarization processing on the capacitor plug grayscale image to obtain a binarized image, which is marked as a concave binarized image; extracting the contour from the concave binarized image to obtain a contour, which is marked as a detection contour; obtaining a qualified contour range based on qualified capacitor plugs; determining whether the contour to be detected is a normal contour based on the qualified contour range; if not, identifying the capacitor plug to be detected as a defective capacitor plug.
[0005] Existing technologies have the following problems: relying solely on edge contour extraction and comparison with the qualified contour range to determine defects makes it difficult to identify hidden flaws, resulting in relatively low defect accuracy. Summary of the Invention
[0006] To address this issue, the present invention provides a machine vision-based medical rubber stopper defect detection system, which overcomes the problem in the prior art that relies solely on edge contour extraction and comparison with qualified contour range for defect judgment, making it difficult to identify hidden defects and resulting in low defect accuracy.
[0007] To achieve the above objectives, the present invention provides a machine vision-based defect detection system for medical rubber stoppers, comprising: The rubber stopper transport module is used to transport the rubber stopper to be tested through the target detection area at an initial transport speed; A rubber stopper detection module includes a transmission light source unit for emitting transmitted light onto the surface of the rubber stopper to be tested, and an image detection unit for acquiring a first image sequence and a second image sequence. The wavelength of the transmitted light is a preset wavelength. The first image sequence includes a plurality of first images, which are images of the surface of the rubber stopper to be tested before the transmission light is emitted. The second image sequence includes a plurality of second images, which are images of the surface of the rubber stopper to be tested after the transmission light is emitted. The image analysis module is used to determine whether the image stability state meets the expected standard based on the first image characterization value and the second image characterization value. If it meets the standard, the module determines the scattering characterization value of the rubber stopper under test based on the second image sequence to determine whether the rubber stopper under test has a defect. The first image characterization value is determined based on the first image sequence, and the second image characterization value is determined based on the second image sequence. The adjustment control module is used to correct the initial transport speed based on the first image characterization value and the second image characterization value under a first relative condition, and to input each second image in the second image sequence into a preset defect detection model under a second relative condition to obtain the defect detection result corresponding to each second image output by the preset defect detection model, and to determine the defect type of the rubber stopper to be tested based on the defect detection result corresponding to each second image, wherein the defect detection result includes the defect detection type and the defect confidence level, the first relative condition is that the image stability state does not meet the expected standard, and the second relative condition is that the rubber stopper to be tested has a defect.
[0008] Furthermore, the image analysis module determines a first registered image sequence based on the motion registration result of the first image sequence, and determines a first image representation value based on the local gray-level distribution dispersion of each first registered image in the first registered image sequence.
[0009] Furthermore, the image analysis module determines a second registered image sequence based on the motion registration result of the second image sequence, and determines a second image representation value based on the temporal variation coefficient of pixel grayscale of each second registered image in the second registered image sequence.
[0010] Furthermore, the image analysis module determines the fused transmission region image based on the temporal fusion result of the second registered image sequence, and determines the scattering characterization value of the rubber plug under test based on the comparison result between the fused transmission region image and the standard transmission region image.
[0011] Furthermore, the image analysis module determines whether the rubber stopper under test has defects based on the comparison result between the scattering characterization value of the rubber stopper under test and the preset scattering characterization value.
[0012] Furthermore, the expected standard is that the first image representation value is greater than the first preset threshold and the second image representation value is greater than the second preset threshold.
[0013] Furthermore, the adjustment control module determines a correction coefficient based on the first deviation characterization value and the second deviation characterization value to correct the initial transport speed, wherein, The first deviation characterization value is determined based on the comparison result between the first image characterization value and the first preset threshold; The second deviation characterization value is determined based on the comparison result between the second image characterization value and the second preset threshold.
[0014] Furthermore, the adjustment control module includes: The sample generation unit is used to acquire a series of images of the surface of the defective rubber plugs, which are transported at an initial transport speed and emit transmitted light of a preset wavelength onto the surface of the marked defective rubber plugs, so as to obtain a number of defect detection sample sets, wherein each defect detection sample set has a corresponding defect detection type. The confidence analysis unit is used to perform target detection on each defect detection sample in each defect detection sample set to obtain the corresponding defect area, and to determine the defect confidence of each defect detection sample based on the comparison result of the defect area corresponding to each defect detection sample with the preset area. The model building unit is used to train the initial defect detection model based on each defect detection sample set and the defect confidence of each defect detection sample to obtain the preset defect detection model.
[0015] Furthermore, the adjustment control module performs cluster analysis based on the defect detection type corresponding to each of the second images to obtain several cluster groups, and determines the defect type of the rubber stopper to be tested based on the number of second images in each cluster group and the defect confidence level corresponding to the second images.
[0016] Furthermore, the adjustment control module adjusts the preset scattering characterization value based on the scattering characterization value of the rubber plug under test under the third relative condition, wherein the third relative condition is that the rubber plug under test has no defects.
[0017] Compared with existing technologies, the beneficial effects of this invention are as follows: This invention acquires images of the base surface without light and through-light transmission under a preset wavelength by acquiring dual-sequence image acquisition before and after the light source is turned on and off, respectively, forming comparative image data. First and second image characterization values are calculated to complete pre-verification of image stability, eliminating unstable imaging data. The second image sequence after transmission is used as the core analysis carrier to calculate the rubber stopper scattering characterization value, achieving quantitative judgment of defects and further improving the accuracy of rubber stopper defect detection. For the first relative condition where the image stability is not up to standard, the transport speed is adjusted in real time by combining the first and second image characterization values, compensating for motion effects, dynamically optimizing the rubber stopper transport state, and improving the imaging environment. For the second relative condition where defects are detected, a preset defect detection model is introduced for intelligent analysis. Combining the defect detection type and defect confidence of a single second image, different defect categories are accurately distinguished, achieving qualitative defect identification and further improving defect detection accuracy.
[0018] Furthermore, the image analysis module of this invention performs motion registration on the first and second image sequences respectively to correct image position deviations during the rubber stopper transport process, obtaining a first registered image sequence and a second registered image sequence. The first image characterization value is calculated using the local region grayscale distribution dispersion, which quantifies the degree of grayscale feature fluctuation on the rubber stopper surface under no-transmittance light conditions, accurately reflecting the stable basic state of the original imaging image. The second image characterization value is constructed using the pixel grayscale temporal variation coefficient, statistically analyzing the dynamic change amplitude of pixel grayscale in multiple frames of transmitted light images from a temporal dimension, achieving accurate evaluation of the transmission imaging state. By performing temporal fusion processing on the second registered image sequence, a high signal-to-noise ratio fused transmission region image is generated, enhancing the display effect of the rubber stopper's transmissive region features. Accurate comparison between the fused transmission region image and the standard transmission region image ensures that the scattering characterization value of the rubber stopper under test accurately reflects the transmission scattering difference between the tested rubber stopper and a defect-free rubber stopper under transmitted light, effectively identifying latent defects in the rubber stopper and improving the accuracy of rubber stopper defect detection.
[0019] Furthermore, the present invention adjusts the control module to construct a defect detection sample set with clear defect type labels by collecting image sequences of marked defective rubber stoppers under standard transportation conditions and fixed transmitted light wavelengths. The module performs target detection on each sample and accurately selects defect areas. The defect confidence is quantitatively calculated by comparing the defect area with a preset area, which can realize the quantitative classification of the significance of sample defects. By integrating multiple types of defect sample sets and refined defect confidence to participate in the initial model training, the preset defect detection model finally trained has the ability to accurately classify multiple types of defects, which can adapt to the differentiated identification needs of various defects in rubber stoppers and improve the accuracy of rubber stopper defect detection.
[0020] Furthermore, the present invention adjusts the control module to perform cluster analysis on the defect detection types of each second image output, effectively filtering out scattered erroneous detection results caused by misidentification and improving the overall rationality of defect classification. By combining the number of second images within each cluster group with the corresponding defect confidence level for comprehensive evaluation, the accuracy of rubber stopper defect detection is further improved. Attached Figure Description
[0021] Figure 1 This is a structural block diagram of a machine vision-based medical rubber stopper defect detection system according to an embodiment of the present invention; Figure 2 This is a logic judgment diagram for determining whether the image stabilization state meets the expected standard in an embodiment of the present invention; Figure 3 This is a logic diagram for determining whether the rubber stopper under test has a defect in an embodiment of the present invention; Figure 4 The structural block diagram of the control module has been adjusted for the embodiments of the present invention. Detailed Implementation
[0022] To make the objectives and advantages of the present invention clearer, the present invention will be further described below with reference to embodiments; it should be understood that the specific embodiments described herein are merely for explaining the present invention and are not intended to limit the present invention.
[0023] Preferred embodiments of the present invention will now be described with reference to the accompanying drawings. Those skilled in the art should understand that these embodiments are merely illustrative of the technical principles of the present invention and are not intended to limit the scope of protection of the present invention.
[0024] Please see Figure 1 The diagram shown is a structural block diagram of a machine vision-based medical rubber stopper defect detection system according to an embodiment of the present invention. The present invention provides a machine vision-based medical rubber stopper defect detection system, comprising: The rubber stopper transport module is used to transport the rubber stopper to be tested through the target detection area at an initial transport speed; In implementation, a conveyor belt can be used to transport the rubber stoppers to be tested. The surface of the conveyor belt is made of high-transmittance glass or acrylic material to ensure that transmitted light can penetrate. In practical applications, positioning grooves can be set, with each groove accommodating one rubber stopper to be tested, preventing the rubber stopper from tipping over or rolling during transportation. The conveyor belt transports the rubber stopper to be tested through the target detection area at a uniform initial transport speed. To ensure the defect (minimum size d) is detected... min () can be clearly imaged during the exposure time t of the image acquisition device. exp The moving distance of the inner rubber stopper to be tested should be less than d. min Half of the (Nyquist sampling criterion) can be determined based on the rubber stopper defects detected in historical data. min Satisfying v0×texp ≤d min / 2, thus determining the initial transport speed.
[0025] A rubber stopper detection module includes a transmission light source unit for emitting transmitted light onto the surface of the rubber stopper to be tested, and an image detection unit for acquiring a first image sequence and a second image sequence. The wavelength of the transmitted light is a preset wavelength. The first image sequence includes a plurality of first images, which are images of the surface of the rubber stopper to be tested before the transmission light is emitted. The second image sequence includes a plurality of second images, which are images of the surface of the rubber stopper to be tested after the transmission light is emitted. In this embodiment, the target detection area is divided into two non-overlapping regions: a first detection sub-region and a second detection sub-region. The rubber stopper to be tested passes through the first and second detection sub-regions sequentially. Transmittent light detection is performed in the first detection sub-region to obtain a first image sequence, and transmitted light detection is performed in the second detection sub-region to obtain a second image sequence. A transmitted light source unit is located in the second detection sub-region. A partition is placed between the first and second detection sub-regions to prevent the transmitted light emitted by the transmitted light source unit from affecting the environmental conditions of the first detection sub-region. The transmitted light source unit can be a high-power LED array, outputting collimated parallel light, with its emitting surface covering the second detection sub-region. A preset wavelength can be set according to the material of the rubber stopper to obtain optimal penetration and scattering contrast. The image detection unit acquires images of the rubber stopper surface frame by frame after the rubber stopper enters the target detection area. The specific structure of the image detection unit is not limited; for example, it can be a high-frame-rate industrial camera, which is existing technology and will not be described further.
[0026] An image analysis module, connected to a rubber stopper detection module, is used to determine whether the image stability state meets the expected standard based on a first image characterization value and a second image characterization value. If it does, the module determines the scattering characterization value of the rubber stopper under test based on the second image sequence to determine whether the rubber stopper under test has a defect. The first image characterization value is determined based on the first image sequence, and the second image characterization value is determined based on the second image sequence. Specifically, the image analysis module determines a first registered image sequence based on the motion registration result of the first image sequence, and determines a first image representation value based on the local gray-level distribution dispersion of each first registered image in the first registered image sequence.
[0027] In this embodiment, the process of motion registration of the first image sequence includes: using the contour, edge corners, and inherent surface texture of the rubber plug to be tested as stable feature targets, and employing feature point matching and homography matrix transformation, performing inter-frame motion registration frame by frame, calculating the lateral offset, vertical offset, and minute rotation angle between adjacent frames, performing pixel coordinate translation and rotation transformation correction on each frame of the first image, unifying the target area coordinate system and framing reference of all frames, eliminating inter-frame misalignment caused by rubber plug transport jitter, travel offset, and slight changes in posture, and outputting an aligned and unified first registered image sequence. This is existing technology and will not be described in detail here.
[0028] Understandably, for each first registration image, a Region of Interest (ROI) for effective detection of the rubber stopper is pre-defined. For example, the ROI is determined by extracting the surface contour of the rubber stopper and then uniformly dividing it into M non-overlapping local regions to ensure that the local regions completely cover the surface of the rubber stopper and avoid interference from background pixels. For any local region, the local gray-level distribution dispersion is calculated, and the gray-level values of each pixel in the local region are obtained. The local gray-level distribution dispersion can characterize the degree of spatial fluctuation of the gray-level values of each pixel in the local region. Preferably, the standard deviation of the gray-level values of each pixel in the local region is determined as the local gray-level distribution dispersion. The larger the local gray-level distribution dispersion, the more chaotic the local light and dark texture distribution and the worse the imaging stability. The local gray-level distribution dispersions of each local region in the first registration image are sorted, and the largest local gray-level distribution dispersion is determined as the distribution dispersion characterization value corresponding to the first registration image. For the first registered image sequence, the mean of the distributed discrete representation values corresponding to each first registered image is determined as the first image representation value.
[0029] Specifically, the image analysis module determines the second registered image sequence based on the motion registration result of the second image sequence, and determines the second image representation value based on the pixel grayscale temporal variation coefficient of each second registered image in the second registered image sequence.
[0030] In this embodiment, the process of motion registration of the second image sequence includes: for the second image sequence acquired after the transmission light is turned on, the registration algorithm, feature extraction rules and correction methods that are completely consistent with the first image sequence can be used to complete the precise inter-frame alignment based on the transmission imaging contour features of the rubber plug under test, correct motion offset and image jitter, and obtain the second registered image sequence with both temporal and positional alignment, ensuring that the same pixel position corresponds to the same physical area of the rubber plug in multiple consecutive frames. This is the prior art and will not be described in detail.
[0031] Understandably, in the second registration image sequence, pixels at the same coordinate position within the Region of Interest (ROI) of the tested rubber stopper are locked, and the grayscale value of that pixel is obtained. The grayscale temporal dataset of that pixel in the second registration image sequence is extracted. This dataset includes the grayscale value of that pixel in each of the second registration images in the sequence. The temporal variation coefficient of the pixel's grayscale value can then characterize the temporal fluctuation of that pixel's grayscale value. Preferably, the standard deviation of that pixel is determined as its temporal variation coefficient. A larger temporal variation coefficient indicates greater temporal fluctuation and poorer imaging stability. The mean of the temporal variation coefficients of the pixel's grayscale value for each pixel within the ROI is determined as the second image representation value.
[0032] Please see Figure 2 As shown, it is a logic judgment diagram for determining whether the image stability state meets the expected standard in an embodiment of the present invention; specifically, the expected standard is that the first image representation value is greater than the first preset threshold and the second image representation value is greater than the second preset threshold.
[0033] In this embodiment, the implementer can set a first preset threshold based on the maximum value of the first image representation calculated from a limited number of image acquisitions of rubber stoppers that passed the qualification inspection in historical data under a stable state. Similarly, the implementer can set a second preset threshold based on the maximum value of the second image representation calculated from a limited number of image acquisitions of rubber stoppers that passed the qualification inspection in historical data under a stable state after being irradiated with transmitted light of a preset wavelength. It should be noted that the rubber stoppers that passed the qualification inspection are defect-free, standard qualified rubber stoppers. The stable state is defined as the rubber stopper being stationary, with consistent acquisition parameters and environmental parameters for each image acquisition. Since the image stability of a stationary rubber stopper is generally better than that of a moving rubber stopper, the first and second preset thresholds in this embodiment are set by reserving a tolerance range for fluctuations in operating conditions.
[0034] Please see Figure 3 As shown, it is a logic judgment diagram for determining whether the rubber stopper under test has defects according to an embodiment of the present invention; specifically, the image analysis module determines the fused transmission region image based on the temporal fusion result of the second registered image sequence, and determines the scattering characterization value of the rubber stopper under test based on the comparison result between the fused transmission region image and the standard transmission region image.
[0035] In this embodiment, the second registered image sequence after motion registration and frame-by-frame pixel position alignment is retrieved. All images in this sequence have the same coordinate reference, the rubber plug area positions overlap, and the transmitted light wavelength, exposure, focal length, and shooting distance parameters are consistent, eliminating motion offset and shooting parameter interference, and providing homogeneous image data for temporal fusion. The grayscale values of multiple frames at the same coordinate position in the sequence are fused by temporal weighted averaging. Through multi-frame temporal averaging, single-frame random noise, instantaneous light and shadow disturbances, and slight light source fluctuations are suppressed, and the stable scattering characteristics formed by transmitted light penetrating the rubber plug are enhanced, generating a fused transmission area image. Under the same transmitted light wavelength, the same transport conditions, and the same optical parameters, a standard transmission area image is collected and fused using a defect-free standard qualified rubber stopper. This image serves as a reference image, representing the reference optical characteristics of uniform light transmission and regular scattering of a good rubber stopper. The fused transmission area image and the standard transmission area image are registered and aligned pixel-by-pixel, and the grayscale difference deviation is calculated pixel by pixel. For example, for any valid pixel, its corresponding grayscale difference deviation is determined based on the grayscale value of the valid pixel in the fused transmission area image and the grayscale value of the valid pixel in the standard transmission area image. Preferably, the absolute value of the difference between the grayscale value of the valid pixel in the fused transmission area image and the grayscale value of the valid pixel in the standard transmission area image is used to determine the standard grayscale difference. The ratio of the standard grayscale difference to the grayscale value of the valid pixel in the standard transmission area image is used to determine the grayscale difference deviation of the valid pixel. The average grayscale difference deviation of each valid pixel is then determined as the scattering characterization value of the rubber stopper under test. The larger the scattering characterization value of the rubber plug under test, the greater the difference in pixel distribution characteristics between the fused transmission area image and the standard transmission area image, and the more significant the scattering characteristics, which means that the rubber plug under test is more likely to have defects.
[0036] Specifically, the image analysis module determines whether the rubber stopper under test has defects based on the comparison result between the scattering characterization value of the rubber stopper under test and the preset scattering characterization value.
[0037] In this embodiment, if the scattering characterization value of the rubber stopper under test is less than the preset scattering characterization value, it is determined that the rubber stopper under test has no defects; if the scattering characterization value of the rubber stopper under test is greater than or equal to the preset scattering characterization value, it is determined that the rubber stopper under test has defects. In practice, the preset scattering characterization value can be set based on the average scattering characterization value of the rubber stopper under test corresponding to the fused transmission area image and the standard transmission area image of rubber stoppers that passed the conformity inspection in historical data.
[0038] Specifically, the image analysis module of this invention performs motion registration on the first and second image sequences respectively to correct image position deviations during the conveying of the rubber stopper, obtaining a first registered image sequence and a second registered image sequence. The first image characterization value is calculated using the local region grayscale distribution dispersion, which quantifies the degree of grayscale feature fluctuation on the rubber stopper surface under no-transmittance light conditions, accurately reflecting the stable basic state of the original imaging image. The second image characterization value is constructed using the pixel grayscale temporal variation coefficient, statistically analyzing the dynamic change amplitude of pixel grayscale in multiple frames of transmitted light images from a temporal dimension, achieving accurate assessment of the transmission imaging state. By performing temporal fusion processing on the second registered image sequence, a high signal-to-noise ratio fused transmission region image is generated, enhancing the display effect of the rubber stopper's transmissive region features. The fused transmission region image is accurately compared with a standard transmission region image, enabling the scattering characterization value of the rubber stopper under test to accurately reflect the transmission scattering difference between the tested rubber stopper and a defect-free rubber stopper under transmitted light, effectively identifying latent defects in the rubber stopper and improving the accuracy of rubber stopper defect detection.
[0039] An adjustment control module, which is connected to the rubber stopper transport module, the rubber stopper detection module, and the image analysis module, is used to correct the initial transport speed based on the first image characterization value and the second image characterization value under a first relative condition, and to input each second image in the second image sequence into a preset defect detection model under a second relative condition to obtain the defect detection result corresponding to each second image output by the preset defect detection model, and to determine the defect type of the rubber stopper to be tested based on the defect detection result corresponding to each second image, wherein the defect detection result includes the defect detection type and the defect confidence level, the first relative condition is that the image stability state does not meet the expected standard, and the second relative condition is that the rubber stopper to be tested has a defect.
[0040] Please see Figure 4 The diagram shown is a structural block diagram of the adjustment control module according to an embodiment of the present invention. Specifically, the adjustment control module includes a speed correction submodule, a model construction submodule, a defect detection submodule, and a threshold correction submodule. A speed correction submodule is used to correct the initial transport speed based on the first image representation value and the second image representation value under a first relative condition; Specifically, the speed correction submodule determines a correction coefficient based on a first deviation characterization value and a second deviation characterization value to correct the initial transport speed. The first deviation characterization value is determined based on a comparison between the first image characterization value and a first preset threshold. The second deviation characterization value is determined based on a comparison between the second image characterization value and a second preset threshold.
[0041] In this embodiment, the difference between the first image representation value and the first preset threshold is determined as the first difference, and the ratio of the first difference to the first preset threshold is determined as the first deviation representation value. The difference between the second image representation value and the second preset threshold is determined as the second difference, and the ratio of the second difference to the second preset threshold is determined as the second deviation representation value. The correction coefficient is the average of the first deviation representation value and the second deviation representation value, to comprehensively reflect the degree of influence of the two deviations on speed correction. The product of the correction coefficient and the initial transport speed is determined as the speed adjustment amount to reduce the initial transport speed. In practical applications, a lower limit protection speed can be set to avoid the speed being too low and affecting the production line cycle time. The adjusted transport speed is then max(V0-XP×V0,V min ), where V0 is the initial transport speed, V min The lower limit protection speed is set, max() is the preset maximum value determination function, and XP is the correction coefficient.
[0042] Specifically, the adjustment control module of this invention calculates the first deviation characterization value and the second deviation characterization value by matching the first image characterization value and the second image characterization value with the first preset threshold and the second preset threshold, respectively. It can separately quantify the degree of stability deviation in two scenarios: lightless imaging and transmitted light imaging. The speed correction coefficient is calculated by combining the two-dimensional deviation characterization values. It comprehensively considers the stability of static surface imaging of rubber stoppers and the temporal stability of transmission dynamic imaging, improves the rationality of transportation speed correction, realizes adaptive and closed-loop adjustment of transportation speed, and ensures the stability and detection accuracy of continuous operation of the overall detection.
[0043] Specifically, the model building submodule includes: The sample generation unit is used to acquire a series of images of the surface of the defective rubber plugs, which are transported at an initial transport speed and emit transmitted light of a preset wavelength onto the surface of the marked defective rubber plugs, so as to obtain a number of defect detection sample sets, wherein each defect detection sample set has a corresponding defect detection type. In implementation, the personnel pre-screened and categorized historical data to obtain various types of labeled defective rubber plugs. These were classified into different defect detection types, such as cracks, micropores, impurities, uneven wall thickness, and surface defects, ensuring accurate sample category labeling. The equipment operating conditions were standardized, maintaining a constant initial transport speed for the rubber plug transport module, ensuring consistent plug posture and transport spacing. The transmission light source unit was locked to a preset wavelength, and exposure intensity, shooting focal length, acquisition frame rate, and shooting distance were uniformly fixed. The labeled defective rubber plugs were sequentially fed into the target detection area. During the uniform speed passage of the plugs, transmitted light of the preset wavelength was continuously emitted, simultaneously triggering continuous image acquisition by the image detection unit. This yielded a sequence of surface images of each type of defective rubber plug, along with a corresponding number of defect-free, standard-compliant rubber plugs as negative samples. The acquired image sequences were categorized and archived according to defect detection type, with all image sequences of the same defect detection type grouped together. This formed multiple independent defect detection sample sets with unique category labels, completing the construction of original defect samples with category labels. This provided real defect data under the same operating conditions and standard light field for model training.
[0044] The confidence analysis unit is used to perform target detection on each defect detection sample in each defect detection sample set to obtain the corresponding defect area, and to determine the defect confidence of each defect detection sample based on the comparison result of the defect area corresponding to each defect detection sample with the preset area. In this embodiment, single defect detection sample images from each defect detection sample set are retrieved sequentially. A target detection algorithm or annotation tool (e.g., LabelImg, CVAT, etc.) is used to perform global feature retrieval on the images, identify and extract defect features within the images, and annotate them. Pixel-level defect contours and coordinate ranges are output, and the defect region corresponding to each defect detection sample is determined. A preset area is pre-labeled and stored; this preset area is the minimum critical area that can be effectively determined as a real defect under the corresponding defect type. Invalid small regions formed by minor noise, texture interference, and light and shadow noise are removed. The defect region area is compared with the preset area, and the ratio of the defect region area to the preset area is determined as the defect confidence of the defect detection sample. If a defect detection sample has multiple defect regions, the defect confidence corresponding to each defect region is calculated separately, and the maximum defect confidence is determined as the defect confidence corresponding to the defect detection sample.
[0045] The model building unit is used to train the initial defect detection model based on each defect detection sample set and the defect confidence of each defect detection sample to obtain the preset defect detection model.
[0046] In implementation, a lightweight multi-task convolutional neural network is used to construct the initial defect detection model. For example, EfficientNet-Lite0 and MobileNetV3-Small are used as the backbone network for feature extraction. Defect detection samples are input, and feature maps are output. Global average pooling (GAP) is performed on the backbone network output to obtain feature vectors, followed by a Dropout layer with a dropout rate of 0.2 to prevent overfitting. The multi-task head includes a classification branch and a confidence regression branch. Cross-entropy is used for classification loss, and mean squared error is used for regression loss. The learning rate, number of iterations, and feature extraction rules are unified. A defect detection sample set labeled with defect detection type and the defect confidence scores of the defect detection samples are input into the initial defect detection model. The defect detection type is used as the classification supervision label, and the defect confidence score is used as the sample weight constraint factor. During the backpropagation training of the model, the feature learning weights are increased for high-confidence samples, enabling the model to prioritize learning typical, clear, and highly identifiable defect features; the weights are reduced for low-confidence, weak defect samples, to weaken noise interference and ineffective fitting of ambiguous features, suppress model overfitting, and continuously iterate training to complete the initial model iteration optimization, ultimately generating the preset defect detection model.
[0047] Specifically, in this embodiment of the invention, the adjustment control module collects image sequences of marked defective rubber stoppers under standard transportation conditions and fixed transmitted light wavelengths to construct a defect detection sample set with clear defect type labels. It then performs target detection on each sample and accurately selects defect areas. By comparing the defect area with a preset area, the defect confidence level is quantitatively calculated, enabling quantitative grading of the sample defect significance. By integrating multiple types of defect sample sets with refined defect confidence levels to participate in the initial model training, the final trained preset defect detection model possesses the ability to accurately classify multiple types of defects, adapting to the differentiated identification needs of various rubber stopper defects and improving the accuracy of rubber stopper defect detection.
[0048] A defect detection submodule, connected to the model building submodule, is used to input each second image in the second image sequence into a preset defect detection model under a second relative condition, so as to obtain the defect detection result corresponding to each second image output by the preset defect detection model, and determine the defect type of the rubber stopper under test based on the defect detection result corresponding to each second image. The defect detection result includes the defect detection type and the defect confidence level. The first relative condition is that the image stability does not meet the expected standard, and the second relative condition is that the rubber stopper under test has a defect. Specifically, the defect detection submodule performs cluster analysis based on the defect detection type corresponding to each of the second images to obtain several cluster groups, and determines the defect type of the rubber stopper to be tested based on the number of second images in each cluster group and the defect confidence level corresponding to the second image.
[0049] In this embodiment, each cluster group includes several second images. The defect detection types corresponding to the second images within the same cluster group are the same. For any cluster group, if the number of second images in the cluster group is greater than half the total number of second images, and the defect confidence level corresponding to each second image in the cluster group is greater than a preset confidence level, then the defect detection type corresponding to that cluster group is determined as the defect type of the rubber stopper to be tested. In actual implementation, the preset confidence level is set based on the average ratio of the area of the rubber stopper defect region to the corresponding preset area in historical data for the defect detection type corresponding to that cluster group.
[0050] Specifically, the present invention adjusts the control module by performing cluster analysis on the defect detection types of each second image output, effectively filtering out scattered erroneous detection results caused by misidentification and improving the overall rationality of defect classification. By combining the number of second images within each cluster group with the corresponding defect confidence level for comprehensive evaluation, the accuracy of rubber stopper defect detection is further improved.
[0051] Specifically, the threshold correction submodule is used to adjust the preset scattering characterization value based on the scattering characterization value of the rubber plug under test under a third relative condition, wherein the third relative condition is that the rubber plug under test has no defects.
[0052] In this embodiment, the scattering characterization value of the rubber stopper to be tested is added to the historical data, and the scattering characterization value of the rubber stopper to be tested corresponding to the earliest passable inspection in the historical data is removed, so as to re-determine the preset scattering characterization value based on the average of the fused transmission area image and the standard transmission area image of the rubber stopper that passed the inspection in the historical data.
[0053] This invention employs dual-sequence image acquisition before and after the light source is switched on and off. It acquires images of the base surface without light and transmitted light of a preset wavelength, forming comparative image data. First and second image characterization values are calculated to perform pre-verification of image stability, eliminating unstable imaging data. The second image sequence after transmitted light is used as the core analysis carrier to calculate the rubber stopper scattering characterization value, achieving quantitative defect determination and further improving the accuracy of rubber stopper defect detection. For the first relative condition where image stability is not met, the transport speed is adjusted in real time by combining the first and second image characterization values to compensate for motion effects, dynamically optimize the rubber stopper transport state, and improve the imaging environment. For the second relative condition where defects are detected, a preset defect detection model is introduced for intelligent analysis. Combining the defect detection type and defect confidence level of a single second image, different defect categories are accurately distinguished, achieving qualitative defect identification and further improving defect detection accuracy.
[0054] The technical solution of the present invention has been described above with reference to the preferred embodiments shown in the accompanying drawings. However, it will be readily understood by those skilled in the art that the scope of protection of the present invention is obviously not limited to these specific embodiments. Without departing from the principles of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will all fall within the scope of protection of the present invention.
Claims
1. A machine vision-based defect detection system for medical rubber stoppers, characterized in that, include: The rubber stopper transport module is used to transport the rubber stopper to be tested through the target detection area at an initial transport speed; A rubber stopper detection module includes a transmission light source unit for emitting transmitted light onto the surface of the rubber stopper to be tested, and an image detection unit for acquiring a first image sequence and a second image sequence. The wavelength of the transmitted light is a preset wavelength. The first image sequence includes a plurality of first images, which are images of the surface of the rubber stopper to be tested before the transmission light is emitted. The second image sequence includes a plurality of second images, which are images of the surface of the rubber stopper to be tested after the transmission light is emitted. The image analysis module is used to determine whether the image stability state meets the expected standard based on the first image characterization value and the second image characterization value. If it meets the standard, the module determines the scattering characterization value of the rubber stopper under test based on the second image sequence to determine whether the rubber stopper under test has a defect. The first image characterization value is determined based on the first image sequence, and the second image characterization value is determined based on the second image sequence. The adjustment control module is used to correct the initial transport speed based on the first image characterization value and the second image characterization value under a first relative condition, and to input each second image in the second image sequence into a preset defect detection model under a second relative condition to obtain the defect detection result corresponding to each second image output by the preset defect detection model, and to determine the defect type of the rubber stopper to be tested based on the defect detection result corresponding to each second image, wherein the defect detection result includes the defect detection type and the defect confidence level, the first relative condition is that the image stability state does not meet the expected standard, and the second relative condition is that the rubber stopper to be tested has a defect.
2. The machine vision-based medical rubber stopper defect detection system according to claim 1, characterized in that, The image analysis module determines the first registered image sequence based on the motion registration result of the first image sequence, and determines the first image characterization value based on the local gray-level distribution dispersion of each first registered image in the first registered image sequence.
3. The machine vision-based medical rubber stopper defect detection system according to claim 2, characterized in that, The image analysis module determines the second registered image sequence based on the motion registration result of the second image sequence, and determines the second image characterization value based on the pixel grayscale temporal variation coefficient of each second registered image in the second registered image sequence.
4. The machine vision-based medical rubber stopper defect detection system according to claim 3, characterized in that, The image analysis module determines the fused transmission region image based on the temporal fusion result of the second registered image sequence, and determines the scattering characterization value of the rubber plug under test based on the comparison result between the fused transmission region image and the standard transmission region image.
5. The machine vision-based medical rubber stopper defect detection system according to claim 4, characterized in that, The image analysis module determines whether the rubber stopper under test has defects based on the comparison between the scattering characterization value of the rubber stopper under test and the preset scattering characterization value.
6. The machine vision-based medical rubber stopper defect detection system according to claim 5, characterized in that, The expected standard is that the first image representation value is greater than the first preset threshold and the second image representation value is greater than the second preset threshold.
7. The machine vision-based medical rubber stopper defect detection system according to claim 6, characterized in that, The adjustment control module determines a correction coefficient based on a first deviation characterization value and a second deviation characterization value to correct the initial transport speed, wherein... The first deviation characterization value is determined based on the comparison result between the first image characterization value and the first preset threshold; The second deviation characterization value is determined based on the comparison result between the second image characterization value and the second preset threshold.
8. The machine vision-based medical rubber stopper defect detection system according to claim 1 or 7, characterized in that, The adjustment control module includes: The sample generation unit is used to acquire a series of images of the surface of the defective rubber plugs, which are transported at an initial transport speed and emit transmitted light of a preset wavelength onto the surface of the marked defective rubber plugs, so as to obtain a number of defect detection sample sets, wherein each defect detection sample set has a corresponding defect detection type. The confidence analysis unit is used to perform target detection on each defect detection sample in each defect detection sample set to obtain the corresponding defect area, and to determine the defect confidence of each defect detection sample based on the comparison result of the defect area corresponding to each defect detection sample with the preset area. The model building unit is used to train the initial defect detection model based on each defect detection sample set and the defect confidence of each defect detection sample to obtain the preset defect detection model.
9. The machine vision-based medical rubber stopper defect detection system according to claim 8, characterized in that, The adjustment control module performs cluster analysis based on the defect detection type corresponding to each of the second images to obtain several cluster groups, and determines the defect type of the rubber stopper to be tested based on the number of second images in each cluster group and the defect confidence level corresponding to the second images.
10. The machine vision-based medical rubber stopper defect detection system according to claim 9, characterized in that, The adjustment control module adjusts the preset scattering characterization value based on the scattering characterization value of the rubber plug under test under the third relative condition, wherein the third relative condition is that the rubber plug under test has no defects.
Citation Information
Patent Citations
Capacitor rubber plug defect detection method, device and storage medium based on visual features
CN120198363B