Packaging pattern automatic detection method based on artificial intelligence
An AI-based automatic detection method for packaging patterns addresses inefficiencies in traditional methods by constructing high-dimensional matrices and calculating pattern similarities, enhancing detection efficiency and accuracy.
Patent Information
- Application Number
- CN202411606730.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-12
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2044-11-12
AI Technical Summary
Traditional manual detection methods for environmentally friendly packaging patterns are inefficient and have high missed detection rates, failing to meet the needs of large-scale production lines due to issues like color difference, blurred printing, and deformation during production.
An automatic detection method using artificial intelligence constructs a high-dimensional matrix from real-time packaging patterns through pixel tracking and masking, followed by similarity calculation to determine pattern quality, incorporating convolution processing and image enhancement techniques.
The method significantly improves detection efficiency and accuracy by automatically matching and comparing packaging patterns without manual intervention, ensuring high versatility and flexibility across various types.
Smart Images

Figure CN119131030A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of image processing, and in particular relates to an automatic detection method for packaging patterns based on artificial intelligence. Background Art
[0002] With the enhancement of environmental awareness, environmentally friendly packaging materials are increasingly used in the market. However, due to factors such as material properties and production processes, environmentally friendly packaging is prone to various pattern defects such as color difference, blurred printing, cracks and deformation during the production process. These defects not only affect the aesthetics of the product, but may also pose a potential threat to the quality and safety of the product. Traditional manual detection methods have problems such as low efficiency and high missed detection rate, which are difficult to meet the needs of large-scale production lines. Therefore, it is particularly important to develop an efficient and accurate automatic detection method for environmentally friendly packaging patterns. Summary of the invention
[0003] In order to solve the above problems, the present invention proposes an automatic detection method for packaging patterns based on artificial intelligence.
[0004] The technical solution of the present invention is: an automatic detection method for packaging patterns based on artificial intelligence comprises the following steps: S1. Obtain a normal packaging pattern and shoot a real-time packaging pattern; S2, constructing a high-dimensional matrix for the real-time packaging pattern using a pixel tracking matrix of the real-time packaging pattern and a corresponding mask matrix; S3. Using the high-dimensional matrix of the real-time packaging pattern, generate packaging similarity between the normal packaging pattern and the real-time packaging pattern, and determine whether the real-time packaging pattern is qualified.
[0005] Furthermore, S2 includes the following sub-steps: S21, performing convolution processing on the real-time packaging pattern using a mean filter to obtain a smooth packaging pattern; S22, filling the pixel values of the pixel points in the smooth packaging pattern into the pixel tracking matrix; S23, determining the mask value corresponding to each element in the pixel tracking matrix, and filling the mask value into the mask matrix; S24, extracting the number of non-zero values in each row of the mask matrix as the update weight of each row; S25, using the update weight of each row of the mask matrix and the pixel tracking matrix to obtain a high-dimensional matrix of the real-time packaging pattern.
[0006] The beneficial effect of the above further scheme is that: in the present invention, the number of rows and columns of the pixel tracking matrix and the mask matrix are the same as the number of pixel rows and columns of the real-time packaging pattern. The pixel values processed by the filter are filled into the pixel tracking matrix, and the image can be smoothed and noise can be removed. The mask matrix corresponding to the pixel tracking matrix can be used for image enhancement and image masking tasks. By specifying the binary value of each pixel point, a high-dimensional matrix of the real-time packaging pattern is obtained, which reflects the global pixel of the packaging pattern.
[0007] Further, in S21, the pixel value y of the pixel point in the smoothing packaging pattern is * The calculation formula is: ; Where y represents the pixel value of the pixel at the same position in the real-time packaging pattern, represents the mean pixel value of the four neighboring pixels corresponding to the pixel at the same position in the real-time packaging pattern, tanh(·) represents the hyperbolic tangent function, w represents the weight of the convolution kernel corresponding to the mean filter, and b represents the bias of the convolution kernel corresponding to the mean filter.
[0008] Further, in S23, the mask value r corresponding to the element in the hth row and the kth column in the pixel tracking matrix h,k The calculation formula is: ; In the formula, x h,k represents the element in the hth row and kth column of the pixel tracking matrix, x h-1,k-1 represents the element in the h-1th row and k-1th column of the pixel tracking matrix, x h+1,k-1 represents the element in the h+1th row and k-1th column of the pixel tracking matrix, x h-1,k+1 represents the element in the h-1th row and k+1th column of the pixel tracking matrix, x h+1,k+1 Represents the element in the h+1th row and k+1th column in the pixel tracking matrix.
[0009] Furthermore, in S24, the expression of the high-dimensional matrix is: ; Where Y represents the pixel tracking matrix, α 1 represents the update weight of the first row in the mask matrix, α m represents the update weight of the mth row in the mask matrix, α M represents the update weight of the Mth row in the mask matrix, R 11 Represents the element in row 1 and column 1 of the mask matrix, R 1n Represents the element in row 1 and column n in the mask matrix, R 1N Represents the element in row 1 and column N in the mask matrix, R m1 Represents the element in the mth row and first column of the mask matrix, R mn Represents the element in the mth row and nth column of the mask matrix, R mN Represents the element in the mth row and Nth column of the mask matrix, R M1Represents the element in the Mth row and the first column of the mask matrix, R Mn Represents the element in the Mth row and nth column of the mask matrix, R MN Represents the element in the Mth row and Nth column of the mask matrix.
[0010] Furthermore, S3 includes the following sub-steps: S31, extracting the L1 norm of the high-dimensional matrix; S32, extracting the maximum value of each row in the high-dimensional matrix as the similarity coefficient corresponding to each row in the real-time packaging pattern; S33, calculating the similarity between the pixel points of the real-time packaging pattern and the corresponding pixel points in the normal packaging pattern according to the L1 norm of the high-dimensional matrix and the similarity coefficient of each row in the real-time packaging pattern; S34. Generate packaging similarity between the normal packaging pattern and the real-time packaging pattern according to the similarity between each pixel point of the real-time packaging pattern and each corresponding pixel point in the normal packaging pattern, and determine whether the real-time packaging pattern is qualified.
[0011] The beneficial effect of the above further scheme is that in the present invention, the size of the normal packaging pattern and the real-time packaging pattern can be revised so that the two patterns have the same size. The high-dimensional matrix is generated through filtering and masking operations, and the Manhattan distance of each pixel point in the two images is corrected by the characteristic parameters of the high-dimensional matrix to obtain the similarity between the patterns, and the qualified pattern detection is completed by the threshold that can be set manually.
[0012] Furthermore, in S33, the calculation formula of the similarity S between the pixel points of the real-time packaging pattern and the corresponding pixel points in the normal packaging pattern is: ; In the formula, s represents the similarity coefficient of the row where the pixel point of the real-time packaging pattern is located, L1 represents the L1 norm of the high-dimensional matrix, rand(0,1) represents a random number generated between 0 and 1, and p 1 Represents the pixel value of the real-time packaging pattern, p 2 represents the pixel value of the corresponding pixel in the normal packaging pattern, and D(·) represents the Manhattan distance function.
[0013] Furthermore, in S34, the mean of all similarities is calculated as the packaging similarity between the normal packaging pattern and the real-time packaging pattern. If the packaging similarity is greater than or equal to the threshold, the real-time packaging pattern is qualified, otherwise the real-time packaging pattern is unqualified.
[0014] The beneficial effects of the present invention are as follows: the present invention utilizes the characteristic matrix of the real-time packaging pattern to calculate the similarity between the real-time packaging pattern and the preset normal packaging pattern, and determines whether the real-time packaging pattern is qualified, and the determination process combines the similarity of specific pixel points; the present invention realizes automatic matching and comparison of patterns through image processing technology, without manual intervention, greatly improving the detection efficiency, being applicable to various types of packaging patterns, and having high versatility and flexibility. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 The flowchart of the automatic detection method of packaging patterns based on artificial intelligence. DETAILED DESCRIPTION
[0016] The embodiments of the present invention will be further described below in conjunction with the accompanying drawings.
[0017] like Figure 1 As shown, the present invention provides an automatic detection method for packaging patterns based on artificial intelligence, comprising the following steps: S1. Obtain a normal packaging pattern and shoot a real-time packaging pattern; S2, constructing a high-dimensional matrix for the real-time packaging pattern using a pixel tracking matrix of the real-time packaging pattern and a corresponding mask matrix; S3. Using the high-dimensional matrix of the real-time packaging pattern, generate packaging similarity between the normal packaging pattern and the real-time packaging pattern, and determine whether the real-time packaging pattern is qualified.
[0018] In this embodiment of the present invention, S2 includes the following sub-steps: S21, performing convolution processing on the real-time packaging pattern using a mean filter to obtain a smooth packaging pattern; S22, filling the pixel values of the pixel points in the smooth packaging pattern into the pixel tracking matrix; S23, determining the mask value corresponding to each element in the pixel tracking matrix, and filling the mask value into the mask matrix; S24, extracting the number of non-zero values in each row of the mask matrix as the update weight of each row; S25, using the update weight of each row of the mask matrix and the pixel tracking matrix to obtain a high-dimensional matrix of the real-time packaging pattern.
[0019] In the present invention, the number of rows and columns of the pixel tracking matrix and the mask matrix are the same as the number of pixel rows and columns of the real-time packaging pattern. The pixel values processed by the filter are filled into the pixel tracking matrix, and the image can be smoothed and noise can be removed. The mask matrix corresponding to the pixel tracking matrix can be used for image enhancement and image masking tasks. By specifying the binary value of each pixel point, a high-dimensional matrix of the real-time packaging pattern is obtained, which reflects the global pixels of the packaging pattern.
[0020] In the embodiment of the present invention, in S21, the pixel value y of the pixel point in the smoothing packaging pattern is * The calculation formula is: ; Where y represents the pixel value of the pixel at the same position in the real-time packaging pattern, represents the mean pixel value of the four neighboring pixels corresponding to the pixel at the same position in the real-time packaging pattern, tanh(·) represents the hyperbolic tangent function, w represents the weight of the convolution kernel corresponding to the mean filter, and b represents the bias of the convolution kernel corresponding to the mean filter.
[0021] In the embodiment of the present invention, in S23, the mask value r corresponding to the element in the hth row and the kth column in the pixel tracking matrix h,k The calculation formula is: ; In the formula, x h,k represents the element in the hth row and kth column of the pixel tracking matrix, x h-1,k-1 represents the element in the h-1th row and k-1th column of the pixel tracking matrix, x h+1,k-1 represents the element in the h+1th row and k-1th column of the pixel tracking matrix, x h-1,k+1 represents the element in the h-1th row and k+1th column of the pixel tracking matrix, x h+1,k+1 Represents the element in the h+1th row and k+1th column in the pixel tracking matrix.
[0022] In the embodiment of the present invention, in S24, the expression of the high-dimensional matrix is: ; Where Y represents the pixel tracking matrix, α 1 represents the update weight of the first row in the mask matrix, α m represents the update weight of the mth row in the mask matrix, α M represents the update weight of the Mth row in the mask matrix, R 11 Represents the element in row 1 and column 1 of the mask matrix, R 1n Represents the element in row 1 and column n in the mask matrix, R 1N Represents the element in row 1 and column N in the mask matrix, R m1 Represents the element in the mth row and first column of the mask matrix, R mn Represents the element in the mth row and nth column of the mask matrix, R mN Represents the element in the mth row and Nth column of the mask matrix, R M1 Represents the element in the Mth row and the first column of the mask matrix, R Mn Represents the element in the Mth row and nth column of the mask matrix, R MN Represents the element in the Mth row and Nth column of the mask matrix.
[0023] In this embodiment of the present invention, S3 includes the following sub-steps: S31, extracting the L1 norm of the high-dimensional matrix; S32, extracting the maximum value of each row in the high-dimensional matrix as the similarity coefficient corresponding to each row in the real-time packaging pattern; S33, calculating the similarity between the pixel points of the real-time packaging pattern and the corresponding pixel points in the normal packaging pattern according to the L1 norm of the high-dimensional matrix and the similarity coefficient of each row in the real-time packaging pattern; S34. Generate packaging similarity between the normal packaging pattern and the real-time packaging pattern according to the similarity between each pixel point of the real-time packaging pattern and each corresponding pixel point in the normal packaging pattern, and determine whether the real-time packaging pattern is qualified.
[0024] In the present invention, the size of the normal packaging pattern and the real-time packaging pattern can be revised so that the two patterns have the same size. The high-dimensional matrix is generated through filtering and masking operations. The Manhattan distance of each pixel in the two images is corrected by the characteristic parameters of the high-dimensional matrix to obtain the similarity between the patterns, and the qualified pattern detection is completed by the threshold that can be set manually.
[0025] In the embodiment of the present invention, in S33, the calculation formula of the similarity S between the pixel points of the real-time packaging pattern and the corresponding pixel points in the normal packaging pattern is: ; In the formula, s represents the similarity coefficient of the row where the pixel point of the real-time packaging pattern is located, L1 represents the L1 norm of the high-dimensional matrix, rand(0,1) represents a random number generated between 0 and 1, and p 1 Represents the pixel value of the real-time packaging pattern, p 2 represents the pixel value of the corresponding pixel in the normal packaging pattern, and D(·) represents the Manhattan distance function.
[0026] In the embodiment of the present invention, in S34, the mean of all similarities is calculated as the packaging similarity between the normal packaging pattern and the real-time packaging pattern. If the packaging similarity is greater than or equal to the threshold, the real-time packaging pattern is qualified, otherwise the real-time packaging pattern is unqualified.
[0027] Those skilled in the art will appreciate that the embodiments described herein are intended to help readers understand the principles of the present invention, and should be understood that the protection scope of the present invention is not limited to such specific statements and embodiments. Those skilled in the art can make various other specific variations and combinations that do not deviate from the essence of the present invention based on the technical revelations disclosed by the present invention, and these variations and combinations are still within the protection scope of the present invention.
Claims
1. An automatic detection method for packaging patterns based on artificial intelligence, characterized in that: The following steps are involved: S1. Obtain a normal packaging pattern and shoot a real-time packaging pattern; S2, constructing a high-dimensional matrix for the real-time packaging pattern using a pixel tracking matrix of the real-time packaging pattern and a corresponding mask matrix; S3. Using the high-dimensional matrix of the real-time packaging pattern, generate packaging similarity between the normal packaging pattern and the real-time packaging pattern, and determine whether the real-time packaging pattern is qualified.
2. The method for automatic detection of packaging patterns based on artificial intelligence according to claim 1, characterized in that: The S2 comprises the following sub-steps: S21, performing convolution processing on the real-time packaging pattern using a mean filter to obtain a smooth packaging pattern; S22, filling the pixel values of the pixel points in the smooth packaging pattern into the pixel tracking matrix; S23, determining the mask value corresponding to each element in the pixel tracking matrix, and filling the mask value into the mask matrix; S24, extracting the number of non-zero values in each row of the mask matrix as the update weight of each row; S25, using the update weight of each row of the mask matrix and the pixel tracking matrix to obtain a high-dimensional matrix of the real-time packaging pattern.
3. The method for automatic detection of packaging patterns based on artificial intelligence according to claim 2, characterized in that: In S21, the pixel value y of the pixel point in the smoothing packaging pattern is * The calculation formula is: ; Where y represents the pixel value of the pixel at the same position in the real-time packaging pattern, represents the mean pixel value of the four neighboring pixels corresponding to the pixel at the same position in the real-time packaging pattern, tanh(·) represents the hyperbolic tangent function, w represents the weight of the convolution kernel corresponding to the mean filter, and b represents the bias of the convolution kernel corresponding to the mean filter.
4. The method for automatic detection of packaging patterns based on artificial intelligence according to claim 2, characterized in that: In S23, the mask value r corresponding to the element in the hth row and the kth column in the pixel tracking matrix h,k The calculation formula is: ; In the formula, x h,k represents the element in the hth row and kth column of the pixel tracking matrix, x h-1,k-1 represents the element in the h-1th row and k-1th column of the pixel tracking matrix, x h+1,k-1 represents the element in the h+1th row and k-1th column of the pixel tracking matrix, x h-1,k+1 represents the element in the h-1th row and k+1th column of the pixel tracking matrix, x h+1,k+1 Represents the element in the h+1th row and k+1th column in the pixel tracking matrix.
5. The method for automatic detection of packaging patterns based on artificial intelligence according to claim 2, characterized in that: In S24, the expression of the high-dimensional matrix is: ; where Y represents the pixel tracking matrix, α1 represents the update weight of the first row in the mask matrix, and α m represents the update weight of the mth row in the mask matrix, α M represents the update weight of the Mth row in the mask matrix, R 11 Represents the element in row 1 and column 1 of the mask matrix, R 1n Represents the element in row 1 and column n in the mask matrix, R 1N Represents the element in row 1 and column N in the mask matrix, R m1 Represents the element in the mth row and first column of the mask matrix, R mn Represents the element in the mth row and nth column of the mask matrix, R mN Represents the element in the mth row and Nth column of the mask matrix, R M1 Represents the element in the Mth row and the first column of the mask matrix, R Mn Represents the element in the Mth row and nth column of the mask matrix, R MN Represents the element in the Mth row and Nth column of the mask matrix.
6. The method for automatic detection of packaging patterns based on artificial intelligence according to claim 1, characterized in that: The S3 comprises the following sub-steps: S31, extracting the L1 norm of the high-dimensional matrix; S32, extracting the maximum value of each row in the high-dimensional matrix as the similarity coefficient corresponding to each row in the real-time packaging pattern; S33, calculating the similarity between the pixel points of the real-time packaging pattern and the corresponding pixel points in the normal packaging pattern according to the L1 norm of the high-dimensional matrix and the similarity coefficient of each row in the real-time packaging pattern; S34. Generate packaging similarity between the normal packaging pattern and the real-time packaging pattern according to the similarity between each pixel point of the real-time packaging pattern and each corresponding pixel point in the normal packaging pattern, and determine whether the real-time packaging pattern is qualified.
7. The method for automatic detection of packaging patterns based on artificial intelligence according to claim 6, characterized in that: In S33, the calculation formula of the similarity S between the pixel points of the real-time packaging pattern and the corresponding pixel points in the normal packaging pattern is: ; Where s represents the similarity coefficient of the row where the pixel of the real-time packaging pattern is located, L1 represents the L1 norm of the high-dimensional matrix, rand(0,1) represents a random number generated between 0 and 1, p1 represents the pixel value of the pixel of the real-time packaging pattern, p2 represents the pixel value of the corresponding pixel in the normal packaging pattern, and D(·) represents the Manhattan distance function.
8. The method for automatic detection of packaging patterns based on artificial intelligence according to claim 6, characterized in that: In S34, the average of all similarities is calculated as the packaging similarity between the normal packaging pattern and the real-time packaging pattern. If the packaging similarity is greater than or equal to the threshold, the real-time packaging pattern is qualified, otherwise the real-time packaging pattern is unqualified.
Citation Information
Patent Citations
Intelligent control method and system for quality inspection of printing ink presswork
CN117576101A
Carbon nanotube image processing method based on neural network algorithm
CN117788843A
Image processing method based on logistics commodities
CN117934344A
Production harness quality detection method
CN118710639A
Apparatus and method for smoothing a video signal using pattern adaptive filtering.
NL1028887A
