Visual defect detection system for paper product line
Patent Information
- Application Number
- CN202512016933.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-30
- Publication Date
- 2026-09-25
- Estimated Expiration
- 2045-12-30
AI Technical Summary
这些缺陷在形态和表现上差异显著:例如,孔洞通常边界清晰、呈封闭轮廓,灰度值明显低于周围区域;而水渍或油污则往往边缘模糊、形状不规则,主要体现为局部纹理的紊乱;刮痕虽细长、长宽比高,但灰度变化微弱;纤维絮团则无明确几何边界,却会引起局部纹理能量或复杂度的异常波动;
本发明通过构建一种融合形状特征与纹理特征、并引入多层次判别机制的视觉缺陷检测系统,有效解决了现有纸制品在线检测技术中误检率高、漏检风险大以及系统鲁棒性不足等核心问题,取得了显著的技术效果;
Smart Images

Figure CN121783990B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of defect detection technology, and more particularly to a visual defect detection system for paper product production lines. Background Technology
[0002] In the high-speed, continuous production of paper products, surface quality is one of the core indicators for evaluating product grade. Common paper surface defects include holes, tears, stains, scratches, spots, wrinkles, and fiber clumps. These defects differ significantly in morphology and appearance: for example, holes usually have clear boundaries and closed outlines, with a gray value significantly lower than the surrounding area; while water stains or oil stains often have blurred edges and irregular shapes, mainly manifesting as disordered local texture; scratches, although thin and long with a high aspect ratio, show only slight changes in gray value; fiber clumps, however, have no clear geometric boundaries, but can cause abnormal fluctuations in local texture energy or complexity. To address the diverse types of defects mentioned above, existing machine vision-based online inspection systems still have significant limitations. On the one hand, they rely solely on single features for discrimination. Specifically, some use only shape parameters, such as area and the aspect ratio of the bounding rectangle, to identify defects. While effective for targets like holes, they struggle to distinguish between embossing, seams, or normal texture undulations in the paper itself. Others rely solely on texture features, such as contrast and entropy values. Although these can capture stains or watermarks, they are prone to misjudging the inherent uneven distribution of fibers on the paper surface as defects, resulting in a persistently high false alarm rate. On the other hand, current mainstream solutions mostly adopt the processing logic of "one-time discrimination and direct conclusion", that is, setting a fixed threshold for all suspected areas and directly classifying them as defects or normal. However, in actual production lines, a large number of suspected areas are in the critical state of characteristics, such as microbubbles and real pinholes, light shadows and slight stains. They are very easy to be misclassified in a single discrimination. The lack of a secondary evaluation mechanism for such ambiguous samples makes the system more prone to false detections under high sensitivity and easy to miss detections under low sensitivity. More importantly, current technologies generally only focus on the "number of confirmed defects" while ignoring the reliability of the detection process itself. When a large number of areas are mistakenly screened as "potential defects" due to factors such as light source aging, camera defocusing, environmental reflection, or changes in the overall humidity of the paper, even if they are ultimately determined to be "non-real defects," the abnormally high total number reflects instability in the system's operating state or an overall shift in the paper background. If products are released based solely on the number of actual defects, potential quality risks can be easily masked, and system drift can even lead to large-scale missed detections in subsequent batches.
[0003] Therefore, there is an urgent need for technical solutions for visual defect detection systems used in paper product production lines. Summary of the Invention
[0004] To address the aforementioned technical problems, this invention provides a visual defect detection system for paper product production lines, specifically comprising the following modules: Image acquisition and preprocessing module: used to acquire surface images of paper products in real time using a line scan camera, and preprocess the surface images to obtain standard inspection images; Potential defect identification module: connected to the image acquisition and preprocessing module, used to perform gridding processing on the standard inspection image, dividing the standard inspection image into several non-overlapping sub-regions, and identifying several potential defect sub-regions from these sub-regions; Real Defect Discrimination Module: Connected to the Potential Defect Determination Module, it is used to calculate the shape feature coefficient and texture feature coefficient of each potential defect sub-region, and to discriminate each potential defect sub-region based on the shape feature coefficient and texture feature coefficient, and to obtain the real defect sub-region based on the discrimination result; Binary mask image generation unit: used to perform binarization processing on each potential defect sub-region and generate a binary mask image for each potential defect sub-region; Area calculation unit: Used to calculate the total number of pixels in each potential defect sub-region based on the binary mask image, and obtain the area of each potential defect sub-region; Minimum bounding rectangle aspect ratio calculation unit: Based on the binary mask image, it extracts the closed contour of each potential defect sub-region, calculates the minimum bounding rectangle of each potential defect sub-region based on the closed contour, obtains the length and width of the minimum bounding rectangle, and calculates the aspect ratio to obtain the minimum bounding rectangle aspect ratio of each potential defect sub-region. Standardized contour sequence acquisition unit: used to normalize the closed contour of each potential defect sub-region to obtain the standardized contour sequence of each potential defect sub-region; Fourier descriptor vector acquisition unit: used to perform discrete Fourier transform on the standardized contour sequence of each potential defect sub-region to form the Fourier descriptor vector of each potential defect sub-region; Shape feature coefficient calculation unit: used to calculate the shape feature coefficient of each potential defect sub-region based on the area of each potential defect sub-region, the aspect ratio of the minimum bounding rectangle of each potential defect sub-region, and the Fourier descriptor vector of each potential defect sub-region; Grayscale image generation unit: used to perform grayscale processing on each potential defect sub-region and generate a grayscale image of each potential defect sub-region; Gray-level co-occurrence matrix acquisition unit: used to calculate the gray-level co-occurrence matrix of each potential defect sub-region based on the gray-level image; Contrast and energy extraction unit: used to extract contrast and energy from the gray-level co-occurrence matrix of each potential defect sub-region; Histogram acquisition unit: used to apply the local binary pattern algorithm to the grayscale image of each potential defect sub-region to obtain the local binary pattern histogram of each potential defect sub-region; Distribution entropy calculation unit: used to calculate the distribution entropy of the local binary pattern histogram of each potential defect sub-region based on the local binary pattern histogram of each potential defect sub-region; Texture feature coefficient calculation unit: used to combine the contrast of each potential defect sub-region, the energy of each potential defect sub-region, and the distribution entropy of the local binary pattern histogram of each potential defect sub-region to calculate the texture feature coefficient of each potential defect sub-region; Preliminary discrimination unit: used to perform preliminary discrimination on each potential defect sub-region based on each parameter, including the area of each potential defect sub-region, the aspect ratio of the minimum bounding rectangle of each potential defect sub-region, the Fourier descriptor vector of each potential defect sub-region, the shape feature coefficient of each potential defect sub-region, the contrast of each potential defect sub-region, the energy of each potential defect sub-region, the distribution entropy of the local binary pattern histogram of each potential defect sub-region, and the texture feature coefficient of each potential defect sub-region, and obtain the first real defect sub-region, the first non-real defect sub-region, and the preliminary potential defect sub-region based on the preliminary discrimination results; First threshold setting subunit: used to set the corresponding first threshold for each parameter; First Real Defect Sub-region Labeling Sub-unit: If the area, minimum bounding rectangle aspect ratio, Fourier descriptor vector and shape feature coefficient of the current potential defect sub-region are all greater than or equal to the corresponding first threshold, and the contrast, energy, distribution entropy of local binary mode histogram and texture feature coefficient of each potential defect sub-region are all greater than or equal to the corresponding first threshold, then the current potential defect sub-region is labeled as the first real defect sub-region. First Non-True Defect Sub-Region Marking Sub-Unit: Used to mark the current potential defect sub-region as the first non-true defect sub-region if the area, minimum bounding rectangle aspect ratio, Fourier descriptor vector and shape feature coefficient of the current potential defect sub-region are all less than the corresponding first threshold, and the contrast, energy, distribution entropy of local binary mode histogram and texture feature coefficient of each potential defect sub-region are all less than the corresponding first threshold. Preliminary potential defect sub-region marking sub-unit: Used to mark the current potential defect sub-region as a preliminary potential defect sub-region if either the first or second case is excluded; Defect confidence score calculation unit: used to extract the shape feature coefficients and texture feature coefficients of each preliminary potential defect sub-region, and substitute the shape feature coefficients and texture feature coefficients of each preliminary potential defect sub-region into the preset defect discrimination function to obtain the defect confidence score of each preliminary potential defect sub-region; Final discrimination unit: used to make a final discrimination of each preliminary potential defect sub-region based on the defect confidence score of each preliminary potential defect sub-region, and to obtain the second real defect sub-region and the second non-real defect sub-region based on the final discrimination result; Second threshold setting subunit: used to set a second threshold for the defect confidence score of each preliminary potential defect sub-region; Second True Defect Sub-region Marking Sub-unit: If the defect confidence score of the current preliminary potential defect sub-region is greater than or equal to the second threshold, then the current preliminary potential defect sub-region is marked as the second true defect sub-region. Second Non-True Defect Sub-Region Marking Sub-Unit: Used to mark the current preliminary potential defect sub-region as the second non-true defect sub-region if the defect confidence score of the current preliminary potential defect sub-region is less than the second threshold; Rejection or retention action execution module: connected to the real defect discrimination module, used to generate detection results based on the real defect sub-region, feed the detection results back to the production line control system, and the production line control system executes rejection or retention actions on the current paper product; First statistical unit: used to count the number of the first real defect sub-region and the second real defect sub-region respectively, and summarize them to obtain the total number of real defect sub-regions; The second statistical unit is used to count the number of the first and second non-real defect sub-regions respectively, and then summarize them to obtain the total number of non-real defect sub-regions. Sub-region number determination unit: used to determine the number of sub-regions when the standard detection image is segmented; Ratio calculation unit: used to calculate the first ratio of the total number of real defect sub-regions to the number of sub-regions when the standard detection image is segmented, and to calculate the second ratio of the total number of non-real defect sub-regions to the number of sub-regions when the standard detection image is segmented; Detection result acquisition unit: used to generate a substandard detection result for the current paper product if the first ratio is greater than or equal to a first preset ratio threshold or the second ratio is greater than or equal to a second preset ratio threshold; If the first ratio is less than the first preset ratio threshold and the second ratio is less than the second preset ratio threshold, then a good test result for the current paper product is generated.
[0005] The embodiments of the present invention have the following technical effects: This invention effectively solves the core problems of existing online paper product inspection technologies, such as high false detection rate, high risk of missed detection, and insufficient system robustness, by constructing a visual defect detection system that integrates shape features and texture features and introduces a multi-level discrimination mechanism, and achieves significant technical results. First, this invention achieves collaborative discrimination of shape and texture at the feature extraction level. For defects with obvious geometric features such as holes and cracks, its contour characteristics are accurately depicted by calculating the area, the aspect ratio of the minimum bounding rectangle, and the Fourier descriptor vector. At the same time, for texture-abnormal defects such as stains, water stains, and fiber clumps, contrast and energy are extracted by gray-level co-occurrence matrix, and the distribution entropy of the local binary mode (LBP) histogram is combined to effectively capture its local gray-level changes and structural complexity. This dual-feature fusion mechanism overcomes the limitation of single-feature discrimination being susceptible to interference, and significantly improves the comprehensive recognition ability of multiple types of defects. In particular, it shows excellent anti-interference performance in distinguishing real defects from normal texture undulations, such as embossing, seams, and differences in wood pulp distribution. Secondly, this invention innovatively adopts a two-stage hierarchical discrimination architecture. In the first stage, potential defect sub-regions are rapidly screened based on a preset threshold to clearly separate "obvious defects" and "obvious normal" samples. For ambiguous regions in the feature critical state, they are retained as "preliminary potential defect sub-regions" and enter the second stage. In the second stage, the defect confidence score is calculated through a preset defect discrimination function, and the final judgment is made based on the second threshold. This mechanism avoids the risk of misjudgment caused by traditional single hard decision, so that the system can significantly reduce the missed detection rate of small, weak contrast or ambiguous boundary defects while maintaining high sensitivity, and suppress false alarms caused by noise or illumination fluctuations. Most importantly, this invention is the first to incorporate the proportion of non-real defect sub-regions into the overall quality assessment system. Since non-real defect sub-regions reflect suspected areas that were mistakenly screened by the system but ultimately proven false, an abnormally high number of them often indicates abnormal detection environments, such as light source attenuation, camera defocusing, or overall paper surface deterioration, such as large-area uneven humidity or coating fluctuations. By setting a second preset proportion threshold, when this proportion exceeds the limit, even if the number of real defects does not exceed the limit, the system still judges it as "inferior," thereby triggering equipment calibration or manual review processes. This design achieves a leap from "only focusing on result quality" to "simultaneously monitoring process reliability," significantly enhancing the stability and reliability of the system in long-term operation. In summary, this invention not only improves the accuracy and adaptability of surface defect detection in paper products, but also ensures the long-term consistency of detection results through a process quality monitoring mechanism, providing reliable technical support for high-speed, high-precision paper product production lines. It has outstanding practical value and promising prospects for promotion. Attached Figure Description
[0006] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0007] Figure 1 This is a framework diagram of a visual defect detection system for paper product production lines provided in an embodiment of the present invention. Detailed Implementation
[0008] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below. Obviously, the described embodiments are only a part of the embodiments of this invention, and not all of them. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.
[0009] Example 1: As Figure 1 As shown, the present invention provides a visual defect detection system for paper product production lines, comprising the following modules: Image acquisition and preprocessing module: used to acquire surface images of paper products in real time using a line scan camera, and preprocess the surface images to obtain standard inspection images; It is worth noting that during the operation of the paper product production line, the paper web continuously passes through the inspection station at a constant speed. At this time, a line scan camera deployed above the production line captures real-time images of the paper web's surface. Specifically, the line scan camera is mounted perpendicular to the direction of paper web movement and is synchronously illuminated by a high-brightness, highly uniform line light source. The line scan camera continuously scans the moving paper web surface line by line at a preset line frequency (i.e., the number of lines captured per second). Combined with the real-time speed signal of the paper web fed back by the encoder, precise synchronization between image acquisition and paper web movement is achieved, thus avoiding image stretching or compression caused by speed fluctuations. The acquired raw images are a one-dimensional line data sequence, which is stitched together by an image acquisition card or embedded vision processor to form a complete two-dimensional grayscale surface image. Subsequently, a series of preprocessing operations are performed on the surface image to obtain a standard inspection image: First, bad pixel correction and dark / bright field compensation are performed to eliminate the effects of sensor noise and uneven illumination; second, Gaussian filtering or median filtering is used to denoise the image, suppressing high-frequency interference while preserving edge information; next, contrast enhancement is performed, using histogram equalization or adaptive gamma correction to improve the distinction between defect areas and the background; finally, the image is cropped according to the production line paper width parameters, removing invalid edge areas on both sides, and the image size is normalized to a preset resolution to ensure that the sub-regions in subsequent meshing processing are of consistent size. The image processed by the above steps is the "standard inspection image," which features low noise, uniform illumination, moderate contrast, and standardized size, providing a high-quality input basis for subsequent defect detection.
[0010] Potential defect identification module: connected to the image acquisition and preprocessing module, used to perform gridding processing on the standard inspection image, dividing the standard inspection image into several non-overlapping sub-regions, and identifying several potential defect sub-regions from these sub-regions; It is worth noting that after obtaining the standard inspection image, it is first processed into a grid. Specifically, the entire standard inspection image is divided into several non-overlapping, regularly arranged rectangular sub-regions according to a preset fixed size (e.g., 64×64 pixels or 128×128 pixels). The division method adopts a left-to-right and top-to-bottom traversal to ensure that the entire image area is completely covered without overlap or omission. The size of each sub-region is pre-calibrated according to the minimum detectable scale of typical defects in paper products and the production line resolution to ensure that even small defects can be completely contained within at least one sub-region. After gridding is completed, the system performs preliminary anomaly detection on each sub-region in sequence to screen out potential defective sub-regions. This screening process is achieved by calculating the difference between each sub-region and its local neighborhood background. Specifically, a sliding window is used to construct a local background model, and the difference in grayscale mean or texture energy between each sub-region and several neighboring sub-regions (such as a 3×3 neighborhood) is calculated. If the difference exceeds a preset first screening threshold, the sub-region is considered abnormal and marked as a "potential defect sub-region." Furthermore, auxiliary indicators such as edge density, local variance, or frequency domain energy can be combined for joint discrimination to improve the robustness of the screening. It is worth noting that this stage does not determine the authenticity of defects; it only extracts sub-regions that significantly deviate from the normal background based on saliency response, forming a candidate set for subsequent detailed analysis. Ultimately, all marked sub-regions constitute "several potential defect sub-regions," while the remaining unmarked sub-regions are considered normal background and no longer participate in subsequent calculations, thus effectively reducing algorithm complexity and focusing on suspicious areas.
[0011] Real Defect Discrimination Module: Connected to the Potential Defect Determination Module, it is used to calculate the shape feature coefficient and texture feature coefficient of each potential defect sub-region, and to discriminate each potential defect sub-region based on the shape feature coefficient and texture feature coefficient, and to obtain the real defect sub-region based on the discrimination result; Binary mask image generation unit: used to perform binarization processing on each potential defect sub-region and generate a binary mask image for each potential defect sub-region; It is worth noting that after obtaining several potential defect sub-regions, for each potential defect sub-region, its corresponding image block (i.e., the original grayscale data of the sub-region in the standard detection image) is first extracted, and then binarized to generate the corresponding binary mask image. Specifically, an adaptive thresholding method is used for binarization: first, the grayscale mean and standard deviation of all pixels in the sub-region are calculated, and the binarization threshold is dynamically determined in combination with local background characteristics. For example, the threshold is set to "local mean minus k times the standard deviation" (where k is an empirical coefficient, usually taken as 0.8 to 1.5, which can be calibrated according to the paper type and lighting conditions). For dark defects such as holes and cracks, if the overall grayscale of the sub-region is lower than that of the background, a low threshold segmentation is used, and pixels with grayscale values lower than the threshold are set as foreground (marked as 1 or 255), and the rest are set as background (marked as 0). Conversely, for bright defects such as bright stains or reflective scratches, a high threshold segmentation is used, and pixels with grayscale values higher than the threshold are regarded as foreground. To improve robustness, Otsu's maximum inter-class variance method or Sauvola's local adaptive algorithm can be introduced to automatically optimize the threshold under complex lighting or texture backgrounds. After thresholding, the preliminary binary image undergoes morphological post-processing: first, an opening operation (erosion followed by dilation) is performed to remove isolated noise points, and then a closing operation (dilation followed by erosion) is performed to fill small holes inside the foreground region, thereby obtaining a foreground target with continuous boundaries and a complete structure. The final output image is the binary mask image of the potential defect sub-region, where foreground pixels precisely correspond to the suspected defect region, and background pixels are 0, providing a clear and reliable binary input basis for subsequent shape feature analysis such as area calculation and contour extraction.
[0012] Area calculation unit: Used to calculate the total number of pixels in each potential defect sub-region based on the binary mask image, and obtain the area of each potential defect sub-region; It is worth noting that after completing the binarization of each potential defect sub-region and generating the corresponding binary mask image, the next step is to analyze these binary mask images to determine the area of each potential defect sub-region. The area referred to here is actually the total number of pixels marked as foreground (i.e., suspected defect part) in the binary mask image. In practice, the process first involves iterating through all pixels in each binary mask image. For each pixel, it checks whether it belongs to the foreground (i.e., the pixel value is set to a value representing the foreground, such as 1 or 255). If it does, the counter is incremented; otherwise, no action is taken, and the process continues to check the next pixel. This process can be implemented using loop structures in programming languages, scanning line by line from the top left corner of the image to the bottom right corner, or by choosing different optimization strategies based on performance requirements, such as block parallel processing, to speed up the computation. Ultimately, after all pixels in the entire binary mask image have been examined, the value in the counter represents the area of the potential defect sub-region, that is, the number of pixels within that sub-region that are considered defects. This area information provides crucial data support for further assessment of the severity and size distribution of defects. At the same time, this calculation method ensures the consistency and accuracy of area measurement, facilitating subsequent quality control and analysis.
[0013] Minimum bounding rectangle aspect ratio calculation unit: Based on the binary mask image, it extracts the closed contour of each potential defect sub-region, calculates the minimum bounding rectangle of each potential defect sub-region based on the closed contour, obtains the length and width of the minimum bounding rectangle, and calculates the aspect ratio to obtain the minimum bounding rectangle aspect ratio of each potential defect sub-region. It is worth noting that, firstly, for each binary mask image, all closed contours need to be identified. This process can be achieved through an edge detection algorithm, which can automatically find the boundaries between all foreground pixels and background pixels. Once these boundaries are determined, they can be processed as closed contours. Next, for each found closed contour, calculate its minimum bounding rectangle. The minimum bounding rectangle is the rectangle that completely contains the contour and has the smallest area. To find this rectangle, a geometric algorithm can be used to traverse all possible directions to determine a rectangle that can completely enclose the contour and has the smallest area. The position, length, and width of this rectangle are dynamically determined according to the specific shape and direction of the contour. Once the minimum bounding rectangle is obtained, its length and width information can be directly read. Here, the length refers to the length of the longer side of the rectangle, and the width is the length of the shorter side. After obtaining these two values, the aspect ratio is further calculated by dividing the length of the longer side by the length of the shorter side. The result is the aspect ratio of the minimum bounding rectangle of the potential defect sub-region. Through the above process, the corresponding minimum bounding rectangle and its aspect ratio information can be generated for each potential defect sub-region. This is crucial for subsequent analysis of the morphological characteristics of defects. For example, different types of defects may have different aspect ratio characteristics, which helps to classify and evaluate defects more accurately. In addition, this shape feature-based analysis method also facilitates the implementation of automated inspection systems, improving the efficiency and accuracy of industrial inspection processes.
[0014] Standardized contour sequence acquisition unit: used to normalize the closed contour of each potential defect sub-region to obtain the standardized contour sequence of each potential defect sub-region; It is worth noting that, firstly, a unified standard size or proportion needs to be determined, which will serve as the benchmark for normalizing all contours. The choice of this standard size can be determined according to the specific application scenario and requirements, with the aim of ensuring that contours of different sizes can be compared and analyzed on the same scale. Next, for the closed contour of each potential defect sub-region, perform the following operations: First, calculate the length and width of the maximum bounding box of the current closed contour, or directly use the length and width of the minimum bounding rectangle calculated earlier. This process is to understand the actual size range of the current contour. Next, the size of the current outline is adjusted according to the selected standard size. If the standard size is smaller than the actual size, the outline is shrunk; if the standard size is larger than the actual size, the outline is enlarged. The scaling ratio is calculated based on the ratio between the standard size and the current outline size. In this way, all outlines are adjusted to the same scale. Since scaling operations may change the number of contour points, it is necessary to resample the scaled contours to ensure that all contours have the same number of points. This simplifies the subsequent contour comparison and matching process. The usual practice is to select a fixed number of points at equal intervals along the contour, which represent the key positions of the contour. To further improve the normalization effect, the contour can be translated and rotated. Translation means moving the contour to a specific starting point of the coordinate system, such as the origin; rotation means making the direction of the contour consistent with the set standard direction, which helps to reduce the impact of differences in position and direction. Through the above process, the closed contour of each potential defect sub-region is transformed into a standardized contour sequence. This sequence not only eliminates differences in size, position, and orientation, but also allows the contours to be analyzed more accurately by comparing their shape features. Such normalization is particularly useful for automatically identifying and classifying defect types because it allows the system to focus on the morphological features of the contours without considering physical dimensions.
[0015] Fourier descriptor vector acquisition unit: used to perform discrete Fourier transform on the standardized contour sequence of each potential defect sub-region to form the Fourier descriptor vector of each potential defect sub-region; It is worth noting that, firstly, all potential defect sub-regions have been normalized to obtain standardized contour sequences, which are composed of a series of points representing information about key locations on the contour. Next, for each standardized contour sequence, perform the following operations: First, the standardized contour sequence is converted into a form suitable for discrete Fourier transform. Typically, this means ensuring that the contour sequence is represented in complex form, where the real and imaginary parts represent the coordinates of the contour points. If the contour sequence is not in this form, it needs to be converted into a suitable format. The prepared contour sequence data is then subjected to a discrete Fourier transform. This process essentially transforms the contour sequence from the spatial domain to the frequency domain. In this way, the frequency components in the contour shape can be captured, which is very useful for distinguishing different shape features. The result of the Discrete Fourier Transform is a series of complex values, each corresponding to the amplitude and phase information of different frequency components. The first few coefficients are selected as part of the Fourier descriptor vector. These coefficients effectively encode the main shape features of the original contour while reducing the dimensionality of the data. The selected Fourier coefficients are then combined to form a vector, namely the Fourier descriptor vector. This vector contains enough information to characterize the main shape features of the original contour, but its dimension is much lower than the number of points in the original contour. This makes subsequent shape comparison, classification or recognition tasks more efficient. Through the above process, the standardized contour sequence of each potential defect sub-region can be converted into the corresponding Fourier descriptor vector. This not only simplifies the representation of the contour, but also helps to improve the efficiency and accuracy of shape feature-based analysis tasks.
[0016] Shape feature coefficient calculation unit: used to calculate the shape feature coefficient of each potential defect sub-region based on the area of each potential defect sub-region, the aspect ratio of the minimum bounding rectangle of each potential defect sub-region, and the Fourier descriptor vector of each potential defect sub-region; It is worth noting that, firstly, the three original features mentioned above are uniformly dimensionless to eliminate the influence caused by differences in units or magnitudes, and to ensure that the features are comparable during fusion. Among them, the area itself has units of pixels and is a dimensional quantity; while the aspect ratio of the minimum bounding rectangle and each component in the Fourier descriptor vector are ratios or relative quantities, and are naturally dimensionless. For the area, a normalization method is used to convert it into a dimensionless form: the area of each potential defect sub-region is divided by the total area of the corresponding image block (i.e., the fixed number of pixels in the sub-region, for example, 64 times 64 equals 4096), thus obtaining a relative area ratio between zero and one. This ratio reflects the proportion of defects within the sub-region, no longer dependent on image resolution or physical size, and has good scale invariance; The aspect ratio of the minimum bounding rectangle is itself the ratio of the two lengths, which is a dimensionless quantity and can be directly used in subsequent calculations. For Fourier descriptor vectors, since they are composed of complex coefficients, usually only the magnitudes of the first few low-frequency coefficients (such as the first eight) are taken as effective features. Although these magnitudes originate from the coordinate sequence, after the Discrete Fourier Transform, their numerical values reflect the frequency domain energy distribution of the contour shape and do not have physical units. To further enhance stability, the entire vector can be divided by the magnitude of its first non-zero coefficient (DC component) to achieve amplitude normalization, thereby eliminating the overall scaling effect and allowing the descriptor to retain only shape information. After dimensionless transformation, the three types of features mentioned above—normalized area, aspect ratio, and normalized Fourier descriptor vector—are weighted and fused according to preset weights, or input into a pre-trained shallow classifier, such as a logistic regression model or support vector machine, to output a single numerical value. This value is the shape feature coefficient of the potential defect sub-region. This coefficient comprehensively reflects the shape characteristics of the defect in multiple dimensions such as geometric scale, aspect ratio, and contour complexity, and is completely dimensionless, making it easy to set a uniform threshold for stable discrimination across samples and batches. It is worth further explaining that the specific calculation method of the shape feature coefficient through the binary mask image generation unit to the shape feature coefficient calculation unit significantly improves the recognition accuracy and robustness of defects with clear geometric shapes such as holes, cracks, and scratches. This technical solution first performs binarization processing on the potential defect sub-region to generate a binary mask image, ensuring that subsequent contour analysis is not affected by grayscale. Then, the area is accurately calculated based on the mask to reflect the physical scale of the defect. By extracting the closed contour and constructing the minimum bounding rectangle, the aspect ratio is obtained to effectively distinguish between slender scratches and near-circular holes. Furthermore, by performing a discrete Fourier transform on the standardized contour sequence, a Fourier descriptor vector is obtained. This vector can completely preserve the high-frequency details and overall shape characteristics of the contour in a low-dimensional form, and has a strong characterization ability for irregular edges or slightly deformed defects. Finally, the area, aspect ratio, and Fourier descriptor vector are fused into a single shape feature coefficient, which not only achieves unified quantification of multi-scale geometric information, but also avoids the problem that single indicators (such as using only area) are easily affected by noise or segmentation errors. In actual testing, this shape feature coefficient can effectively distinguish between real holes and normal structures such as paper embossing and seams, significantly reducing misjudgments caused by geometric similarity. Especially in high-speed production line environments, even if the defect edges are blurred or partially obscured, the Fourier descriptor can still stably capture its essential contour features, thus ensuring high sensitivity and high specificity of shape discrimination and providing a solid and reliable geometric foundation for subsequent multi-level discrimination mechanisms.
[0017] Grayscale image generation unit: used to perform grayscale processing on each potential defect sub-region and generate a grayscale image of each potential defect sub-region; It is worth noting that, firstly, the original image block corresponding to each sub-region marked as a potential defect is extracted from the standard inspection image. Since the standard inspection image itself is usually a single-channel grayscale image (acquired by a line scan camera and preprocessed), this process mainly serves to isolate data and confirm the format. If the original image is in color (for example, a color line scan camera is used in some special configurations), then grayscale conversion needs to be performed at this stage. When dealing with color images, grayscale processing uses a weighted average method, which combines the pixel values of the red, green, and blue color channels according to the differences in human eye sensitivity to different colors. Specifically, the new grayscale value of each pixel is equal to the red component multiplied by 0.299, plus the green component multiplied by 0.587, plus the blue component multiplied by 0.114. The sum of the three is the final grayscale value of the pixel. This weighted combination conforms to the standard luminance perception model and can effectively preserve the visual contrast characteristics of the image. After the above processing is completed, regardless of whether the original input is grayscale or color, each potential defect sub-region is uniformly represented as a single-channel grayscale image block. Each pixel contains only one grayscale intensity value, which usually ranges from zero to 255. This grayscale image fully preserves visual information such as surface brightness, shadows, stains, or textures within the sub-region, and the format is standardized, providing a unified and reliable data foundation for subsequent calculation of texture features such as grayscale co-occurrence matrix and local binary patterns.
[0018] Gray-level co-occurrence matrix acquisition unit: used to calculate the gray-level co-occurrence matrix of each potential defect sub-region based on the gray-level image; It is worth noting that, firstly, the parameter settings of the gray-level co-occurrence matrix need to be determined, including distance and angle. For distance, a small positive value is usually chosen to ensure that the spatial relationship between adjacent pixels can be captured. For angle, four directions can be selected: 0 degrees, 45 degrees, 90 degrees, and 135 degrees, to ensure that texture features are analyzed from different directions. Next, for each potential defective sub-region of grayscale image, pixels are paired according to the selected distance and angle. Specifically, for a given pixel, another pixel at a specific distance and in the selected angle direction is found, and the grayscale values of the two pixels are recorded as a pair. The above process is repeated throughout the grayscale image to count the frequency of all possible combinations of grayscale values and fill these frequency values into the corresponding positions in the grayscale co-occurrence matrix. It is worth noting that in actual operation, due to the large number of grayscale levels, direct calculation will make the matrix very large and sparse. Therefore, the grayscale image is often quantized first, that is, the original 256 grayscale levels are reduced to a smaller number, such as eight or sixteen levels, to simplify the calculation and reduce data redundancy. After constructing the gray-level co-occurrence matrix, we can further extract the texture information it contains. Commonly used features include the second moment of the angle, contrast, energy, and entropy, which respectively reflect the uniformity of the image, the intensity of local changes, the linear dependence between pixels, the consistency of texture, and the level of randomness. By calculating these features, we can effectively describe the texture characteristics of potential defective sub-regions, providing strong support for subsequent defect identification.
[0019] Contrast and energy extraction unit: used to extract contrast and energy from the gray-level co-occurrence matrix of each potential defect sub-region; It is worth noting that the first step is to calculate the contrast ratio. The contrast ratio reflects the intensity of local changes in an image, especially the degree of difference between a pixel value and its neighboring pixel values. For each element in the gray-level co-occurrence matrix, the intensity of this local change is quantified by summing the product of the square of the difference between its coordinates and the value at that position. In practice, the entire gray-level co-occurrence matrix is traversed, and the above rules are applied to each non-zero element. All results are then accumulated and summed to obtain the contrast ratio. This process ensures that the changes in texture within potential defective sub-regions are captured from different directions and distances. The next step is energy extraction. Energy, also known as the second moment of the angle, is an important indicator for measuring the uniformity of image texture. It can reflect the concentration of gray-level distribution in the image. When calculating energy, the square value of each element in the gray-level co-occurrence matrix needs to be accumulated. Specifically, all elements of the gray-level co-occurrence matrix are traversed, and the value of each element is multiplied by itself and then accumulated into the sum. If the frequency of certain gray-level combinations in the gray-level co-occurrence matrix of a region is much higher than that of other combinations, the energy value of that region will be relatively high, indicating that this region has strong uniformity and repetitive texture features. Through the above process, the contrast and energy are extracted from the gray-level co-occurrence matrix of each potential defective sub-region, which provides important quantitative indicators for subsequent analysis.
[0020] Histogram acquisition unit: used to apply the local binary pattern algorithm to the grayscale image of each potential defect sub-region to obtain the local binary pattern histogram of each potential defect sub-region; It is worth noting that, firstly, a pixel is selected as the center point, and its surrounding neighboring pixels are considered. Typically, a 3x3 window is selected, with the pixel to be processed at the center and the surrounding 8 pixels as the neighboring pixels. Next, the gray value of the center pixel is compared with the gray values of each of its neighboring pixels. If the gray value of a neighboring pixel is greater than or equal to that of the center pixel, the position is marked as 1; otherwise, it is marked as 0. In this way, a set of binary numbers is formed around the center pixel. This set of numbers can be combined in a specific way to convert into a new value, namely the LBP value of that pixel. After completing the above operations, repeat this process for all pixels in each potential defect sub-region to calculate the LBP value of each pixel. Then, construct a histogram based on these LBP values. Specifically, set a series of intervals (or "buckets"). The number of intervals depends on the desired histogram accuracy and the needs of subsequent analysis. Traverse the entire sub-region, assign each pixel to the corresponding interval based on its LBP value, and accumulate the count of that interval. The final histogram reflects the frequency distribution of different LBP values in the region. This distribution effectively describes the texture characteristics of the sub-region. Throughout the process, it is important to maintain consistency and standardization in the implementation of the algorithm, ensuring that each potential defect sub-region is processed according to the same rules. This guarantees the comparability of the extracted local binary pattern histograms, providing a reliable basis for further defect identification. In addition, to improve the accuracy of feature extraction, the parameters of the LBP algorithm, such as the neighborhood radius and the number of sampling points, can be adjusted and optimized according to the actual situation.
[0021] Distribution entropy calculation unit: used to calculate the distribution entropy of the local binary pattern histogram of each potential defect sub-region based on the local binary pattern histogram of each potential defect sub-region; It is worth noting that, firstly, it is necessary to clarify that distribution entropy is a way to measure the information content of a local binary pattern histogram, and it reflects the uniformity of data distribution in different intervals of the histogram. At the beginning, a local binary pattern histogram of each potential defect sub-region is obtained. For this histogram, the total number of pixels is first determined, which is the sum of the counts of all intervals. Then, for each interval in the histogram, the proportion of the number of pixels in that interval to the total number of pixels is calculated. This proportion represents the importance or contribution of that interval in the whole histogram. Next, repeat the following process for each interval: Based on the proportions obtained above, if the proportion of a certain interval is not zero, calculate the proportion multiplied by its own natural logarithm. Note that the emphasis here is on considering non-zero proportions, because zero proportions will not affect the final distribution entropy. Each time such a calculation is completed, the result is negative and accumulated into a cumulative value. The final step is to check whether the accumulated result correctly reflects the definition of distribution entropy. The higher the distribution entropy, the more uniform the information distribution in the histogram; conversely, if the distribution entropy is low, it means that the information is concentrated in a few intervals. In this way, the texture complexity or consistency of each potential defect sub-region can be quantified, thus providing valuable information for subsequent analysis. The entire process must be strictly performed according to the description to ensure that each potential defect sub-region is processed according to the same standard to guarantee the validity and accuracy of the comparison.
[0022] Texture feature coefficient calculation unit: used to combine the contrast of each potential defect sub-region, the energy of each potential defect sub-region, and the distribution entropy of the local binary pattern histogram of each potential defect sub-region to calculate the texture feature coefficient of each potential defect sub-region; It is worth noting that, firstly, we need to analyze the physical properties of each indicator. Contrast reflects the degree of drastic change in gray level, and its value is affected by the dynamic range of the image, so it is a dimensional quantity. Energy represents the sum of squares of the elements in the gray-level co-occurrence matrix, and its value range depends on the gray level and the image size, so it is also dimensional. Distribution entropy is an information metric based on probability calculation and is itself a dimensionless quantity. Therefore, contrast and energy need to be normalized separately. The normalization method employs a maximum value scaling strategy: for all potential defective sub-regions in the entire batch of paper images to be inspected or in the current batch, the maximum contrast value is calculated, and the contrast of each sub-region is divided by this maximum value to make it fall between zero and one; similarly, the same method is used for energy, dividing it by its maximum value in the current batch to achieve dimensionless conversion. Since the distribution entropy is naturally dimensionless and has a limited theoretical range (usually between zero and several bits), the original value can be used directly, or it can be further divided by the theoretical maximum entropy (such as the upper limit of the logarithm corresponding to eight-bit quantized grayscale) to enhance consistency; After dimensionless transformation, the three indicators are linearly weighted and fused according to preset weights. The weights can be determined based on historical data or paper type characteristics. For example, paper that is sensitive to stains can be given a higher weight for contrast, while paper that requires high texture uniformity can have its energy or distribution entropy weight increased. The weighted sum constitutes the texture feature coefficient of the potential defect sub-region. This coefficient comprehensively characterizes the overall texture characteristics of the sub-region in three dimensions: grayscale change intensity, texture repeatability, and information complexity. It is completely dimensionless, which makes it easy to set a unified threshold for stable discrimination across samples and working conditions, providing a reliable basis for subsequent defect authenticity determination. It is worth further explaining that the systematic extraction process of texture feature coefficients, constructed from the grayscale image generation unit to the texture feature coefficient calculation unit, effectively solves the problem of identifying defects such as stains, water stains, and fiber clumps that have no clear boundaries but exhibit texture anomalies. This scheme first performs grayscale processing on potential defect sub-regions to ensure input consistency; then, a grayscale co-occurrence matrix is constructed based on the grayscale image, and contrast and energy are extracted from it—the former reflects the intensity of local grayscale differences and can keenly capture abrupt changes in brightness caused by oil or water stains, while the latter characterizes texture repeatability and is highly sensitive to disordered fiber distribution or uneven coating; simultaneously, a local binary mode algorithm is introduced to generate a histogram, and its distribution entropy is further calculated to quantify the complexity and randomness of local textures, demonstrating excellent response capabilities to subtle but structurally disordered defects (such as slight mold spots or slurry clumps). Finally, contrast, energy, and distribution entropy are fused into texture feature coefficients, forming a multi-dimensional comprehensive measure of texture anomalies. This coefficient not only overcomes the shortcomings of single texture indicators (such as contrast alone) being susceptible to light fluctuations, but also effectively distinguishes between real stains and the inherent wood pulp texture undulations of the paper surface. In practical applications, even if the grayscale change of the defect is slight, as long as it disrupts the consistency of the local texture, this texture feature coefficient can still stably output a high response value, thereby significantly improving the detection rate of low-contrast, non-geometric defects, while suppressing false alarms caused by uneven paper raw materials. It provides high signal-to-noise ratio input support for the texture dimension in the dual-feature collaborative discrimination mechanism.
[0023] Preliminary discrimination unit: used to perform preliminary discrimination on each potential defect sub-region based on each parameter, including the area of each potential defect sub-region, the aspect ratio of the minimum bounding rectangle of each potential defect sub-region, the Fourier descriptor vector of each potential defect sub-region, the shape feature coefficient of each potential defect sub-region, the contrast of each potential defect sub-region, the energy of each potential defect sub-region, the distribution entropy of the local binary pattern histogram of each potential defect sub-region, and the texture feature coefficient of each potential defect sub-region, and obtain the first real defect sub-region, the first non-real defect sub-region, and the preliminary potential defect sub-region based on the preliminary discrimination results; First threshold setting subunit: used to set the corresponding first threshold for each parameter; It is worth noting that setting a corresponding first threshold for each parameter is a key prerequisite for achieving preliminary judgment. These parameters include the area of each potential defect sub-region, the aspect ratio of the minimum bounding rectangle, the Fourier descriptor vector, the shape feature coefficient, the contrast, the energy, the distribution entropy of the local binary mode histogram, and the texture feature coefficient. For each parameter, the setting of its first threshold is based on a large amount of historical sample data and paper product process quality standards, and is determined through a combination of statistical analysis and engineering verification. For area, the first threshold is set according to the minimum acceptable defect size allowed for paper products. For example, in the production of sanitary paper, if the process specifies that holes with a diameter of less than 0.5 mm can be ignored, they are converted into the corresponding number of pixels and then appropriately relaxed to a certain margin before being used as the first threshold for area. For the aspect ratio of the minimum bounding rectangle, the first threshold is set based on the geometric characteristics of typical defects. For example, scratches usually have a high aspect ratio (greater than five), while spots or holes are close to circles (aspect ratio close to one). Therefore, the first threshold of aspect ratio is set to three to distinguish between slender defects and near-circular anomalies. For Fourier descriptor vectors, since they are multidimensional vectors, the first threshold is not a single value. Instead, it is obtained by extracting the typical range of low-frequency coefficients from known real defect samples through principal component analysis or clustering, and using the boundary of this range as the discrimination threshold. In practice, the weighted magnitude of the first few descriptor components can be calculated, and the lower limit of this magnitude can be set as the first threshold. For the shape feature coefficient, the coefficient itself is already a fusion index. Its first threshold is obtained by offline calibration on standard good products and typical defect samples. The specific method is: collect hundreds of defect-free paper web images and images containing various real defects, run the aforementioned feature extraction process, count the maximum value of the shape feature coefficient of the good product samples, and add a 10% safety margin on this basis as the first threshold. For contrast and energy, both are derived from the gray-level co-occurrence matrix. The first threshold is determined by analyzing the fluctuation range of normal paper texture. After continuously acquiring a section of defect-free paper image, the contrast and energy distribution of all sub-regions are calculated, and the 99th percentile is taken as the first threshold to ensure that normal texture fluctuations are not misjudged. For the distribution entropy of the local binary pattern histogram, the first threshold reflects the upper limit of texture complexity. In normal paper, although the fiber distribution is random, the overall entropy value is stable. However, stains and water stains will significantly increase the local entropy value. Therefore, by collecting the entropy distribution of good samples, the maximum observed value is taken and a tolerance is added as the first threshold. For texture feature coefficients, as a fusion index, the first threshold is set in a similar way to that of shape feature coefficients. That is, the upper limit is calculated on the good sample set, and the separation effect is verified by combining a small number of typical defect samples. Finally, a reasonable threshold is determined that can effectively eliminate normal interference and retain real defects. All initial thresholds can be automatically written into the configuration file through the calibration process during the system initialization phase, and can be dynamically updated according to paper type switching or production line adjustment, thereby ensuring the adaptability and accuracy of the initial judgment under different working conditions.
[0024] First Real Defect Sub-region Labeling Sub-unit: If the area, minimum bounding rectangle aspect ratio, Fourier descriptor vector and shape feature coefficient of the current potential defect sub-region are all greater than or equal to the corresponding first threshold, and the contrast, energy, distribution entropy of local binary mode histogram and texture feature coefficient of each potential defect sub-region are all greater than or equal to the corresponding first threshold, then the current potential defect sub-region is labeled as the first real defect sub-region. First Non-True Defect Sub-Region Marking Sub-Unit: Used to mark the current potential defect sub-region as the first non-true defect sub-region if the area, minimum bounding rectangle aspect ratio, Fourier descriptor vector and shape feature coefficient of the current potential defect sub-region are all less than the corresponding first threshold, and the contrast, energy, distribution entropy of local binary mode histogram and texture feature coefficient of each potential defect sub-region are all less than the corresponding first threshold. Preliminary potential defect sub-region marking sub-unit: Used to mark the current potential defect sub-region as a preliminary potential defect sub-region if either the first or second case is excluded; It is worth noting that for the current potential defect sub-region, if the values of its parameters do not meet the first case (i.e., all shape parameters are greater than or equal to the corresponding first threshold and all texture parameters are greater than or equal to the corresponding first threshold) or the second case (i.e., all shape parameters are less than the corresponding first threshold and all texture parameters are less than the corresponding first threshold), then the sub-region is marked as a preliminary potential defect sub-region. Specifically, this "any case" covers the mixed state in which some parameters are greater than or equal to the corresponding first threshold and the remaining parameters are less than the corresponding first threshold in all parameter combinations. These mixed states include, but are not limited to, the following typical cases: The area of the current potential defect sub-region is greater than or equal to the corresponding first threshold, the aspect ratio of the minimum bounding rectangle is less than the corresponding first threshold, the Fourier descriptor vector is greater than or equal to the corresponding first threshold, and the shape feature coefficient is less than the corresponding first threshold; at the same time, the contrast is greater than or equal to the corresponding first threshold, the energy is less than the corresponding first threshold, the distribution entropy of the local binary mode histogram is greater than or equal to the corresponding first threshold, and the texture feature coefficient is less than the corresponding first threshold. Area is less than the corresponding first threshold, aspect ratio of minimum bounding rectangle is greater than or equal to the corresponding first threshold, Fourier descriptor vector is less than the corresponding first threshold, shape feature coefficient is greater than or equal to the corresponding first threshold; contrast is less than the corresponding first threshold, energy is greater than or equal to the corresponding first threshold, distribution entropy of local binary mode histogram is less than the corresponding first threshold, texture feature coefficient is greater than or equal to the corresponding first threshold; The area, the aspect ratio of the minimum bounding rectangle, and the Fourier descriptor vector are all greater than or equal to the corresponding first threshold, but the shape feature coefficient is less than the corresponding first threshold; at the same time, the contrast, energy, and distribution entropy of the local binary pattern histogram are all less than the corresponding first threshold, while the texture feature coefficient is greater than or equal to the corresponding first threshold. One or more of the following parameters are less than the corresponding first threshold: area, aspect ratio of the minimum bounding rectangle, Fourier descriptor vector, and shape feature coefficients; the rest are greater than or equal to the corresponding first threshold. At the same time, there are also combinations of some parameters less than the corresponding first threshold and some parameters greater than or equal to the corresponding first threshold among contrast, energy, distribution entropy of local binary pattern histogram, and texture feature coefficients.
[0025] Any combination of the above parameters, where not all eight parameters are greater than or equal to their respective first thresholds, nor are not all of them less than their respective first thresholds, but are in a state of intersection, contradiction, or ambiguous boundaries, is considered as a situation that cannot be clearly determined as a real defect or a non-real defect by the preliminary rules. For such sub-regions, the system does not make a final conclusion, but retains them as preliminary potential defect sub-regions, and submits them to the subsequent second-stage discrimination process based on defect confidence scores for refined analysis, so as to avoid misjudgment or omission due to hard threshold segmentation. It is worth further elaborating that by setting the first threshold sub-unit to the initial potential defect sub-region marking sub-unit, three types of preliminary discrimination and their judgment logic are clearly defined. This provides clear, executable, and comprehensive classification rules for the first stage of the two-stage architecture, ensuring that all potential defect sub-regions are reasonably categorized without omission. This scheme sets corresponding first thresholds for eight key parameters and strictly stipulates that: a region is marked as the first true defect sub-region only when all shape parameters (area, minimum bounding rectangle aspect ratio, Fourier descriptor vector, shape feature coefficients) and all texture parameters (contrast, energy, distribution entropy of local binary mode histogram, texture feature coefficients) are greater than or equal to their respective first thresholds; a region is marked as the first non-true defect sub-region only when all parameters are less than their respective first thresholds; all other mixed cases (i.e., some parameters are greater than or equal to, and some are less than) are classified as initial potential defect sub-regions. This judgment logic, which links all parameters, avoids the one-sidedness caused by relying on only a single or a few parameters in traditional methods. For example, a region might meet the area requirement but have a smooth texture (such as normal embossing), or have an abnormal texture but an irregular shape (such as light reflection). In this scheme, neither will be misjudged as a clear defect or a clear normal condition, but will instead proceed to the second stage for confidence assessment. This design greatly enhances the rigor and inclusiveness of the initial screening stage, retaining all suspicious samples for subsequent high-precision discrimination, while efficiently filtering out obviously good products. It significantly optimizes the allocation of system computing resources and is a key technical guarantee for achieving both high accuracy and high efficiency.
[0026] Defect confidence score calculation unit: used to extract the shape feature coefficients and texture feature coefficients of each preliminary potential defect sub-region, and substitute the shape feature coefficients and texture feature coefficients of each preliminary potential defect sub-region into the preset defect discrimination function to obtain the defect confidence score of each preliminary potential defect sub-region; It is worth noting that, firstly, the preset defect discrimination function is a mapping model that has been trained and validated offline. It is used to combine the input shape feature coefficients and texture feature coefficients into a value between zero and one hundred, i.e., the defect confidence score. This function is constructed in the form of weighted fusion plus nonlinear correction. The specific structure is as follows: First, the shape feature coefficients and texture feature coefficients are assigned corresponding weights. The weight values are determined according to the statistical characteristics of historical defect samples. For example, in paper types where hole defects are dominant, the weight of the shape feature coefficients is higher, while in paper types where stains or water stains are frequent, the weight of the texture feature coefficients is higher. The sum of the weights is one to ensure the stability of the fusion result. Subsequently, the two weighted features are added together to obtain a preliminary fusion value. Since the distribution of the original feature coefficients may be non-uniform, in order to further improve the discrimination sensitivity, a monotonically increasing nonlinear transformation function, such as a sigmoid function or a piecewise linear stretching function, is applied to the preliminary fusion value. The parameters of the transformation function are optimized and calibrated on the labeled dataset: using a large number of preliminary potential defect sub-region samples with known labels (real defects or non-real defects), the function parameters are adjusted so that the output score of real defect samples is as close to one hundred as possible, the output score of non-real defect samples is as close to zero as possible, and the interval between the scores of the two types of samples is maximized. In actual operation, the system will directly read the pre-calculated shape feature coefficients and texture feature coefficients of the current preliminary potential defect sub-region without re-extracting the original image features. Then, these two coefficients are input into the aforementioned preset defect discrimination function. The function automatically performs weighting, fusion, and nonlinear mapping, and finally outputs a specific value, namely the defect confidence score of the sub-region. The higher the score, the more likely the region is to be a real defect; the lower the score, the more likely it is to be normal interference or false detection. Through this mechanism, the system can provide quantitative credibility for fuzzy samples while preserving them, laying the foundation for subsequent threshold-based final judgment.
[0027] Final discrimination unit: used to make a final discrimination of each preliminary potential defect sub-region based on the defect confidence score of each preliminary potential defect sub-region, and to obtain the second real defect sub-region and the second non-real defect sub-region based on the final discrimination result; It is worth noting that a two-stage hierarchical discrimination architecture is introduced from the preliminary discrimination unit to the final discrimination unit. This fundamentally solves the inherent defects of traditional single-step hard decision-making in handling critical samples, significantly improving the system's reliability in discriminating between ambiguous, weak, or complex defects. The first stage utilizes eight parameters—area, aspect ratio, Fourier descriptor vector, shape feature coefficient, contrast, energy, distribution entropy, and texture feature coefficient—to quickly separate "obvious defect" and "obvious normal" regions through a preset first threshold, achieving efficient initial screening. For "preliminary potential defect sub-regions" where the parameters are contradictory or at the boundary, no conclusion is drawn immediately; instead, they are sent to the second stage. In the second stage, the system extracts the pre-calculated shape and texture feature coefficients, substitutes them into a preset defect discrimination function, generates a defect confidence score, and then makes a final judgment based on the second threshold. This mechanism allows the system to maintain a high detection rate for typical defects while also enabling refined evaluation of areas that are difficult to classify directly, such as tiny bubbles, light-colored shadows, and scratches with blurred edges. For example, when a region is small but has high texture entropy, it cannot be clearly classified in the first stage. However, the second stage can comprehensively judge whether it is more likely to be a real defect or interference through confidence scoring. This grading strategy effectively balances sensitivity and specificity, avoiding missed detections due to excessive conservatism and false rejections due to excessive aggressiveness in high-speed production lines, thus greatly improving the intelligence and adaptability of the overall detection system.
[0028] Second threshold setting subunit: used to set a second threshold for the defect confidence score of each preliminary potential defect sub-region; It is worth noting that, before system deployment or paper type switching, an offline calibration process is first carried out: a large number of paper images containing known real defects (such as artificially implanted holes and stain samples) and typical non-real interferences (such as normal texture undulations, light reflections, seams, etc.) are collected, the complete detection process is run, and the defect confidence scores of the corresponding preliminary potential defect sub-regions are generated. Subsequently, the distribution of the scores of real defect samples is statistically analyzed to determine their lower limit; at the same time, the upper limit of the scores of non-real defect samples is analyzed. Based on this, a value that can maximize the separation between the two types of samples is selected as the initial second threshold, which is usually located in the valley area at the junction of the two types of score distributions. To balance the detection rate and false alarm rate, the second threshold needs to be fine-tuned in conjunction with the production line quality control strategy. For example, in the production of medical paper with high cleanliness requirements, the second threshold can be appropriately lowered to improve the sensitivity of defect detection; while in the production of ordinary packaging paper, the second threshold can be moderately increased to reduce false rejections caused by texture interference. The adjusted second threshold is used after being confirmed by the process engineer. During actual operation, the system automatically loads the corresponding second threshold based on the type of paper currently being produced. This threshold is a fixed value between zero and one hundred, used to compare with the defect confidence score of each preliminary potential defect sub-region. Once set, it remains unchanged in a single inspection task to ensure the consistency and traceability of the discrimination logic. In addition, the system supports recording the trend of score distribution changes during continuous operation. When an overall score drift is detected, the system can prompt the operator to recalibrate the second threshold, thereby maintaining the stability of long-term inspection performance.
[0029] Second True Defect Sub-region Marking Sub-unit: If the defect confidence score of the current preliminary potential defect sub-region is greater than or equal to the second threshold, then the current preliminary potential defect sub-region is marked as the second true defect sub-region. Second Non-True Defect Sub-Region Marking Sub-Unit: Used to mark the current preliminary potential defect sub-region as the second non-true defect sub-region if the defect confidence score of the current preliminary potential defect sub-region is less than the second threshold; It is worth further elaborating that the core step in implementing the two-stage discrimination mechanism is to accurately characterize fuzzy samples by setting the second threshold sub-unit to the second non-real defect sub-region marking sub-unit, setting the second threshold, and performing final discrimination based on the defect confidence score. In the second stage, each preliminary potential defect sub-region has obtained a defect confidence score output by a preset defect discrimination function. This score comprehensively reflects its probability of becoming a real defect. It is explicitly stipulated that if the score is greater than or equal to the second threshold, it is confirmed as the second real defect sub-region; if it is less than the second threshold, it is determined as the second non-real defect sub-region. This threshold is not arbitrarily set but is derived from statistical optimization based on a large number of labeled samples, maximizing the boundary between real defects and interference. For example, for a weak water stain, its confidence score may be at a moderate level. If the second threshold is set too high, it will be missed; if it is set too low, it will be falsely reported. Through reasonable calibration, the system can achieve an optimal balance under specific paper types. More importantly, this discrimination process is fully automated and quantifiable, avoiding the subjectivity of human intervention. In actual operation, this mechanism makes the system's accuracy in identifying critical defects (such as 0.3mm pinholes and light-colored oil spots) significantly higher than that of traditional methods. At the same time, it greatly reduces the false rejections caused by paper texture fluctuations or environmental noise, truly achieving "rejecting what should be rejected and keeping what should be kept", providing a scientific, stable and traceable decision-making basis for the quality control of paper products.
[0030] Rejection or retention action execution module: connected to the real defect discrimination module, used to generate detection results based on the real defect sub-region, feed the detection results back to the production line control system, and the production line control system executes rejection or retention actions on the current paper product; It is worth noting that, firstly, after the system completes the analysis of the entire standard detection image, it makes a decision based on the first ratio and the second ratio, and according to the judgment rules of the detection result acquisition unit; When the first ratio is greater than or equal to the first preset ratio threshold, regardless of the second ratio, the system immediately generates the "inferior detection result of the current paper product". This result indicates that the paper product has unacceptable real physical defects and is a definitive non-conforming product. After receiving this instruction, the production line control system immediately activates the high-speed rejection mechanism (such as a pneumatic blow-off device or a mechanical swing arm). When the paper web runs to the designated rejection station, the paper products in the corresponding section are completely rejected from the main process and are not reused, ensuring that defective products do not enter the downstream process. When the first ratio is less than the first preset ratio threshold, but the second ratio is greater than or equal to the second preset ratio threshold, the system also generates a "defective test result for the current paper product", but its nature is "process abnormality warning type defective". At this time, the production line control system performs the "rejection and temporary retention" action: that is, through the servo guide roller or diversion mechanism, the paper product is guided to an independent buffer channel or a dedicated temporary storage roll-up unit, instead of being directly discarded. At the same time, the system automatically triggers the equipment maintenance and calibration process, including but not limited to: recalibrating the gain and exposure parameters of the line scan camera, checking and cleaning the light source window, recalculating the background compensation model based on the standard whiteboard, and verifying the stability of the encoder synchronization signal. After calibration, if the production line configuration supports it (such as having a buffer return mechanism), the temporarily stored paper product is sent back to the inspection station for re-inspection. If the re-inspection result meets the good conditions (that is, both the first ratio and the second ratio are lower than their respective thresholds), it can be downgraded for use or merged into a good roll. If the re-inspection still does not meet the requirements, it is finally discarded. If the production line does not have the re-inspection capability, the temporarily stored paper product can be handed over to the manual re-judgment station for processing. When the first ratio is less than the first preset ratio threshold and the second ratio is less than the second preset ratio threshold, the system determines that the current paper product quality is good and the detection process is stable, and generates a "good detection result of the current paper product". The production line control system maintains the normal process accordingly and does not perform any intervention on the paper product, so that it can smoothly enter the subsequent winding, slitting or packaging process, achieving efficient preservation. Through the aforementioned graded response mechanism, this invention not only achieves reliable interception of physical defects in products, but also actively identifies abnormal states of the detection system or paper background by monitoring the proportion of non-real defects, thereby ensuring product quality while improving the long-term operational robustness and intelligence level of the entire visual inspection system.
[0031] First statistical unit: used to count the number of the first real defect sub-region and the second real defect sub-region respectively, and summarize them to obtain the total number of real defect sub-regions; The second statistical unit is used to count the number of the first and second non-real defect sub-regions respectively, and then summarize them to obtain the total number of non-real defect sub-regions. Sub-region number determination unit: used to determine the number of sub-regions when the standard detection image is segmented; Ratio calculation unit: used to calculate the first ratio of the total number of real defect sub-regions to the number of sub-regions when the standard detection image is segmented, and to calculate the second ratio of the total number of non-real defect sub-regions to the number of sub-regions when the standard detection image is segmented; Detection result acquisition unit: used to generate a substandard detection result for the current paper product if the first ratio is greater than or equal to a first preset ratio threshold or the second ratio is greater than or equal to a second preset ratio threshold; If the first ratio is less than the first preset ratio threshold and the second ratio is less than the second preset ratio threshold, then a good test result for the current paper product is generated. It is worth noting that by introducing a dual monitoring mechanism of first and second ratios from the first statistical unit to the test result acquisition unit, and generating the final test result accordingly, "process quality" is incorporated into the online inspection judgment system for paper products for the first time, achieving a leap from passive defect interception to proactive system health management. This scheme not only counts the total number of real defect sub-regions to calculate the first ratio (reflecting the physical quality of the product), but also simultaneously counts the total number of non-real defect sub-regions to calculate the second ratio (reflecting the stability of the testing process). When the first ratio is greater than or equal to the first preset ratio threshold, the system arbitrarily judges it as substandard and performs complete rejection to ensure that seriously defective products do not flow out; when the second ratio is greater than or equal to the second preset ratio threshold (even if the first ratio is qualified), the system also judges it as substandard, but triggers the "rejection followed by temporary retention" strategy and initiates maintenance processes such as linear scan camera calibration and light source compensation, and re-inspects the temporarily stored paper products if necessary—this effectively prevents hidden quality risks caused by equipment drift or overall paper surface abnormalities (such as large-area humidity changes); products are only released when both ratios are below the threshold. This design breaks through the limitations of traditional methods that only focus on "how many defects there are," instead focusing on "why so many suspected areas are generated." This ensures product quality while continuously monitoring the reliability of the testing system itself. In long-term operation, this mechanism can provide early warnings of equipment aging or process fluctuations, significantly improving the robustness and intelligence of the entire production line, demonstrating outstanding engineering practical value.
[0032] It should be noted that the terminology used in this invention is for describing specific embodiments only and is not intended to limit the scope of this application. As shown in this specification, unless the context clearly indicates otherwise, words such as "a," "an," "an," and / or "the" do not specifically refer to the singular and may include the plural. The terms "comprising," "including," or any other variations thereof are intended to cover a non-exclusive inclusion, such that a process, method, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, or apparatus that includes said element.
[0033] It should also be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the present invention. Unless otherwise expressly specified and limited, the terms "installed," "connected," "linked," etc., should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components. For those skilled in the art, the specific meaning of the above terms in the present invention can be understood according to the specific circumstances.
[0034] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the technical solutions of the embodiments of the present invention.
Claims
1. A visual defect detection system for paper product production lines, characterized in that, Includes the following modules: Image acquisition and preprocessing module: used to acquire surface images of paper products in real time using a line scan camera, and preprocess the surface images to obtain standard inspection images; Potential defect identification module: connected to the image acquisition and preprocessing module, used to perform gridding processing on the standard inspection image, dividing the standard inspection image into several non-overlapping sub-regions, and identifying several potential defect sub-regions from these sub-regions; The real defect discrimination module is connected to the potential defect determination module. It calculates the shape feature coefficients and texture feature coefficients of each potential defect sub-region, and discriminates each potential defect sub-region based on these coefficients. The real defect sub-regions are then determined based on the discrimination results. The calculation of the shape feature coefficients of each potential defect sub-region includes: Binary mask image generation unit: used to perform binarization processing on each potential defect sub-region and generate a binary mask image for each potential defect sub-region; Area calculation unit: Used to calculate the total number of pixels in each potential defect sub-region based on the binary mask image, and obtain the area of each potential defect sub-region; Minimum bounding rectangle aspect ratio calculation unit: Based on the binary mask image, it extracts the closed contour of each potential defect sub-region, calculates the minimum bounding rectangle of each potential defect sub-region based on the closed contour, obtains the length and width of the minimum bounding rectangle, and calculates the aspect ratio to obtain the minimum bounding rectangle aspect ratio of each potential defect sub-region. Standardized contour sequence acquisition unit: used to normalize the closed contour of each potential defect sub-region to obtain the standardized contour sequence of each potential defect sub-region; Fourier descriptor vector acquisition unit: used to perform discrete Fourier transform on the standardized contour sequence of each potential defect sub-region to form the Fourier descriptor vector of each potential defect sub-region; Shape feature coefficient calculation unit: used to calculate the shape feature coefficient of each potential defect sub-region based on the area of each potential defect sub-region, the aspect ratio of the minimum bounding rectangle of each potential defect sub-region, and the Fourier descriptor vector of each potential defect sub-region; The calculation of texture feature coefficients for each potential defect sub-region includes: Grayscale image generation unit: used to perform grayscale processing on each potential defect sub-region and generate a grayscale image of each potential defect sub-region; Gray-level co-occurrence matrix acquisition unit: used to calculate the gray-level co-occurrence matrix of each potential defect sub-region based on the gray-level image; Contrast and energy extraction unit: used to extract contrast and energy from the gray-level co-occurrence matrix of each potential defect sub-region; Histogram acquisition unit: used to apply the local binary pattern algorithm to the grayscale image of each potential defect sub-region to obtain the local binary pattern histogram of each potential defect sub-region; Distribution entropy calculation unit: used to calculate the distribution entropy of the local binary pattern histogram of each potential defect sub-region based on the local binary pattern histogram of each potential defect sub-region; Texture feature coefficient calculation unit: used to combine the contrast of each potential defect sub-region, the energy of each potential defect sub-region, and the distribution entropy of the local binary pattern histogram of each potential defect sub-region to calculate the texture feature coefficient of each potential defect sub-region; The process of identifying each potential defect sub-region based on shape feature coefficients and texture feature coefficients, and obtaining the true defect sub-region based on the identification results, includes: Preliminary discrimination unit: used to perform preliminary discrimination on each potential defect sub-region based on each parameter, including the area of each potential defect sub-region, the aspect ratio of the minimum bounding rectangle of each potential defect sub-region, the Fourier descriptor vector of each potential defect sub-region, the shape feature coefficient of each potential defect sub-region, the contrast of each potential defect sub-region, the energy of each potential defect sub-region, the distribution entropy of the local binary pattern histogram of each potential defect sub-region, and the texture feature coefficient of each potential defect sub-region, and obtain the first real defect sub-region, the first non-real defect sub-region, and the preliminary potential defect sub-region based on the preliminary discrimination results; Defect confidence score calculation unit: used to extract the shape feature coefficients and texture feature coefficients of each preliminary potential defect sub-region, and substitute the shape feature coefficients and texture feature coefficients of each preliminary potential defect sub-region into the preset defect discrimination function to obtain the defect confidence score of each preliminary potential defect sub-region; Final discrimination unit: used to make a final discrimination of each preliminary potential defect sub-region based on the defect confidence score of each preliminary potential defect sub-region, and to obtain the second real defect sub-region and the second non-real defect sub-region based on the final discrimination result; The rejection or retention action execution module is connected to the real defect identification module. It is used to generate detection results based on the real defect sub-regions, feed the detection results back to the production line control system, and then the production line control system executes rejection or retention actions on the current paper product.
2. The visual defect detection system for paper product production lines according to claim 1, characterized in that, The process involves performing preliminary discrimination on each potential defect sub-region based on each parameter, including the area of each potential defect sub-region, the aspect ratio of the minimum bounding rectangle of each potential defect sub-region, the Fourier descriptor vector of each potential defect sub-region, the shape feature coefficient of each potential defect sub-region, the contrast of each potential defect sub-region, the energy of each potential defect sub-region, the distribution entropy of the local binary pattern histogram of each potential defect sub-region, and the texture feature coefficient of each potential defect sub-region. Based on the preliminary discrimination results, a first real defect sub-region, a first non-real defect sub-region, and preliminary potential defect sub-regions are obtained, including: First threshold setting subunit: used to set the corresponding first threshold for each parameter; First Real Defect Sub-region Labeling Sub-unit: If the area, minimum bounding rectangle aspect ratio, Fourier descriptor vector and shape feature coefficient of the current potential defect sub-region are all greater than or equal to the corresponding first threshold, and the contrast, energy, distribution entropy of local binary mode histogram and texture feature coefficient of each potential defect sub-region are all greater than or equal to the corresponding first threshold, then the current potential defect sub-region is labeled as the first real defect sub-region. First Non-True Defect Sub-Region Marking Sub-Unit: Used to mark the current potential defect sub-region as the first non-true defect sub-region if the area, minimum bounding rectangle aspect ratio, Fourier descriptor vector and shape feature coefficient of the current potential defect sub-region are all less than the corresponding first threshold, and the contrast, energy, distribution entropy of local binary mode histogram and texture feature coefficient of each potential defect sub-region are all less than the corresponding first threshold. Preliminary potential defect sub-region marking sub-unit: Used to mark the current potential defect sub-region as a preliminary potential defect sub-region if either the first or second case is excluded.
3. The visual defect detection system for paper product production lines according to claim 2, characterized in that, The process involves performing a final determination on each preliminary potential defect sub-region based on its defect confidence score, and obtaining a second true defect sub-region and a second non-true defect sub-region based on the final determination results, including: Second threshold setting subunit: used to set a second threshold for the defect confidence score of each preliminary potential defect sub-region; Second True Defect Sub-region Marking Sub-unit: If the defect confidence score of the current preliminary potential defect sub-region is greater than or equal to the second threshold, then the current preliminary potential defect sub-region is marked as the second true defect sub-region. Second Non-True Defect Sub-Region Marking Sub-Unit: If the defect confidence score of the current preliminary potential defect sub-region is less than the second threshold, then the current preliminary potential defect sub-region is marked as the second non-true defect sub-region.
4. The visual defect detection system for paper product production lines according to claim 3, characterized in that, The process of generating detection results based on actual defect sub-regions includes: First statistical unit: used to count the number of the first real defect sub-region and the second real defect sub-region respectively, and summarize them to obtain the total number of real defect sub-regions; The second statistical unit is used to count the number of the first and second non-real defect sub-regions respectively, and then summarize them to obtain the total number of non-real defect sub-regions. Sub-region number determination unit: used to determine the number of sub-regions when the standard detection image is segmented; Ratio calculation unit: used to calculate the first ratio of the total number of real defect sub-regions to the number of sub-regions when the standard detection image is segmented, and to calculate the second ratio of the total number of non-real defect sub-regions to the number of sub-regions when the standard detection image is segmented; Detection result acquisition unit: used to generate a substandard detection result for the current paper product if the first ratio is greater than or equal to a first preset ratio threshold or the second ratio is greater than or equal to a second preset ratio threshold; If the first ratio is less than the first preset ratio threshold and the second ratio is less than the second preset ratio threshold, then a good test result for the current paper product is generated.
Citation Information
Patent Citations
Method and system for detecting surface defects of fiber cloth
CN120707511A
Corrugated board stacking defect detection method and system based on machine vision
CN121186087A