A machine vision-based polypropylene film surface defect online detection and sorting method and system
By acquiring image features through a machine vision system and establishing a defect assessment model, the problem of objective evaluation after detecting surface defects in polypropylene films was solved, enabling efficient sorting and transmission speed correction of polypropylene films, and improving detection efficiency and accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SICHUAN XINKANG YIZHONGSHEN NEW MATERIALS CO LTD
- Filing Date
- 2026-02-13
- Publication Date
- 2026-05-12
AI Technical Summary
In existing technologies, the lack of objective evaluation after detecting defects on the surface of polypropylene films leads to potential unnecessary waste and improper handling.
Image features are acquired through a machine vision system, a defect assessment model is established, a defect evaluation value is output, and the transmission speed and sorting judgment are adjusted based on the evaluation value.
It enables objective assessment and sorting decisions for defects in polypropylene films, improving detection efficiency and accuracy while reducing the uncertainty of human intervention.
Smart Images

Figure CN121708019B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image recognition technology, and more specifically, to a method and system for online detection and sorting of surface defects in polypropylene films based on machine vision. Background Technology
[0002] Online detection of surface defects in polypropylene (PP) films based on machine vision utilizes optical imaging, image processing, and AI algorithms to achieve real-time acquisition, accurate identification, intelligent classification, and rapid handling of minute defects on the film surface during high-speed production. Its core advantages lie in replacing manual labor, improving detection rate and efficiency, and adapting to the full-width, high-precision quality inspection needs of transparent, semi-transparent, and composite PP films.
[0003] However, in existing technologies, after identifying the current polypropylene film, the output only indicates whether defects exist or not, without an objective judgment on whether to proceed with further processing. All of these require subjective judgment by the staff, which may lead to unnecessary waste and improper handling. Summary of the Invention
[0004] The purpose of this invention is to provide a method and system for online detection and sorting of surface defects in polypropylene films based on machine vision, so as to solve the above-mentioned problems in the prior art.
[0005] This invention is achieved through the following technical solution:
[0006] In a first aspect, the present invention provides a method for online detection and sorting of surface defects in polypropylene films based on machine vision, comprising:
[0007] Send a control signal to activate the oblique supplementary light, acquire the initial image of the current target segment, and preprocess the initial image to obtain the image to be identified;
[0008] The image recognition model is used to identify the image to be identified and output the result of whether there is a defect. If there is no defect, no processing is performed. If there is a defect, the image features of the current defect are obtained and an alarm signal is issued.
[0009] The parameters of the current defect are obtained based on image features, a defect evaluation model is established, the evaluation value of the current defect is output through the defect evaluation model based on the current parameters, and the current transmission speed is corrected based on the evaluation value.
[0010] Obtain the target length of the storage tube currently wound with polypropylene film and the maximum length of polypropylene film that can be wound into a single storage tube. Based on the target length, maximum length, and evaluation value, determine whether to sort the target segment.
[0011] Preferably, the preprocessing of the initial image data to obtain the image to be identified includes:
[0012] Align and register the current initial image, and then denoise the aligned and registered image.
[0013] Histogram equalization is performed on the denoised target image to remove extreme gray values, resulting in the image to be identified.
[0014] Preferably, the alignment and registration of the current initial image includes:
[0015] Historical images of defect-free polypropylene films are obtained and used as reference templates. Edges are extracted from the reference templates to obtain template edge maps.
[0016] Calculate the grayscale centroid of the template edge image, and divide the template edge image into Q uniform first sub-grids along the width direction, and record the local centroid and edge features of each sub-grid;
[0017] Obtain the initial image of the current polypropylene film, and divide it into Q corresponding second sub-grids. Match each second sub-grid based on the first sub-grid to obtain the offset of each sub-grid.
[0018] The global average offset is calculated based on the offset of each sub-grid to obtain a coarse registration image. The edge map of the coarse registration image is extracted and its gray centroid is calculated.
[0019] Using the grayscale centroid of the template as the target, the rotation and offset are corrected, the column grayscale mean of the coarse registration image and the reference template is calculated, the stretching coefficient k is obtained by quadratic polynomial fitting, and the coarse registration image is vertically scaled to obtain the final registration image.
[0020] Preferably, the noise reduction of the aligned and registered image includes:
[0021] Based on the registered image, the local variance within each window is calculated using a sliding window. A variance threshold is set, and the image is divided into a first variance region and a second variance region. The first variance region is preserved, and the second variance region is denoised.
[0022] Define the Gaussian kernel size, calculate the local gray mean for each window, and perform window-by-window variable Gaussian filtering on the registered image to obtain the Gaussian denoised image;
[0023] A sliding window is used to calculate the gray-level similarity weight between each pixel in the window and the center pixel. The pixels in the window are sorted according to their gray-level values. The weighted median is calculated based on the gray-level similarity weights and replaced with the center pixel value. The registered image is then subjected to weighted median filtering to obtain a median-denoised image.
[0024] A denoising fusion function is constructed, and the final target denoised image is output based on the Gaussian denoised image and the median denoised image.
[0025] Preferably, the step of performing histogram equalization to remove extreme gray values based on the denoised target image includes:
[0026] The degree histogram of the target denoised image is statistically analyzed, and upper and lower limits of gray levels are set and determined by the cumulative histogram. Extreme gray values below the first threshold and those above the second threshold are removed.
[0027] Pixels in the image whose grayscale value is less than the lower grayscale limit are set as the lower grayscale limit value, and pixels whose grayscale value is greater than the upper grayscale limit are set as the upper grayscale limit value, thus obtaining a grayscale cropped image;
[0028] The window sizes for the first and second variance regions are set respectively, and the grayscale cropped image is divided into non-uniform windows with an overlap of T% between each window.
[0029] For each local window, calculate its grayscale histogram, set a histogram clipping threshold, and evenly distribute the histogram portion exceeding the histogram clipping threshold to all grayscale levels to obtain a corrected histogram.
[0030] Different enhancement gains are set according to different variance regions, the cumulative distribution function of the modified histogram is calculated, and gray-level mapping is performed based on the gain coefficient to obtain the equalized image within the window;
[0031] The pixel values of the overlapping windows are fused using a weighted average to output the final enhanced image to be recognized.
[0032] Preferably, the image recognition model includes:
[0033] Acquire historical image data of various defects, and divide the historical image data into training set and validation set;
[0034] Parallel convolutional branches are set up to extract different defect features. A defect attention mask is generated for the feature map output by each branch, and the feature weights of the defect region are weighted to enhance the feature weights.
[0035] The importance of features at different scales is learned by learning weight concatenation and residual connection. The defect features are then processed by global average pooling and global max pooling respectively and fused to obtain a fused feature vector.
[0036] The dimensionality of the fused feature vector is reduced by establishing a fully connected layer and the ReLU activation function. The probability distribution of various defects is output by using Softmax activation, and the defect area is output by using linear activation.
[0037] A loss function will be established, and the training process will be optimized based on the results of the loss function.
[0038] Preferably, the loss function includes:
[0039]
[0040]
[0041]
[0042] In the formula, For weighted cross loss, This represents the number of image samples input to the model in a single training iteration. This represents the total number of defect categories. This serves as the index for this batch of samples. and These are indexes for different defect categories. For the first Weights of class defects For the first The corresponding sample of the th sample Similar to real-world labels, For the first The sample was predicted by the model to be the th sample. The probability of a class For defect feature alignment loss, For the first The fused deep feature vector of each sample For the first Feature centers of class defects For the first The sample corresponds to the first The true label of the class, For the first Feature centers of class defects As the background penalty coefficient, As a background area mask, For the total loss, This is the loss balance coefficient.
[0043] Preferably, the step of establishing a defect assessment model and outputting the evaluation value of the current defect based on the current parameters includes:
[0044]
[0045] In the formula, As an evaluation value, The area of the initial image. The area occupied by the defect. The average number of defects appearing in the initial image for each target end. This represents the number of defects in the current initial image. The cost of the polypropylene film at the current target end, The cost of the polypropylene film for one storage bin. This represents the number of defect types on the current target side. This represents the number of defect types that have occurred in current production. , , , The coefficients are calculated, and their sum is 1.
[0046] Preferably, the step of correcting the current transmission speed based on the evaluation value includes:
[0047] Set a first correction threshold and a second correction threshold;
[0048] when When it is less than the first correction threshold, ,when When it is greater than or equal to the first correction threshold and less than the second correction threshold ,when When it is greater than the first correction threshold, ,in, To adjust the conveyor belt speed, Current conveyor belt speed.
[0049] Preferably, the step of determining whether to sort the target segment based on the target length, maximum length, and evaluation value includes establishing a sorting index function, which includes:
[0050]
[0051] In the formula, This is the sorting index. For the maximum length, For the target length, The cost of repairing the polypropylene film at the current target end;
[0052] Set a judgment threshold, when When the value is greater than or equal to the judgment threshold, a signal to initiate sorting is issued.
[0053] Secondly, the present invention also provides a machine vision-based online detection and sorting system for surface defects of polypropylene films, used to perform the above-described machine vision-based online detection and sorting method for surface defects of polypropylene films, comprising:
[0054] The image recognition module is configured to send a control signal to activate the oblique supplementary light, acquire the initial image of the current target segment, preprocess the initial image to obtain the image to be recognized, and recognize the image to be recognized based on the image recognition model, output the result of whether there is a defect. If there is no defect, no processing is performed. If there is a defect, the image features of the current defect are acquired and an alarm signal is issued.
[0055] The evaluation module is configured to obtain parameters of the current defect based on image features, establish a defect evaluation model, output the evaluation value of the current defect based on the current parameters through the defect evaluation model, and correct the current transmission speed based on the evaluation value; obtain the target length of the storage tube currently wound with polypropylene film and the maximum length of polypropylene film that can be wound into a single storage tube, and determine whether to sort the target segment based on the target length, maximum length and evaluation value.
[0056] The technical solution of the present invention has at least the following advantages and beneficial effects:
[0057] The method provided by this invention mainly includes: obtaining parameters of the current defect based on image features; establishing a defect assessment model; outputting an evaluation value of the current defect based on the current parameters and the defect assessment model; correcting the current transmission speed based on the evaluation value; obtaining the target length of the currently wound polypropylene film storage tube and the maximum length of polypropylene film that can be wound into a single storage tube; and determining whether to sort the target segment based on the target length, maximum length, and evaluation value. This method identifies defects in the current segment of polypropylene film. When a defect is identified, a further sorting judgment is made, determining whether to ignore the defect or sort the segment of polypropylene film using the same standard, providing an objective choice to assist staff in making a decision. Attached Figure Description
[0058] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0059] Figure 1 This is a schematic diagram of the process of the present invention;
[0060] Figure 2 This is a schematic diagram of the system structure of the present invention. Detailed Implementation
[0061] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0062] The independently described modules or sub-modules may or may not be physically separated; they may be implemented in software or hardware, and some modules or sub-modules may be implemented in software, with the processor calling the software to implement the function of these modules or sub-modules, while other modules or sub-modules may be implemented in hardware, such as through hardware circuits. Furthermore, some or all of the modules can be selected to achieve the purpose of this application's solution according to actual needs.
[0063] Please refer to Figures 1-2 A machine vision-based online detection and sorting method for surface defects in polypropylene films, comprising:
[0064] S101: Send a control signal to start the oblique supplementary light, acquire the initial image of the current target segment, and preprocess the initial image to obtain the image to be identified;
[0065] In this invention, the illumination from the supplementary oblique supplementary light can amplify the shadows of defects such as damage, foreign objects, missing weft, and residual yarn. During image recognition, these features that differ from those of normal polypropylene films under illumination can be better captured, reducing the false negative rate.
[0066] S102: Based on the image recognition model, the image to be recognized is identified, and the result of whether there is a defect is output. If there is no defect, no processing is performed. If there is a defect, the image features of the current defect are obtained and an alarm signal is issued.
[0067] S103: Obtain the parameters of the current defect based on image features, establish a defect evaluation model, output the evaluation value of the current defect based on the current parameters through the defect evaluation model, and correct the current transmission speed based on the evaluation value;
[0068] When a defect occurs, the current segment of polypropylene film needs to be evaluated before a further decision can be made. In order to allow time for judgment, the current conveying speed needs to be corrected. After the problem caused by the defect is resolved, the staff will restore the system.
[0069] S104: Obtain the target length of the storage tube currently wound with polypropylene film and the maximum length of polypropylene film that can be wound into a single storage tube, and determine whether to sort the target segment based on the target length, maximum length and evaluation value.
[0070] Whether to sort the polypropylene film depends on the length of film already stored. After production, the polypropylene film is wound and stored in storage bins. Once a sufficient amount of film has been wound in the bins, the bins are replaced for continued storage. The degree of defects in the current segment of polypropylene film is then considered to determine whether to sort it.
[0071] The method provided by this invention mainly includes: acquiring parameters of the current defect based on image features; establishing a defect assessment model; outputting an evaluation value of the current defect based on the current parameters and the defect assessment model; and correcting the current transmission speed based on the evaluation value. It also involves acquiring the target length of the currently wound polypropylene film storage tube and the maximum length of polypropylene film that can be wound into a single storage tube; and determining whether to sort the target segment based on the target length, maximum length, and evaluation value. This method identifies defects in the current segment of polypropylene film. When a defect is identified, a further sorting judgment is made, determining whether to ignore the defect or sort the segment of polypropylene film using the same standard. This provides an objective choice to assist workers in making a decision.
[0072] In one exemplary embodiment of the present invention, the preprocessing of the initial image data to obtain the image to be identified includes:
[0073] Align and register the current initial image, and then denoise the aligned and registered image.
[0074] Histogram equalization is performed on the denoised target image to remove extreme gray values, resulting in the image to be identified.
[0075] In one exemplary embodiment of the present invention, the alignment and registration of the current initial image includes:
[0076] Historical images of defect-free polypropylene films are obtained and used as reference templates. Edges are extracted from the reference templates to obtain template edge maps.
[0077] Calculate the grayscale centroid of the template edge image, and divide the template edge image into Q uniform first sub-grids along the width direction, and record the local centroid and edge features of each sub-grid;
[0078] Obtain the initial image of the current polypropylene film, and divide it into Q corresponding second sub-grids. Match each second sub-grid based on the first sub-grid to obtain the offset of each sub-grid.
[0079] The global average offset is calculated based on the offset of each sub-grid to obtain the coarse registration image. That is, the initial image is translated based on the global average offset. The edge map of the coarse registration image is extracted and its gray centroid is calculated.
[0080] Using the grayscale centroid of the template as the target, the rotation and offset are corrected, the column grayscale mean of the coarse registration image and the reference template is calculated, the stretching coefficient k is obtained by quadratic polynomial fitting, and the coarse registration image is vertically scaled to obtain the final registration image.
[0081] Using the above method, a defect-free PP film area is used as a reference template. The edge texture and grayscale contour of the template are extracted as features to avoid the problem of sparse texture. Adaptive block segmentation in the width direction reduces the computational load per image, adapts to online high speed, sub-pixel level fine-tuning and polynomial stretching distortion correction, and meets the detection accuracy requirement of 0.02mm.
[0082] In one exemplary embodiment of the present invention, polypropylene film images simultaneously exhibit Gaussian noise (light source fluctuations, camera photoelectric device noise) and salt-and-pepper noise (dust, acquisition and transmission interference). Gaussian filtering alone blurs the edges of minute defects (such as 0.05mm crystal points), while median filtering alone has poor Gaussian noise suppression. Traditional hybrid filtering has fixed weights and cannot distinguish between defect areas and smooth background areas, resulting in a trade-off between noise reduction and detail preservation. Therefore, the present invention proposes a method combining Gaussian and median fusion filtering.
[0083] The step of denoising the aligned and registered image includes:
[0084] Based on the registered images, through 3 3. Calculate the local variance within each window using a sliding window, set a variance threshold, and divide the image into a first variance region and a second variance region. The first variance region is preserved, and the second variance region is denoised. Regions with local variance greater than the variance threshold are classified as the first variance region (high variance region), and regions with local variance less than or equal to the variance threshold are classified as the second variance region (low variance region).
[0085] Define the Gaussian kernel size, for each 3 The three-window method calculates the local gray-level mean, performs window-by-window variable Gaussian filtering on the registered image, and obtains a Gaussian denoised image. The noise intensity is determined based on the gray-level mean, and the standard deviation of the Gaussian kernel is proportional to the noise intensity. Gaussian filtering is performed based on the Gaussian kernel with variable standard deviation.
[0086] A sliding window is used to calculate the gray-level similarity weight between each pixel in the window and the center pixel. The pixels in the window are sorted according to their gray-level values. The weighted median is calculated based on the gray-level similarity weights and replaced with the center pixel value. The registered image is then subjected to weighted median filtering to obtain a median-denoised image.
[0087]
[0088] In the formula, For the window number Gray-level similarity weights of location pixels, To register the grayscale values of neighboring pixels within a window in an image, To the center pixel of the window in the registered image grayscale value, This is the grayscale similarity adjustment coefficient.
[0089] A denoising fusion function is constructed by setting calculation weights for each image. Based on their respective calculation weights, the final target denoised image is output by summing the Gaussian denoised image and the median denoised image.
[0090] In this embodiment, the image region type is first determined by local variance (high variance = suspected defect / texture region, low variance = smooth background region). The Gaussian kernel is adjusted according to the local noise intensity to avoid excessive blurring. Weighted median filtering is used to assign grayscale similarity weights to neighboring pixels to improve the salt-and-pepper noise suppression effect while preserving edges. This achieves higher weighting of median filtering for high variance regions (preserving defect details) and higher weighting of Gaussian filtering for low variance regions (strong noise reduction).
[0091] In one exemplary embodiment of the present invention, conventional global histogram equalization amplifies the background noise and slight texture of polypropylene films, causing minor defects to be submerged. Conventional local histogram equalization (CLAHE) has a single contrast limitation and cannot distinguish between defect areas and background texture areas, resulting in overexposure of reflective areas.
[0092] Therefore, the histogram equalization method for removing extreme gray values based on the denoised target image proposed in this invention includes:
[0093] The degree histogram of the target denoised image is statistically analyzed. The upper and lower limits of gray level are set and determined by the cumulative histogram. Extreme gray level values below the first threshold and above the second threshold are removed. Specifically, this can be understood as removing the top 2% and bottom 2% of extreme gray level values.
[0094] Pixels in the image whose grayscale value is less than the lower grayscale limit are set as the lower grayscale limit value, and pixels whose grayscale value is greater than the upper grayscale limit are set as the upper grayscale limit value, thus obtaining a grayscale cropped image;
[0095] Using the region variance mask var_mask (1=high variance region, 0=low variance region) from the previous steps, set the window size for the first variance region and the second variance region respectively, and perform non-uniform window division on the grayscale cropped image. The overlap between each window is T%, and T can be 50.
[0096] For each local window, calculate its grayscale histogram, set a histogram clipping threshold, and evenly distribute the histogram portion exceeding the histogram clipping threshold to all grayscale levels to obtain a corrected histogram.
[0097] Different enhancement gains are set according to different variance regions: high variance window (suspected defects): gain coefficient γ=1.2 (enhancing the difference between defects and background), low variance window (smoothing background): gain coefficient γ=0.6 (suppressing texture enhancement and avoiding noise amplification). The cumulative distribution function of the modified histogram is calculated, and gray-level mapping is performed based on the gain coefficient to obtain the equalized image within the window.
[0098] The pixel values of the overlapping windows are fused using a weighted average to output the final enhanced image to be recognized.
[0099] In one exemplary embodiment of the present invention, the image recognition model includes:
[0100] Acquire historical image data of various defects, and divide the historical image data into training set and validation set;
[0101] Parallel convolutional branches are set up to extract different defect features. A defect attention mask is generated for the feature map output by each branch, and the feature weights of the defect region are weighted to enhance the feature weights.
[0102] Branch 1: Fine-grained 3×3 shape, edge, outline, fine texture (rough texture of crystal point surface); Branch 2: Medium-grained 5×5 local gray-level distribution, gray-level gradient of defects and surrounding background; Branch 3: Coarse-grained 7×7 global gray-level distribution, gray-level proportion of defects in the whole image, and its relationship with the distant background.
[0103] The Gabor filter is suitable for capturing the background texture of polypropylene films. In this invention, a Gabor kernel with fixed parameters is not used. Instead, the direction and scale of the Gabor kernel are adaptively adjusted according to the statistical characteristics of the background texture of the input image to avoid insufficient adaptability to polypropylene films with different textures.
[0104] The importance of features at different scales is learned by learning weight concatenation and residual connection. The defect features are then processed by global average pooling and global max pooling respectively and fused to obtain a fused feature vector.
[0105]
[0106]
[0107]
[0108] In the formula, This represents the average eigenvalues after global average pooling. The height of the deep feature map. The height and width of the deep feature map. For the purpose of marking The feature values of the deep feature map of the pixels. The largest eigenvalue after global max pooling. This is a feature fusion map.
[0109] The dimensionality of the fused feature vector is reduced by establishing a fully connected layer and the ReLU activation function. The probability distribution of various defects is output by using Softmax activation, and the defect area is output by using linear activation.
[0110] A loss function will be established, and the training process will be optimized based on the results of the loss function.
[0111] Specifically, establishing the loss function includes:
[0112]
[0113]
[0114]
[0115] In the formula, For weighted cross loss, This represents the number of image samples input to the model in a single training iteration. This represents the total number of defect categories. This serves as the index for this batch of samples. and These are indexes for different defect categories. For the first Weights of class defects For the first The corresponding sample of the th sample Similar to real-world labels, For the first The sample was predicted by the model to be the th sample. The probability of a class For defect feature alignment loss, For the first The fused deep feature vector of each sample For the first Feature centers of class defects For the first The sample corresponds to the first The true label of the class, For the first Feature centers of class defects As the background penalty coefficient, As a background area mask, For the total loss, This is the loss balance coefficient.
[0116] Existing loss functions (such as cross-entropy) only focus on classification results, failing to constrain the clustering of deep defect features, and exhibit poor adaptability to class imbalances in polypropylene film defects (e.g., a large number of crystal point samples and a small number of insect foreign object samples). This scheme combines a weighted cross-entropy loss (WCE) with a defect feature alignment loss (DFAL) to balance classification accuracy and feature discriminative power.
[0117] In one exemplary embodiment of the present invention, a defect assessment model is established, and the evaluation value of the current defect is output based on the current parameters through the defect assessment model, including:
[0118]
[0119] In the formula, As an evaluation value, The area of the initial image. The area occupied by the defect. The average number of defects appearing in the initial image for each target end. This represents the number of defects in the current initial image. The cost of the polypropylene film at the current target end, The cost of the polypropylene film for one storage bin. This represents the number of defect types on the current target side. This represents the number of defect types that have occurred in current production. , , , The coefficients are calculated, and their sum is 1.
[0120] In this embodiment, the higher the evaluation value, the more severe the defect. Based on the type of defect and the basic parameters of various defects, a relatively objective reference value is given for the judgment of subsequent steps.
[0121] Specifically, correcting the current transmission speed based on the evaluation value includes:
[0122] Set a first correction threshold and a second correction threshold;
[0123] when When it is less than the first correction threshold, ,when When it is greater than or equal to the first correction threshold and less than the second correction threshold ,when When it is greater than the first correction threshold, ,in, To adjust the conveyor belt speed, When the current conveyor belt speed exceeds the second correction threshold, it indicates that the defect is very serious and the line needs to be stopped. This is to sort out the parts with serious defects and to allow staff time to find the cause of the serious defects.
[0124] In one exemplary embodiment of the present invention, determining whether to sort the target segment based on the target length, maximum length, and evaluation value includes establishing a sorting index function, wherein the sorting index function includes:
[0125]
[0126] In the formula, This is the sorting index. For the maximum length, For the target length, The cost of repairing the polypropylene film at the current target end;
[0127] Set a judgment threshold, when When the value is greater than or equal to the judgment threshold, a signal to initiate sorting is issued.
[0128] In this embodiment, further judgment is made on whether to sort. If the current storage bin is almost full, the current defective segment can be removed before sorting. It is necessary to comprehensively consider the evaluation value of the current defect, whether it can continue to be rolled into the storage bin, and the repair cost, whether it can continue to be stored. The above method provides an objective index to assist the staff in making judgments. Secondly, the judgment threshold can be set according to historical data to obtain a more balanced value. In this embodiment, it can be set to 0.02.
[0129] A machine vision-based online detection and sorting system for surface defects of polypropylene films, used to perform the aforementioned machine vision-based online detection and sorting method for surface defects of polypropylene films, includes:
[0130] The image recognition module is configured to send a control signal to activate the oblique supplementary light, acquire the initial image of the current target segment, preprocess the initial image to obtain the image to be recognized, and recognize the image to be recognized based on the image recognition model, output the result of whether there is a defect. If there is no defect, no processing is performed. If there is a defect, the image features of the current defect are acquired and an alarm signal is issued.
[0131] The evaluation module is configured to obtain parameters of the current defect based on image features, establish a defect evaluation model, output the evaluation value of the current defect based on the current parameters through the defect evaluation model, and correct the current transmission speed based on the evaluation value; obtain the target length of the storage tube currently wound with polypropylene film and the maximum length of polypropylene film that can be wound into a single storage tube, and determine whether to sort the target segment based on the target length, maximum length and evaluation value.
[0132] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0133] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. This computer software product, stored in a storage medium, includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0134] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for online detection and sorting of surface defects in polypropylene films based on machine vision, characterized in that, include: Send a control signal to activate the oblique supplementary light, acquire the initial image of the current target segment, and preprocess the initial image to obtain the image to be identified; The image recognition model is used to identify the image to be identified and output the result of whether there is a defect. If there is no defect, no processing is performed. If there is a defect, the image features of the current defect are obtained and an alarm signal is issued. The parameters of the current defect are obtained based on image features, a defect evaluation model is established, the evaluation value of the current defect is output through the defect evaluation model based on the current parameters, and the current transmission speed is corrected based on the evaluation value. Obtain the target length of the storage tube currently wound with polypropylene film and the maximum length of polypropylene film that can be wound into a single storage tube. Based on the target length, maximum length, and evaluation value, determine whether to sort the target segment. The establishment of a defect assessment model, which outputs the evaluation value of the current defect based on the current parameters, includes: In the formula, As an evaluation value, The area of the initial image. The area occupied by the defect. The average number of defects appearing in the initial image for each target end. This represents the number of defects in the current initial image. The cost of the polypropylene film at the current target end, The cost of a polypropylene film for a storage bin. This represents the number of defect types on the current target side. This represents the number of defect types that have occurred in current production. , , , The coefficients are calculated, and their sum is 1; The correction of the current transmission speed based on the evaluation value includes: Set a first correction threshold and a second correction threshold; when When it is less than the first correction threshold, ,when When it is greater than or equal to the first correction threshold and less than the second correction threshold ,when When it is greater than the first correction threshold, ,in, To adjust the conveyor belt speed, Current conveyor belt speed; The step of determining whether to sort the target segment based on the target length, maximum length, and evaluation value includes establishing a sorting index function, which includes: In the formula, This is the sorting index. For the maximum length, For the target length, The cost of repairing the polypropylene film at the current target end; Set a judgment threshold, when When the value is greater than or equal to the judgment threshold, a signal to initiate sorting is issued.
2. The online detection and sorting method for surface defects of polypropylene film based on machine vision according to claim 1, characterized in that, The preprocessing of the initial image data to obtain the image to be identified includes: Align and register the current initial image, and then denoise the aligned and registered image. Histogram equalization is performed on the denoised target image to remove extreme gray values, resulting in the image to be identified. The alignment and registration of the current initial image includes: Historical images of defect-free polypropylene films are obtained and used as reference templates. Edges are extracted from the reference templates to obtain template edge maps. Calculate the grayscale centroid of the template edge image, and divide the template edge image into Q uniform first sub-grids along the width direction, and record the local centroid and edge features of each sub-grid; Obtain the initial image of the current polypropylene film, and divide it into Q corresponding second sub-grids. Match each second sub-grid based on the first sub-grid to obtain the offset of each sub-grid. The global average offset is calculated based on the offset of each sub-grid to obtain a coarse registration image. The edge map of the coarse registration image is extracted and its gray centroid is calculated. Using the grayscale centroid of the template as the target, the rotation and offset are corrected, the column grayscale mean of the coarse registration image and the reference template is calculated, the stretching coefficient k is obtained by quadratic polynomial fitting, and the coarse registration image is vertically scaled to obtain the final registration image.
3. The online detection and sorting method for surface defects of polypropylene film based on machine vision according to claim 2, characterized in that, The step of denoising the aligned and registered image includes: Based on the registered image, the local variance within each window is calculated using a sliding window. A variance threshold is set, and the image is divided into a first variance region and a second variance region. The first variance region is preserved, and the second variance region is denoised. Define the Gaussian kernel size, calculate the local gray mean for each window, and perform window-by-window variable Gaussian filtering on the registered image to obtain the Gaussian denoised image; A sliding window is used to calculate the gray-level similarity weight between each pixel in the window and the center pixel. The pixels in the window are sorted according to their gray-level values. The weighted median is calculated based on the gray-level similarity weights and replaced with the center pixel value. The registered image is then subjected to weighted median filtering to obtain a median-denoised image. A denoising fusion function is constructed, and the final target denoised image is output based on the Gaussian denoised image and the median denoised image.
4. The online detection and sorting method for surface defects of polypropylene film based on machine vision according to claim 3, characterized in that, The histogram equalization process for removing extreme gray values based on the denoised target image includes: The degree histogram of the target denoised image is statistically analyzed, and upper and lower limits of gray levels are set and determined by the cumulative histogram. Extreme gray values below the first threshold and those above the second threshold are removed. Pixels in the image whose grayscale value is less than the lower grayscale limit are set as the lower grayscale limit value, and pixels whose grayscale value is greater than the upper grayscale limit are set as the upper grayscale limit value, thus obtaining a grayscale cropped image; The window sizes for the first and second variance regions are set respectively, and the grayscale cropped image is divided into non-uniform windows with an overlap of T% between each window. For each local window, calculate its grayscale histogram, set a histogram clipping threshold, and evenly distribute the histogram portion exceeding the histogram clipping threshold to all grayscale levels to obtain a corrected histogram. Different enhancement gains are set according to different variance regions, the cumulative distribution function of the modified histogram is calculated, and gray-level mapping is performed based on the gain coefficient to obtain the equalized image within the window; The pixel values of the overlapping windows are fused using a weighted average to output the final enhanced image to be recognized.
5. The online detection and sorting method for surface defects of polypropylene film based on machine vision according to claim 4, characterized in that, The image recognition model includes: Acquire historical image data of various defects, and divide the historical image data into training set and validation set; Parallel convolutional branches are set up to extract different defect features. A defect attention mask is generated for the feature map output by each branch, and the feature weights of the defect region are weighted to enhance the feature weights. The importance of features at different scales is learned by learning weight concatenation and residual connection. The defect features are then processed by global average pooling and global max pooling respectively and fused to obtain a fused feature vector. The dimensionality of the fused feature vector is reduced by establishing a fully connected layer and the ReLU activation function. The probability distribution of various defects is output by using Softmax activation, and the defect area is output by using linear activation. A loss function will be established, and the training process will be optimized based on the results of the loss function.
6. The online detection and sorting method for surface defects of polypropylene film based on machine vision according to claim 5, characterized in that, The loss function is defined as follows: In the formula, For weighted cross loss, This represents the number of image samples input to the model in a single training iteration. This represents the total number of defect categories. This serves as the index for this batch of samples. and These are indexes for different defect categories. For the first Weights of class defects For the first The corresponding sample of the th sample Similar to real-world labels, For the first The sample was predicted by the model to be the th sample. The probability of a class For defect feature alignment loss, For the first The fused deep feature vector of each sample For the first Feature centers of class defects For the first The sample corresponds to the first The true label of the class, For the first Feature centers of class defects As the background penalty coefficient, As a background area mask, For the total loss, This is the loss balance coefficient.
7. A machine vision-based online detection and sorting system for surface defects in polypropylene films, characterized in that, A method for online detection and sorting of surface defects of polypropylene film based on machine vision, as described in any one of claims 1-6, includes: The image recognition module is configured to send a control signal to activate the oblique supplementary light, acquire the initial image of the current target segment, preprocess the initial image to obtain the image to be recognized, and recognize the image to be recognized based on the image recognition model, output the result of whether there is a defect. If there is no defect, no processing is performed. If there is a defect, the image features of the current defect are acquired and an alarm signal is issued. The evaluation module is configured to obtain parameters of the current defect based on image features, establish a defect evaluation model, output the evaluation value of the current defect based on the current parameters through the defect evaluation model, and correct the current transmission speed based on the evaluation value; obtain the target length of the storage tube currently wound with polypropylene film and the maximum length of polypropylene film that can be wound into a single storage tube, and determine whether to sort the target segment based on the target length, maximum length and evaluation value.