A visual detection-based defect detection method and system for an automobile interior injection molding part

By optimizing light source conditions and combining visual inspection algorithms and deep learning models, the problem of insufficient accuracy in defect identification of automotive interior injection molded parts has been solved, achieving efficient and automated defect detection.

CN120747000BActive Publication Date: 2026-03-24SUZHOU BOYA TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-26
Publication Date
2026-03-24

AI Technical Summary

Technical Problem

Existing visual inspection methods are not accurate enough in identifying defects in automotive interior injection molded parts, making it difficult to meet the requirements of high-quality inspection, especially due to problems such as unstable image quality and difficulty in feature extraction.

Method used

By adjusting preset light source conditions such as light source type, position, angle, intensity, and wavelength, combined with preset defect feature extraction and matching algorithms, the image acquisition quality is optimized. Furthermore, by utilizing transparency analysis algorithms and deep learning models, surface and internal defects of transparent, semi-transparent, and opaque injection molded parts are accurately identified.

Benefits of technology

It improves the accuracy and efficiency of defect detection, reduces missed and false detections, realizes automated inspection of automotive interior injection molded parts, and reduces the workload and subjective error of manual inspection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120747000B_ABST
    Figure CN120747000B_ABST
Patent Text Reader

Abstract

The application is suitable for the field of visual detection technology, and provides a vehicle interior trim injection molding part defect detection method and system based on visual detection. The method comprises the following steps: collecting an original image set under a preset light source condition, extracting defect features from the original image set by using a preset defect feature extraction algorithm to obtain a defect feature set, performing similarity matching on the defect feature set and a preset defect template by using a preset defect matching algorithm to obtain a target similarity, determining a defect type of the preset defect template as a defect type of the defect feature set when the target similarity meets a preset similarity threshold, performing defect feature extraction processing on internal defect features of a transparent and / or translucent injection molding part by using a transparency analysis algorithm to obtain an optimized defect feature label set, and training a defect detection model to be trained based on the original image set and the optimized defect feature label set to obtain a target defect detection model, so that accurate identification of injection molding part defects can be realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of visual inspection technology, and in particular to a method and system for detecting defects in automotive interior injection molded parts based on visual inspection. Background Technology

[0002] Machine Vision Inspection is a technology that uses optical devices (such as cameras and light sources) and image processing algorithms to automatically collect, analyze, and determine surface or internal defects of target objects. Its core principle is to simulate human visual function and combine it with the efficient computing power of computers to achieve automated, high-precision inspection of product quality.

[0003] In the defect inspection of automotive interior injection molded parts, existing visual inspection methods are limited in their accuracy of defect identification, often facing problems such as unstable image quality and difficulties in feature extraction. This results in insufficient accuracy and robustness in defect identification, making it difficult to meet the high-quality inspection requirements of automotive interior injection molded parts in actual production. Therefore, how to efficiently and accurately identify defects in automotive interior injection molded parts has become an urgent technical problem to be solved. Summary of the Invention

[0004] This application provides a vision-based method and system for detecting defects in automotive interior injection molded parts, which can solve the technical problem of how to efficiently and accurately identify defects in automotive interior injection molded parts.

[0005] In a first aspect, embodiments of this application provide a method for detecting defects in automotive interior injection-molded parts based on visual inspection, including:

[0006] Under preset light source conditions, acquire a set of original images of the surface and interior of the injection molded part. The injection molded part type includes at least one of transparent, semi-transparent and opaque types. The preset light source conditions include at least one of light source type, light source position, light source angle, light source intensity and light source wavelength.

[0007] The original image set is processed by a preset defect feature extraction algorithm to obtain a defect feature set, which includes surface defect features and internal defect features.

[0008] A preset defect matching algorithm is used to perform similarity matching between the defect feature set and the preset defect template to obtain the target similarity.

[0009] When the target similarity meets the preset similarity threshold, the defect type corresponding to the preset defect template is determined as the defect type corresponding to the defect feature set, and a defect feature tag set is obtained.

[0010] Based on the defect feature label set, the internal defect features of transparent and / or semi-transparent injection molded parts in the original image set are extracted using a transparency analysis algorithm to obtain an optimized defect feature label set;

[0011] The target defect detection model is obtained by training the original image set and the optimized defect feature label set.

[0012] Input the image of the injection molded part to be inspected into the target defect detection model, and output the defect detection result corresponding to the image of the injection molded part to be inspected.

[0013] In one embodiment, acquiring a set of original images of the surface and interior of the injection molded part under preset light source conditions includes:

[0014] Determine whether the image brightness of the images in the original image set meets the preset brightness threshold;

[0015] If the image brightness does not meet the preset brightness threshold, the light source conditions are adjusted using a preset light source intensity adjustment algorithm based on the material reflection parameters of the injection molded part to obtain the first adjusted light source conditions. The first adjusted light source conditions are used to make the image brightness of the acquired image meet the preset brightness threshold.

[0016] Images of the surface and interior of the injection molded part were acquired again under the first adjusted light source conditions to obtain the original image set.

[0017] In one embodiment, acquiring a set of original images of the surface and interior of the injection molded part under preset light source conditions further includes:

[0018] Determine whether the image resolution of the images in the original image set meets the preset resolution threshold;

[0019] If the image resolution does not meet the preset resolution threshold, the image resolution is enhanced using a bilinear interpolation algorithm to obtain an enhanced image set.

[0020] Based on the enhanced image set, the target light source wavelength combination for transparent or semi-transparent injection molded parts is determined using a light source wavelength selection algorithm;

[0021] The light source conditions are adjusted according to the target light source wavelength combination to obtain the second adjusted light source conditions. The second adjusted light source conditions are used to make the gray range of the acquired image meet the preset gray range.

[0022] Under the second adjusted light source condition, images of the surface and interior of the injection molded part were acquired again to obtain the original image set.

[0023] In one embodiment, a defect feature set is obtained by performing defect feature extraction processing on the original image set using a preset defect feature extraction algorithm, including:

[0024] Obtain the grayscale range and noise distribution of the original image set;

[0025] Based on the noise distribution, the original image set is filtered using an adaptive mean filtering algorithm to obtain a denoised image set;

[0026] An adaptive contrast stretching algorithm is used to adjust the grayscale range of the denoised image set to enhance image contrast, resulting in a contrast-enhanced image set.

[0027] A defect feature set is obtained by using a preset defect feature extraction algorithm to extract defect features from the contrast-enhanced image set.

[0028] In one embodiment, a pre-defined defect feature extraction algorithm is used to extract defect features from a set of contrast-enhanced images to obtain a defect feature set, including:

[0029] Extract image gradient information corresponding to the contrast-enhanced image set, and use the Canny edge detection algorithm to generate defect boundary contour data based on the image gradient information;

[0030] Based on the defect boundary contour data, the gray-level co-occurrence matrix algorithm is used to extract the defect texture features and generate a defect feature set.

[0031] In one embodiment, a preset defect matching algorithm is used to perform similarity matching between a defect feature set and a preset defect template to obtain target similarity, including:

[0032] The minimum distance between the defect boundary contour data and the contour points corresponding to the preset defect template is calculated using the Hausdorff distance algorithm.

[0033] Target similarity is calculated based on the minimum distance between contour points.

[0034] In one embodiment, when the target similarity meets a preset similarity threshold, the defect type corresponding to the preset defect template is determined as the defect type corresponding to the defect feature set, resulting in a defect feature tag set, including:

[0035] When the target similarity meets the preset similarity threshold, the region corresponding to the defect boundary contour data is marked as the initial defect region.

[0036] The boundaries of the initial defect region are refined using a region segmentation algorithm to obtain a refined defect region.

[0037] Determine whether the similarity between the refined defect area and the preset defect template meets the preset similarity threshold;

[0038] When the similarity between the refined defect region and the preset defect template meets the preset similarity threshold, the defect type corresponding to the preset defect template is determined as the defect type corresponding to the refined defect region.

[0039] An image merging algorithm is used to fuse the defect type corresponding to the refined defect region with the original image set to generate a defect feature label set.

[0040] In one embodiment, determining whether the similarity between the refined defect region and the preset defect template meets a preset similarity threshold includes:

[0041] The gray-level co-occurrence matrix algorithm is used to extract the defect texture features corresponding to the refined defect region, and the Canny edge detection algorithm is used to extract the defect boundary contour data corresponding to the refined defect region.

[0042] The weighted features corresponding to the defect texture features and defect boundary contour data are calculated using a weighted fusion algorithm to obtain the target defect features;

[0043] If the Euclidean distance between the target defect feature and the preset defect template is less than the preset distance threshold, then calculate whether the cosine similarity between the target defect feature and the preset defect template meets the preset similarity threshold.

[0044] In one embodiment, based on the defect feature label set, a transparency analysis algorithm is used to extract internal defect features from transparent and / or semi-transparent injection molded parts in the original image set, resulting in an optimized defect feature label set, including:

[0045] The transmission path and / or intensity distribution of light in transparent and / or semi-transparent injection molded parts are calculated using a transparency analysis algorithm.

[0046] When the transmission path and / or light intensity distribution do not meet the preset range, the internal defect features of transparent and / or semi-transparent injection molded parts in the original image set are extracted to obtain an optimized defect feature label set.

[0047] Secondly, embodiments of this application provide a vision-based inspection system for detecting defects in automotive interior injection molded parts. This system has the functionality to implement the method in the first aspect or any possible implementation thereof. Specifically, the system includes units for implementing the method in the first aspect or any possible implementation thereof.

[0048] In one embodiment, the system includes:

[0049] The acquisition unit is used to acquire a set of original images of the surface and interior of the injection molded part under preset light source conditions. The injection molded part type includes at least one of transparent, semi-transparent and opaque types. The light source conditions include at least one of light source type, light source position, light source angle, light source intensity and light source wavelength.

[0050] The extraction unit is used to extract defect features from the original image set using a preset defect feature extraction algorithm to obtain a defect feature set, which includes surface defect features and internal defect features.

[0051] The matching unit is used to perform similarity matching between the defect feature set and the preset defect template using a preset defect matching algorithm to obtain the target similarity.

[0052] The processing unit is used to determine the defect type corresponding to the preset defect template as the defect type corresponding to the defect feature set when the target similarity meets the preset similarity threshold, and obtain the defect feature tag set.

[0053] The extraction unit is also used to extract internal defect features of transparent and / or semi-transparent injection molded parts in the original image set based on the defect feature label set and using a transparency analysis algorithm to obtain an optimized defect feature label set.

[0054] The training unit is used to train the defect detection model to be trained based on the original image set and the optimized defect feature label set, so as to obtain the target defect detection model;

[0055] The output unit is used to input the image of the injection molded part to be detected into the target defect detection model and output the defect detection result corresponding to the image of the injection molded part to be detected.

[0056] Thirdly, embodiments of this application provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it causes the computer device to implement any of the implementation methods of the first aspect described above.

[0057] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed by a computer device, causes the computer device to implement any of the implementation methods of the first aspect described above.

[0058] Fifthly, embodiments of this application provide a computer program product that, when run on a computer device, causes the computer device to execute any of the implementation methods of the first aspect described above.

[0059] The beneficial effects of this application embodiment compared with the prior art are as follows: Considering that injection molded parts have various types such as transparent, semi-transparent, and opaque, by controlling the light source type, position, angle, intensity, wavelength, and other parameters to adjust the appropriate preset light source conditions, it is possible to better capture image information of different types of injection molded parts, optimize image acquisition quality, reduce the impact of lighting conditions on image quality, and provide clearer and more stable images for subsequent processing; by using a preset defect feature extraction algorithm to extract defect features from the original image set, a defect feature set is obtained, which can accurately locate and extract surface and internal defect features, such as scratches and bubbles, from the original image; by performing similarity matching between the extracted defect features and known defect templates, the most similar matching result can be quickly found; and by matching the preset defect templates that meet the similarity threshold with... The corresponding defect type is determined as the actual defect type, and each defect feature is assigned a clear label, making the defect type information clearer and more intuitive. Internal defect features are extracted again specifically for transparent and semi-transparent injection molded parts, compensating for the shortcomings of traditional methods in handling these special material injection molded parts. This allows for more accurate acquisition of information such as the location and size of internal defects, making the detection of transparent / semi-transparent injection molded parts more comprehensive and accurate, reducing the possibility of missed and false detections. The defect detection model is trained based on the original image set and the optimized defect feature label set, enabling the model to better adapt to specific injection molded part types and defect features, improving detection efficiency and accuracy. This achieves automated detection of defects in automotive interior injection molded parts, greatly improving detection efficiency and reducing the workload and subjective errors of manual inspection. Attached Figure Description

[0060] Figure 1 This is a schematic flowchart of a vision-based defect detection method for automotive interior injection molded parts provided in an embodiment of this application;

[0061] Figure 2 This is a schematic diagram of a vision-based inspection system for detecting defects in automotive interior injection molded parts, provided in an embodiment of this application.

[0062] Figure 3 This is a schematic diagram of the structure of the computer device provided in the embodiments of this application. Detailed Implementation

[0063] To further illustrate the technical solution of this application, specific embodiments are described below.

[0064] Figure 1 This is a schematic flowchart of a vision-based defect detection method for automotive interior injection molded parts, provided in an embodiment of this application.

[0065] like Figure 1 As shown, the above method includes the following steps S101 to S107.

[0066] S101. Acquire the original image set of the injection molded part surface and the injection molded part under the preset light source conditions.

[0067] The injection molded parts include at least one of the following types: transparent, semi-transparent, and opaque. The preset light source conditions include at least one of the following: light source type, light source position, light source angle, light source intensity, and light source wavelength.

[0068] It is understandable that transparent injection molded parts refer to parts that allow a large amount of light to pass through, and whose internal structure is basically clearly visible; semi-transparent injection molded parts refer to parts that allow light to pass through, and whose internal structure is vaguely visible, such as frosted products; and opaque injection molded parts refer to parts that do not allow light to pass through, and whose internal structure is completely invisible.

[0069] Among them, the light source type refers to the type of light source used for lighting, such as LED light source, halogen light source, and fluorescent light source.

[0070] The position of the light source refers to its spatial position relative to the injection molded part, such as above, below, or to the side of the injection molded part. Different positions will affect the angle and intensity of the light shining on the injection molded part.

[0071] The light source angle refers to the angle between the light emitted by the light source and the surface of the injection molded part. By properly adjusting the light source angle, the texture and defects on the surface of the injection molded part can be highlighted.

[0072] Light source intensity refers to the strength of light emitted by a light source, usually measured in units such as lux (lumens per square meter). Appropriate light source intensity ensures image sharpness, while excessively strong or weak light intensity may result in overexposure or underexposure.

[0073] The wavelength of a light source refers to the wavelength of light as it travels through space. Light of different wavelengths has different energy and penetrating power.

[0074] It is understandable that the core of visual inspection lies in acquiring high-quality images through optical devices (cameras, light sources). Adjusting preset light source conditions (light source type, position, angle, intensity, wavelength) directly corresponds to the lighting optimization technology of visual inspection, ensuring that uniform and clear images are obtained under different materials (transparent, semi-transparent, opaque).

[0075] In one implementation, a preset camera array is used to acquire multi-view original image data of the surface and interior of the injection molded part under different light source angles. A light source angle control algorithm is used to adjust the position of the light source according to the geometry of the injection molded part to obtain a first image set with uniform illumination.

[0076] It is understood that multi-view original image data of the injection molded part is acquired by a preset camera array under different light source angles. The initial position of the light source is determined by a preset threshold based on the geometry of the injection molded part, resulting in an original image set containing the surface and internal information. Based on the brightness distribution of the original image set, a light source angle control algorithm is used to calculate the light source position adjustment parameters corresponding to the geometry of the injection molded part. If the brightness distribution is not uniform, the light source angle is iteratively adjusted to obtain a first image set with uniform illumination.

[0077] For example, the camera array can consist of eight high-definition industrial cameras, evenly distributed around the injection-molded part to form 360-degree coverage. The light source uses adjustable-angle LED light groups, with the initial position determined based on a preset threshold according to the geometry of the injection-molded part.

[0078] For example, for a cylindrical injection molded part with a diameter of 100 mm, the initial angle of the light source can be set to 45 degrees, and the distance from the injection molded part surface can be 50 mm to ensure that the light covers the main surface area. This configuration can effectively capture defect information such as surface scratches and internal bubbles, which helps to improve the comprehensiveness of image data.

[0079] Specifically, determining the initial position of the light source based on the geometry of the injection molded part requires considering the curvature and size of the part.

[0080] For example, for injection molded parts with complex geometries, the surface normal vector can be pre-analyzed using 3D modeling software to calculate the angle of illumination from the light source, so that the angle between the light and the surface is kept between 30 and 60 degrees, thereby reducing reflections and shadows.

[0081] For example, for a rectangular injection-molded part with dimensions of 200 mm, 100 mm, and 50 mm, the light source can be placed at the top and sides to form a three-point lighting layout, ensuring that the light evenly covers all surfaces. This method can significantly improve the quality of the original image set and provide reliable data for subsequent analysis.

[0082] In one implementation, the brightness distribution analysis of the original image set relies on image processing algorithms. The brightness value distribution can be statistically analyzed using grayscale histograms to determine whether there are excessively bright or dark areas.

[0083] It should be noted that if the brightness distribution is uneven, such as a certain area having a grayscale value concentrated above 200 while other areas are below 50, it indicates uneven illumination. To address this issue, a light source angle control algorithm can be used to adjust the position of the light source.

[0084] For example, in areas with excessively high brightness, the angle of the corresponding light source can be adjusted from 45 degrees to 60 degrees to reduce the intensity of direct light; for dark areas, the light source can be moved 10 mm closer to the injection-molded part to enhance the illumination intensity. This iterative adjustment can effectively generate a first image set with uniform illumination, improving the accuracy of defect detection.

[0085] As an example, and not a limitation, the light source angle control algorithm can dynamically optimize the light source position based on the gradient descent principle, combined with brightness distribution feedback. For example, the algorithm calculates the light source position adjustment parameters, such as an angle increment of 5 degrees or a distance offset of 2 millimeters, based on the image brightness distribution after each adjustment, until the standard deviation of the brightness distribution is lower than a preset threshold. This method can quickly converge to the optimal lighting conditions.

[0086] In one example, when inspecting injection-molded parts for automotive dashboards, the initial image showed an overly bright central area and overly dark edges. After three iterations of adjustments, the light source angle was optimized from 40 degrees to 55 degrees, and the distance was adjusted from 60 mm to 45 mm, ultimately resulting in a uniformly illuminated image set. This uniform illumination significantly improved the detection rate of minor surface scratches and internal inclusions.

[0087] The first image set with uniform illumination can be directly used for subsequent defect classification and localization. Compared with non-uniform illumination images, the uniform image set can reduce the false detection rate caused by illumination differences, such as reducing the possibility of misjudging normal textures as defects by about 30%.

[0088] S102. Use a preset defect feature extraction algorithm to extract defect features from the original image set to obtain a defect feature set.

[0089] The defect feature set includes surface defect features and internal defect features.

[0090] Pre-defined defect feature extraction algorithms refer to algorithms that are pre-set to extract defect features from images. These algorithms can identify and extract specific features in images, such as edges, textures, and shapes, to distinguish between normal and defective areas. Common defect feature extraction algorithms include edge detection algorithms (such as the Canny operator), texture analysis algorithms (such as gray-level co-occurrence matrix), and shape recognition algorithms.

[0091] It is understandable that visual inspection relies on image processing algorithms to extract defect features. Pre-defined defect feature extraction algorithms (such as Canny edge detection and gray-level co-occurrence matrix) are the core methods of feature engineering in visual inspection, used to locate and describe defects such as scratches and bubbles from images.

[0092] A defect feature set can be understood as a collection of defect-related features extracted from the original image set. These features can characterize the surface and internal defects of the injection molded part, including information such as the type, location, size, and shape of the defects.

[0093] Surface defect features reflect the characteristics of surface defects in injection molded parts, such as surface scratches, dents, and cracks. These features are usually related to the surface texture, shape, and gloss, and can be extracted through methods such as edge detection and texture analysis.

[0094] Internal defect features reflect the characteristics of internal defects in injection molded parts, such as internal bubbles, cracks, and inclusions. These features are usually related to the material's density, uniformity, and internal structure, and can be extracted through methods such as transparency analysis and X-ray inspection.

[0095] Based on the type of injection molded part (transparent, semi-transparent, opaque) and the type of defect (surface defect, internal defect), a suitable preset defect feature extraction algorithm is selected. For example, for surface defect detection, edge detection and texture analysis algorithms can be selected; for internal defect detection, transparency analysis and ray detection algorithms can be selected. The extracted surface defect features and internal defect features are integrated into a complete defect feature set, which contains detailed information on the surface and internal defects of the injection molded part, providing a basis for subsequent defect identification and classification.

[0096] S103. Use a preset defect matching algorithm to perform similarity matching between the defect feature set and the preset defect template to obtain the target similarity.

[0097] It is understandable that in visual inspection, the extracted features need to be compared with known defect templates, and automated judgment is achieved by quantifying similarity.

[0098] Pre-defined defect matching algorithms refer to algorithms that are pre-set to match extracted defect features with known defect templates based on similarity. These algorithms can quantify the degree of similarity between extracted features and templates. Common matching algorithms include Euclidean distance matching based on feature vectors.

[0099] Pre-defined defect templates are pre-built templates containing various known defect features, used for comparison with extracted defect features. These templates are typically based on historical data, standard defect samples, or generated through simulation, covering different types of surface and internal defects and their characteristics.

[0100] Target similarity is a quantitative metric that measures the degree of similarity between extracted defect features and a preset defect template. It is typically a value between 0 and 1, indicating the degree of similarity. The higher the similarity, the more closely the extracted features match the template, and the greater the likelihood of a defect existing.

[0101] In one implementation, a corresponding template is selected from a pre-set defect template library based on the type of the injection molded part (transparent, semi-transparent, opaque) and the type of defect (surface defect, internal defect). For example, for internal bubble defects in transparent injection molded parts, a template containing bubble features is selected. It is important to note that this step must ensure that the features of the pre-set defect template are comparable to the extracted defect features; that is, the feature dimensions and types of the template must be consistent with the extracted features.

[0102] The defect feature set and the preset defect template are each transformed into feature vectors. For the defect feature set, key features (such as area, aspect ratio, edge strength, etc.) are extracted and a feature vector is formed. Similarly, features of the same dimensions are extracted from the preset defect template to form a corresponding feature vector. Simultaneously, the construction of the feature vectors must ensure that the feature order and dimensions of both are consistent to facilitate similarity matching. For example, the feature vector can include features such as the defect's area, perimeter, shape factor, and mean grayscale value.

[0103] A pre-defined defect matching algorithm is used to calculate the similarity between the feature vectors of the defect feature set and the feature vectors of the pre-defined defect template. Common similarity matching algorithms include: Euclidean distance-based matching, which calculates the Euclidean distance between two feature vectors, with a smaller distance indicating a higher similarity; and cosine similarity-based matching, which calculates the cosine similarity between two feature vectors, with the similarity ranging from [-1, 1], and a value closer to 1 indicating a higher similarity.

[0104] As an example, and not a limitation, if multiple types of defects need to be detected, the defect feature set can be matched with multiple preset defect templates for similarity. The target similarity for each template is calculated, and a similarity threshold is used to determine if a corresponding defect type exists. All matching results are then analyzed comprehensively. If multiple templates have high similarity to the extracted features, it may indicate a combination of multiple defects.

[0105] S104. When the target similarity meets the preset similarity threshold, the defect type corresponding to the preset defect template is determined as the defect type corresponding to the defect feature set, and a defect feature tag set is obtained.

[0106] A preset similarity threshold refers to a pre-defined similarity threshold used to determine whether the extracted defect features are sufficiently similar to a preset defect template. For example, if the preset similarity threshold is 0.8, and the calculated target similarity is greater than or equal to 0.8, then the extracted defect features are considered to match the defect template, indicating the existence of that type of defect; otherwise, it is considered that that type of defect does not exist.

[0107] Defect types refer to the categories of various defects present in injection molded parts, such as surface scratches, bubbles, cracks, inclusions, etc. Each defect type has specific characteristics and manifestations.

[0108] A defect feature label set is a dataset that associates extracted defect features with their corresponding defect types. It contains the feature information of the defects and their corresponding defect type labels, used for subsequent defect identification and classification.

[0109] In one implementation, the target similarity obtained in step S103 is compared with a preset similarity threshold. If the target similarity is greater than or equal to the preset similarity threshold, the extracted defect features are considered to match the preset defect template. At this time, the defect type corresponding to the preset defect template is determined as the defect type corresponding to the defect feature set.

[0110] For example, suppose there is a template in the preset defect template library that corresponds to the defect type "internal bubble". The similarity between its feature vector and the extracted defect feature vector is 0.85, which is greater than the preset similarity threshold of 0.8. Therefore, the extracted defect feature is considered to belong to the "internal bubble" type. Labels are generated for the matched defect features. The label content includes information such as defect type, defect location, and defect size. These labels, together with the corresponding defect features, form a defect feature label set.

[0111] It can be understood that a label can be represented as a structure containing the following information: defect ID, defect type, defect location coordinates, defect size, defect shape, etc. For example: {“Defect ID”: “001”, “Defect Type”: “Internal Bubble”, “Location”: “[x1, y1, x2, y2]”, “Size”: “0.5mm×0.5mm”}. All matching defect features and their corresponding labels are integrated into a single set to form a complete defect feature label set.

[0112] S105. Based on the defect feature label set, use the transparency analysis algorithm to extract the internal defect features of transparent and / or semi-transparent injection molded parts in the original image set to obtain an optimized defect feature label set.

[0113] Transparency analysis algorithms are used to analyze the propagation of light in transparent or translucent materials. Based on a multilayer light transmission model, the algorithm identifies internal defects in transparent and / or translucent injection molded parts by considering the refraction, scattering, and absorption behavior of light in the material.

[0114] Specifically, the refraction behavior of light in transparent / semi-transparent injection molded parts is described based on Snell's law:

[0115] ;

[0116] in, n 1 The refractive index of air is approximately 1.0. n 2 This refers to the refractive index of the injection molded material (e.g., 1.58 for PC). Angle of incidence It is the angle of refraction.

[0117] The light intensity attenuation model, based on the Lambert-Beer law, can be expressed as:

[0118] ;

[0119] in, I 0 For the incident light intensity, α The material absorption coefficient, x The depth through which light penetrates.

[0120] As an example, and not a limitation, a CMOS sensor camera was used to scan the injection-molded part at a resolution of 10 megapixels to capture the reflection and transmission characteristics of light inside the part. By analyzing the refraction and scattering behavior of light inside the injection-molded part, a three-dimensional model of the corresponding light propagation path was constructed, resulting in a multi-layer light transmission model.

[0121] It can be understood that the above formula is used to simulate the light transmission path, the refraction direction is calculated by combining the material's refractive index, and the light intensity attenuation formula is used to predict the theoretical light intensity distribution when there are no defects. By comparing the actual light intensity distribution with the theoretical value, if the light intensity deviation in a local area exceeds a threshold (such as ±10%), it is marked as an internal defect (such as a bubble or crack). For example, for a semi-transparent injection molded part, if an abnormal light intensity attenuation is detected in a certain area (such as a 20% decrease in light intensity due to bubble scattering), combined with the abrupt change in the light path, it is determined to be an internal defect.

[0122] In other words, internal defects such as bubbles or cracks can alter the propagation characteristics of light in localized areas. For example, abnormal scattering and refraction may occur in specific regions, leading to abnormal changes in light intensity. Therefore, by comparing the changes in light intensity before and after entering the injection molded part, especially the attenuation within the material, the location where light interacts with the defects can be determined.

[0123] This can also be understood as calculating the propagation path and attenuation of light within a transparent or translucent material by considering factors such as the material's refractive index, thickness, and angle of incidence. Based on changes in light intensity and the light propagation path, the location and size of internal defects (such as bubbles and cracks) can be identified.

[0124] Finally, the extracted defect information is integrated into the defect feature label set, and the defect data in the defect feature label set is updated to obtain the optimized defect feature label set.

[0125] This algorithm can effectively capture minute defect features inside transparent or semi-transparent injection molded parts and determine their location. The updated tag set contains more accurate information on defect location, size, and type, optimizing the description of internal defects in transparent or semi-transparent injection molded parts.

[0126] S106. Train the defect detection model to be trained based on the original image set and the optimized defect feature label set to obtain the target defect detection model.

[0127] The defect detection model to be trained is a deep learning model, such as a convolutional neural network (CNN), which is trained by inputting the original image set and the optimized defect feature label set.

[0128] For example, the model is trained using backpropagation algorithms and optimizers (such as Adam, SGD, etc.). Loss functions (such as cross-entropy loss, mean squared error, etc.) are used to measure the difference between the model's predictions and the true labels. During training, training loss and validation loss are monitored, and the model is validated using a validation set to prevent overfitting. The finally trained target defect detection model can accurately identify and classify defects in injection molded parts.

[0129] S107. Input the image of the injection molded part to be inspected into the target defect detection model, and output the defect detection result corresponding to the image of the injection molded part to be inspected.

[0130] The image of the injection molded part to be inspected refers to the image of the injection molded part that needs to be inspected for defects. It can be a single image or a set of images.

[0131] Defect detection results refer to the identification results of defects output by the target defect detection model after processing the input image, including information such as the type, location, and size of the defect.

[0132] It is understandable that after training a target defect detection model, it is possible to quickly and accurately identify whether there are defects in the image of the injection molded part to be inspected.

[0133] In one embodiment, acquiring an original image set of the surface and interior of the injection molded part under preset light source conditions includes: determining whether the image brightness of the images in the original image set meets a preset brightness threshold; if the image brightness does not meet the preset brightness threshold, adjusting the light source conditions according to the material reflection parameters of the injection molded part using a preset light source intensity adjustment algorithm to obtain a first adjusted light source condition, the first adjusted light source condition being used to make the image brightness of the acquired images meet the preset brightness threshold; and acquiring images of the surface and interior of the injection molded part again under the first adjusted light source condition to obtain the original image set.

[0134] It's understandable that if the image brightness is within a preset brightness threshold range, the image quality is considered acceptable and can be used for subsequent processing. If the image brightness is outside the preset brightness threshold range, the light source needs to be adjusted. For example, image processing software can be used to perform grayscale analysis on the image, calculate the brightness value of each pixel, and generate a brightness histogram. If the histogram shows that the brightness values ​​are concentrated in the range of 100-150 and the standard deviation is less than 20, then the brightness distribution is considered uniform and meets the preset brightness threshold.

[0135] Alternatively, it can be understood that for the first image set, a light source intensity adjustment algorithm is used to dynamically adjust the light source intensity according to the reflective characteristics of the injection molded part material until the image brightness distribution meets the preset brightness threshold, then it is judged to be uniform, and a second image set with optimized brightness is acquired.

[0136] In one implementation, a spectrometer is used to measure reflectance to obtain the material reflectance characteristics parameters corresponding to the surface of the injection molded part. For example, a spectrometer with a wavelength range of 400-700 nm is selected, and the reflectance curve is obtained by scanning the plastic material on the surface of the injection molded part. Assuming that the surface of a certain injection molded part is made of smooth polypropylene, the reflectance is approximately 0.45 at 550 nm, which reflects the material's absorption and reflection characteristics of green light.

[0137] Based on the material's reflectivity parameters, a light source intensity adjustment algorithm is used to dynamically adjust the light source intensity. For example, for wavelengths with low reflectivity, the light source intensity can be appropriately increased to enhance image brightness. Assuming the initial light source intensity is 1000 lux, and reflectivity data indicates that the red light band reflects light weakly, the algorithm can increase the red light intensity to 1200 lux, while keeping the green light intensity unchanged.

[0138] Preferably, the light source intensity should be adjusted within a preset range, such as 800-1500 lux, to avoid overexposure or underexposure. This dynamic adjustment ensures appropriate image brightness, facilitating subsequent analysis.

[0139] In one implementation, a pre-trained convolutional neural network model is used, which takes a set of original images with uniform brightness as input. The model enhances the brightness contrast of local areas of the image through multiple convolution and pooling operations.

[0140] For example, for areas with minor scratches that may exist on the surface of injection molded parts, the network can enhance the brightness details of the area, making the scratch features more obvious.

[0141] In one embodiment, acquiring an original image set of the injection molded part's surface and interior under preset light source conditions further includes: determining whether the image resolution of the images in the original image set meets a preset resolution threshold; if the image resolution does not meet the preset resolution threshold, enhancing the image resolution using a bilinear interpolation algorithm to obtain an enhanced image set; determining the target light source wavelength combination for a transparent or semi-transparent injection molded part using a light source wavelength selection algorithm based on the enhanced image set; adjusting the light source conditions according to the target light source wavelength combination to obtain a second adjusted light source condition, the second adjusted light source condition being used to ensure that the grayscale range of the acquired images meets a preset grayscale range; and acquiring images of the injection molded part's surface and interior again under the second adjusted light source condition to obtain the original image set.

[0142] As mentioned above, if the image resolution is above the preset resolution threshold, the image quality is considered acceptable and can be used for subsequent processing. If the image resolution is below the preset resolution threshold, image resolution enhancement processing is required.

[0143] Alternatively, if the image resolution of the second image set is insufficient, a light source wavelength selection algorithm is used to select a combination of infrared and visible light wavelengths for transparent or semi-transparent injection molded parts to enhance the development effect of internal defects and obtain a third image set with prominent defect features.

[0144] In one implementation, image resolution and grayscale distribution data are acquired, and a preset resolution threshold is used to determine whether the image resolution meets the feature extraction requirements. If the image resolution is lower than the threshold, a bilinear interpolation algorithm is used to improve the resolution, resulting in a resolution-enhanced image set.

[0145] For example, resolution data, such as 1920×1080 pixels, can be extracted using image processing software, and a grayscale histogram can be calculated to obtain the grayscale value distribution range, such as 0-255. The preset resolution threshold can be set to 1280×720; if it is lower than this value, it indicates that the image details are insufficient to support subsequent defect detection.

[0146] For example, if the resolution of an injection-molded part image is 800×600, which is below the threshold, a bilinear interpolation algorithm is used to interpolate the pixels using a neighborhood-weighted average interpolation, generating an enhanced image set with a resolution of 1920×1080. This method improves resolution through a smooth transition, preserves edge details, and facilitates subsequent feature extraction.

[0147] Based on the resolution-enhanced image set, a light source wavelength selection algorithm is used, combined with the preset ratio of infrared light intensity to visible light intensity, to determine the optimal wavelength combination for transparent or semi-transparent injection molded parts, thereby obtaining wavelength-optimized light source configuration data.

[0148] In one possible implementation, a light source wavelength selection algorithm combines the intensity ratio of infrared light to visible light to optimize the light source configuration for transparent or translucent injection molded parts.

[0149] Specifically, the infrared light intensity can be set to 60% and the visible light intensity to 40%. Transmittance at different wavelengths is measured using a spectrometer; for example, the transmittance at 850nm infrared wavelength reaches 80%, and the transmittance at 550nm visible light wavelength reaches 65%. Based on the transmittance data, the combination of 850nm and 550nm is selected as the optimal wavelength configuration. This configuration enhances the development of internal defects in transparent materials, facilitating subsequent defect detection.

[0150] Images of the injection molded part's surface and interior were re-acquired using wavelength-optimized light source configuration data. The pixel value range and grayscale distribution of internal defects in the acquired images were obtained. After adjusting the image contrast using a histogram equalization algorithm, the features of the internal defects were extracted. The defect features were then classified using a support vector machine algorithm to generate a third image set with prominent defect features.

[0151] For example, the original image has gray values ​​concentrated in the range of 50-100, with a narrow dynamic range. Histogram equalization can be used to remap the gray values ​​to 0-255, thereby enhancing the contrast between the defective area and the background.

[0152] Preferably, the pixel value of the defect area may be increased to over 200, while the background area may be reduced to below 50, thereby highlighting the defect features. This method can effectively improve the visibility of defects.

[0153] In one embodiment, when extracting defect features, the defect contour, such as the geometry of a crack or bubble, can be identified by an edge detection algorithm, and feature vectors, such as defect area and aspect ratio, can be extracted.

[0154] For example, a crack defect has an area of ​​100 pixels and an aspect ratio of 5:1, while a bubble defect has an area of ​​50 pixels and an aspect ratio of 1:1. A support vector machine (SVM) algorithm is used to classify the feature vectors. The training dataset contains 500 defect samples. The classifier can accurately distinguish between cracks and bubbles, generating a third image set with prominent defect features. This classification method effectively separates different types of defects, facilitating subsequent quality assessment.

[0155] It is understandable that in visual inspection, the stability of lighting conditions and image quality directly affect the accuracy of subsequent processing. By dynamically adjusting the intensity and wavelength of the light source, the influence of different materials and ambient lighting can be overcome, improving image consistency; while resolution enhancement (such as bilinear interpolation) can ensure that image details are clear enough, helping to capture minute defects and avoiding missed detections due to insufficient resolution in traditional methods.

[0156] In one embodiment, a defect feature set is obtained by performing defect feature extraction processing on the original image set using a preset defect feature extraction algorithm, including: obtaining the image grayscale range and noise distribution of the original image set; filtering the original image set using an adaptive mean filtering algorithm based on the noise distribution to obtain a denoised image set; adjusting the grayscale range of the denoised image set using an adaptive contrast stretching algorithm to enhance image contrast to obtain a contrast-enhanced image set; and performing defect feature extraction processing on the contrast-enhanced image set using the preset defect feature extraction algorithm to obtain a defect feature set.

[0157] Alternatively, it can be understood that for the third image set, image preprocessing algorithms are used for denoising and contrast enhancement, edge detection is used to extract the boundary contour features of scratches and bubbles, and texture analysis is used to extract linear and circular texture features, resulting in a fourth image set containing the initial features of surface scratches and internal bubbles.

[0158] In other words, image grayscale and noise distribution data are obtained from the third image set. An adaptive mean filtering algorithm is used to denoise the third image set, resulting in a denoised image set. Based on the denoised third image set, an adaptive contrast stretching algorithm is used to adjust the grayscale range of the denoised image set, resulting in a contrast-enhanced image set. Image gradient information is extracted from the contrast-enhanced image set, and the Canny edge detection algorithm is used to generate boundary contour data of scratches and bubbles, resulting in an intermediate image set containing contour features. Based on the contour features of the intermediate image set, the gray-level co-occurrence matrix algorithm is used to extract linear texture features of scratches and circular texture features of bubbles, generating a fourth image set containing the initial features of surface scratches and internal bubbles.

[0159] In one possible implementation, when acquiring grayscale and noise distribution data from a third image set, image processing software can be used to analyze the grayscale value range and noise characteristics of the image. The grayscale distribution reflects pixel brightness variations, while the noise distribution reveals random interference.

[0160] For example, for a set of injection-molded part images with grayscale values ​​ranging from 20 to 200, the noise is characterized by high-frequency salt-and-pepper noise, concentrated in the image edge regions. By plotting a grayscale histogram, it can be observed that the grayscale values ​​are concentrated in the lower range, while the noise points exhibit a discrete distribution. This analysis provides a data foundation for subsequent denoising, helping to reduce interference while preserving defect characteristics.

[0161] Specifically, when using the adaptive mean filtering algorithm for noise reduction, the size of the filtering window is dynamically adjusted based on the local pixel grayscale differences.

[0162] Adaptive mean filtering algorithms can dynamically adjust filter parameters, such as the filter window size and weighting coefficients, based on the noise characteristics of local image regions to remove noise while preserving image details. For example, a smaller filter window can be used in noisy regions, while a larger filter window can be used in flat regions.

[0163] For example, a 3×3 pixel window is set for noisy edge areas, while a 5×5 pixel window is set for flat areas.

[0164] The filtered images form a denoised image set. Noise in these images is effectively suppressed, and image quality is improved, providing a better data foundation for subsequent contrast enhancement and defect feature extraction. For example, after processing an injection molded part image with a resolution of 1920×1080, noise points are reduced by approximately 70%, while the grayscale values ​​of defect areas remain stable. This method balances denoising effectiveness with detail preservation and is suitable for the complex textures of transparent injection molded parts.

[0165] In one implementation, an adaptive contrast stretching algorithm is used to adjust the grayscale range based on a set of denoised images.

[0166] Adaptive contrast stretching algorithms dynamically expand or compress the grayscale range based on the image's grayscale distribution, thereby enhancing the image's contrast. For example, if the original image has a grayscale range of 50-150, stretching and mapping it to 0-255 can increase the grayscale value of defective areas to above 180 and reduce the grayscale value of background areas to below 40, thus enhancing the image's visual effect and feature separability.

[0167] The contrast-stretched image forms a contrast-enhanced image set, making defect features in the image more obvious. For injection molded part images containing micro-cracks, the contrast of the crack area is improved after stretching, and the outline is clearer. This processing facilitates subsequent edge detection.

[0168] In one embodiment, a defect feature set is obtained by performing defect feature extraction processing on a set of contrast-enhanced images using a preset defect feature extraction algorithm, including: extracting image gradient information corresponding to the set of contrast-enhanced images; generating defect boundary contour data based on the image gradient information using the Canny edge detection algorithm; and extracting defect texture features based on the defect boundary contour data using the gray-level co-occurrence matrix algorithm to generate the defect feature set.

[0169] It is understandable that the Canny edge detection algorithm is a feature extraction method in visual inspection.

[0170] It should be noted that when extracting gradient information from the contrast-enhanced image set and using the Canny edge detection algorithm to generate boundary contour data of scratches and bubbles, dual thresholds can be set to optimize edge recognition.

[0171] For example, setting the low threshold to 50 and the high threshold to 150 generates an intermediate image set containing linear edges of scratches and circular edges of bubbles.

[0172] In one embodiment, the scratch contour is represented as a long, continuous line segment, and the bubble contour is a closed circle. The Canny algorithm ensures accurate contours and reduces false detections through gradient calculation and non-maximum suppression.

[0173] Understandably, based on the contour features of the intermediate image set, the gray-level co-occurrence matrix algorithm is used to extract the texture features of scratches and bubbles. The gray-level co-occurrence matrix describes the spatial relationship between pixels and is suitable for analyzing linear and circular textures.

[0174] For example, the co-occurrence matrix of scratches shows high directionality, reflecting its linear characteristics; while the matrix of bubbles shows a uniform distribution, reflecting circular characteristics.

[0175] In one possible implementation, the extracted scratch texture features include high contrast and directionality, while the bubble features include low contrast and roundness. Generating a fourth image set containing these features facilitates subsequent defect classification and quality assessment. This method improves the comprehensiveness of defect identification through multi-dimensional feature extraction.

[0176] In one embodiment, a preset defect matching algorithm is used to perform similarity matching between a defect feature set and a preset defect template to obtain target similarity, including: using the Hausdorff distance algorithm to calculate the minimum distance between the defect boundary contour data and the contour points corresponding to the preset defect template; and calculating the target similarity based on the minimum distance between the contour points.

[0177] It is understandable that the core of the preset defect matching algorithm lies in comparing the similarity between the image contour and the defect template library.

[0178] For example, the contour feature data includes the linear contour of scratches and the circular contour of bubbles, which are described by parameters such as geometry, length, and curvature.

[0179] In one implementation, the Hausdorff distance algorithm is used to calculate contour similarity, and the degree of matching is quantified by comparing the minimum distance between the contour point sets.

[0180] Specifically, the defect boundary contour point set A is extracted and matched with the preset template contour point set B. The bidirectional Hausdorff distance H(A,B) is calculated and normalized to a similarity score S. If S≥0.8, the match is considered successful.

[0181] For example, extract the boundary contour point set A={a1,a2,...,a...} of the defect to be tested. m}

[0182] The preset defect template has a set of contour points B = {b1, b2, ..., b}. n}

[0183] Two-way Hausdorff distance calculation:

[0184] ;

[0185] in, d ( a , b ) is a point a With point b The Euclidean distance.

[0186] Normalize the distance to obtain a similarity score:

[0187] ;

[0188] in, This is the maximum allowable distance (which can be customized, for example, 10% of the diagonal of the maximum circumscribed rectangle of the injection molded part).

[0189] For example, for images of injection molded parts, the template library contains standard scratch and bubble outlines. When matching, the coordinates of the boundary points of the outline are extracted, and the distance difference with the template is calculated.

[0190] It should be noted that the matching score is usually normalized to 0 to 1, and the threshold is set to 0.8. If the score is higher than 0.8, the contours are considered to be highly similar. This method ensures the accuracy of defect identification through template comparison.

[0191] In one embodiment, when the target similarity meets a preset similarity threshold, the defect type corresponding to the preset defect template is determined as the defect type corresponding to the defect feature set, resulting in a defect feature label set. This includes: when the target similarity meets the preset similarity threshold, marking the region corresponding to the defect boundary contour data as the initial defect region; using a region segmentation algorithm to refine the boundary of the initial defect region to obtain a refined defect region; determining whether the similarity between the refined defect region and the preset defect template meets the preset similarity threshold; when the similarity between the refined defect region and the preset defect template meets the preset similarity threshold, determining the defect type corresponding to the preset defect template as the defect type corresponding to the refined defect region; and using an image merging algorithm to fuse the defect type corresponding to the refined defect region with the original image set to generate a defect feature label set.

[0192] Alternatively, this can be understood as follows: Boundary contour feature data is obtained from the fourth image set. A contour matching algorithm is used to calculate the similarity between the contours and contour templates in a pre-established defect template library, resulting in a contour matching score. If the matching score is higher than a preset matching threshold, the region corresponding to the marked contour is designated as the initial defect region, generating an intermediate marked image set containing the initial defect region. Based on the intermediate marked image set, a region segmentation algorithm is used to refine the boundaries of the initial defect region, resulting in a refined defect region image set.

[0193] It is understandable that region segmentation algorithms separate defective regions from background regions based on pixel grayscale or gradient differences.

[0194] Preferably, a graph-cut-based segmentation algorithm is used, which optimizes boundary partitioning by constructing an energy function between pixels.

[0195] In one embodiment, for an image of an injection-molded part containing microcracks, the graph cut algorithm refines the boundary of the crack region from a blurred state to a clear line based on the grayscale gradient, reducing the boundary pixel width from 5 pixels to 1 pixel. This refinement enhances the clarity of the defect region's boundary, facilitating subsequent analysis.

[0196] The above method ensures initial screening of defects through contour matching, optimizes boundary accuracy through region segmentation, and presents the results intuitively through image merging.

[0197] In one embodiment, determining whether the similarity between the refined defect region and the preset defect template meets a preset similarity threshold includes: extracting the defect texture features corresponding to the refined defect region using a gray-level co-occurrence matrix algorithm, and extracting the defect boundary contour data corresponding to the refined defect region using a Canny edge detection algorithm; calculating the weighted features corresponding to the defect texture features and the defect boundary contour data using a weighted fusion algorithm to obtain the target defect features; if the Euclidean distance between the target defect features and the preset defect template is less than a preset distance threshold, then calculating whether the cosine similarity between the target defect features and the preset defect template meets the preset similarity threshold.

[0198] Alternatively, this can be understood as follows: texture features are extracted using a gray-level co-occurrence matrix to generate a first feature vector, and boundary contours are extracted using an edge detection algorithm to obtain first contour data. A weighted fusion algorithm is then used to combine the first feature vector and the first contour data, where the texture feature weight is W1 and the boundary contour weight is W2 (W1 and W2 are preset constants) to generate a comprehensive feature vector.

[0199] This can also be understood as weighting edge features and texture features:

[0200] ;

[0201] Where W1+W2=1 (e.g., W1=0.6, W2=0.4).

[0202] If the Euclidean distance between the composite feature vector and any defect template in the pre-established template library is less than a preset threshold, then the composite feature vector and the defect template are compared using cosine similarity calculation to obtain a matching result. Based on the matching result, the corresponding defect type is retrieved from the template library to generate a defect tag set.

[0203] When extracting texture features using the gray-level co-occurrence matrix, statistical features are generated based on the spatial relationships between pixels.

[0204] For example, for an injection molded part image, the distance parameter of the gray-level co-occurrence matrix is ​​set to 1, and the directions are 0°, 45°, 90° and 135°. Features such as contrast, correlation and entropy are calculated to form the first feature vector.

[0205] Assuming the extracted feature vector contains four dimensions, such as [0.75, 0.62, 1.23, 0.89], these values ​​reflect the roughness and regularity of the surface texture of the injection molded part. This feature extraction method can effectively capture subtle differences in surface texture.

[0206] Specifically, when extracting boundary contours using edge detection algorithms, the Canny algorithm can be used to process injection molded part images. The algorithm smooths the image using Gaussian filtering, calculates gradient intensity, applies double thresholding to detect edges, and finally generates the first contour data.

[0207] For example, a closed contour is detected in an image of an injection-molded part, and its set of coordinate points represents an irregular scratch area. This contour data provides accurate boundary information for subsequent feature fusion.

[0208] In one embodiment, the weighted fusion algorithm combines texture features and boundary contours, assuming weights W1 is 0.6 and W2 is 0.4. The texture feature vector [0.75, 0.62, 1.23, 0.89] and the contour feature vector (such as a descriptor based on contour length and curvature [2.1, 0.45]) are weighted and summed to generate a comprehensive feature vector. This fusion method balances the importance of texture and contour, ensuring that the comprehensive feature vector fully characterizes the defect properties.

[0209] For example, in calculating the Euclidean distance between the comprehensive feature vector and the defect template library, assuming the template library contains three types of defect templates: scratches, particles, and cracks. The Euclidean distance between the comprehensive feature vector and the scratch template is 0.3, which is less than the preset threshold T=0.5, so cosine similarity calculation is performed. The calculation result shows a similarity of 0.92, indicating a high match. This dual verification mechanism improves the reliability of the matching.

[0210] It is understandable that when retrieving defect types from the template library based on the matching results, a defect tag set will be generated.

[0211] For example, if the matching result confirms the defect as a scratch, the tag set is recorded as {Defect ID: 001, Type: Scratch, Location: (x1, y1, x2, y2)}. This tag set provides structured information for subsequent defect classification and location, which helps to efficiently execute the automated inspection process.

[0212] In one implementation, the image merging algorithm overlays the highlight marks of defective regions onto the original image through weighted fusion or masking operations.

[0213] Specifically, the masking operation can assign red highlight marks to defective areas while retaining the original grayscale of the background.

[0214] For example, for an injection molded part image with a resolution of 1920×1080, the defect area is displayed with a red outline after fusion, the grayscale value is adjusted to above 200, and the background grayscale is kept below 50.

[0215] In one possible implementation, the merged image is adjusted for transparency, with the defect area transparency set to 0.7 and the background transparency set to 1.0, ensuring that the defect is prominent while the original details are visible.

[0216] In one embodiment, based on the defect feature label set, a transparency analysis algorithm is used to extract defect features from the internal defect features of transparent and / or semi-transparent injection molded parts in the original image set to obtain an optimized defect feature label set. This includes: using the transparency analysis algorithm to calculate the transmission path and / or light intensity distribution of light in the transparent and / or semi-transparent injection molded parts; when the transmission path and / or light intensity distribution do not meet a preset range, performing defect feature extraction processing on the internal defect features of the transparent and / or semi-transparent injection molded parts in the original image set to obtain an optimized defect feature label set.

[0217] Based on the above, it can be understood that by establishing a physical optical model of transparent / semi-transparent materials, the propagation behavior of light within injection-molded parts can be analyzed. The model is based on parameters such as the material's refractive index, thickness, and scattering coefficient, combined with the incident light angle and wavelength, to calculate the transmission path (such as refraction and scattering paths) and intensity attenuation law of light in different material layers.

[0218] For example, for a 5mm thick translucent injection molded part, assuming the incident light is 850nm infrared light, the algorithm will calculate the remaining light intensity after the light penetrates the injection molded part based on the material's refractive index (e.g., 1.5) and light attenuation coefficient (e.g., 0.2 / mm). If the light intensity distribution deviates from the theoretical value by more than a preset threshold (e.g., ±10%), the defect detection process will be triggered.

[0219] The actual detected light intensity distribution is compared with the light intensity distribution predicted by the theoretical model. If the transmitted light intensity in a certain area is significantly lower than expected (e.g., the light intensity decreases due to enhanced scattering in the bubble area), or the transmission path is abnormal (e.g., a crack causes a sudden change in the direction of light refraction), it is identified as a potential defect area.

[0220] It is understandable that the tolerance threshold for light intensity distribution can be dynamically adjusted based on the material type and ambient lighting conditions (such as the stability of the light source) to avoid misjudgment caused by external interference.

[0221] As an example, and not a limitation, let's assume we're inspecting a semi-transparent dashboard injection molded part. The algorithm detects that the light intensity in a certain area is 20% lower than the theoretical value, and the transmission path shows abnormal scattering. After background segmentation, a circular outline with a diameter of 0.3 mm is extracted. The similarity to the bubble template reaches 0.9, and it is finally labeled as "internal bubble defect," and updated to the optimized label set.

[0222] It is understandable that traditional visual inspection often struggles to capture internal defects when dealing with transparent materials. However, by analyzing transmission paths and changes in light intensity, internal defects such as bubbles and cracks can be identified more effectively. Combined with an optimized feature label set, the model's ability to identify complex defects is further enhanced.

[0223] In one embodiment, for an injection molded part image with complex background interference, a background segmentation algorithm is used to distinguish the foreground and background by using a preset threshold.

[0224] This algorithm sets a threshold based on pixel grayscale values. For example, pixels with a grayscale value greater than 120 are considered foreground, and the rest are considered background, thus separating the injection molded part image. For instance, the injection molded part image may contain a background such as a workbench or fixture. Through threshold segmentation, the foreground of the injection molded part can be clearly separated, improving the accuracy of subsequent feature extraction.

[0225] In one embodiment, an adaptive feature adjustment algorithm is used to dynamically update the boundary and texture feature weights of the defect model according to changes in illumination conditions, thereby obtaining an optimized defect detection model.

[0226] Based on the changes in lighting conditions, the light intensity value is obtained from the image processing module. A preset lighting classification rule is adopted. If the light intensity value exceeds the preset threshold, the boundary feature weights in the feature set are increased to obtain the first feature set.

[0227] For the first feature set, an adaptive algorithm is used to analyze the texture features and extract high-frequency components from the distribution of texture features. If the high-frequency components meet the preset texture saliency threshold, the optimized feature combination is determined to obtain the second feature set.

[0228] By using the second feature set, the boundary and texture features of the defect model are dynamically updated. A convolutional neural network is then used to train the defect detection model, resulting in an optimized defect detection model.

[0229] It is understandable that changes in lighting conditions are crucial for image processing in the field of injection molded part defect detection. Illumination intensity values ​​reflect differences in light intensity within the imaging environment, affecting the accuracy of feature extraction. When acquiring illumination intensity values, ambient light data can be collected in real time using optical sensors; for example, in an injection molded part imaging device, the sensor measures an illumination intensity of 800 lux. Preset illumination classification rules can be based on empirical thresholds, such as setting 1000 lux as a high illumination threshold. If the illumination intensity exceeds this threshold, it indicates that strong light may cause blurred boundaries, requiring an increase in the boundary feature weights in the feature set.

[0230] For example, the weights of the boundary features can be adjusted from 0.3 to 0.5 to form the first feature set, thereby enhancing the robustness of edge detection.

[0231] In one possible implementation, when analyzing texture features using an adaptive algorithm for the first feature set, high-frequency components of the texture can be extracted using wavelet transform. These high-frequency components reflect subtle changes on the surface of the injection-molded part, such as minor scratches or unevenness. Assuming the high-frequency components account for 20% of the analyzed texture, and the preset texture saliency threshold is 15%, this indicates significant texture features, and the feature combination can be optimized to form a second feature set.

[0232] In other words, the weights of boundary and texture features are adjusted based on the real-time illumination intensity (e.g., strong or weak light). For example, in strong light (illumination intensity > 1000 lux), the boundary may be blurred due to overexposure. In this case, the weight of the boundary feature is increased (e.g., from 0.3 to 0.5) to enhance the robustness of edge detection. In weak light, the weight of the texture feature is increased to capture subtle surface defects.

[0233] For example, when inspecting injection-molded parts for automotive dashboards, the workshop lighting fluctuates frequently. The algorithm monitors the light intensity in real time through sensors. If strong light interference is detected, it automatically optimizes the boundary weights to make the scratch outline clearer and reduce the false detection rate.

[0234] By combining boundary features (boundary contours) and texture features, a comprehensive feature vector is generated through weighted fusion. Dynamic weight adjustment balances the importance of both features in different scenarios, avoiding the failure of a single feature. This addresses the core pain point of traditional visual inspection being sensitive to lighting conditions, and improves the accuracy of defect detection.

[0235] In one embodiment, for the optimized defect detection model, a deep learning algorithm is used to perform secondary verification of the defect label set through a convolutional neural network. If false detections or missed detections are detected, the model parameters are adjusted through a feedback mechanism to obtain the final defect classification result.

[0236] Raw image data is obtained from the training dataset. Image preprocessing methods are used to denoise and standardize the raw image data, resulting in a first image set. For this first image set, features are extracted using a convolutional neural network to generate a feature vector set, which is then compared with a defect label set to obtain a preliminary classification result. If the preliminary classification result deviates from the defect label set, secondary verification is used to determine false positives or false negatives. A feedback mechanism is then used to update the model parameters, resulting in an optimized classification model. Based on the optimized classification model and a preset classification threshold, the feature vector set is finally classified to obtain the defect classification result.

[0237] For example, the process of obtaining raw image data from the training dataset can be understood as extracting data from a sequence of images captured by an industrial camera.

[0238] For example, in the scenario of injection molded parts inspection, the camera takes images of the injection molded parts surface at a frequency of 100 frames per second, with each image having a resolution of 1024×1024 pixels, containing potential scratches or dents.

[0239] In one possible implementation, denoising can be achieved through Gaussian blur filtering, with the filter kernel size set to 3×3 pixels to reduce the impact of random noise; normalization normalizes the pixel values ​​to the range of 0 to 1 to ensure the stability of subsequent feature extraction.

[0240] For example, the processed image has a more uniform distribution of gray values, which helps improve the model's sensitivity to minor defects.

[0241] Specifically, for the process of extracting features from the first image set using a convolutional neural network, a network structure containing multiple layers of convolution and pooling can be designed.

[0242] For example, the network contains three convolutional layers, each using 32 3×3 convolutional kernels, with ReLU as the activation function and 2×2 max pooling as the pooling layer, generating a feature vector set.

[0243] Preferably, each vector in the feature vector set has a dimension of 128, representing the texture and edge information of the image.

[0244] In one embodiment, when comparing feature vectors with a set of defect labels, the classification probability can be output using a softmax function.

[0245] For example, the label set contains two categories: "normal" and "defective". If the probability of a certain image being defective is 0.8, it is classified as a defective image.

[0246] It should be noted that the preliminary classification results may be biased due to uneven distribution of training data, such as misclassifying some minor scratches as normal.

[0247] In one embodiment, secondary verification can be achieved through manual annotation or additional rules.

[0248] For example, for an image initially classified as a defect, check if the area of ​​the defect region exceeds 10 pixels. If it does not, it is considered a false detection. If a defect is missed, supplementary annotation is performed by comparing it with defect patterns in historical data. The feedback mechanism can use gradient descent to update the model weights, for example, by setting the learning rate to 0.001 to gradually optimize the model's ability to identify complex defects.

[0249] Understandably, the feedback mechanism improves the robustness of the model, especially in scenes with changing lighting or complex backgrounds.

[0250] For example, during the final classification, the preset classification threshold can be set to 0.75, meaning that if the probability of a defect corresponding to a feature vector exceeds 0.75, it is judged as a defect.

[0251] In one possible implementation, for the inspection of injection molded parts, the optimized classification model can accurately distinguish between defect types such as scratches, dents, and dust.

[0252] For example, after classification, the feature vector of an injection molded part image shows a scratch probability of 0.85 and a dent probability of 0.1, and is therefore determined to be a scratch defect.

[0253] The methods of the embodiments of this application have been described above with reference to the accompanying drawings. It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially, these steps are not necessarily executed in the order shown in the figures. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least a portion of the steps or stages of other steps. The apparatus of one embodiment of this application will now be described with reference to the accompanying drawings. For brevity, appropriate omissions will be made when describing the system below; relevant content can be referred to in the relevant descriptions of the methods above, and will not be repeated.

[0254] Figure 2 This is a schematic diagram of a vision-based inspection system for detecting defects in automotive interior injection molded parts, provided in an embodiment of this application.

[0255] like Figure 2 As shown, the system 1000 includes the following units.

[0256] The acquisition unit 1001 is used to acquire a set of original images of the surface and interior of the injection molded part under preset light source conditions. The injection molded part type includes at least one of transparent, semi-transparent and opaque types. The light source conditions include at least one of light source type, light source position, light source angle, light source intensity and light source wavelength.

[0257] Extraction unit 1002 is used to perform defect feature extraction processing on the original image set using a preset defect feature extraction algorithm to obtain a defect feature set, which includes surface defect features and internal defect features.

[0258] The matching unit 1003 is used to perform similarity matching between the defect feature set and the preset defect template using a preset defect matching algorithm to obtain the target similarity.

[0259] The processing unit 1004 is used to determine the defect type corresponding to the preset defect template as the defect type corresponding to the defect feature set when the target similarity meets the preset similarity threshold, and obtain the defect feature tag set.

[0260] The extraction unit 1002 is also used to extract internal defect features of transparent and / or semi-transparent injection molded parts in the original image set by using a transparency analysis algorithm based on the defect feature label set, so as to obtain an optimized defect feature label set.

[0261] Training unit 1005 is used to train the defect detection model to be trained based on the original image set and the optimized defect feature label set to obtain the target defect detection model;

[0262] The output unit 1006 is used to input the image of the injection molded part to be detected into the target defect detection model and output the defect detection result corresponding to the image of the injection molded part to be detected.

[0263] It should be noted that the information interaction and execution process between the above-mentioned units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, which will not be repeated here.

[0264] Figure 3 This is a schematic diagram of the structure of the computer device provided in an embodiment of this application. Figure 3 As shown, the computer device 3000 of this embodiment includes: at least one processor 3100 ( Figure 3 (Only one is shown) a processor, a memory 3200, and a computer program 3210 stored in the memory 3200 and executable on at least one processor 3100, wherein when the processor 3100 executes the computer program 3210, the computer device performs the steps described in the above embodiments.

[0265] The processor 3100 can be a Central Processing Unit (CPU), or it can be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor.

[0266] In some embodiments, memory 3200 may be an internal storage unit of computer device 3000, such as a hard disk or memory of computer device 3000. In other embodiments, memory 3200 may be an external storage device of computer device 3000, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD) card, flash card, etc., equipped on computer device 3000. Furthermore, memory 3200 may include both internal and external storage units of computer device 3000. Memory 3200 is used to store operating system, application programs, bootloader data, and other programs, such as program code of computer programs. Memory 3200 may also be used to temporarily store data that has been output or will be output.

[0267] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units is merely an example. In practical applications, the above functions can be assigned to different functional units or modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0268] This application also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a computer device, it enables the computer device to perform the steps described in the above-described method embodiments.

[0269] This application provides a computer program product that, when run on a computer device, enables the computer device to implement the methods described above.

[0270] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it enables a computer device to implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include at least: any entity or device capable of carrying computer program code to a photographing device / terminal device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunication signals.

[0271] It should be understood that the sequence numbers of the steps in the above embodiments do not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application. In the description, specific details such as particular system structures and technologies are set forth for illustrative purposes rather than for limiting purposes, so as to provide a thorough understanding of the embodiments of this application. However, those skilled in the art should understand that this application can also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of this application with unnecessary details.

[0272] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.

[0273] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0274] Furthermore, in the description of this application and the appended claims, the terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.

[0275] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0276] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0277] In the embodiments provided in this application, it should be understood that the disclosed apparatus, computer equipment, and methods can be implemented in other ways. For example, the apparatus and computer equipment embodiments described above are merely illustrative. For instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0278] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. A method for defect detection of automotive interior injection molded parts based on vision inspection, characterized in that, include: Under preset light source conditions, a set of original images of the surface and interior of the injection molded part are acquired. The injection molded part is of at least one type, including transparent, semi-transparent, and opaque. The preset light source conditions include at least one type, including light source type, light source position, light source angle, light source intensity, and light source wavelength. The original image set is processed by a preset defect feature extraction algorithm to obtain a defect feature set, which includes surface defect features and internal defect features. A preset defect matching algorithm is used to perform similarity matching between the defect feature set and the preset defect template to obtain the target similarity. When the target similarity meets the preset similarity threshold, the defect type corresponding to the preset defect template is determined as the defect type corresponding to the defect feature set, and a defect feature tag set is obtained; Based on the defect feature label set, the internal defect features of transparent and / or semi-transparent injection molded parts in the original image set are extracted using a transparency analysis algorithm to obtain an optimized defect feature label set; The target defect detection model is obtained by training the defect detection model to be trained based on the original image set and the optimized defect feature label set. The target defect detection model inputs the image of the injection molded part to be detected and outputs the defect detection result corresponding to the image of the injection molded part to be detected. The step of extracting internal defect features from transparent and / or semi-transparent injection molded parts in the original image set using a transparency analysis algorithm, based on the defect feature label set, to obtain an optimized defect feature label set, includes: The transmission path and / or light intensity distribution of light in the transparent and / or semi-transparent injection molded parts are calculated using a transparency analysis algorithm. When the transmission path and / or light intensity distribution do not meet the preset range, the internal defect features of transparent and / or semi-transparent injection molded parts in the original image set are extracted to obtain an optimized defect feature label set. The step of training the defect detection model to be trained based on the original image set and the optimized defect feature label set to obtain the target defect detection model includes: An adaptive feature adjustment algorithm is used to dynamically update the boundary and texture feature weights of the defect model according to changes in lighting conditions, resulting in an optimized defect detection model. Based on the changes in lighting conditions, the light intensity value is obtained, and a preset lighting classification rule is adopted. If the light intensity value exceeds the preset threshold, the boundary feature weights in the feature set are increased to obtain the first feature set. For the first feature set, an adaptive algorithm is used to analyze the texture features and extract high-frequency components from the distribution of texture features. If the high-frequency components meet the preset texture saliency threshold, the optimized feature combination is determined to obtain the second feature set. By using the second feature set, the boundary and texture features of the defect model are dynamically updated. A convolutional neural network is then used to train the defect detection model, resulting in an optimized defect detection model.

2. The method according to claim 1, characterized in that, The acquisition of the original image set of the injection molded part surface and interior under preset light source conditions includes: Determine whether the image brightness of the images in the original image set meets a preset brightness threshold; If the image brightness does not meet the preset brightness threshold, the light source conditions are adjusted using a preset light source intensity adjustment algorithm based on the material reflection parameters of the injection molded part to obtain the first adjusted light source conditions. The first adjusted light source conditions are used to make the image brightness of the acquired image meet the preset brightness threshold. Under the first adjusted light source conditions, images of the surface and interior of the injection molded part are acquired again to obtain the original image set.

3. The method according to claim 2, characterized in that, The acquisition of the original image set of the injection molded part surface and interior under preset light source conditions also includes: Determine whether the image resolution of the images in the original image set meets a preset resolution threshold; If the image resolution does not meet the preset resolution threshold, the image resolution is enhanced using a bilinear interpolation algorithm to obtain an enhanced image set. Based on the enhanced image set, a light source wavelength selection algorithm is used to determine the target light source wavelength combination for transparent or semi-transparent injection molded parts; The light source conditions are adjusted according to the target light source wavelength combination to obtain the second adjusted light source conditions. The second adjusted light source conditions are used to make the gray range of the acquired image meet the preset gray range. Under the second adjusted light source condition, images of the surface and interior of the injection molded part are acquired again to obtain the original image set.

4. The method according to any one of claims 1-3, characterized in that, The step of using a preset defect feature extraction algorithm to extract defect features from the original image set to obtain a defect feature set includes: Obtain the image grayscale range and noise distribution of the original image set; Based on the noise distribution, the original image set is filtered using an adaptive mean filtering algorithm to obtain a denoised image set. An adaptive contrast stretching algorithm is used to adjust the grayscale range of the denoised image set to enhance image contrast, resulting in a contrast-enhanced image set. The defect feature set is obtained by performing defect feature extraction processing on the contrast-enhanced image set using a preset defect feature extraction algorithm.

5. The method according to claim 4, characterized in that, The defect feature set is obtained by performing defect feature extraction processing on the contrast-enhanced image set using a preset defect feature extraction algorithm, including: Extract the image gradient information corresponding to the contrast-enhanced image set, and use the Canny edge detection algorithm to generate defect boundary contour data based on the image gradient information; Based on the defect boundary contour data, the defect texture features are extracted using the gray-level co-occurrence matrix algorithm to generate the defect feature set.

6. The method according to claim 5, characterized in that, The step of using a preset defect matching algorithm to perform similarity matching between the defect feature set and the preset defect template to obtain the target similarity includes: The minimum distance between the defect boundary contour data and the contour points corresponding to the preset defect template is calculated using the Hausdorff distance algorithm. The target similarity is calculated based on the minimum distance between the contour points.

7. The method according to claim 5, characterized in that, When the target similarity meets a preset similarity threshold, the defect type corresponding to the preset defect template is determined as the defect type corresponding to the defect feature set, resulting in a defect feature tag set, including: When the target similarity meets the preset similarity threshold, the region corresponding to the defect boundary contour data is marked as the initial defect region. The boundaries of the initial defect region are refined using a region segmentation algorithm to obtain a refined defect region; Determine whether the similarity between the refined defect region and the preset defect template meets the preset similarity threshold; When the similarity between the refined defect region and the preset defect template meets the preset similarity threshold, the defect type corresponding to the preset defect template is determined as the defect type corresponding to the refined defect region. An image merging algorithm is used to fuse the defect type corresponding to the refined defect region with the original image set to generate a defect feature label set.

8. The method according to claim 7, characterized in that, The step of determining whether the similarity between the refined defect region and the preset defect template meets the preset similarity threshold includes: The gray-level co-occurrence matrix algorithm is used to extract the defect texture features corresponding to the refined defect region, and the Canny edge detection algorithm is used to extract the defect boundary contour data corresponding to the refined defect region. The target defect features are obtained by calculating the weighted features corresponding to the defect texture features and the defect boundary contour data using a weighted fusion algorithm. If the Euclidean distance between the target defect feature and the preset defect template is less than a preset distance threshold, then calculate whether the cosine similarity between the target defect feature and the preset defect template satisfies the preset similarity threshold.

9. A vision-based inspection system for defect detection in automotive interior injection molded parts, characterized in that, A method for detecting defects in automotive interior injection molded parts based on vision inspection as described in any one of claims 1 to 8 includes: The acquisition unit is used to acquire a set of original images of the surface and interior of the injection molded part under preset light source conditions. The injection molded part includes at least one of transparent, semi-transparent and opaque types. The light source conditions include at least one of light source type, light source position, light source angle, light source intensity and light source wavelength. An extraction unit is used to perform defect feature extraction processing on the original image set using a preset defect feature extraction algorithm to obtain a defect feature set, wherein the defect feature set includes surface defect features and internal defect features. The matching unit is used to perform similarity matching between the defect feature set and the preset defect template using a preset defect matching algorithm to obtain the target similarity. The processing unit is used to determine the defect type corresponding to the preset defect template as the defect type corresponding to the defect feature set when the target similarity meets the preset similarity threshold, so as to obtain the defect feature tag set; The extraction unit is further configured to, based on the defect feature label set, use a transparency analysis algorithm to extract internal defect features of transparent and / or semi-transparent injection molded parts in the original image set to obtain an optimized defect feature label set; The training unit is used to train the defect detection model to be trained based on the original image set and the optimized defect feature label set, so as to obtain the target defect detection model; The output unit is used to input the image of the injection molded part to be detected into the target defect detection model and output the defect detection result corresponding to the image of the injection molded part to be detected.

Citation Information

Patent Citations

  • Product detection method and system based on machine vision

    CN119323659A

  • PCB (Printed Circuit Board) defect detection method, device, equipment and storage medium

    CN119379662A

  • Training method and system of diffusion plate defect detection model and medium

    CN119904455A