Polypropylene film surface defect online detection and sorting method and system based on machine vision
By using machine vision technology to preprocess and evaluate surface defects of polypropylene films, the problem of lack of objective evaluation in existing technologies is solved, and efficient and accurate sorting of polypropylene films is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-02-13
- Publication Date
- 2026-03-20
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.
Using machine vision-based methods, image preprocessing, recognition, defect assessment, and sorting decisions are performed, including image registration, noise reduction, histogram equalization, image recognition model training, and defect assessment model establishment. The output defect evaluation value guides sorting decisions.
This technology enables objective assessment and sorting of defects in polypropylene films, reducing manual intervention and improving detection efficiency and accuracy.
Smart Images

Figure CN121708019A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image recognition, in particular to a polypropylene film surface defect online detection and sorting method and system based on machine vision. BACKGROUND
[0002] The polypropylene (PP) film surface defect online detection based on machine vision is to realize real-time collection, accurate identification, intelligent classification and rapid disposal of tiny defects on the film surface in high-speed production through optical imaging, image processing and AI algorithm. The core advantage is to replace manual work, improve detection rate and efficiency, and adapt to the full-width, high-precision quality inspection needs of transparent, semi-transparent and composite PP films.
[0003] However, in the prior art, after the current polypropylene film is recognized, only the result of whether there is a defect or not is output, and there is no objective judgment on whether to perform the next step. The subjective judgment of the staff may cause unnecessary waste and improper handling. SUMMARY
[0004] The purpose of the present application is to provide a polypropylene film surface defect online detection and sorting method and system based on machine vision to solve the above problems in the prior art.
[0005] The present application is realized by the following technical solutions:
[0006] In a first aspect, the present application provides a polypropylene film surface defect online detection and sorting method based on machine vision, comprising: sending a control signal to start the oblique light supplement lamp, obtaining an initial image collected by the current target section, and preprocessing the initial image to obtain a to-be-recognized image; recognizing the to-be-recognized image based on an image recognition model, outputting a result of whether there is a defect, if there is no defect, no processing is performed, and if there is a defect, the image features of the current defect are obtained and an alarm signal is sent; obtaining the parameters of the current defect based on the image features, establishing a defect evaluation model, outputting the evaluation value of the current defect based on the current parameters through the defect evaluation model, and correcting the current transmission speed based on the evaluation value; obtaining the target length of the storage cylinder into which the polypropylene film is wound and the maximum length of the single storage cylinder that can wind the polypropylene film, and judging whether to sort the target section based on the target length, the maximum length and the evaluation value.
[0007] Preferably, the preprocessing of the initial image data to obtain the to-be-recognized image comprises: aligning and registering the current initial image, and denoising the registered image after alignment and registration; Histogram equalization is performed on the denoised target image to remove extreme gray values, resulting in the image to be identified.
[0008] Preferably, 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.
[0009] Preferably, the noise reduction of 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.
[0010] Preferably, the step of performing histogram equalization to remove 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.
[0011] Preferably, 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.
[0012] Preferably, the loss function includes:
[0013]
[0014]
[0015] 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 a real label, a probability that the i-th sample is predicted by the model as the j-th class, a probability that the i-th sample is predicted by the model as the j-th class, a defect feature alignment loss, a fusion deep feature vector of the i-th sample, a feature center of the j-th defect, a fusion deep feature vector of the i-th sample, a feature center of the j-th defect, a real label of the i-th sample corresponding to the j-th class, a feature center of the j-th defect, a real label of the i-th sample corresponding to the j-th class, a feature center of the j-th defect, a background penalty coefficient, a background region mask, a total loss, a loss balancing coefficient. Preferably, the establishing of the defect evaluation model comprises:
[0016]
[0017] In the formula, the evaluation value is an evaluation value, an area of an initial image, an area occupied by a defect, an average number of defects in each target end initial image, a number of defects in a current initial image, a cost of the polypropylene film of the current target end, a cost of the polypropylene film of a storage barrel, a number of defect types of the current target end, a number of defect types that have appeared in the current production, , , , a calculation coefficient, and the sum of the calculation coefficients is 1.
[0018] Preferably, the correcting of the current transmission speed based on the evaluation value comprises: setting a first correction threshold and a second correction threshold; when the evaluation value is less than the first correction threshold, when the evaluation value is greater than or equal to the first correction threshold and less than the second correction threshold, when the evaluation value is greater than the second correction threshold, when the evaluation value is greater than the second correction threshold, when the evaluation value is greater than the second correction threshold, wherein, correcting the speed of the conveying belt, the current conveying belt speed.
[0019] Preferably, the judging whether to sort the target section based on the target length, the maximum length and the evaluation value comprises establishing a sorting index function, and the sorting index function comprises:
[0020] wherein, is the sorting index, is the maximum length, is the target length, is the repair cost of the polypropylene film at the current target end; a judgment threshold is set, and when is greater than or equal to the judgment threshold, a signal for sorting is sent.
[0021] In a second aspect, the present application also provides a polypropylene film surface defect online detection and sorting system based on machine vision, which is used to execute the above-mentioned polypropylene film surface defect online detection and sorting method based on machine vision, and comprises: The image recognition module is configured to send a control signal for starting the oblique light compensation lamp, acquire an initial image collected by the current target section, pre-process the initial image to obtain a to-be-recognized image, recognize the to-be-recognized image based on an image recognition model, output a result of whether there is a defect, if there is no defect, do not process, if there is a defect, acquire image features of the current defect in advance and send an alarm signal; The evaluation module is configured to acquire parameters of the current defect based on the image features, establish a defect evaluation model, output an evaluation value of the current defect through the defect evaluation model based on the current parameters, correct the current conveying speed based on the evaluation value, acquire a target length of a storage cylinder into which the polypropylene film has been wound and a maximum length of the polypropylene film that can be wound into a single storage cylinder, and judge whether to sort the target section based on the target length, the maximum length and the evaluation value.
[0022] The technical scheme of the present application has at least the following advantages and beneficial effects: The method provided by the application mainly comprises the following steps: acquiring parameters of a current defect based on image features, establishing a defect evaluation model, outputting an evaluation value of the current defect based on the current parameters through the defect evaluation model, and correcting a current transmission speed based on the evaluation value; acquiring a target length of a storage cylinder into which polypropylene film is currently wound and a maximum length of polypropylene film that can be wound into a single storage cylinder, and judging whether to sort a target section based on the target length, the maximum length and the evaluation value. The above method identifies defects of the current section of polypropylene film, and when a defect is identified, further sorting judgment is performed to determine whether to ignore the defect or to sort the section of polypropylene film, so as to give an objective selection according to the same standard and assist the staff to make a decision after judgment. BRIEF DESCRIPTION OF DRAWINGS
[0023] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments. It should be understood that the following drawings only show some embodiments of the present application, and therefore should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can also be obtained without creative labor.
[0024] Fig. 1 The flowchart of the present application; Fig. 2 The system structure diagram of the present application. DETAILED DESCRIPTION
[0025] In order to make the purpose, technical solutions and advantages of the embodiments of the present application more clear, the following will combine the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are some of the embodiments of the present application, not all the embodiments. The components of the embodiments of the present application described and shown in the drawings can be arranged and designed in various different configurations.
[0026] The independently described modules or sub-modules can be physically separated or not physically separated, can be software implemented or hardware implemented, and part of the modules or sub-modules can be implemented by software, the function of the part of the modules or sub-modules is called by the processor, and the other part of the modules or sub-modules is implemented by hardware, for example, by hardware circuit. In addition, part or all of the modules can be selected to achieve the purpose of the present application scheme according to actual needs.
[0027] Please refer to Figs. 1-2 A polypropylene film surface defect online detection and sorting method based on machine vision, comprising: S101: A control signal for starting the oblique light compensation lamp is sent, an initial image collected by the current target section is obtained, and the initial image is preprocessed to obtain a to-be-identified image; In the present application, the illumination of the supplementary oblique light compensation lamp is supplemented, and based on the illumination, the shadow of defects such as breakage, foreign matter, weft shortage and residual yarn can be enlarged, and in image recognition, these features different from normal polypropylene film under illumination can be better captured, and the missed detection rate is reduced.
[0028] S102: The to-be-identified image is identified based on an image recognition model, and a result of whether a defect exists is output, if no defect exists, no processing is performed, and if a defect exists, an image feature of the current defect is obtained and an alarm signal is sent out; S103: The parameters of the current defect are obtained based on the image feature, a defect evaluation model is established, an 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; When a defect occurs, the polypropylene film of the current section needs to be evaluated before the next decision is made, in order to leave room for judgment, the current transmission speed needs to be corrected, and after the problem of the defect is solved, the staff restores it.
[0029] S104: The target length of the storage cylinder into which the current polypropylene film is wound and the maximum length of the single storage cylinder into which the polypropylene film can be wound are obtained, and whether the target section is sorted is judged based on the target length, the maximum length and the evaluation value.
[0030] Whether the current polypropylene film is sorted needs to be determined in combination with the length that has been stored, so that a reasonable judgment can be made, the polypropylene film is wound and stored by the storage barrel after production, the storage barrel is replaced for further storage after winding a sufficient amount, and whether to sort is further determined in combination with the degree of defects of the current section of polypropylene film.
[0031] The method provided by the present application mainly includes obtaining the parameters of the current defect based on the image feature, establishing a defect evaluation model, outputting the evaluation value of the current defect through the defect evaluation model based on the current parameters, and correcting the current transmission speed based on the evaluation value; obtaining the target length of the storage cylinder into which the current polypropylene film is wound and the maximum length of the single storage cylinder into which the polypropylene film can be wound, and judging whether the target section is sorted based on the target length, the maximum length and the evaluation value. Through the above method, the defects of the current section of polypropylene film are identified, and when a defect occurs after identification, further judgment of sorting is made, whether to ignore the defect here or to sort the polypropylene film of the section is given an objective choice under the same standard, to assist the staff to make a decision after judgment In one exemplary embodiment of the present invention, 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.
[0032] In one exemplary embodiment of the present invention, 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 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. 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.
[0033] 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.
[0034] 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.
[0035] The step of denoising the aligned and registered image includes: Based on the registered images, through 3 3The sliding window calculates the local variance in each window, sets a variance threshold, divides the image into a first variance region and a second variance region, the first variance region is reserved, the second variance region is denoised, the local variance greater than the variance threshold is the first variance region (high variance region), and the local variance less than or equal to the variance threshold is the second variance region (low variance region).
[0036] The size of the Gaussian kernel is defined, and the local gray mean value is calculated for each 3 3window, and the registered image is subjected to variable Gaussian filtering window by window to obtain a Gaussian denoised image, the noise intensity is determined based on the gray mean value, the Gaussian kernel standard deviation is proportional to the noise intensity, and the Gaussian filtering is performed based on the Gaussian kernel with variable standard deviation.
[0037] The sliding window is adopted to calculate the gray similarity weight of each pixel in the window with respect to the center pixel, the pixels in the window are sorted according to the gray value, the weighted median is calculated by combining the gray similarity weight, the center pixel value is replaced, and the registered image is subjected to weighted median filtering to obtain a median denoised image.
[0038] In the formula, is the gray similarity weight of the pixel at the position in the window, is the gray value of the neighborhood pixel in the window in the registered image, is the gray value of the center pixel in the registered image, is a gray similarity adjustment coefficient.
[0039] The calculation weight is set respectively to construct a denoising fusion function, and the Gaussian denoised image and the median denoised image are summed to output a final target denoised image based on the respective calculation weight.
[0040] In this embodiment, the image region type is first judged by the 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, the neighborhood pixels are given a gray similarity weight by the weighted median filtering to improve the salt and pepper noise suppression effect while retaining the edge, the high variance region is given a higher weight of the median filtering (to retain defect details), and the low variance region is given a higher weight of the Gaussian filtering (to strongly denoise).
[0041] In an example embodiment of the present application, the traditional global histogram equalization can amplify the background noise and slight texture of the polypropylene film, resulting in that the tiny defects are submerged, the traditional local histogram equalization (CLAHE) has a single contrast limit and cannot distinguish the defect region and the background texture region, and the reflection region is overexposed.
[0042] Therefore, the application is based on the target denoising image after noise reduction to carry out histogram equalization to remove extreme gray values, which includes: The gray histogram of the target denoising image is counted, the upper and lower limits of the gray value are set, the extreme gray values less than the first threshold value and greater than the second threshold value are removed by the cumulative histogram, and specifically, the extreme gray values of the first 2% and the last 2% can be removed. The pixels with a gray value less than the lower limit of the gray value in the image are set as the lower limit value of the gray value, and the pixels with a gray value greater than the upper limit of the gray value are set as the upper limit value of the gray value, to obtain a gray clipping image. The region variance mask var_mask (1=high variance region, 0=low variance region) of the previous step is used, the window size of the first variance region and the second variance region is set respectively, and the gray clipping image is divided into non-uniform windows, and each window overlaps T%, and T can be 50.
[0043] For each local window, the gray histogram thereof is calculated, the histogram clipping threshold is set, the histogram part exceeding the histogram clipping threshold is uniformly distributed to all gray levels, and a modified histogram is obtained. Different enhancement gains are set according to different variance regions, the high-variance window (suspected defect): the gain coefficient gamma=1.2 (enhancing the difference between the defect and the background), the low-variance window (smooth background): the gain coefficient gamma=0.6 (suppressing texture enhancement and avoiding noise amplification), the cumulative distribution function of the modified histogram is calculated, the gray mapping is performed based on the gain coefficient, and an equalized image in the window is obtained. For the pixel values of the overlapping windows, weighted average is used for fusion, and a final enhanced image to be recognized is output.
[0044] In an example embodiment of the application, the image recognition model includes: The historical image data of various defects is obtained, and the historical image data is divided into a training set and a validation set; Parallel convolution branches are set to extract different defect features, and a defect attention mask is generated for the feature map output by each branch to enhance the feature weight of the defect region by weighting; Branch 1: fine-grained 3*3 shape, edge, contour, fine texture (crystal surface rough texture); Branch 2: medium-grained 5*5 local gray distribution, gray gradient between the defect and the surrounding background; Branch 3: coarse-grained 7*7 global gray distribution, gray proportion of the defect in the entire image, and association with the distant background.
[0045] The Gabor filter is used, which is suitable for capturing the background texture of the polypropylene film. In the application, a fixed parameter Gabor kernel is not used, but the direction and scale of the Gabor kernel are adaptively adjusted according to the background texture statistical characteristics of the input image, so as to avoid insufficient adaptability to different texture polypropylene films.
[0046] The importance of different scale features is learned through learnable weight concatenation and residual connection, and the defect features are fused after being processed by global average pooling and global maximum pooling respectively to obtain a fusion feature vector;
[0047]
[0048]
[0049] In the formula, is the average feature value after global average pooling, is the height of the deep feature map, is the height and width of the deep feature map, is the feature value of the deep feature map of the pixel point marked as is the maximum feature value after global maximum pooling, is the feature fusion map.
[0050] The fusion feature vector is reduced by establishing a fully connected layer and a ReLU activation function, the probability distribution of each type of defect is output by Softmax activation, and the defect area is output by linear activation; A loss function is established, and the training process is optimized based on the result of the loss function.
[0051] Specifically, the loss function includes:
[0052]
[0053]
[0054] In the formula, is the weighted cross loss, is the number of image samples input into the model in a single training, is the total number of defect categories, is the index of the current batch of samples, and are the indexes of different defect categories, is the weight of the th defect category, is the real label of the th sample corresponding to the th defect category, is the probability that the th sample is predicted by the model as the th category, is the 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.
[0055] 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.
[0056] 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:
[0057] 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.
[0058] 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.
[0059] Specifically, correcting the current transmission speed based on the evaluation value includes: Set a first correction threshold and a second correction threshold; When less than the first correction threshold value, When greater than or equal to the first correction threshold value and less than the second correction threshold value, When greater than the first correction threshold value, wherein, is the correction speed of the conveying belt, the current conveying belt speed, when greater than the second correction threshold value, it means that the defect at this time is very serious and needs to be stopped for processing, on the one hand, it is to sort out the part with serious defects, and on the other hand, it leaves time for workers to find the reason for the serious defect.
[0060] In an example embodiment of the present application, the judgment on whether to sort the target section based on the target length, the maximum length and the evaluation value includes establishing a sorting index function, and the sorting index function includes:
[0061] In the formula, is the sorting index, is the maximum length, is the target length, is the repair cost of the current target end of the polypropylene film; a judgment threshold value is set, when greater than or equal to the judgment threshold value, a signal for sorting is sent.
[0062] In the present embodiment, further judgment is made on whether to sort, if the current storage barrel has been almost stored, the current defective section can be considered to be sorted after being rejected, the evaluation value of the current defect needs to be considered comprehensively, whether it can continue to be wound into the storage cylinder, at the same time, the repair cost can also be considered, whether it can continue to be stored, an objective index is given by the above method to assist the judgment of the workers, secondly, the judgment threshold value can be set according to historical data to obtain a more balanced value, in the present embodiment, it can be set to 0.02.
[0063] A polypropylene film surface defect online detection and sorting system based on machine vision, used to execute the above-mentioned polypropylene film surface defect online detection and sorting method based on machine vision, comprising: An image recognition module configured to send a control signal to start the oblique light supplementing lamp, acquire an initial image collected by the current target section, pre-process the initial image to obtain a to-be-recognized image, recognize the to-be-recognized image based on an image recognition model, and output a result of whether there is a defect, if there is no defect, no processing is performed, if there is a defect, image features of the current defect are acquired and an alarm signal is sent; 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.
[0064] 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.
[0065] 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.
[0066] 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.
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. The online detection and sorting method for surface defects of polypropylene film based on machine vision according to claim 6, characterized in that, 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.
8. The online detection and sorting method for surface defects of polypropylene film based on machine vision according to claim 7, characterized in that, 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.
9. The online detection and sorting method for surface defects of polypropylene film based on machine vision according to claim 8, characterized in that, 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.
10. 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-9, 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.
Citation Information
Patent Citations
Method for inspecting film
CN105869143A
Sorting method and sorting system for thin film products and estimation method for omission ratio
CN113096078A
Household membrane element surface defect detection system and detection method based on machine vision
CN117030612A
Method for discriminating defect of composite film
KR1020160145997A
Cited By
Intelligent optimization method and system for composite technological parameters of multi-layer polypropylene film
CN121978965A