An artificial intelligence-based plastic product quality detection method, device and medium

By performing angle identification and light intensity feature analysis on polarization images of plastic products, and combining multi-level convolutional neural networks and spatial attention mechanisms, the problems of insufficient polarization feature optimization and defect localization accuracy were solved, and accurate identification and boundary resolution of defect areas were achieved.

CN121147136BActive Publication Date: 2026-04-24SUZHOU JINRONG PRECISION MOLDING TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SUZHOU JINRONG PRECISION MOLDING TECH CO LTD
Filing Date
2025-09-02
Publication Date
2026-04-24

AI Technical Summary

Technical Problem

Existing technologies have shortcomings in polarization feature optimization and defect location accuracy. Traditional methods have failed to effectively solve the problems of polarization feature calculation distortion and insufficient sensitivity to defect areas.

Method used

By acquiring polarization images of plastic products, angular position identification and light intensity feature distribution analysis are performed. Combined with multi-level convolutional neural networks and spatial attention mechanisms, defect thermal distribution maps are generated to identify defect areas and diffusion boundaries.

Benefits of technology

It enables precise location and diffusion boundary analysis of minute defects in plastic products, breaking through the blind spot of traditional methods in identifying blurred boundary areas, and improving the sensitivity and accuracy of defect feature extraction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121147136B_ABST
    Figure CN121147136B_ABST
Patent Text Reader

Abstract

The application discloses a kind of based on artificial intelligence's plastic product quality detection method, equipment and medium, it is related to industrial vision technology field, including, the polarization image of acquisition plastic product and quality demand data, and angle position mark is carried out according to the polarization angle of polarization image, generates polarization image set;Extract the light intensity characteristic distribution atlas of polarization image set, output feature polarization image and feature contrast coefficient;Image registration and polarization fusion are carried out to feature polarization image, generate two-dimensional polarization feature atlas;Two-dimensional polarization feature atlas is input into multilevel convolutional neural network, and the defect thermal power distribution graph is output;According to the probability gradient change of defect thermal power distribution graph, output defect region data;Product eligibility determination is carried out to defect region data and quality demand data, and output quality detection report.The application realizes the accurate positioning of plastic product tiny defect and diffusion boundary analysis by multidimensional polarization feature fusion and defect response modeling.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of industrial vision technology, and in particular to a method, equipment and medium for quality inspection of plastic products based on artificial intelligence. Background Technology

[0002] The quality inspection technology for plastic products is rapidly developing towards the integration of multi-dimensional optical perception and intelligent decision-making. In recent years, significant progress has been made in surface defect detection methods based on multi-angle polarization imaging. By analyzing the polarization state distribution of reflected light from the material surface, joint features of light intensity and polarization angle can be extracted, revealing changes in local light scattering characteristics caused by defects such as microcracks and bubbles. The current mainstream approach relies on polarization-sensitive detectors to construct multi-angle polarization image sequences, and then uses convolutional neural networks (CNNs) to perform end-to-end modeling of the two-dimensional polarization feature map, gradually forming a closed-loop detection process from feature response generation to defect heatmap output. The synergistic optimization of probabilistic heatmaps and clustering algorithms provides a new path for the topological analysis of defect diffusion boundaries, promoting the evolution of plastic product quality inspection from traditional threshold segmentation to intelligent recognition based on physical field distribution.

[0003] However, existing technologies have shortcomings in polarization feature optimization and defect localization accuracy. Traditional methods typically use fixed-angle polarization image stitching without establishing a dynamic light intensity-angle optimization model, leading to distortion in the calculation of feature contrast coefficients. The image registration process lacks an adaptive correction mechanism for the affine transformation matrix, making it susceptible to artifacts introduced by angle deviations, affecting the continuity of the two-dimensional feature map. Existing deep learning models mostly rely on global feature extraction and do not introduce spatial attention mechanisms to weight and enhance local gradient changes in the defect region, resulting in insufficient sensitivity of feature response values ​​to diffusion boundaries. Summary of the Invention

[0004] In view of the aforementioned existing problems, the present invention is proposed.

[0005] Therefore, this invention provides an artificial intelligence-based method for quality inspection of plastic products to address the deficiencies in polarization feature optimization and defect location accuracy.

[0006] To solve the above-mentioned technical problems, the present invention provides the following technical solution:

[0007] In a first aspect, the present invention provides an artificial intelligence-based method for quality inspection of plastic products, comprising: acquiring polarization images and quality requirement data of plastic products, and marking the angular positions according to the polarization angles of the polarization images to generate a set of polarization images; extracting the light intensity feature distribution spectrum of the set of polarization images, performing polarization angle optimization analysis based on the light intensity feature distribution spectrum, and outputting feature polarization images and feature contrast coefficients; performing image registration and polarization fusion on the feature polarization images to generate a two-dimensional polarization feature spectrum; inputting the two-dimensional polarization feature spectrum into a multi-level convolutional neural network, extracting feature response values ​​of defect areas of plastic products layer by layer through a spatial attention mechanism, performing nonlinear transformation on the feature response values, and outputting a defect thermal distribution map; identifying defect areas and diffusion boundaries of plastic products through a clustering algorithm based on the probability gradient changes of the defect thermal distribution map, integrating the defect areas and diffusion boundaries, and outputting defect area data; and determining the product qualification by combining the defect area data and quality requirement data, and outputting a quality inspection report.

[0008] As a preferred embodiment of the artificial intelligence-based plastic product quality inspection method of the present invention, the step of generating a polarization image set by marking the angular position according to the polarization angle of the polarization image includes the following specific steps:

[0009] Extract the shooting angle of the polarization image from the real-time data stream of an industrial polarization camera;

[0010] Based on the conveyor belt movement direction of plastic products, the shooting angle is transformed into an industrial coordinate system to output the polarization angle;

[0011] The polarization image is bound to the polarization angle to generate a polarization image data block;

[0012] The polarization image data blocks are structured and integrated to generate a set of polarization images.

[0013] As a preferred embodiment of the artificial intelligence-based plastic product quality inspection method of the present invention, the specific steps for extracting the light intensity feature distribution map of the polarization image set are as follows:

[0014] The grayscale normalization process is performed on the polarization image set to generate a standard polarization image;

[0015] By using the local contrast analysis method, the pixel region of the standard polarization image is divided into sliding windows, and the standard deviation of pixel grayscale in each sliding window is obtained.

[0016] The pixel grayscale standard deviation is assigned back to the standard polarization image, and a local contrast spectrum is output.

[0017] The local contrast maps corresponding to the polarization angles are sequentially stitched together to output a light intensity feature distribution map.

[0018] As a preferred embodiment of the artificial intelligence-based plastic product quality inspection method of the present invention, the steps of performing polarization angle optimization analysis based on the light intensity feature distribution spectrum and outputting a feature polarization image and feature contrast coefficient are as follows:

[0019] The local contrast statistics corresponding to each polarization angle are extracted from the light intensity characteristic distribution map. The polarization angles are then filtered according to the local contrast statistics to output the characteristic polarization angles.

[0020] Extract the polarization image corresponding to the characteristic polarization angle from the set of polarization images, and use it as the characteristic polarization image;

[0021] The local contrast statistics are scaled proportionally to output the feature contrast coefficient.

[0022] As a preferred embodiment of the artificial intelligence-based plastic product quality inspection method of the present invention, the specific steps of performing image registration and polarization fusion on the characteristic polarization image to generate a two-dimensional polarization feature map are as follows:

[0023] Polarization feature points are extracted from the feature polarization image using a feature point matching algorithm. Spatial matching of the polarization feature points of each feature polarization image is then performed to generate an affine transformation matrix.

[0024] Select a reference image from the characteristic polarization images as the reference image, and adjust the position and angle of each characteristic polarization image according to the coordinate system of the reference image through an affine transformation matrix to generate a registration image;

[0025] The pixel values ​​of the registered image are weighted and fused with the feature contrast coefficient to generate a weighted pixel matrix;

[0026] A two-dimensional polarization feature map is generated by mapping the grayscale range of the weighted pixel matrix.

[0027] As a preferred embodiment of the artificial intelligence-based plastic product quality inspection method of the present invention, the steps include: inputting a two-dimensional polarization feature map into a multi-level convolutional neural network, extracting feature response values ​​of defect areas of the plastic product layer by layer through a spatial attention mechanism, performing nonlinear transformation on the feature response values, and outputting a defect thermal distribution map.

[0028] The convolutional layers of a multi-level convolutional neural network are used to perform convolution operations on the two-dimensional polarization feature map, and defect feature data is extracted from the two-dimensional polarization feature map.

[0029] The defect feature data is weighted using a spatial attention mechanism to output the feature response value of the defect region;

[0030] The characteristic response values ​​of the defect region are nonlinearly transformed to obtain the gradient change information of the defect region;

[0031] The gradient change information is integrated to generate a global probability distribution of the defect area;

[0032] The global probability distribution is upsampled and restored to output a probability heatmap.

[0033] Based on the gradient changes in the probability heatmap, the defects in the probability heatmap are marked to generate a defect heatmap.

[0034] As a preferred embodiment of the artificial intelligence-based plastic product quality inspection method of the present invention, the steps of identifying defect regions and diffusion boundaries of plastic products through clustering algorithms based on the probability gradient changes of the defect thermal distribution map, integrating the defect regions and diffusion boundaries, and outputting defect region data are as follows:

[0035] The probability gradient values ​​are read pixel by pixel from the defect thermal distribution map, and the probability gradient values ​​are integrated according to the pixel order of the defect thermal distribution map to generate a two-dimensional gradient value matrix.

[0036] Identify the local density of each pixel in the two-dimensional gradient value matrix, and use the pixels with local density higher than a preset density threshold as cluster centers;

[0037] The cluster centers are merged to form a set of pixels representing the defect region and the diffusion boundary;

[0038] Morphological closure is performed on the set of pixels between the defect region and the diffusion boundary to generate the defect region outline;

[0039] Edge detection is performed on the contour of the defect region to obtain the coordinates of the minimum bounding rectangle and the coordinates of the inflection point of the defect region contour;

[0040] The coordinates of the smallest bounding rectangle and the coordinates of the inflection point are combined to output the defect area data.

[0041] As a preferred embodiment of the artificial intelligence-based plastic product quality inspection method of the present invention, the specific steps of determining product conformity by comparing defect area data with quality requirement data and outputting a quality inspection report are as follows:

[0042] Analyze the maximum permissible defect area, maximum permissible boundary length, and defect location of plastic products from quality requirement data;

[0043] The defect area data is compared with the maximum allowable defect area, the maximum allowable boundary length, and the defect location for judgment.

[0044] If the defect area data does not exceed the requirements for the maximum allowable defect area, the maximum allowable boundary length, and the defect location, then the plastic product is judged to be of qualified quality.

[0045] If the defect area data exceeds the requirements for the maximum allowable defect area, the maximum allowable boundary length, and the defect location, the plastic product is judged to be substandard and the substandard plastic product is rejected.

[0046] The judgment results, defect area data, and quality requirement data are integrated to output a quality inspection report.

[0047] In a second aspect, the present invention provides a computer device, including a memory and a processor, wherein the memory stores a computer program, wherein: when the computer program is executed by the processor, it implements any step of the artificial intelligence-based plastic product quality inspection method as described in the first aspect of the present invention.

[0048] Thirdly, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein: when the computer program is executed by a processor, it implements any step of the artificial intelligence-based plastic product quality inspection method as described in the first aspect of the present invention.

[0049] The beneficial effects of this invention are as follows: By fusing multi-dimensional polarization features and modeling defect responses, precise localization and diffusion boundary analysis of minute defects in plastic products are achieved. Through polarization angle optimization analysis and image registration fusion, a high-contrast two-dimensional polarization feature map is constructed, solving the sensitivity problem of traditional single-intensity imaging to surface reflection interference. This provides a multi-dimensional physical field representation for defect feature extraction. The spatial attention mechanism extracts defect feature response values ​​layer by layer, and combined with nonlinear transformation to generate gradient change information, enhancing the local sensitivity and global correlation of the defect region. This overcomes the limitations of traditional convolutional networks in capturing weak features. Based on probability gradients, the defect region and diffusion boundary are divided, achieving topological structure analysis of the defect contour and solving the blind spot problem of traditional threshold segmentation in identifying blurred boundary regions. Attached Figure Description

[0050] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0051] Figure 1 This is a flowchart of an artificial intelligence-based method for quality inspection of plastic products.

[0052] Figure 2 A flowchart for generating a set of polarization images.

[0053] Figure 3 A flowchart for generating a characteristic polarization image.

[0054] Figure 4 This is a flowchart for generating and judging defect area data. Detailed Implementation

[0055] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.

[0056] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.

[0057] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The phrase "in one embodiment" appearing in different places in this specification does not necessarily refer to the same embodiment, nor is it a single or selective embodiment that is mutually exclusive with other embodiments.

[0058] Reference Figures 1-4 This is one embodiment of the present invention, which provides a method for quality inspection of plastic products based on artificial intelligence, including the following steps:

[0059] S1. Collect polarization images and quality requirement data of plastic products, and mark the angle positions according to the polarization angle of the polarization images to generate a set of polarization images.

[0060] Collect polarization images and quality requirement data of plastic products;

[0061] Specifically, industrial polarization cameras are used to continuously photograph the surface of plastic products, acquiring polarized images containing characteristics of different polarization angles. Simultaneously, parameters corresponding to the type of plastic product, process standards, and testing specifications are retrieved from the plastic product quality requirements document to form structured quality requirement data. The plastic product quality requirements document is comprehensively formulated based on industry requirements, user needs, and production process requirements. Its core content typically includes appearance grading (e.g., A / B / C grade surfaces), dimensional tolerances, physical performance indicators (e.g., tensile strength and aging resistance), and restrictions on hazardous substances (e.g., heavy metals and VOCs).

[0062] Extract the shooting angle of the polarization image from the real-time data stream of an industrial polarization camera;

[0063] Based on the hardware interface protocol of the industrial polarization camera, the real-time data stream is parsed. The real-time data stream is a record containing polarized images and the rotation angle of the industrial polarization camera, which is acquired by the image sensor and recorded in real time through the communication interface during continuous shooting. The rotation angle value of the polarization filter of the industrial polarization camera corresponding to each frame of polarization image is located, i.e., the shooting angle. The extracted rotation angle value is bound to the polarization image to generate an image metadata table containing angle information. Through time synchronization, it is ensured that the shooting angle and the polarization image acquisition time point strictly correspond to each other, avoiding data misalignment caused by transmission delay.

[0064] Based on the conveyor belt movement direction of plastic products, the shooting angle is transformed into an industrial coordinate system to output the polarization angle;

[0065] Specifically, based on the movement trajectory of the plastic products on the conveyor belt, the alignment relationship between the running direction of the conveyor belt and the positive X-axis of the industrial coordinate system is determined; the shooting angle is converted into polar coordinates based on the movement direction of the conveyor belt, and the polarization angle is corrected due to the tilt of the viewing angle by rotating the coordinate system and combining the installation position of the plastic products and the installation height of the camera, and the polarization angle is output that is strictly aligned with the industrial coordinate system.

[0066] The polarization image is bound to the polarization angle to generate a polarization image data block;

[0067] The pixel matrix and corresponding polarization angle of each frame of polarized image are encapsulated into a structured data set. The structured data set contains fields such as polarized image width, height, pixel depth, and angle value. A unique identifier is assigned to each field using a hash algorithm to establish a direct mapping relationship between polarization angle and polarized image. The structured data set is written into a memory buffer in chronological order to form polarized image data blocks.

[0068] The polarization image data blocks are structured and integrated to generate a set of polarization images;

[0069] The polarization image data blocks are classified according to the batch number and testing stage of the plastic products. Data blocks under the same testing task are aggregated into a multidimensional array structure. Metadata headers are embedded in the multidimensional array structure to record the polarization angle distribution range, image resolution, and quality requirement data reference identifiers. A fast retrieval path for polarization angle and polarization image is generated, and finally, a set of polarization images that can be called is output.

[0070] S2. Extract the light intensity feature distribution map of the polarization image set, perform polarization angle optimization analysis based on the light intensity feature distribution map, and output the feature polarization image and feature contrast coefficient.

[0071] The grayscale normalization process is performed on the polarization image set to generate a standard polarization image;

[0072] Specifically, grayscale normalization is performed on each polarization image in the polarization image set, for example, between 0 and 1, to ensure that polarization images acquired under different lighting conditions can be compared with each other. By applying a linear transformation, the minimum grayscale value in each polarization image is mapped to 0 and the maximum grayscale value is mapped to 1. The grayscale values ​​are scaled proportionally to ensure the consistency and comparability of the entire polarization image set. After grayscale normalization, a standard polarization image is obtained.

[0073] By using the local contrast analysis method, the pixel region of the standard polarization image is divided into sliding windows, and the standard deviation of pixel grayscale in each sliding window is obtained.

[0074] On the generated standard polarization image, a fixed-size sliding window is used to traverse the entire standard polarization image row by row and column by column. For each pixel in the sliding window, the standard deviation of the gray value is calculated as the range of the local contrast of the sliding window, i.e., the pixel gray standard deviation.

[0075] The formula for the standard deviation of pixel grayscale is:

[0076] ;

[0077] in, This represents the X-coordinate of the center pixel of the sliding window. This represents the Y-coordinate of the center pixel of the sliding window. Represented by pixels The standard deviation of pixel grayscale values ​​for the centered sliding window. Represents the area within the sliding window relative to the center pixel. Offset on the X-axis Represents the area within the sliding window relative to the center pixel. Offset on the Y-axis, This represents the grayscale value of each pixel within the sliding window; This refers to a mathematical term, specifically the identifier for the maximum value. This refers to a mathematical term, specifically the identifier for the minimum value.

[0078] The pixel grayscale standard deviation is assigned back to the standard polarization image, and a local contrast spectrum is output.

[0079] Based on the standard deviation of pixel grayscale in each sliding window, the standard deviation of pixel grayscale is remapped back to the corresponding position in the original standard polarization image; that is, the value of each pixel in the standard polarization image is no longer the original grayscale value, but a new image composed of grayscale standard deviation values ​​that reflects the local contrast distribution of the image, namely the local contrast spectrum, which intuitively shows the contrast changes.

[0080] The local contrast maps corresponding to the polarization angle are sequentially stitched together to output a light intensity feature distribution map.

[0081] Specifically, the local contrast maps obtained from images taken at different polarization angles are arranged sequentially according to the polarization angle and stitched together. The local contrast maps at each polarization angle are regarded as a series of slices, and then the series of slices are combined along the time dimension to form a multi-dimensional light intensity feature distribution map. The light intensity feature distribution map not only contains local contrast information at each polarization angle, but also reflects the evolution of local contrast as the polarization angle changes.

[0082] The local contrast statistics corresponding to each polarization angle are extracted from the light intensity characteristic distribution map. The polarization angles are then filtered according to the local contrast statistics to output the characteristic polarization angles.

[0083] Specifically, a global statistical analysis is performed on the local contrast spectrum corresponding to each polarization angle in the light intensity feature distribution map. This global statistical analysis involves performing overall numerical statistics on the grayscale values ​​of all pixels in the local contrast spectrum at each polarization angle to obtain global statistical indicators, including the mean or peak standard deviation. The mean or peak standard deviation of all pixels at each polarization angle is then used as the local contrast statistical value for that polarization angle. The polarization angles are sorted according to these local contrast statistical values, and a fixed number (e.g., four) of polarization angles are selected as candidate feature angles. Combining the material characteristics of the plastic product (e.g., transparency, surface gloss) and defect types (e.g., bubbles, scratches), the polarization angles most sensitive to defect detection are selected, and the feature polarization angles are output.

[0084] Extract the polarization image corresponding to the characteristic polarization angle from the set of polarization images, and use it as the characteristic polarization image;

[0085] Based on the characteristic polarization angle, polarization images that strictly match the characteristic polarization angle are extracted from the set of polarization images to ensure that the shooting angle of each frame of characteristic polarization image is completely consistent with the selected characteristic angle; the correspondence between the polarization angle and the image is verified by timestamp or image identifier to eliminate deviations caused by transmission delay or data misalignment, and finally the extracted polarization image is used as the characteristic polarization image.

[0086] The local contrast statistics are scaled proportionally to output the feature contrast coefficient.

[0087] The local contrast statistics (such as standard deviation, mean, or peak value) corresponding to the characteristic polarization angle are normalized, mapping all statistical values ​​to the range of 0-1, with the maximum value corresponding to 1, the minimum value corresponding to 0, and the intermediate values ​​linearly scaled proportionally to generate a sequence of characteristic contrast coefficients. Each characteristic contrast coefficient represents the relative intensity of local contrast at the corresponding characteristic polarization angle. The characteristic contrast coefficients are used to determine the weight ratio of each characteristic polarization image during subsequent image weighted fusion, ensuring that images with high contrast angles contribute more to the fusion result.

[0088] S3. Perform image registration and polarization fusion on the characteristic polarization image to generate a two-dimensional polarization feature map.

[0089] Polarization feature points are extracted from the feature polarization image using a feature point matching algorithm. Spatial matching of the polarization feature points of each feature polarization image is then performed to generate an affine transformation matrix.

[0090] Specifically, the feature point matching algorithm identifies pixels with edge or corner characteristics from each feature polarization image as polarization feature points based on local structural characteristics. Then, it establishes a correspondence between different feature polarization images and obtains the affine transformation matrix by minimizing the coordinate difference of the polarization feature points. The affine transformation matrix contains translation, rotation, scaling and shearing parameters, which are used to describe the geometric relationship between different feature polarization images.

[0091] Select a reference image from the characteristic polarization images as the reference image, and adjust the position and angle of each characteristic polarization image according to the coordinate system of the reference image through an affine transformation matrix to generate a registration image;

[0092] Furthermore, a reference image is selected from the characteristic polarization images as the reference image. The selection of the reference image must meet the requirements of global information integrity. The characteristic polarization images are corrected pixel by pixel through affine transformation matrix, including translation to compensate for image displacement, rotation to correct image tilt, scaling to adjust image ratio, and shearing to eliminate image deformation. Finally, all characteristic polarization images are spatially aligned in a unified coordinate system to form a registered image with the same pixel position as the reference image.

[0093] The pixel values ​​of the registered image are weighted and fused with the feature contrast coefficient to generate a weighted pixel matrix;

[0094] The feature contrast coefficient reflects the richness of image detail information under different polarization angles. The weighted fusion process is carried out at the pixel level, which weights and fuses the pixel values ​​and feature contrast coefficients at corresponding positions in the registered image to form a weighted pixel matrix containing information from multiple polarization channels. Each pixel value in the weighted pixel matrix comprehensively represents the spatial structure and contrast features of the original polarization image.

[0095] A two-dimensional polarization feature map is generated by mapping the grayscale range of the weighted pixel matrix.

[0096] Gray-scale range mapping compresses the numerical distribution in a weighted pixel matrix to a target gray-scale range (e.g., 0-255) through linear or nonlinear transformations. Linear mapping uses proportional stretching to map the weighted pixel matrix to the target gray-scale range, ensuring that the image visualization effect meets the needs of human visual perception. The mapped two-dimensional polarization feature map completely preserves the spatial alignment relationship and weighted fusion information of the polarization image, and can be used as input data for subsequent polarization feature extraction and analysis. It is important to ensure the continuity and monotonicity of the gray-scale range mapping to avoid loss of image details or contrast distortion due to improper mapping methods.

[0097] S4. Input the two-dimensional polarization feature map into a multi-level convolutional neural network, extract the feature response values ​​of the defect area of ​​the plastic product layer by layer through the spatial attention mechanism, perform nonlinear transformation on the feature response values, and output the defect thermal distribution map.

[0098] The convolutional layers of a multi-level convolutional neural network are used to perform convolution operations on the two-dimensional polarization feature map, and defect feature data is extracted from the two-dimensional polarization feature map.

[0099] Specifically, a two-dimensional polarization feature map is used as input data and sequentially passed to each convolutional layer of a multi-level convolutional neural network. Each convolutional layer uses a learnable filter to locally perceive the input two-dimensional polarization feature map, capturing defect features at different scales. The convolution operation covers each pixel region of the two-dimensional polarization feature map through a sliding window mechanism, obtaining the dot product of the filter and the pixel region to generate a convolutional feature map. As the convolutional layers are stacked, the spatial resolution of the convolutional feature map gradually decreases, while the number of feature channels gradually increases, thereby achieving hierarchical extraction from low-level edge features to high-level semantic features. Finally, the defect feature data extracted through multi-level convolutional operations contains the spatial location, shape, and texture information of the defect region, providing an input basis for the subsequent attention mechanism.

[0100] The defect feature data is weighted using a spatial attention mechanism to output the feature response value of the defect region;

[0101] Based on the spatial dimension of defect feature data, a spatial attention mechanism is used to obtain the attention weight at each pixel location. The specific steps include: performing global average pooling on the defect feature data to compress the spatial dimension of the defect feature data into a single vector while retaining the channel dimension information; generating a spatial attention weight map with the same size as the convolutional feature map through a fully connected layer and a non-linear activation function (such as Sigmoid); and weighting the spatial attention weight map and the defect feature data element by element. The final output feature response value characterizes the saliency of the defect region, enhances the contrast of the defect region, and provides an enhanced feature representation for subsequent non-linear transformation.

[0102] The characteristic response values ​​of the defect region are nonlinearly transformed to obtain the gradient change information of the defect region;

[0103] Specifically, the feature response values ​​are input into a nonlinear activation function (such as ReLU or Softmax) to enhance the expressive power of the features through nonlinear transformation; the activation function processes the feature response values ​​element by element, truncating negative values ​​and retaining positive values ​​for amplification; the spatial variation trend of the feature response values ​​is extracted through the gradient changes of adjacent pixels (such as the Sobel operator or directional derivative), quantifying the edge strength and directional information of the defect region; the gradient change information reflects the boundary clarity and morphological complexity of the defect region, providing local differential features for the subsequent generation of the global probability distribution;

[0104] The gradient change information is integrated to generate a global probability distribution of the defect area;

[0105] Gradient change information is normalized (e.g., L2 normalization) and mapped to a unified probability interval. When converting the normalized gradient change information into defect probability values ​​using a probability mapping strategy (e.g., the Softmax function), the normalized gradient change information is first dynamically adjusted. Then, the magnitude of the gradient change information is mapped to the corresponding defect probability value through the probability mapping function, so that the defect probability value of each pixel is proportional to the gradient change intensity, with high gradient change regions corresponding to higher defect probability values ​​and low gradient change regions corresponding to lower defect probability values. Finally, the defect probability values ​​of all pixels are combined to form the global probability distribution of the defect region. The global probability distribution quantifies the possibility of defect existence in pixels, with high defect probability values ​​corresponding to high-confidence defect regions and low defect probability values ​​corresponding to background or normal regions.

[0106] The global probability distribution is upsampled and restored to output a probability heatmap.

[0107] Specifically, the global probability distribution is upsampled using transposed convolution or interpolation algorithms (such as bilinear interpolation). During the upsampling process, the continuity and smoothness of the defect probability values ​​are maintained to avoid probability breaks caused by discretization. The resulting high-resolution probability map is presented as a probability heatmap, where the brightness value of each pixel corresponds to the probability intensity of the defect, intuitively reflecting the spatial distribution of the defect area. The generation of the probability heatmap depends on the interpolation accuracy of the upsampling algorithm and the stability of the probability distribution, ensuring that the boundaries of the defect area are clear and the probability transitions are natural.

[0108] Based on the gradient changes in the probability heatmap, the defects in the probability heatmap are marked to generate a defect heatmap distribution map.

[0109] Based on the gradient change information of the probability heatmap, a confidence threshold for the defect region is determined by a threshold segmentation method (such as the Otsu algorithm), and pixels with high defect probability values ​​are marked as candidate defect regions. Subsequently, morphological processing (such as dilation and erosion) is performed on the candidate regions in combination with gradient change information (such as edge intensity) to eliminate isolated noise and strengthen defect boundaries. Finally, the marked defect regions are superimposed on the original heatmap to generate a defect heatmap containing defect location, boundary, and probability intensity. The defect heatmap uses color coding (such as red highlighting) to intuitively identify defect regions, providing a visual basis for the subsequent extraction of defect region data.

[0110] S5. Based on the probability gradient change of the defect thermal distribution map, identify the defect area and diffusion boundary of the plastic product through clustering algorithm, integrate the defect area and diffusion boundary, and output the defect area data.

[0111] The probability gradient values ​​are read pixel by pixel from the defect thermal distribution map, and the probability gradient values ​​are integrated according to the pixel order of the defect thermal distribution map to generate a two-dimensional gradient value matrix.

[0112] Specifically, using the defect heat map as input, the probability gradient value of each pixel is read row by row and column by column in a scanning order from left to right and top to bottom. The probability gradient value reflects the intensity of the probability change of the pixel in the heat map. The read probability gradient values ​​are linearized and stored according to the spatial arrangement of the pixels to form a two-dimensional gradient value matrix with the same size as the defect heat map. The two-dimensional gradient value matrix is ​​organized in row-major order, with each element corresponding to the probability gradient value at a specific location in the defect heat map, providing a numerical basis for subsequent cluster analysis and ensuring that the gradient information of all pixels is completely preserved and the spatial relationship is not destroyed.

[0113] Identify the local density of each pixel in the two-dimensional gradient value matrix, and use the pixels with local density higher than a preset density threshold as cluster centers;

[0114] Based on the two-dimensional gradient value matrix, a local density statistical method (such as the core point determination strategy in the DBSCAN algorithm) is adopted. Taking each pixel as the center, the number of pixels with gradient values ​​greater than a preset density threshold in the neighborhood is counted to quantify the local density. Pixels with local density higher than the background area are selected by the preset density threshold and are used as cluster centers.

[0115] Furthermore, the preset density threshold is usually set based on the density distribution characteristics of the defect region in the two-dimensional gradient value matrix and the density difference of the background noise. For example, in a defect detection scenario, if the minimum size of the known defect region is about 5x5 pixels, the preset density threshold can be set to include at least 3 pixels with high gradient values ​​in the neighborhood to ensure that the core defect region is identified as the core point.

[0116] The cluster centers are merged to form a set of pixels representing the defect region and the diffusion boundary;

[0117] Specifically, starting from the selected cluster centers, the pixels with continuous gradient values ​​and consistent trends within the neighborhood are gradually merged into the set of the corresponding cluster centers through neighborhood expansion strategies (such as K-nearest neighbor search or connected region growth algorithm). Finally, the set corresponding to each cluster center contains pixels of the core region and the adjacent diffusion region, forming a complete set of pixels of the defect region and diffusion boundary, realizing the initial division of the defect region.

[0118] Morphological closure is performed on the set of pixels between the defect region and the diffusion boundary to generate the defect region outline;

[0119] The set of pixels in the defect region and the diffusion boundary is converted into a binary mask image, where defect region pixels are marked as 1 and background pixels are marked as 0. Morphological closure operations (such as dilation followed by erosion) are performed on the binary mask image to expand the boundary of the defect region and fill the internal voids through structuring elements, eliminating local breaks caused by gradient value fluctuations. The closed binary mask image is then used to extract the defect region contour through a connected component labeling algorithm. The defect region contour completely covers the defect region and the diffusion boundary, providing a stable foundation for subsequent edge detection and ensuring the geometric integrity of the defect region.

[0120] Edge detection is performed on the contour of the defect region to obtain the coordinates of the minimum bounding rectangle and the coordinates of the inflection point of the defect region contour;

[0121] Specifically, based on the defect region contour, the boundary pixels of the contour are extracted to form a continuous edge curve. Subsequently, the edge curve is fitted, and the minimum bounding rectangle algorithm (such as the rotating caliper method) is used to obtain the minimum rectangle that can completely enclose the defect region contour, and the coordinates of the four vertices of the rectangle are recorded. At the same time, the inflection point detection algorithm (such as convex hull decomposition) is used to identify the points of curvature change in the edge curve, and the points of change are used as the key inflection points of the defect region contour. The coordinates of the key inflection points are used to characterize the shape features of the defect region. The coordinates of the minimum bounding rectangle and the coordinates of the inflection points together constitute the geometric description of the defect region, providing standardized data for subsequent coordinate integration.

[0122] Combine the coordinates of the smallest bounding rectangle with the coordinates of the inflection point to output the defect area data;

[0123] The coordinates of the four vertices and inflection points of the minimum bounding rectangle are normalized and arranged in spatial order to generate a coordinate list containing the location, size, and shape information of the defect area. The coordinate list is stored in a structured format (such as JSON or CSV). The final output defect area data includes the boundary range of the minimum bounding rectangle, the geometric distribution of the inflection points, and the global spatial characteristics of the defect area, providing quantifiable input for subsequent product qualification judgment and ensuring logical consistency between the description of the defect area and the comparison with the quality requirement data.

[0124] S6. Combine the defect area data with the quality requirement data to determine the product's conformity and output a quality inspection report.

[0125] Analyze the maximum permissible defect area, maximum permissible boundary length, and defect location of plastic products from quality requirement data;

[0126] Specifically, the quality requirement data is parsed, and three key quality constraint parameters for plastic products are extracted according to a predefined data structure (such as JSON or XML format): maximum allowable defect area, maximum allowable boundary length, and defect location. The maximum allowable defect area is used to limit the upper limit of the spatial size of a single defect area, the maximum allowable boundary length is used to constrain the minimum perimeter of the bounding rectangle of the defect area, and the defect location is used to specify the allowable distribution area of ​​the defect area in the product coordinate system. During the extraction process, the parameter values ​​are read item by item through a field matching strategy (such as key-value pair parsing) and converted into numerical variables to ensure the consistency of numerical values ​​in subsequent comparison and judgment.

[0127] The defect area data is compared with the maximum allowable defect area, the maximum allowable boundary length, and the defect location for judgment.

[0128] Furthermore, using the defect area data as input, the coordinates of the minimum bounding rectangle and the inflection point coordinates of each defect area are geometrically summarized sequentially: First, the actual area of ​​the defect area is obtained by multiplying the length and width of the minimum bounding rectangle, and the actual area is numerically compared with the maximum allowable defect area; second, the perimeter of the minimum bounding rectangle is numerically compared with the maximum allowable boundary length; finally, the vertex coordinates of the minimum bounding rectangle are used to determine whether the defect area is completely within the allowable defect location. If any vertex coordinate exceeds the allowable requirement, the location is judged to be in violation. All comparison operations adopt a strict less than or equal to or greater than or equal to logical relationship to ensure that the judgment result meets the hard constraints of the quality requirement data. The comparison result is recorded as a Boolean value (true / false) to record the compliance status of each defect area.

[0129] If the defect area data does not exceed the requirements for the maximum allowable defect area, the maximum allowable boundary length, and the defect location, the plastic product is judged to be of qualified quality and marked as true.

[0130] If the defect area data exceeds the requirements for the maximum allowable defect area, the maximum allowable boundary length, and the defect location, the plastic product is judged to be substandard, marked as fake, and the substandard plastic product is rejected.

[0131] The judgment results, defect area data and quality requirement data are integrated to output a quality inspection report;

[0132] Specifically, the quality compliance judgment results, all defect area data (including the coordinates of the minimum bounding rectangle, inflection point coordinates, and actual area / perimeter of compliant and non-compliant defect areas), and quality requirement data (maximum allowable defect area, maximum allowable boundary length, and defect location) are integrated in a structured format (such as JSON or CSV). During the integration process, the data is organized in a hierarchical nested manner, for example, with plastic products as the top-level node, and the lower levels successively containing judgment results, a list of defect areas, and quality requirement parameters. The final quality inspection report is output in file format, and the report content includes product number, judgment results, a visual diagram of defect areas, violation details, and a comparison table of quality requirement parameters, providing a traceable basis for subsequent quality analysis, customer feedback, and process optimization.

[0133] This embodiment also provides a computer device applicable to the case of an artificial intelligence-based plastic product quality inspection method, including: a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to realize the artificial intelligence-based plastic product quality inspection method proposed in the above embodiment.

[0134] The computer device can be a terminal, comprising a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, carrier networks, NFC (Near Field Communication), or other technologies. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad on the computer device's casing, or an external keyboard, touchpad, or mouse.

[0135] This embodiment also provides a storage medium storing a computer program, which, when executed by a processor, implements the artificial intelligence-based plastic product quality inspection method proposed in the above embodiments. The storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Red-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.

[0136] In summary, this invention achieves precise localization and diffusion boundary analysis of minute defects in plastic products through multi-dimensional polarization feature fusion and defect response modeling. By optimizing polarization angle analysis and image registration fusion, a high-contrast two-dimensional polarization feature map is constructed, solving the sensitivity problem of traditional single-intensity imaging to surface reflection interference. This provides a multi-dimensional physical field representation for defect feature extraction. The spatial attention mechanism extracts defect feature response values ​​layer by layer, and combined with nonlinear transformation to generate gradient change information, enhancing the local sensitivity and global correlation of the defect region. This overcomes the limitations of traditional convolutional networks in capturing weak features. Based on probability gradient partitioning of the defect region and diffusion boundary, the topological structure analysis of the defect contour is achieved, solving the blind spot problem of traditional threshold segmentation in identifying blurred boundary regions.

[0137] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.

Claims

1. A method for quality inspection of plastic products based on artificial intelligence, characterized in that: include, Collect polarization images and quality requirement data of plastic products, and mark the angle positions according to the polarization angle of the polarization images to generate a set of polarization images; Extract the light intensity feature distribution map of the polarization image set, perform polarization angle optimization analysis based on the light intensity feature distribution map, and output the feature polarization image and feature contrast coefficient; Image registration and polarization fusion are performed on the characteristic polarization image to generate a two-dimensional polarization feature map; Two-dimensional polarization feature maps are input into multi-level convolutional neural networks. The feature response values ​​of defect areas in plastic products are extracted layer by layer through spatial attention mechanism. The feature response values ​​are then nonlinearly transformed to output a defect thermal distribution map. Based on the probability gradient change of the defect thermal distribution map, the defect area and diffusion boundary of the plastic product are identified by clustering algorithm, the defect area and diffusion boundary are integrated, and the defect area data is output. The defect area data and quality requirement data are used to determine the product's conformity, and a quality inspection report is output. The step of identifying the angular positions according to the polarization angle of the polarization image and generating a set of polarization images involves the following steps: Extract the shooting angle of the polarization image from the real-time data stream of an industrial polarization camera; Based on the conveyor belt movement direction of plastic products, the shooting angle is transformed into an industrial coordinate system to output the polarization angle; The polarization image is bound to the polarization angle to generate a polarization image data block; The polarization image data blocks are structured and integrated to generate a set of polarization images; The specific steps for extracting the intensity feature distribution map of the polarization image set are as follows: The grayscale normalization process is performed on the polarization image set to generate a standard polarization image; By using the local contrast analysis method, the pixel region of the standard polarization image is divided into sliding windows, and the standard deviation of pixel grayscale in each sliding window is obtained. The pixel grayscale standard deviation is assigned back to the standard polarization image, and a local contrast spectrum is output. The local contrast maps corresponding to the polarization angle are sequentially stitched together to output a light intensity feature distribution map. The specific steps for performing polarization angle optimization analysis based on the light intensity characteristic distribution map, outputting a characteristic polarization image and characteristic contrast coefficient, are as follows: The local contrast statistics corresponding to each polarization angle are extracted from the light intensity characteristic distribution map. The polarization angles are then filtered according to the local contrast statistics to output the characteristic polarization angles. Extract the polarization image corresponding to the characteristic polarization angle from the set of polarization images, and use it as the characteristic polarization image; The local contrast statistics are scaled proportionally to output the feature contrast coefficient. The specific steps for performing image registration and polarization fusion on the characteristic polarization image to generate a two-dimensional polarization feature map are as follows: Polarization feature points are extracted from the feature polarization image using a feature point matching algorithm. Spatial matching of the polarization feature points of each feature polarization image is then performed to generate an affine transformation matrix. Select a reference image from the characteristic polarization images as the reference image, and adjust the position and angle of each characteristic polarization image according to the coordinate system of the reference image through an affine transformation matrix to generate a registration image; The pixel values ​​of the registered image are weighted and fused with the feature contrast coefficient to generate a weighted pixel matrix; A two-dimensional polarization feature map is generated by mapping the grayscale range of the weighted pixel matrix.

2. The artificial intelligence-based plastic product quality inspection method as described in claim 1, characterized in that: The specific steps are as follows: inputting the two-dimensional polarization feature map into a multi-level convolutional neural network, extracting the feature response values ​​of the defect region of the plastic product layer by layer through a spatial attention mechanism, performing nonlinear transformation on the feature response values, and outputting a defect thermal distribution map. The convolutional layers of a multi-level convolutional neural network are used to perform convolution operations on the two-dimensional polarization feature map, and defect feature data is extracted from the two-dimensional polarization feature map. The defect feature data is weighted using a spatial attention mechanism to output the feature response value of the defect region; The characteristic response values ​​of the defect region are nonlinearly transformed to obtain the gradient change information of the defect region; The gradient change information is integrated to generate a global probability distribution of the defect area; The global probability distribution is upsampled and restored to output a probability heatmap. Based on the gradient changes in the probability heatmap, the defects in the probability heatmap are marked to generate a defect heatmap.

3. The artificial intelligence-based plastic product quality inspection method as described in claim 1, characterized in that: The steps involve identifying defect regions and diffusion boundaries of plastic products based on the probability gradient changes in the defect thermal distribution map, integrating the defect regions and diffusion boundaries, and outputting defect region data. The probability gradient values ​​are read pixel by pixel from the defect thermal distribution map, and the probability gradient values ​​are integrated according to the pixel order of the defect thermal distribution map to generate a two-dimensional gradient value matrix. Identify the local density of each pixel in the two-dimensional gradient value matrix, and use the pixels with local density higher than a preset density threshold as cluster centers; The cluster centers are merged to form a set of pixels representing the defect region and the diffusion boundary; Morphological closure is performed on the set of pixels between the defect region and the diffusion boundary to generate the defect region outline; Edge detection is performed on the contour of the defect region to obtain the coordinates of the minimum bounding rectangle and the coordinates of the inflection point of the defect region contour; The coordinates of the smallest bounding rectangle and the coordinates of the inflection point are combined to output the defect area data.

4. The artificial intelligence-based quality inspection method for plastic products as described in claim 1, characterized in that: The specific steps for determining product conformity by comparing defect area data with quality requirement data and outputting a quality inspection report are as follows: Analyze the maximum permissible defect area, maximum permissible boundary length, and defect location of plastic products from quality requirement data; The defect area data is compared with the maximum allowable defect area, the maximum allowable boundary length, and the defect location for judgment. If the defect area data does not exceed the requirements for the maximum allowable defect area, the maximum allowable boundary length, and the defect location, then the plastic product is judged to be of qualified quality. If the defect area data exceeds the requirements for the maximum allowable defect area, the maximum allowable boundary length, and the defect location, the plastic product is judged to be substandard and the substandard plastic product is rejected. The judgment results, defect area data, and quality requirement data are integrated to output a quality inspection report.

5. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, it implements the steps of the artificial intelligence-based plastic product quality inspection method according to any one of claims 1 to 4.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor, it implements the steps of the artificial intelligence-based plastic product quality inspection method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Workpiece defect detection method and device, electronic equipment and readable storage medium

    CN114782451A

  • Intelligent detection method, device and equipment for plastic container

    CN120235842A