Method and system for detecting surface quality of injection molded part

By introducing Gaussian prior information and shape constraint loss function in the surface quality detection of injection molded parts, optimizing the preset network encoder, extracting the geometric shape of the surface defects of injection molded parts, solving the problem of low detection accuracy in the prior art, and achieving efficient and accurate defect detection.

CN119648688APending Publication Date: 2025-03-18SHAANXI RUNZE BROSE TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510147102.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-11
Publication Date
2025-03-18

AI Technical Summary

Technical Problem

When detecting surface defects of injection molded parts, existing machine vision technology is difficult to automatically extract image classification features, resulting in low detection accuracy and difficulty in adapting to complex defect detection tasks.

Method used

By obtaining the surface images of injection molded parts under different lighting conditions for preprocessing, the geometry of the defect area is extracted, and a two-dimensional Gaussian distribution is generated based on the geometric shape parameters as the image label, Gaussian prior information and shape constraint loss function are introduced, and the preset network encoder is optimized using weighted fusion to obtain the defect detection model.

Benefits of technology

It improves the model's perception of defect shapes, enhances the model's robustness, reduces the risk of overfitting, improves detection accuracy and training efficiency, and is suitable for efficient and accurate defect detection in complex lighting conditions and different production batches.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119648688A_ABST
    Figure CN119648688A_ABST
Patent Text Reader

Abstract

The invention relates to the field of image processing, in particular to an injection molding part surface quality detection method and system, and the method comprises the steps: obtaining surface images of various types of injection molding parts under different illumination conditions, carrying out the preprocessing, extracting the geometrical shape of a defect region, and carrying out the fitting based on the geometrical shape parameters, gaussian distributions are generated as image tags. And introducing the Gaussian distribution into a preset network encoder, and fusing the Gaussian distribution with the intermediate feature map in a weighted fusion mode. And correcting the fusion coefficient by using a loss function value in the last complete training period as a regulation factor and combining the periodicity of a sine function to obtain a defect detection model. Inputting a surface image in real time, and outputting a quality detection result. According to the method, Gaussian prior information and a shape constraint loss function are introduced, so that the model can more accurately identify and position defects on the surface of the injection molded part, and the accuracy of model detection is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing, and more specifically, to a method and system for detecting the surface quality of an injection molded part. Background Art

[0002] Injection molded parts refer to plastic products produced by injection molding. Injection molding is a common plastic processing method used in the production of various industrial and consumer products. Injection molded parts are prone to various surface defects during the production process, such as scratches, dents, bubbles, burrs, etc. These defects not only affect the appearance quality of the product, but may also affect the function and service life of the product. Therefore, efficient and accurate detection of surface defects of injection molded parts is a key link to ensure product quality.

[0003] The existing Chinese patent application document with publication number CN117036205A discloses an injection molded part production quality inspection method based on image enhancement, including: obtaining a grayscale image of the injection molded part surface image and the contrast of pixels in the grayscale image, obtaining a sharpened image, obtaining the contrast of pixels in the sharpened image, obtaining a window enhancement degree sequence, obtaining a weighted fluctuation degree of the window enhancement degree sequence according to the contrast enhancement degree of pixels in the window enhancement degree sequence, obtaining the adjusted Laplace parameters of the window center pixel, sharpening and normalizing the grayscale image of the injection molded part surface image according to the adjusted Laplace sharpening parameters, and obtaining a final sharpening result image.

[0004] The application document adjusts the sharpening degree of different areas of the image by combining the distribution law of pixel points in the image, so that the defective area of ​​the injection molded part can be found more quickly in the sharpened image. However, the current use of machine vision to inspect injection molded parts is difficult due to the large size, curved shape, curved surface and strong mirror reflection of injection molded parts. Although machine vision technology can overcome the shortcomings of manual inspection, traditional technology cannot automatically extract image classification features and is difficult to adapt to complex defect detection tasks, resulting in low detection efficiency and low accuracy. Summary of the invention

[0005] In order to solve the problem that machine vision technology can overcome the shortcomings of manual detection, but traditional technology cannot automatically extract image classification features and is difficult to adapt to complex defect detection tasks, resulting in low detection accuracy, the present invention provides solutions in the following aspects.

[0006] In a first aspect, a surface quality detection method for injection molded parts includes: obtaining surface images of various types of injection molded parts under different lighting conditions and preprocessing them, extracting the geometric shape of the defect area, fitting based on the geometric shape parameters, generating a Gaussian distribution of a two-dimensional geometric shape as an image label for training a preset network encoder; introducing the Gaussian distribution into the preset network encoder to provide prior information on the shape of the defect area, fusing the Gaussian distribution with the intermediate feature map in a weighted fusion manner according to the feature extraction of the preset network encoder, using the loss function value in the last complete training cycle as a control factor, using the periodicity of the sine function and the control factor to correct the fusion coefficient in the weighted fusion, and obtaining a significant fusion coefficient for optimizing the preset network encoder to obtain a defect detection model; obtaining the surface image of the injection molded part in real time and inputting it into the defect detection model to obtain the surface quality detection result of the injection molded part; wherein the significant fusion coefficient satisfies the following relationship: ; In the formula, Indicates The Gaussian prior fusion coefficient of the loss value in the last complete training cycle in the training round, represents the maximum value of the fusion coefficient, represents the period value of the sine function, represents the current training round, represents the total number of training rounds, represents the sine function, , represents a hyperparameter.

[0007] By dynamically adjusting the fusion coefficient, the model's perception of defect shapes is improved, the model's robustness is enhanced, the risk of overfitting is reduced, and the training efficiency is improved. It can achieve higher detection accuracy in fewer training rounds and is suitable for efficient and accurate defect detection in actual industrial environments.

[0008] Preferably, the preprocessing to extract the geometric shape of the defect area includes: The surface image is grayed to obtain a gray image, a filter is used to remove noise from the gray image, an adaptive threshold method is used to perform threshold segmentation on the gray image, an edge detection algorithm is used to obtain the edge contour of the defect area, and the maximum connected domain is extracted as the suspected defect area; The least squares method is used to fit the edge points of the suspected defect area to obtain the geometric shape of the defect area.

[0009] Through preprocessing steps such as grayscale processing, noise removal, threshold segmentation and edge detection, the defect area can be effectively highlighted and the interference of background noise can be reduced. The least squares method is used to fit the suspected defect area, which can accurately extract the geometric shape of the defect area and provide high-quality annotation data for subsequent model training. The preprocessing step ensures the consistency and quality of the input data, so that the model can maintain good performance under different lighting conditions and production batches. By accurately extracting the geometric shape of the defect area, the model can better learn the characteristics of the defect and improve the recognition ability of defects of different shapes and sizes.

[0010] Preferably, the image tag includes: A two-dimensional geometric Gaussian distribution is generated as an image label according to the geometric shape parameters. Any defect is used as the annotation defect to generate an all-zero matrix consistent with the size of the surface image. The Gaussian distribution value of each pixel in the geometry is calculated according to the geometric shape parameters and normalized to the standard as the image label of the surface image.

[0011] By generating a two-dimensional geometric Gaussian distribution based on geometric shape parameters, the shape and position of the defect area can be described more accurately. As a continuous probability distribution, Gaussian distribution can provide smooth transition and shape information of the defect area. This smooth annotation method enables the model to better perceive the shape and boundary of the defect during the learning process and improve the recognition ability of complex shapes.

[0012] Preferably, the method for obtaining the period value of the sine function includes: The sine function is used to perform the least square method to fit the fusion coefficient sequence in the training process, and the fitted sine function is obtained, and the period value corresponding to the continuous fitted sine function is obtained; In response to the period value of the continuous fitting function being a stable constant, the period value corresponding to the constant is used as the period value of the sine function corresponding to the fusion coefficient in the current training process; The determination process of the stable constant is as follows: if the variance of the corresponding constant in the iterative process of a preset number of consecutive times is less than a preset threshold, then it is a stable constant.

[0013] By using the sine function to perform least squares method to fit the fusion coefficient sequence during the training process, the period value of the sine function can be adaptively determined. The period value reflects the changing law of the fusion coefficient during the training process, making the adjustment of the fusion coefficient more in line with the needs of actual training.

[0014] Preferably, the model of the preset network encoder is a ResNet network, the input of the preset network encoder is a surface image of the injection molded part acquired in real time, and the output is a defect confidence score of each pixel after normalization, wherein the defect confidence score is divided into a probability indicating that the pixel is the center of the pixel; The loss function adopts the mean square error loss function. When the mean square error loss function value is minimum or reaches a certain number of training times, the model training is completed.

[0015] Preferably, the loss function further includes: ; In the formula, represents the shape constraint loss function, Indicates that the data set contains the total number of samples, Indicates Samples corresponding to the position The weight of the pixel value at Indicates The predicted value of the sample model, Indicates Elliptical Gaussian annotations generated by samples.

[0016] By introducing a weight matrix through the shape constraint loss function, the model pays more attention to the prediction accuracy of the defect area rather than the background area. This helps the model better learn the geometric shape of the defect and improve the accuracy of defect detection.

[0017] Preferably, the Samples corresponding to the position The weights of the pixel values ​​at , including: In response to Samples corresponding to the position If it is in the Gaussian distribution, then select Samples corresponding to the position The original weight of the pixel value at , otherwise, a hyperparameter is selected.

[0018] In a second aspect, a surface quality inspection system for injection molded parts includes: a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the above-mentioned surface quality inspection method for injection molded parts is implemented.

[0019] The present invention has the following effects: 1. By introducing Gaussian prior information and shape constraint loss function, the model can more accurately identify and locate defects on the surface of injection molded parts. Gaussian prior information helps the model better learn the shape characteristics of defects during training, while the shape constraint loss function ensures that the model pays more attention to the defect area during prediction and reduces the interference of background noise. This combination enables the model to maintain high-precision detection capabilities under complex lighting conditions and different production batches.

[0020] 2. The present invention uses a dynamically adjusted Gaussian prior fusion coefficient to enable the model to adaptively adjust its reliance on prior information during training. In the early stages of training, the model mainly relies on data features to avoid overfitting; in the middle stages, the influence of prior information is gradually increased to improve the recognition ability of complex shapes; in the final stages, the influence of prior information is reduced to ensure the stability of the model. This dynamic adjustment mechanism enables the model to maintain good performance at different training stages and enhances the robustness of the model.

[0021] 3. The present invention fits the periodic value of the sine function through the least squares method, and the model can find the optimal fusion coefficient adjustment strategy more quickly. In addition, the introduction of the shape constraint loss function allows the model to focus more on the defect area during the training process, reducing unnecessary calculations and improving training efficiency. Combined with the mean square error loss function, the model can achieve higher accuracy in fewer training rounds, reducing training time and consumption of computing resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] By reading the following detailed description with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein: Figure 1 It is a method flow chart of steps S1 to S3 in a method for detecting surface quality of an injection molded part according to an embodiment of the present invention.

[0023] Figure 2 The present invention is a structural block diagram of a surface quality detection system for injection molded parts according to an embodiment of the present invention. DETAILED DESCRIPTION

[0024] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0025] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0026] Reference Figure 1 A method for detecting the surface quality of an injection molded part includes steps S1 to S3, which are specifically as follows: S1: Obtain and preprocess the surface images of various types of injection molded parts under different lighting conditions, extract the geometric shapes of the defective areas, fit them based on the geometric shape parameters, and generate a Gaussian distribution of two-dimensional geometric shapes as image labels for training the preset network encoder.

[0027] Extract the geometry of the defect area, including: The surface image is grayed to obtain a gray image, a filter is used to remove noise from the gray image, an adaptive threshold method is used to perform threshold segmentation on the gray image, an edge detection algorithm is used to obtain the edge contour of the defect area, and the maximum connected domain is extracted as the suspected defect area; The least squares method is used to fit the edge points of the suspected defect area to obtain the geometric shape of the defect area.

[0028] It should be noted that traditional defect detection is generally based on the box-type target detection method. The target detection method uses a box-type mark on the defect area, which will make it difficult to extract the edge position of the defect, mainly because the defect position is relatively accurate. In order to more accurately describe the shape of the defect, a more flexible shape representation method is needed. Therefore, the present invention uses defect fitting to generate defect labels, and at the same time converts the defect detection task into a pixel-by-pixel prediction task, and determines the defect position by the pixel confidence output by the model. That is, the higher the pixel confidence, the more likely the position is a defect. At the same time, based on the above analysis, the use of elliptical Gaussian distribution can generate the actual shape of the defect as a label, avoiding the errors caused by the traditional circular assumption.

[0029] Exemplarily, in this embodiment, the geometric shape of the defect area is preset to be an ellipse. Specifically, the ellipse parameters include: center point coordinates, major and minor axis lengths, and rotation angles.

[0030] Generate image labels based on defect areas, including: A two-dimensional geometric Gaussian distribution is generated as the image label according to the set shape parameters. Any defect is used as the annotation defect to generate an all-zero matrix consistent with the size of the surface image. The Gaussian distribution value of each pixel in the geometry is calculated according to the geometric shape parameters and normalized to the standard as the image label of the surface image.

[0031] Specifically, the Gaussian distribution value satisfies the following relationship: ; In the formula, Indicates Gaussian distribution value of pixel position, represents the determinant of the matrix, represents the covariance matrix of the Gaussian distribution, represents the position of the pixel in the surface image, represents the mean vector of the Gaussian distribution, which is the center position of the ellipse. represents the transpose of a matrix, Indicates that the sub-function An exponential function with base .

[0032] It should be noted that the calculation of Gaussian distribution value is a well-known technology to those skilled in the art. For ease of understanding, the formula for calculating the Gaussian distribution value is briefly described.

[0033] In addition, in another embodiment, the defective area may be manually annotated and used as an image label.

[0034] S2: Introduce Gaussian distribution into the preset network encoder to provide prior information on the shape of the defect area. According to the feature extraction of the preset network encoder, use weighted fusion to fuse the Gaussian distribution with the intermediate feature map. Use the loss function value in the last complete training cycle as a control factor. Use the periodicity of the sine function and the control factor to correct the fusion coefficient in the weighted fusion to obtain a significant fusion coefficient, which is used to optimize the preset network encoder and obtain a defect detection model.

[0035] Specifically, weighted fusion satisfies the following relationship: ; In the formula, Represents the fused feature map at each stage, Represents the feature map of each stage, represents the Gaussian prior fusion coefficient, Represents the center point of the Gaussian distribution.

[0036] That is to say, the weighted fusion method is a well-known technology in the art. The above-mentioned weighted fusion adopts a conventional operation method. The example formula is as follows to facilitate understanding of the following.

[0037] It should be noted that if the Gaussian distribution map obtained by fitting the input image is directly added to the network as prior information, the model will easily overfit and cause training failure. In order to improve the stability of the training process and ensure that the model can learn Gaussian prior information, a Gaussian prior weighted fusion training strategy is proposed, which adaptively fuses Gaussian prior information in the Encoder network to optimize the model training process.

[0038] It should be noted that the revised logic is: Initialization: At the beginning of training, the fusion coefficient is initialized to , reducing the influence of Gaussian prior on feature maps and making the network mainly rely on data features.

[0039] Mid-term adjustment: As training progresses, the fusion coefficient Gradually increase it to increase the influence of Gaussian prior information on network learning and help the model improve its ability to recognize complex shapes.

[0040] Final adjustment: Near the end of training, the fusion coefficient Lower it again, keeping the learning rate small to avoid the model losing its reliance on the Gaussian prior.

[0041] In this embodiment, a sine function is used for adjustment: the periodicity of the sine function is used to integrate the coefficients During the training process, it changes according to the sinusoidal waveform to ensure a smooth transition of the training process.

[0042] Use regulatory factor adjustment: Dynamically adjust the fusion coefficient according to the loss function value in the last complete training cycle , ensuring that the model increases the Gaussian prior weight when the loss value is large, and decreases the Gaussian prior weight otherwise.

[0043] The method for obtaining the period value of the sine function includes: The sine function is used to perform the least square method to fit the fusion coefficient sequence in the training process, and the fitted sine function is obtained, and the period value corresponding to the continuous fitted sine function is obtained; In response to the period value of the continuous fitting function being a stable constant, the period value corresponding to the constant is used as the period value of the sine function corresponding to the fusion coefficient in the current training process.

[0044] The determination process of the stable constant is as follows: if the variance of the corresponding constant in the iterative process of a preset number of consecutive times is less than a preset threshold, then it is a stable constant.

[0045] Exemplarily, in this embodiment, the preset number of times is 5 times, and the preset threshold is 0.2, which can be adjusted by the implementer according to the specific implementation scenario.

[0046] That is to say, the periodicity of the sine function makes the fusion coefficient change according to the sine waveform during the training process, which helps the model maintain stability in the early and late stages of training, while making full use of Gaussian prior information in the mid-term stage; the period value determines the period of the sine function, that is, the number of training rounds required to complete a complete periodic change. By fitting the fusion coefficient sequence learned during the training process by the least squares method, the period value can be adaptively determined to adapt to different training sets and task requirements.

[0047] Among them, the periodic correction fusion coefficient based on the sine function satisfies the following relationship: ; In the formula, represents the significant fusion coefficient, represents the initialized fusion coefficient, represents the maximum value of the fusion coefficient, represents the period value of the sine function, represents the current training round, represents the total number of training rounds, Represents the sine function.

[0048] Further analysis shows that unilaterally adjusting the weight of the Gaussian prior during training may lead to a mismatch with the learning speed of the network. For example, in the unstable stage of the initial training, if the Gaussian prior weight is too large, the representation learned by the model may be biased towards the Gaussian prior rather than the data itself. Therefore, the loss value of the last complete training cycle is taken. Modeling a regulator as a reference , constraining the automatic adjustment of the Gaussian prior weights according to the loss value.

[0049] Among them, the fusion coefficient is dynamically adjusted based on the loss function value in the last complete training cycle to satisfy the following relationship: ; In the formula, represents the regulatory factor, represents the loss value in the last complete training cycle, represents the current training round, represents a parameter that is highly related to the training round, , represents a hyperparameter.

[0050] That is to say, in this embodiment, , , can be adjusted according to specific circumstances, The domain of , the value range is is a monotonically increasing function of . ,in, represents the current training round, represents the total number of training rounds, It is highly related to the training round, that is, the later the training, the The smaller the value, the less influence the regulatory factor will have.

[0051] In summary, the final dynamic adjustment formula of the fusion coefficient is obtained, which is the significant fusion coefficient, ( can be omitted), the significant fusion coefficient satisfies the following relationship: ; In the formula, Indicates The Gaussian prior fusion coefficient of the loss value in the last complete training cycle in the training round, represents the maximum value of the fusion coefficient, represents the period value of the sine function, represents the current training round, represents the total number of training rounds, represents the sine function, , represents a hyperparameter.

[0052] That is to say, Generate periodic changes to ensure that the fusion coefficients change in a sinusoidal waveform during training. The effect of can be when the loss value is large, Outputting larger values ​​increases the Gaussian prior weight, and vice versa.

[0053] The model of the preset network encoder is a ResNet network. The input of the preset network encoder is a surface image of the injection molded part acquired in real time, and the output is a normalized defect confidence score for each pixel, wherein the defect confidence score represents the probability that the pixel is the pixel center.

[0054] The loss function adopts the mean square error loss function. When the mean square error loss function value is minimum or reaches a certain number of training times, the model training is completed.

[0055] In this embodiment, the Encoder-Decoder architecture is adopted, and the backbone network can adopt a multi-stage network such as ResNet, SwinTransformer, etc., which can be selected according to the specific situation.

[0056] Specifically, the mean square error loss function satisfies the following relationship: ; In the formula, represents the mean square error loss function, Indicates that the data set contains the total number of samples, Indicates The true value of the samples, Indicates The predicted value of a sample.

[0057] That is, the mean squared error loss function measures the average error between the model's predictions and the true values. It amplifies the error by squaring the difference, so that larger errors contribute more to the loss function, thereby encouraging the model to reduce the difference between the predicted values ​​and the true values.

[0058] In addition, in another embodiment, further analysis is required. Since the concave defects on the surface of the injection molded parts are complex in shape and often present a non-standard circular shape, the MSE loss is a serious problem: 1. Ignoring shape information: MSE loss only focuses on pixel-level errors and does not consider the geometric shape characteristics of the defect. Especially when the defect edge is blurred or non-circular, it is difficult for the model to learn the accurate defect boundary.

[0059] 2. Background interference: When the errors between the defect area and the background are similar, the MSE loss may give too much weight to the errors in the background area, thus affecting the effectiveness of training.

[0060] Therefore, a shape constraint loss function is proposed, which gives higher weights to pixels in the defect area when calculating the loss, so as to encourage the model to better learn the geometric shape of the defect. The shape constraint loss combines the MSE loss with a weight matrix based on the shape of the defect area. The weight matrix is ​​dynamically generated according to the results of the ellipse fitting to ensure that the model focuses on the key areas of the defect. In order to make the model pay more attention to the defect area, the weight matrix is ​​introduced to adjust the contribution of each sample error to the total loss.

[0061] Specifically, the shape constraint loss function satisfies the following relationship: ; In the formula, represents the shape constraint loss function, Indicates that the data set contains the total number of samples, Indicates Samples corresponding to the position The weight of the pixel value at Indicates The predicted value of the sample model, Indicates Elliptical Gaussian annotations generated by samples.

[0062] No. Samples corresponding to the position The weights of the pixel values ​​at , including: In response to Samples corresponding to the position If it is in the Gaussian distribution, then select Samples corresponding to the position The original weight of the pixel value at , otherwise, a hyperparameter is selected.

[0063] Specifically, the weight of the pixel value satisfies the following relationship: ; In the formula, Indicates Samples corresponding to the position The weight of the pixel value at Indicates Samples corresponding to the position The original weight of the pixel value at represents Gaussian distribution annotation, represents a hyperparameter.

[0064] That is, the initialization is generated based on the ellipse fitting result, giving higher weights to the defect area and lower weights to the background area. , exemplary , It is a minimum positive value and can be adjusted according to actual training conditions.

[0065] In this embodiment, the loss function adopts the mean square error loss function and the shape constraint loss function. When the mean square error loss function value and the shape constraint loss function value are minimum or reach a certain number of training times, the model training is completed.

[0066] S3: The surface image of the injection molded part is acquired in real time and input into the defect detection model to obtain the surface quality detection result of the injection molded part.

[0067] The present invention also provides a surface quality detection system for injection molded parts. Figure 2 As shown, the system includes a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, a method for detecting surface quality of an injection molded part according to the first aspect of the present invention is implemented.

[0068] The system also includes other components familiar to those skilled in the art, such as a communication bus and a communication interface. The configuration and functions of these components are known in the art and will not be described in detail here.

[0069] In the present invention, the aforementioned memory may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, apparatus or device. For example, a computer-readable storage medium may be any appropriate magnetic storage medium or magneto-optical storage medium, such as a resistive random access memory RRAM (Resistive Random Access Memory), a dynamic random access memory DRAM (Dynamic Random Access Memory), a static random access memory SRAM (Static Random-Access Memory), an enhanced dynamic random access memory EDRAM (Enhanced Dynamic Random Access Memory), a high-bandwidth memory HBM (High-Bandwidth Memory), a hybrid memory cube HMC (Hybrid Memory Cube), etc., or any other medium that can be used to store the required information and can be accessed by an application, a module, or both. Any such computer storage medium may be part of a device or accessible or connectable to a device. Any application or module described in the present invention may be implemented by computer-readable / executable instructions stored or otherwise maintained by such a computer-readable medium.

[0070] In the description of this specification, "plurality" or "several" means at least two, such as two, three or more, etc., unless otherwise clearly and specifically defined.

[0071] Although this specification has shown and described a number of embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will conceive of many modifications, changes and alternatives without departing from the ideas and spirit of the present invention. It should be understood that in the practice of the present invention, various alternatives to the embodiments of the present invention described herein may be employed.

Claims

1. A method for detecting the surface quality of an injection molded part, characterized in that: include: Obtain and preprocess the surface images of various types of injection molded parts under different lighting conditions, extract the geometric shape of the defect area, fit it based on the geometric shape parameters, and generate a Gaussian distribution of the two-dimensional geometric shape as an image label for the training of the preset network encoder; The Gaussian distribution is introduced into the preset network encoder to provide prior information on the shape of the defect area. According to the feature extraction of the preset network encoder, the Gaussian distribution is fused with the intermediate feature map using a weighted fusion method. The loss function value in the last complete training cycle is used as a control factor. The periodicity of the sine function and the control factor are used to correct the fusion coefficient in the weighted fusion to obtain a significant fusion coefficient, which is used to optimize the preset network encoder and obtain a defect detection model. The surface image of the injection molded part is acquired in real time and input into the defect detection model to obtain the surface quality detection result of the injection molded part; The significant fusion coefficient satisfies the following relationship: ; In the formula, Indicates The Gaussian prior fusion coefficient of the loss value in the last complete training cycle in the training round, represents the maximum value of the fusion coefficient, represents the period value of the sine function, represents the current training round, represents the total number of training rounds, represents the sine function, , Represents a hyperparameter.

2. A method for detecting surface quality of injection molded parts according to claim 1, characterized in that: The preprocessing to extract the geometric shape of the defect area includes: The surface image is grayed to obtain a gray image, a filter is used to remove noise from the gray image, an adaptive threshold method is used to perform threshold segmentation on the gray image, an edge detection algorithm is used to obtain the edge contour of the defect area, and the maximum connected domain is extracted as the suspected defect area; The least squares method is used to fit the edge points of the suspected defect area to obtain the geometric shape of the defect area.

3. The surface quality detection method of an injection molded part according to claim 1, characterized in that: The image tag includes: A two-dimensional geometric Gaussian distribution is generated as an image label according to the geometric shape parameters. Any defect is used as the annotation defect to generate an all-zero matrix consistent with the size of the surface image. The Gaussian distribution value of each pixel in the geometry is calculated according to the geometric shape parameters and normalized to the standard as the image label of the surface image.

4. The surface quality detection method of an injection molded part according to claim 1, characterized in that: The method for obtaining the period value of the sine function includes: The sine function is used to perform the least square method to fit the fusion coefficient sequence in the training process, and the fitted sine function is obtained, and the period value corresponding to the continuous fitted sine function is obtained; In response to the period value of the continuous fitting function being a stable constant, the period value corresponding to the constant is used as the period value of the sine function corresponding to the fusion coefficient in the current training process; The determination process of the stable constant is as follows: if the variance of the corresponding constant in the iterative process of a preset number of consecutive times is less than a preset threshold, then it is a stable constant.

5. The surface quality detection method of an injection molded part according to claim 1, characterized in that: The model of the preset network encoder is a ResNet network, the input of the preset network encoder is a surface image of the injection molded part acquired in real time, and the output is a defect confidence score of each pixel after normalization, wherein the defect confidence score is divided into a probability indicating that the pixel is the center of the pixel; The loss function adopts the mean square error loss function. When the mean square error loss function value is minimum or reaches a certain number of training times, the model training is completed.

6. A method for detecting surface quality of injection molded parts according to claim 5, characterized in that: The loss function also includes: ; In the formula, represents the shape constraint loss function, Indicates that the data set contains the total number of samples, Indicates Samples corresponding to the position The weight of the pixel value at Indicates The predicted value of the sample model, Indicates Elliptical Gaussian annotations generated by samples.

7. A method for detecting surface quality of injection molded parts according to claim 6, characterized in that: The said Samples corresponding to the position The weights of the pixel values ​​at , including: In response to Samples corresponding to the position If it is in the Gaussian distribution, then select Samples corresponding to the position The original weight of the pixel value at , otherwise, a hyperparameter is selected.

8. A surface quality inspection system for injection molded parts, characterized in that: include: A processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the surface quality detection method of the injection molded part according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Injection molding part production quality detection method based on image enhancement

    CN117036205A