On-line classification method of thermal paper defects by visual inspection
Patent Information
- Application Number
- CN202611130378.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-28
- Publication Date
- 2026-10-13
AI Technical Summary
[0004]本发明旨在至少在一定程度上解决现有技术中的技术问题之一,通过对热敏纸进行双光照图像采集,获取热敏纸在可见光波长和紫外光波长上的可见光图像和紫外荧光图像,然后构建用于识别缺陷区域的缺陷识别标记模型,同步构建用于提取独立的图像特征的表面特征提取模型并提取可见光特征和紫外荧光特征,然后提取可见光图像和紫外荧光图像综合的图像特征,命名为综合表面特征,再对热敏纸不同缺陷下的可见光特征、紫外荧光特征以及综合表面特征进行分类学习,得到热敏纸缺陷分类模型,最后使用热敏纸缺陷分类模型对热敏纸的缺陷进行识别并分类,以解决现有的热敏纸缺陷识别技术还存在无法对热敏纸的缺陷进行分类识别且易出现漏检或误判的情况,导致热敏纸缺陷识别的整体流程不够智能的问题
[0015]本发明的有益效果:本发明通过对热敏纸进行双光照图像采集,获取热敏纸在可见光波长和紫外光波长上的可见光图像和紫外荧光图像,然后构建用于识别缺陷区域的缺陷识别标记模型,同步构建用于提取独立的图像特征的表面特征提取模型并提取可见光特征和紫外荧光特征,然后提取可见光图像和紫外荧光图像综合的图像特征,命名为综合表面特征,优势在于,热敏纸的预涂层中普遍含有荧光增白剂或显色剂前体,在紫外光激发下会发出明亮的蓝色荧光,当涂层厚薄不均或存在油污时,荧光强度会剧烈变化,这种差异远超可见光下的纹理差异,能够发现可见光下难以察觉的缺陷,能够更加准确地提取热敏纸表面的图像特征,提高了热敏纸缺陷识别的准确性以及全面性;
Smart Images

Figure CN122906018A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of thermal paper defect recognition technology, specifically to an online classification method for thermal paper defects using visual inspection. Background Technology
[0002] Thermal paper defect identification technology refers to an online quality inspection technology that uses machine vision, optical imaging, and artificial intelligence algorithms to automatically and non-destructively detect and classify surface and coating defects on high-speed thermal paper production lines.
[0003] Existing thermal paper defect identification technologies typically only identify whether thermal paper has defects. However, different defect types require different processing methods. If only the presence of defects is identified, the defect types of thermal paper still need to be manually screened. Furthermore, due to the high reflectivity of thermal paper surfaces, traditional visual inspection is prone to missing or misjudging defects. For example, in patent application CN120411105A, a method and system for detecting defects in thermal coatings of thermal paper are disclosed. This solution only identifies defects in thermal paper without identifying the defect types in detail. For thermal paper with defects, manual classification is still required in the subsequent processing. The overall process of thermal paper defect identification is not intelligent enough. Existing thermal paper defect identification technologies also have the problem of being unable to classify and identify defects in thermal paper and being prone to missing or misjudging defects, resulting in an unintelligent overall process of thermal paper defect identification. Summary of the Invention
[0004] This invention aims to at least partially solve one of the technical problems in the prior art. By acquiring visible light and ultraviolet fluorescence images of thermal paper under dual illumination, a defect identification marker model for identifying defective areas is constructed. Simultaneously, a surface feature extraction model for extracting independent image features is constructed, and visible light and ultraviolet fluorescence features are extracted. Then, the combined image features of the visible light and ultraviolet fluorescence images are extracted and named the combined surface features. The visible light features, ultraviolet fluorescence features, and combined surface features under different defects of thermal paper are then classified and learned to obtain a thermal paper defect classification model. Finally, the thermal paper defect classification model is used to identify and classify defects in thermal paper. This solves the problem that existing thermal paper defect identification technologies are unable to classify and identify defects in thermal paper and are prone to missed detections or misjudgments, resulting in an unintelligent overall process for thermal paper defect identification.
[0005] To achieve the above objectives, in a first aspect, this application provides an online classification method for defects in thermal paper using visual inspection, comprising the following steps: Dual-light image acquisition was performed on the thermal paper to obtain visible light images and ultraviolet fluorescence images of the thermal paper at visible light wavelengths and ultraviolet light wavelengths. Independent image features were extracted from visible light images and ultraviolet fluorescence images, and named visible light features and ultraviolet fluorescence features; The combined image features of visible light images and ultraviolet fluorescence images are extracted and named as comprehensive surface features; By classifying and learning the visible light characteristics, ultraviolet fluorescence characteristics, and comprehensive surface characteristics of thermal paper under different defects, a thermal paper defect classification model is obtained. The defects in thermal paper are identified and classified using a thermal paper defect classification model.
[0006] Furthermore, the step of acquiring visible light and ultraviolet fluorescence images of the thermal paper under dual illumination to obtain visible light and ultraviolet light wavelengths further includes the following sub-steps: The surface of the thermal paper is illuminated by a light source with visible wavelengths, and the surface of the thermal paper is photographed by an industrial camera to obtain a visible light image; The visible light source is turned off, and the surface of the thermal paper is irradiated with an ultraviolet light source. The surface of the thermal paper is then photographed using an industrial camera and a filter to obtain an ultraviolet fluorescence image.
[0007] Furthermore, the step of extracting independent image features from the visible light image and the ultraviolet fluorescence image also includes the following sub-steps: Construct a defect identification and labeling model for identifying defective regions; A surface feature extraction model is constructed to extract independent image features and to extract visible light features and ultraviolet fluorescence features.
[0008] Furthermore, the step of constructing a defect identification marker model for identifying defective regions also includes the following sub-steps: The visible light image and the ultraviolet fluorescence image are collectively referred to as the image to be extracted, and the pixel in the nth row and mth column of the image to be extracted is labeled as P. n,m Where n and m are both positive integers and are subscripts of P; Within the ranges of 2 ≤ n ≤ max(n) - 1 and 2 ≤ m ≤ max(m) - 1, obtain each P n,m The pixels in the eight neighboring regions of P are considered as P. n,m Given the neighborhood points of P, calculate the relationship between each neighborhood point and P. n,m The average of the differences in grayscale values is named the regional grayscale fluctuation parameter. Calculate each P... n,m The regional grayscale fluctuation parameter; The gray-level fluctuation parameters of the region are sorted in ascending order, denoted by RF. h It indicates that the RF hIn this context, h is a positive integer and a subscript of RF, where the subscript h represents the X-axis and the region grayscale fluctuation parameter RF. h Establish a two-dimensional coordinate system for the Y-axis, named the grayscale fluctuation analysis chart, and set the RF... h Enter the grayscale fluctuation analysis chart according to h, perform linear regression on the grayscale fluctuation analysis chart, obtain the slope of the regression function, and name it the comprehensive grayscale fluctuation parameter; A defect-free thermal paper is obtained as a normal sample, and the comprehensive gray-scale fluctuation parameter of the normal sample is extracted and named the normal gray-scale fluctuation parameter. The maximum value of the normal gray-scale fluctuation parameter is taken as the normal gray-scale fluctuation threshold. When the comprehensive gray-scale fluctuation parameter of the image to be extracted is greater than the normal gray-scale fluctuation threshold, the thermal paper surface is marked as having a defect. When defects exist on the surface of thermal paper, P is determined according to the grayscale value. n,m Perform cluster analysis to group P values for all values of n and m. n,m Divide the pixels into different grayscale pixel clusters and count the P values in each grayscale pixel cluster. n,m The number of grayscale pixels is named the number of pixels within a cluster. The grayscale pixel cluster with the largest number of pixels within a cluster is named the normal pixel cluster, and the remaining grayscale pixel clusters are named the abnormal pixel clusters. The coordinate points in the normal pixel clusters are named normal surface points, and the coordinate points in the abnormal pixel clusters are named abnormal surface points. The abnormal surface points in the image to be extracted are marked, and the region formed by consecutive adjacent abnormal surface points is named the defect region.
[0009] Furthermore, the step of constructing a surface feature extraction model for extracting independent image features and extracting visible light features and ultraviolet fluorescence features also includes the following sub-steps: Calculate the average gray value of pixels in the normal pixel cluster and name it the normal gray value. Calculate the average gray value of pixels in the abnormal pixel cluster and name it the abnormal gray value. Calculate the difference between the normal gray value and the abnormal gray value and name it the gray value deviation parameter. Connect the two farthest coordinate points in the defect area to obtain a line segment, which is named the defect direction line. Use the perpendicular line of the defect direction line as an auxiliary line, which is named the region width mapping line. The region width mapping line is considered to be infinitely long. Move the region width mapping line along one end of the defect direction line to the other end. During the movement, extract the length of the intersection between the region width mapping line and the defect region in real time, and name it the defect width. Calculate the average value of the defect width and name it the mean defect width. The visible light features are obtained by extracting the grayscale deviation parameters and the average width of defects from the visible light image, and the ultraviolet fluorescence features are obtained by extracting the grayscale deviation parameters and the average width of defects from the ultraviolet fluorescence image.
[0010] Furthermore, the step of extracting the combined image features of the visible light image and the ultraviolet fluorescence image and naming them as combined surface features also includes the following sub-steps: The pixels in the defective regions of the visible light image and the ultraviolet fluorescence image are named visible light defect points and ultraviolet fluorescence defect points, respectively. The P corresponding to visible light defect points and ultraviolet fluorescence defect points n,m They are respectively labeled as PV n,m and PU n,m If PV n,m and PU n,m If n and m are equal, then PV n,m and PU n,m Consider them as a group with the same defect; When analyzing any defect region, it is named the main region, and the defect region that has the most defect groups with the main region is named the object region. At the same time, the number of defect groups between the object region and the main region is named the number of overlapping points, denoted by the symbol CP. The number of visible light defects or ultraviolet fluorescence defects in the main region is called the main point count, denoted by the symbol SP. The number of visible light defects or ultraviolet fluorescence defects in the object region is called the object point count, denoted by the symbol OP. Calculate CP / max(SP,OP), and name the result as the defect overlap rate. Here, max() is the maximum value operator. Calculate the defect overlap rate of each defect region, and take the minimum value of the defect overlap rate as the comprehensive surface feature.
[0011] Furthermore, the step of classifying and learning the visible light characteristics, ultraviolet fluorescence characteristics, and comprehensive surface characteristics of thermal paper under different defects to obtain a thermal paper defect classification model also includes the following sub-steps: Prepare thermal paper with different defect types as abnormal samples. The defect types include scratches, stains and uneven coating. Extract the visible light characteristics, ultraviolet fluorescence characteristics and comprehensive surface characteristics of the abnormal samples, and name them as visible light abnormal characteristics, ultraviolet fluorescence abnormal characteristics and comprehensive surface abnormal characteristics, respectively. A deep learning model was constructed and deep learning was performed on the visible light anomaly features, ultraviolet fluorescence anomaly features, and comprehensive surface anomaly features of different defect types to obtain a thermal paper defect classification model.
[0012] Furthermore, the step of identifying and classifying defects in thermal paper using the thermal paper defect classification model further includes the following sub-steps: The visible light characteristics, ultraviolet fluorescence characteristics, and comprehensive surface characteristics of thermal paper are extracted in real time and named, respectively, visible light real-time characteristics, ultraviolet fluorescence real-time characteristics, and comprehensive surface real-time characteristics. The real-time visible light features, real-time ultraviolet fluorescence features, and comprehensive surface real-time features are input into the thermal paper defect classification model. After analysis by the thermal paper defect classification model, the defect type of the thermal paper is output.
[0013] Secondly, this application provides an electronic device including a processor and a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps in the method described above are performed.
[0014] Thirdly, this application provides a storage medium on which a computer program is stored, which, when executed by a processor, performs the steps of the method described above.
[0015] The beneficial effects of this invention are as follows: This invention acquires visible light and ultraviolet fluorescence images of thermal paper by performing dual-light image acquisition on thermal paper at visible and ultraviolet wavelengths. Then, a defect identification marker model for identifying defective areas is constructed. Simultaneously, a surface feature extraction model for extracting independent image features is constructed and visible light and ultraviolet fluorescence features are extracted. Finally, the combined image features of the visible light and ultraviolet fluorescence images are extracted and named the combined surface features. The advantage is that the pre-coating of thermal paper generally contains fluorescent whitening agents or color developer precursors, which emit bright blue fluorescence under ultraviolet light excitation. When the coating thickness is uneven or there is oil, the fluorescence intensity will change drastically. This difference is far greater than the texture difference under visible light, which can detect defects that are difficult to detect under visible light. It can extract the image features of the thermal paper surface more accurately and improve the accuracy and comprehensiveness of thermal paper defect identification. This invention classifies thermal paper defects by performing classification learning on the visible light characteristics, ultraviolet fluorescence characteristics, and comprehensive surface characteristics of different defects in thermal paper. A thermal paper defect classification model is then used to identify and classify defects in thermal paper. The advantage lies in the fact that different defect types exhibit different manifestations in visible light characteristics, ultraviolet fluorescence characteristics, and comprehensive surface characteristics. Deep learning can summarize the characteristics of different defect types, and these characteristics can then be used to identify and classify defects in thermal paper, avoiding the need for subsequent manual classification and improving the accuracy and intelligence of thermal paper defect identification.
[0016] Advantages of additional aspects of the invention will be set forth in part in the detailed description of the invention below, and in part will be obvious from the description or may be learned by practice of the invention. Attached Figure Description
[0017] Other features, objects, and advantages of the invention will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings: Figure 1 This is a flowchart illustrating the steps of the method of the present invention; Figure 2 This is a schematic diagram of the grayscale fluctuation analysis diagram of the present invention; Figure 3 This is a schematic diagram of the defective area of the present invention; Figure 4 This is a schematic diagram of the defect path line and the region width mapping line of the present invention. Detailed Implementation
[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0019] Example 1, please refer to Figure 1 As shown, this application provides an online classification method for defects in thermal paper using visual inspection, comprising the following steps: Step S100 involves dual-light image acquisition of the thermal paper to obtain visible light and ultraviolet fluorescence images of the thermal paper at visible and ultraviolet light wavelengths; Step S100 also includes the following sub-steps: Step S101: Irradiate the surface of the thermal paper with a light source of visible wavelength, and simultaneously capture the surface of the thermal paper with an industrial camera to obtain a visible light image. Step S102: Turn off the visible light wavelength light source, and at the same time use the ultraviolet light wavelength light source to irradiate the surface of the thermal paper. Then, take a picture of the surface of the thermal paper with an industrial camera and a filter to obtain an ultraviolet fluorescence image. In practice, since the pre-coating of thermal paper generally contains fluorescent whitening agents or color developer precursors, it will emit bright blue fluorescence under ultraviolet light excitation. When the coating thickness is uneven or there is oil, the fluorescence intensity will change drastically. This difference is far greater than the texture difference under visible light. Therefore, in this embodiment, visible light and ultraviolet fluorescence are used as light sources to irradiate the surface of thermal paper. Then, the surface of thermal paper is photographed by a high-definition industrial camera to obtain visible light images and ultraviolet fluorescence images.
[0020] Step S200: Extract independent image features from the visible light image and the ultraviolet fluorescence image, naming them visible light features and ultraviolet fluorescence features; Step S200 also includes the following sub-steps: Step S201: Construct a defect identification marker model for identifying defective regions; Step S201 also includes the following sub-steps: Step S201.1: The visible light image and the ultraviolet fluorescence image are collectively referred to as the image to be extracted, and the pixel in the nth row and mth column of the image to be extracted is marked as P. n,m n and m are both positive integers and are indices of P; In practical implementation, taking a visible light image as the image to be extracted as an example, if a certain pixel is located in row 146 and column 285, then that pixel can be marked as P. 146,285 At this time, n=146, m=285, and the resolution of the visible light image captured in this embodiment is 580×720, that is, 1≤n≤580, 1≤m≤720. It should be noted that both the visible light image and the ultraviolet fluorescence image contain only the pixels belonging to the thermal paper and do not contain other background pixels.
[0021] Step S201.2: Within the range of 2≤n≤max(n)-1 and 2≤m≤max(m)-1, obtain each P n,m The pixels in the eight neighboring regions of P are considered as P. n,m Given the neighborhood points of P, calculate the relationship between each neighborhood point and P. n,m The average of the differences in grayscale values is named the regional grayscale fluctuation parameter. Calculate each P... n,m The regional grayscale fluctuation parameter; In specific implementation, the gray-level fluctuation parameters of the region are analyzed within the ranges of 2≤n≤579 and 2≤m≤719, for example, for P 2,2 In terms of P 1,1 P 1,2 P 1,3 P 2,1 P 2,3 P 3,1 P 3,2 and P 3,3 All are in P 2,2 Within the eight neighboring regions, the grayscale values of these eight pixels were extracted simultaneously as 233, 235, 234, 235, 232, 233, 232, and 233, respectively, while P 2,2 The grayscale value is 233, and P is calculated. 2,2 The regional grayscale fluctuation parameter is 0.875. Similarly, the calculation is performed for each P within the ranges of 2≤n≤579 and 2≤m≤719. n,m The regional grayscale fluctuation parameter.
[0022] Please see Figure 2 As shown, in step S201.3, the grayscale fluctuation parameters of the region are sorted in ascending order, using the symbol RF. h It indicates that RFh In this context, h is a positive integer and a subscript of RF, where the subscript h represents the X-axis and the region grayscale fluctuation parameter RF. h Establish a two-dimensional coordinate system for the Y-axis, named the grayscale fluctuation analysis chart, and set the RF... h Enter the grayscale fluctuation analysis chart according to h, perform linear regression on the grayscale fluctuation analysis chart, obtain the slope of the regression function, and name it the comprehensive grayscale fluctuation parameter; Step S201.4: Obtain a thermal paper with no surface defects as a normal sample and extract the comprehensive grayscale fluctuation parameter of the normal sample, which is named the normal grayscale fluctuation parameter. Take the maximum value of the normal grayscale fluctuation parameter as the normal grayscale fluctuation threshold. When the comprehensive grayscale fluctuation parameter of the image to be extracted is greater than the normal grayscale fluctuation threshold, mark that there is a defect on the surface of the thermal paper. In practice, if the surface of the thermal paper is free of defects, its color will be uniform, and the difference in grayscale values between pixels will be very small. If defects exist, the grayscale values in the defective areas will fluctuate significantly. The RF value is obtained by sorting the grayscale fluctuation parameters of the areas in ascending order. h 1≤h≤415004, and then the grayscale fluctuation analysis diagram is obtained as follows. Figure 2 As shown, due to the excessive density of data making it difficult to observe, this embodiment... Figure 2 The example only shows a portion of the data. The comprehensive grayscale fluctuation parameter obtained through linear regression is 0.00001. The comprehensive grayscale fluctuation parameter reveals the fluctuation of the grayscale values of the pixels on the surface of the thermal paper. The smaller the value, the lower the fluctuation amplitude. The normal grayscale fluctuation parameter of normal samples is extracted. The normal grayscale fluctuation parameter represents the fluctuation of the grayscale values of the pixels on the surface of defect-free thermal paper. The maximum value is taken as the normal grayscale fluctuation threshold, which is 0.00003. The normal grayscale fluctuation threshold represents the maximum fluctuation of the grayscale values of the pixels on the surface of defect-free thermal paper. If the comprehensive grayscale fluctuation parameter is greater than the normal grayscale fluctuation threshold, it means that there is an abnormality in the grayscale value fluctuation of the thermal paper surface. This is usually caused by surface defects. Therefore, this type of thermal paper is judged to have surface defects.
[0023] Step S201.5: When defects exist on the surface of the thermal paper, P is adjusted according to its grayscale value. n,m Perform cluster analysis to group P values for all values of n and m. n,m Divide the pixels into different grayscale pixel clusters and count the P values in each grayscale pixel cluster. n,m The number of grayscale pixels is named the number of pixels within a cluster. The grayscale pixel cluster with the largest number of pixels within a cluster is named the normal pixel cluster, and the remaining grayscale pixel clusters are named the abnormal pixel clusters. Step S201.6: Name the coordinate points in the normal pixel cluster as normal surface points, and name the coordinate points in the abnormal pixel cluster as abnormal surface points. Mark the abnormal surface points in the image to be extracted, and name the area composed of consecutive adjacent abnormal surface points as the defect area. In practice, when defects exist on the surface of thermal paper, the grayscale values of the pixels on the surface of thermal paper fluctuate significantly. At this time, cluster analysis can be used to divide the grayscale values into different grayscale pixel clusters. The grayscale values within the same grayscale pixel cluster are very similar, while the grayscale values between different grayscale pixel clusters differ significantly. At the same time, defects in the defect detection process usually do not occupy a large area, while the defect-free part of the thermal paper surface occupies a large proportion, resulting in the largest number of pixels in the grayscale pixel cluster to which this part belongs, i.e., the largest number of points within the cluster. This yields normal pixel clusters and abnormal pixel clusters, and further, normal surface points and abnormal surface points. Abnormal surface points represent the pixels in the defective part. By marking them, the defect area can be obtained. Since different defect types will produce defect areas with different characteristics, subsequent classification of defect types must be combined with the characteristics exhibited by the defect area. It should be noted that both visible light images and ultraviolet fluorescence images need to be analyzed simultaneously, and the normal grayscale fluctuation threshold and defect area of the visible light images and ultraviolet fluorescence images are independent of each other.
[0024] Step S202: Construct a surface feature extraction model for extracting independent image features and extract visible light features and ultraviolet fluorescence features; Step S202 also includes the following sub-steps: Step S202.1: Calculate the average gray value of the pixels in the normal pixel cluster and name it the normal gray value; calculate the average gray value of the pixels in the abnormal pixel cluster and name it the abnormal gray value; calculate the difference between the normal gray value and the abnormal gray value and name it the gray value deviation parameter. In the specific implementation, the normal grayscale average value is calculated to be 234, representing the average grayscale value of the defect-free part of the thermal paper surface. At the same time, the abnormal grayscale average value is calculated to be 182, representing the average grayscale value of the defective part. The grayscale deviation parameter is further calculated to be 52, representing the difference in grayscale value between the defect-free part and the defective part. The grayscale deviation parameter is used to identify scratch defects because scratch defects do not have the property of staining. Their essence is that there are dents on the surface of the thermal paper. The grayscale deviation parameter of this type of defect is usually more stable than that of the normal part and does not fluctuate in a large range. Therefore, it can be used to identify scratch defects. The specific judgment process is explained in step S4.
[0025] Please see Figures 3 to 4As shown, in step S202.2, connect the two coordinate points that are farthest apart in the defect area to obtain a line segment, which is named the defect direction line. Use the perpendicular line of the area direction line as an auxiliary line, which is named the area width mapping line. The area width mapping line is considered to be infinitely long. Step S202.3: Move the region width mapping line from one end of the defect direction line to the other end. During the movement, extract the length of the intersection between the region width mapping line and the defect region in real time, name it the defect width, and calculate the average value of the defect width, name it the average defect width. Step S202.4: Extract the grayscale deviation parameter and the mean width of the defect from the visible light image to obtain the visible light features; extract the grayscale deviation parameter and the mean width of the defect from the ultraviolet fluorescence image to obtain the ultraviolet fluorescence features. In practical implementation, for example, a certain defective area such as Figure 3 As shown, Figure 3 The dark gray line area represents the defect area. The pixels at the bottom left and top right corners of this defect area are furthest apart. Based on this, the defect direction line and the area width mapping line are drawn as follows: Figure 4 As shown, for ease of observation, Figure 4 A local magnification was performed. Figure 4 In the diagram, the dashed line represents the defect path line, and the solid line represents the region width mapping line. The length of the region width mapping line within the defect region is the defect width, representing the width of the defect portion. By moving the region width mapping line and continuously extracting the defect width, the final calculated average defect width is 2.3. Since the extracted defect widths are in the same unit, the specific unit attribute can be ignored. Thus, the grayscale deviation parameter and the average defect width are obtained. The grayscale deviation parameter and the average defect width in the visible light image and the ultraviolet fluorescence image are analyzed respectively to obtain the visible light characteristics and ultraviolet fluorescence characteristics of a thermal paper surface.
[0026] Step S300: Extract the combined image features from the visible light image and the ultraviolet fluorescence image, and name them as combined surface features; Step S300 also includes the following sub-steps: Step S301: Name the pixels in the defect area in the visible light image and the ultraviolet fluorescence image as visible light defect points and ultraviolet fluorescence defect points, respectively. Step S302, P corresponding to visible light defect points and ultraviolet fluorescence defect points. n,m They are respectively labeled as PV n,m and PU n,m If PV n,m and PU n,m If n and m are equal, then PV n,m and PU n,m Consider them as a group with the same defect; Step S303: When analyzing any defect region, name it as the main region, name the defect region that has the most defect groups with the main region as the object region, and name the number of defect groups between the object region and the main region as the number of overlapping points, denoted by the symbol CP. Step S304: Count the number of visible light defect points or ultraviolet fluorescence defect points in the main area, and name it as the main point count, denoted by the symbol SP. Count the number of visible light defect points or ultraviolet fluorescence defect points in the object area, and name it as the object point count, denoted by the symbol OP. Step S305: Calculate CP / max(SP,OP), and name the calculation result as the defect overlap rate. Here, max() is the maximum value operator. Calculate the defect overlap rate of each defect region and take the minimum value of the defect overlap rate as the comprehensive surface feature. In specific implementations, for example, PV exists in visible light defect points and ultraviolet fluorescence defect points. 288,364 and PU 288,364 PV 288,364 and PU 288,364 This refers to a group of defects, representing P in both visible light and ultraviolet fluorescence images. 288,364 All of these belong to the defect area. Similarly, all defect groups are analyzed. For example, in a certain analysis, the number of subject points (SP) in the subject area is 58, the number of object points (OP) is 16, and the number of overlapping points (CP) between them is 16. The calculated defect overlap rate is 16 / 58 = 8 / 29, which means that the comprehensive surface characteristics of the thermal paper are 8 / 29. Since defects such as uneven coating are not clearly identifiable under visible light, but can be clearly identified under ultraviolet fluorescence, the defect overlap rate of the defect areas in the two images will be small in the case of uneven coating defects. However, scratches and stains show similar performance under visible light and ultraviolet fluorescence, and there will be no significant difference. In this case, the defect overlap rate will be large, thus distinguishing uneven coating defects.
[0027] Step S400 involves classifying and learning the visible light characteristics, ultraviolet fluorescence characteristics, and comprehensive surface characteristics of thermal paper under different defects to obtain a thermal paper defect classification model; Step S400 also includes the following sub-steps: Step S401: Prepare thermal paper with different defect types as abnormal samples. The defect types include scratches, stains and uneven coating. Extract the visible light features, ultraviolet fluorescence features and comprehensive surface features of the abnormal samples, and name them as visible light abnormal features, ultraviolet fluorescence abnormal features and comprehensive surface abnormal features, respectively. Step S402: Construct a deep learning model and perform deep learning on the visible light anomaly features, ultraviolet fluorescence anomaly features, and comprehensive surface anomaly features of different defect types to obtain a thermal paper defect classification model. In practice, visible light anomaly features, ultraviolet fluorescence anomaly features, and comprehensive surface anomaly features are extracted for three defect types: scratches, stains, and uneven coating. Since comprehensive surface features are used to identify uneven coating, the comprehensive surface anomaly features for scratches and stains are both greater than or equal to 0.86, while those for uneven coating are both less than or equal to 0.52. The median of 0.69 is taken as the criterion for judging uneven coating. If the comprehensive surface feature of the thermal paper is less than or equal to 0.69, the defect type of the thermal paper is marked as uneven coating. For scratch defects, since scratch defects are essentially depressions on the surface of the thermal paper rather than a higher color, the grayscale deviation parameter of scratch defects is usually within a fixed range. Deep learning reveals that the grayscale deviation parameters in the visible light anomaly features of scratch defects are all within the range [46, 59], while the grayscale deviation parameters in the ultraviolet fluorescence anomaly features of scratch defects are all within the range [28, 45]. Therefore, when the grayscale deviation of the visible light image of the thermal paper... When the parameters are in the range [46, 59] and the grayscale deviation parameter of the UV fluorescence image is in the range [28, 45], the defect type of the thermal paper is determined to be a scratch. For stain defects, because stain defects have dyeing properties, they will change the color of the thermal paper, causing the grayscale deviation parameter to likely deviate from the criteria for scratch defects, but this is not absolute. However, stain defects are usually diffused in shape, unlike the linear shape of scratch defects. Scratch defects usually present as lines, with a smaller average defect width, while stain defects... The average width of defects is relatively large. Through deep learning, it was found that the average width of stain defects is usually greater than or equal to 6.42, while the average width of scratch defects is usually less than or equal to 4.38. The median of the two, 5.4, is taken as the judgment standard. When the average width of defects in thermal paper is greater than or equal to 5.4, the defect type of thermal paper is judged as stain. For the three types of defects, scratch, stain and uneven coating, the priority of judgment is uneven coating > stain > scratch. When there are multiple judgment results, the result with the highest priority is used as the output.
[0028] Step S500 involves identifying and classifying defects in the thermal paper using a thermal paper defect classification model; step S500 also includes the following sub-steps: Step S501: Real-time extraction of visible light features, ultraviolet fluorescence features, and comprehensive surface features of thermal paper, which are named in sequence as visible light real-time features, ultraviolet fluorescence real-time features, and comprehensive surface real-time features. Step S502: Input the real-time visible light features, real-time ultraviolet fluorescence features, and comprehensive surface real-time features into the thermal paper defect classification model. After analysis by the thermal paper defect classification model, the defect type of the thermal paper is output. In practice, the specific process of classifying defect types using the thermal paper defect classification model has been explained in step S4, so it will not be described in detail here.
[0029] Example 2: This application provides an electronic device, which may include a processor, a communication interface, a memory, and a communication bus. The processor, communication interface, and memory communicate with each other via the communication bus. The memory stores computer-readable instructions. The processor can call the instructions in the memory. When the computer-readable instructions are executed by the processor, steps such as those in the online classification method for thermal paper defects in visual inspection are performed to achieve the following functions: acquiring visible light images and ultraviolet fluorescence images of thermal paper at visible and ultraviolet wavelengths; extracting independent image features from the visible light and ultraviolet fluorescence images, naming them visible light features and ultraviolet fluorescence features; extracting combined image features from the visible light and ultraviolet fluorescence images, naming them combined surface features; performing classification learning on the visible light features, ultraviolet fluorescence features, and combined surface features under different defects of the thermal paper to obtain a thermal paper defect classification model; and using the thermal paper defect classification model to identify and classify defects in the thermal paper.
[0030] Furthermore, the logical instructions in the aforementioned memory can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application.
[0031] Example 3: This application also provides a computer program product, which includes a computer program stored on a computer-readable storage medium. The computer program includes program instructions. When the program instructions are executed by the computer, the computer can execute the online classification method for thermal paper defects provided by the above methods. The method includes: acquiring visible light images and ultraviolet fluorescence images of thermal paper at visible light wavelengths and ultraviolet light wavelengths; extracting independent image features from the visible light images and ultraviolet fluorescence images, naming them visible light features and ultraviolet fluorescence features; extracting combined image features from the visible light images and ultraviolet fluorescence images, naming them combined surface features; performing classification learning on the visible light features, ultraviolet fluorescence features, and combined surface features under different defects of thermal paper to obtain a thermal paper defect classification model; and using the thermal paper defect classification model to identify and classify defects in thermal paper.
[0032] Example 4: This application may also provide a computer-readable storage medium, which, when executed by the processor of a server, enables the server to perform and implement the following functions: acquiring visible light images and ultraviolet fluorescence images of thermal paper at visible and ultraviolet wavelengths; extracting independent image features from the visible light and ultraviolet fluorescence images, naming them visible light features and ultraviolet fluorescence features; extracting combined image features from the visible light and ultraviolet fluorescence images, naming them combined surface features; performing classification learning on the visible light features, ultraviolet fluorescence features, and combined surface features under different defects of the thermal paper to obtain a thermal paper defect classification model; and using the thermal paper defect classification model to identify and classify defects in the thermal paper.
[0033] Furthermore, the computer-readable storage medium provided in this application may be: read-only memory (ROM), random access memory (RAM), random access programmable read-only memory (PROM), electrically erasable programmable read-only memory (EEPROM), dynamic random access memory (DRAM), static random access memory (SRAM), flash memory, non-volatile memory, CD-ROM, CD-R, CD+R, CD-RW, CD+RW, DVD-ROM, DVD-R, DVD+R, DVD-RW, DVD+RW, DVD-RAM, BD-ROM, BD-R, B DRAM, BD-RE, Blu-ray or optical disc storage, hard disk drive (HDD), solid-state drive (SSD), card storage (such as multimedia cards, secure digital cards, or high-speed digital cards), magnetic tape, floppy disk, magneto-optical data storage device, optical data storage device, hard disk, solid-state drive, and any other device configured to store a computer program and any associated data, data files, and data structures in a non-transitory manner and to provide the computer program and any associated data, data files, and data structures to a processor or computer so that the processor or computer can execute the computer program. The computer program in the aforementioned computer-readable storage medium can run in an environment deployed in computer devices such as clients, hosts, agent devices, servers, etc. Furthermore, in one example, the computer program and any associated data, data files, and data structures are distributed across a networked computer system, such that the computer program and any associated data, data files, and data structures are stored, accessed, and executed in a distributed manner through one or more processors or computers.
[0034] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media containing computer-usable program code. These computer program instructions can also be stored in a computer-readable storage medium capable of directing a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means implemented in a process. Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0035] The above-described embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and are not intended to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the scope of the technology disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of protection of the claims.
Claims
1. A method for online classification of defects in thermal paper using visual inspection, characterized in that, Includes the following steps: Dual-light image acquisition was performed on the thermal paper to obtain visible light images and ultraviolet fluorescence images of the thermal paper at visible light wavelengths and ultraviolet light wavelengths. Independent image features were extracted from visible light images and ultraviolet fluorescence images, and named visible light features and ultraviolet fluorescence features; The combined image features of visible light images and ultraviolet fluorescence images are extracted and named as comprehensive surface features; By classifying and learning the visible light characteristics, ultraviolet fluorescence characteristics, and comprehensive surface characteristics of thermal paper under different defects, a thermal paper defect classification model is obtained. The defects in thermal paper are identified and classified using a thermal paper defect classification model.
2. The online classification method for defects in thermal paper using visual inspection according to claim 1, characterized in that, The step of acquiring visible light and ultraviolet fluorescence images of thermal paper under dual illumination to obtain visible light and ultraviolet light wavelengths further includes the following sub-steps: The surface of the thermal paper is illuminated by a light source with visible wavelengths, and the surface of the thermal paper is photographed by an industrial camera to obtain a visible light image; The visible light source is turned off, and the surface of the thermal paper is irradiated with an ultraviolet light source. The surface of the thermal paper is then photographed using an industrial camera and a filter to obtain an ultraviolet fluorescence image.
3. The online classification method for defects in thermal paper using visual inspection according to claim 2, characterized in that, The step of extracting independent image features from visible light images and ultraviolet fluorescence images also includes the following sub-steps: Construct a defect identification and labeling model for identifying defective regions; A surface feature extraction model is constructed to extract independent image features and to extract visible light features and ultraviolet fluorescence features.
4. The online classification method for defects in thermal paper using visual inspection according to claim 3, characterized in that, The step of constructing a defect identification marker model for identifying defective regions also includes the following sub-steps: The visible light image and the ultraviolet fluorescence image are collectively referred to as the image to be extracted, and the pixel in the nth row and mth column of the image to be extracted is labeled as P. n,m Where n and m are both positive integers and are subscripts of P; Within the ranges of 2 ≤ n ≤ max(n) - 1 and 2 ≤ m ≤ max(m) - 1, obtain each P n,m The pixels in the eight neighboring regions of P are considered as P. n,m Given the neighborhood points of P, calculate the relationship between each neighborhood point and P. n,m The average of the differences in grayscale values is named the regional grayscale fluctuation parameter. Calculate each P... n,m The regional grayscale fluctuation parameter; The gray-level fluctuation parameters of the region are sorted in ascending order, denoted by RF. h It indicates that the RF h In this context, h is a positive integer and a subscript of RF, where the subscript h represents the X-axis and the region grayscale fluctuation parameter RF. h Establish a two-dimensional coordinate system for the Y-axis, named the grayscale fluctuation analysis chart, and set the RF... h Enter the grayscale fluctuation analysis chart according to h, perform linear regression on the grayscale fluctuation analysis chart, obtain the slope of the regression function, and name it the comprehensive grayscale fluctuation parameter; A defect-free thermal paper is obtained as a normal sample, and the comprehensive gray-scale fluctuation parameter of the normal sample is extracted and named the normal gray-scale fluctuation parameter. The maximum value of the normal gray-scale fluctuation parameter is taken as the normal gray-scale fluctuation threshold. When the comprehensive gray-scale fluctuation parameter of the image to be extracted is greater than the normal gray-scale fluctuation threshold, the thermal paper surface is marked as having a defect. When defects exist on the surface of thermal paper, P is determined according to the grayscale value. n,m Perform cluster analysis to group P values for all values of n and m. n,m Divide the pixels into different grayscale pixel clusters and count the P values in each grayscale pixel cluster. n,m The number of grayscale pixels is named the number of pixels within a cluster. The grayscale pixel cluster with the largest number of pixels within a cluster is named the normal pixel cluster, and the remaining grayscale pixel clusters are named the abnormal pixel clusters. The coordinate points in the normal pixel clusters are named normal surface points, and the coordinate points in the abnormal pixel clusters are named abnormal surface points. The abnormal surface points in the image to be extracted are marked, and the region formed by consecutive adjacent abnormal surface points is named the defect region.
5. The online classification method for defects in thermal paper using visual inspection according to claim 4, characterized in that, The step of constructing a surface feature extraction model for extracting independent image features and extracting visible light features and ultraviolet fluorescence features also includes the following sub-steps: Calculate the average gray value of pixels in the normal pixel cluster and name it the normal gray value. Calculate the average gray value of pixels in the abnormal pixel cluster and name it the abnormal gray value. Calculate the difference between the normal gray value and the abnormal gray value and name it the gray value deviation parameter. Connect the two farthest coordinate points in the defect area to obtain a line segment, which is named the defect direction line. Use the perpendicular line of the defect direction line as an auxiliary line, which is named the region width mapping line. The region width mapping line is considered to be infinitely long. Move the region width mapping line along one end of the defect direction line to the other end. During the movement, extract the length of the intersection between the region width mapping line and the defect region in real time, and name it the defect width. Calculate the average value of the defect width and name it the mean defect width. The visible light features are obtained by extracting the gray-level deviation parameters and the average width of defects from the visible light image, and the ultraviolet fluorescence features are obtained by extracting the gray-level deviation parameters and the average width of defects from the ultraviolet fluorescence image.
6. The online classification method for defects in thermal paper using visual inspection according to claim 5, characterized in that, The step of extracting the combined image features from the visible light image and the ultraviolet fluorescence image, and naming it the combined surface features, further includes the following sub-steps: The pixels in the defective regions of the visible light image and the ultraviolet fluorescence image are named visible light defect points and ultraviolet fluorescence defect points, respectively. The P corresponding to visible light defect points and ultraviolet fluorescence defect points n,m They are respectively labeled as PV n,m and PU n,m If PV n,m and PU n,m If n and m are equal, then PV n,m and PU n,m Consider them as a group with the same defect; When analyzing any defect region, it is named the main region, and the defect region that has the most defect groups with the main region is named the object region. At the same time, the number of defect groups between the object region and the main region is named the number of overlapping points, denoted by the symbol CP. The number of visible light defects or ultraviolet fluorescence defects in the main region is called the main point count, denoted by the symbol SP. The number of visible light defects or ultraviolet fluorescence defects in the object region is called the object point count, denoted by the symbol OP. Calculate CP / max(SP,OP), and name the result as the defect overlap rate. Here, max() is the maximum value operator. Calculate the defect overlap rate of each defect region, and take the minimum value of the defect overlap rate as the comprehensive surface feature.
7. The online classification method for defects in thermal paper using visual inspection according to claim 6, characterized in that, The step of classifying and learning the visible light characteristics, ultraviolet fluorescence characteristics, and comprehensive surface characteristics of thermal paper under different defects to obtain a thermal paper defect classification model also includes the following sub-steps: Prepare thermal paper with different defect types as abnormal samples. The defect types include scratches, stains and uneven coating. Extract the visible light characteristics, ultraviolet fluorescence characteristics and comprehensive surface characteristics of the abnormal samples, and name them as visible light abnormal characteristics, ultraviolet fluorescence abnormal characteristics and comprehensive surface abnormal characteristics, respectively. A deep learning model was constructed and deep learning was performed on the visible light anomaly features, ultraviolet fluorescence anomaly features, and comprehensive surface anomaly features of different defect types to obtain a thermal paper defect classification model.
8. The online classification method for defects in thermal paper using visual inspection according to claim 7, characterized in that, The step of identifying and classifying defects in thermal paper using the thermal paper defect classification model further includes the following sub-steps: The visible light characteristics, ultraviolet fluorescence characteristics, and comprehensive surface characteristics of thermal paper are extracted in real time and named, respectively, visible light real-time characteristics, ultraviolet fluorescence real-time characteristics, and comprehensive surface real-time characteristics. The real-time visible light features, real-time ultraviolet fluorescence features, and comprehensive surface real-time features are input into the thermal paper defect classification model. After analysis by the thermal paper defect classification model, the defect type of the thermal paper is output.
9. An electronic device, characterized in that, It includes a processor and a memory, the memory storing computer-readable instructions that, when executed by the processor, perform the steps of the method as described in any one of claims 1-8.
10. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it performs the steps of the method as described in any one of claims 1-8.
Citation Information
Patent Citations
Method and system for detecting defects of thermosensitive coating of thermosensitive paper
CN120411105A