Food glass bottle packaging defect detection method and system
By processing the image data of food glass bottles and fuzzing comprehensive evaluation, detecting and evaluating the defect level of the bottle, the problem of accidentally crushing unqualified products in the existing technology is solved, the detection accuracy and production efficiency are improved, and economic losses are reduced .
Patent Information
- Application Number
- CN202411119839.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-15
- Publication Date
- 2024-12-03
AI Technical Summary
In the industrial production process of food glass bottles, it is difficult for the prior art to effectively detect and distinguish defective bottles that do not affect the use, resulting in a large number of unqualified products being accidentally broken and economic losses.
Using a packaging defect detection method and system for food glass bottles, the degree of chaos and grayscale uniformity of pixel blocks is calculated by acquiring and processing the image data of the bottle, noise reduction processing and semantic analysis are carried out, and coordinate point detection model is established. The fuzzy comprehensive evaluation method evaluates the defect level of the bottle and determines whether to perform crushing treatment.
It improves the accuracy and production efficiency of defect detection, reduces manual intervention, ensures real-time monitoring and processing, avoids the entry of unqualified products into the market, and reduces production costs.
Smart Images

Figure CN119067933A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of defect detection, and more particularly to a packaging defect detection method and system for food glass bottles. Background Art
[0002] The industrial production process of bottled food will be affected by factors such as raw material quality, processing technology (filling), machine tool equipment quality, and production environment. The final bottled food may have various surface defects that affect the overall product quality. Today's consumers' requirements for industrial products are constantly increasing, and consumers' consumption desires are no longer limited to the quality of products. The quality inspection of bottled food surface defects will be particularly important. Improving the quality inspection capabilities of bottled wine bottle surface defects can affect the sales prospects of bottled wine to a certain extent.
[0003] Since bottles with mouth defects are usually discarded, most food manufacturers directly reject and crush bottles that fail the mouth inspection, while bottles that fail the sidewall and bottom inspections are returned to the bottle washer for cleaning and then returned to the chain for empty bottle inspection. However, a large number of defective bottles that do not affect the use of the bottles are mistakenly crushed, which will cause considerable economic losses to food manufacturers. Summary of the invention
[0004] In view of this, the present invention provides a packaging defect detection method and system for food glass bottles, which comprehensively evaluates whether the defective bottle needs to be crushed by evaluating the defect characteristics and coordinates of the food glass bottle to be detected.
[0005] In order to achieve the above object, the present invention adopts the following technical solution:
[0006] A method for detecting packaging defects of food glass bottles, comprising:
[0007] Acquire image data of historical food glass bottles, perform grayscale conversion and pixel segmentation on the image data, obtain pixel blocks, divide pixel points in the pixel blocks into two categories, calculate the pixel disorder degree and grayscale uniformity degree based on the two categories; determine the type of each pixel block according to the pixel disorder degree and grayscale uniformity degree; perform noise reduction on the image data based on the type of each pixel block to obtain a noise-reduced image;
[0008] Classify the defects in the denoised image according to preset defect types, perform semantic analysis on the classified images, obtain defect features corresponding to the denoised image under the defect type, mark and obtain coordinate points, and establish a data set based on the coordinate points; build a coordinate point detection model and train it through the data set, collect the image to be detected, and obtain the pixel coordinates of the center of the coordinate point to be detected;
[0009] Based on the food glass bottle to be inspected in the image to be inspected, confirm the first coordinate position of the pixel coordinate in the coordinate system of the bottle to be inspected; determine the conversion matrix for converting the pixel coordinate into the coordinate in the coordinate system of the bottle to be inspected, and obtain the conversion coordinate of the pixel coordinate based on the conversion matrix;
[0010] Based on each of the transformed coordinates and the corresponding defect features, an evaluation is performed through a fuzzy comprehensive evaluation method to obtain a grade evaluation value of the food glass bottle to be tested. When the grade evaluation value is less than or equal to a preset evaluation threshold, the food glass bottle to be tested is smashed.
[0011] Preferably, dividing the pixel points in the pixel block into two categories specifically includes:
[0012] According to the gray value of each pixel in the 8-neighborhood of pixel a, calculate the neighborhood eigenvalue ρ of pixel a a ;
[0013]
[0014] Among them, n z represents the neighborhood z in the 8-neighborhood direction, I represents the grayscale value, Find the first-order derivative of the grayscale difference between pixel a and its adjacent neighborhood pixels, represents the neighboring points whose derivative result between pixel point a and the neighborhood is 0, G represents the number, Represents the number of neighborhood points without gray gradient, A is the first type of pixel, and the first type of pixel represents the pixel in the gray uniform area;
[0015] When the neighborhood eigenvalue of pixel i is greater than , confirm that pixel a is a first-class pixel; when the neighborhood eigenvalue of pixel a is less than or equal to , it is confirmed that pixel a is a second-type pixel, and the second-type pixel means that only two sides of it do not have grayscale gradient.
[0016] Preferably, the calculation of the pixel chaos degree and the grayscale uniformity degree based on two categories specifically includes: dividing all pixel points in the pixel block into two categories, calculating the pixel chaos degree of the pixel block based on the number of pixel points in the two categories, and calculating the grayscale uniformity degree of the pixel block according to the grayscale values of all pixel points and the number of pixel points.
[0017] Preferably, the denoising of the image data based on the type of each pixel block specifically includes: clustering the pixel blocks based on the type of each pixel block to obtain corresponding type clusters, and obtaining an adaptive size of the mean filter according to the distribution of pixel blocks in each type cluster to perform adaptive mean filtering on the grayscale image to obtain the denoised image.
[0018] Preferably, the coordinate point detection model specifically includes: the coordinate point detection model is based on the LetNet-5 model, adopts a feature extractor consistent with the LetNet-5 model, and has two branches: a classification branch and a regression branch; the two branches share the same feature extractor, both consisting of 2 fully connected layers with the same number of neurons, wherein the number of neurons in the first fully connected layer is 84, and the number of neurons in the second fully connected layer is 2.
[0019] Preferably, the method of obtaining the pixel coordinates of the center of the coordinate point to be detected specifically includes: collecting the image to be detected, adding a detection frame to the image, and then using the classification branch of the coordinate point detection model to determine whether the detection frame contains the coordinate point; if the classification branch of the coordinate point detection model determines that there is a coordinate point in the detection frame, the regression branch of the coordinate point detection model predicts the pixel coordinates of the center of the coordinate point and outputs them; if the classification branch of the coordinate point detection model determines that there is no coordinate point in the detection frame, the detection frame is expanded, and then the regression branch of the coordinate point detection model predicts the pixel coordinates of the center of the coordinate point.
[0020] Preferably, obtaining the grade evaluation value of the food glass bottle to be tested specifically includes:
[0021] A grade evaluation model is constructed based on each of the transformed coordinates and the corresponding defect features, the influence degree of each defect feature is compared, a judgment matrix of each defect feature is formed, and a weight vector of the defect feature is obtained after normalization processing;
[0022] The sensor is used to collect data on the defect features that affect the grade evaluation value of the food glass bottle to be tested, and the collected defect features are quantized by membership vectors to obtain the fuzzy relationship matrix corresponding to the defect features in the current time period. A fuzzy comprehensive evaluation is performed based on the fuzzy relationship matrix and weight vector to obtain the grade evaluation value of the food glass bottle to be tested.
[0023] A packaging defect detection system for food glass bottles, comprising:
[0024] A noise reduction processing module is provided, which obtains image data of a historical food glass bottle, performs grayscale conversion and pixel segmentation on the image data, obtains pixel blocks, divides the pixel points in the pixel blocks into two categories, and calculates the pixel disorder degree and grayscale uniformity degree based on the two categories; determines the type of each pixel block according to the pixel disorder degree and grayscale uniformity degree; and performs noise reduction on the image data based on the type of each pixel block to obtain a noise-reduced image;
[0025] The pixel coordinate acquisition module classifies the defects in the denoised image according to the preset defect type, performs semantic analysis on the classified image, obtains the defect features corresponding to the denoised image under the defect type, marks and obtains the coordinate points, and establishes a data set based on the coordinate points; builds a coordinate point detection model and trains it through the data set, collects the image to be detected, and obtains the pixel coordinates of the center of the coordinate point to be detected;
[0026] A coordinate conversion module, which confirms the first coordinate position of the pixel coordinate in the coordinate system of the bottle to be inspected based on the glass bottle to be inspected in the image to be inspected; determines a conversion matrix for converting the pixel coordinate into the coordinate in the coordinate system of the bottle to be inspected, and obtains the conversion coordinate of the pixel coordinate based on the conversion matrix;
[0027] The grade evaluation module evaluates the transformed coordinates and the corresponding defect features through a fuzzy comprehensive evaluation method to obtain a grade evaluation value of the food glass bottle to be tested. When the grade evaluation value is less than or equal to a preset evaluation threshold, the food glass bottle to be tested is smashed.
[0028] It can be seen from the above technical solutions that, compared with the prior art, the present invention discloses a packaging defect detection method and system for food glass bottles. Based on the classification and clustering of pixel blocks, more important features can be retained in the denoising process, thereby improving the effect of subsequent analysis; by classifying and semantically analyzing the defects in the denoised image, defect features can be systematically extracted, and the pixel coordinates are mapped to the coordinate system of the bottle to be inspected using a transformation matrix, ensuring the accuracy of defect detection and evaluation, making the system more versatile; the fuzzy comprehensive evaluation method is used to evaluate the grade of the food glass bottle to be inspected, which is more in line with the actual situation and can more comprehensively consider the influence of various factors on the detection results; by building a coordinate point detection model, the system can automatically identify and process the information in the detection frame, reduce manual intervention, and improve production efficiency; the system design allows rapid acquisition and processing of the image to be inspected, can realize real-time monitoring and processing, and adapt to the needs of modern production lines; the set evaluation threshold can clearly divide the processing decision, improve the safety and reliability of the production process, and when unqualified products are detected, they are crushed in time to avoid entering the market; the method and system can be applied to defect detection of different types of glass bottles and other similar products, and have strong adaptability. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0030] Figure 1 A diagram of the method steps provided by the present invention;
[0031] Figure 2 A schematic diagram of the structure provided by the present invention. DETAILED DESCRIPTION
[0032] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0033] The embodiment of the present invention discloses a method for detecting packaging defects of food glass bottles, such as Figure 1 As shown, including:
[0034] Obtain image data of historical food glass bottles, perform grayscale conversion and pixel segmentation on the image data, obtain pixel blocks, divide the pixel points in the pixel blocks into two categories, and calculate the pixel disorder degree and grayscale uniformity based on the two categories; determine the type of each pixel block according to the pixel disorder degree and grayscale uniformity; perform denoising on the image data based on the type of each pixel block to obtain a denoised image;
[0035] Classify the defects in the denoised image according to the preset defect type, perform semantic analysis on the classified image, obtain the defect features corresponding to the denoised image under the defect type and mark the coordinate points, and establish a data set based on the coordinate points; build a coordinate point detection model and train it through the data set, collect the image to be detected, and obtain the pixel coordinates of the center of the coordinate point to be detected;
[0036] Confirm the first coordinate position of the pixel coordinates in the coordinate system of the bottle to be inspected based on the image of the food glass bottle to be inspected; determine the conversion matrix for converting the pixel coordinates into the coordinates in the coordinate system of the bottle to be inspected, and obtain the conversion coordinates of the pixel coordinates based on the conversion matrix;
[0037] Based on each transformed coordinate and the corresponding defect feature, the fuzzy comprehensive evaluation method is used to obtain the grade evaluation value of the food glass bottle to be tested. When the grade evaluation value is less than or equal to the preset evaluation threshold, the food glass bottle to be tested will be smashed.
[0038] In a specific embodiment, semantic analysis of the classified image can be performed on the tunnel defect image through a pre-trained semantic generation model to obtain defect features corresponding to the denoised image. Image semantic analysis is a process of analyzing the relationship between an image and its semantics. Generally, a semantic generation model is trained based on a database of known images and corresponding image semantics. Both the image and the image semantics can be used as inputs of the process.
[0039] It should be noted that the pre-trained semantic generation model can be a recurrent neural network model (RNN). For each defect feature, the input set of the pre-trained semantic generation model is the denoised image under the defect feature and the technical condition description set under the defect feature, and the output of the pre-trained semantic generation model is the defect feature text description corresponding to the denoised image.
[0040] In a specific embodiment, the transformation matrix is determined by an iterative closest point (ICP) algorithm to transform pixel coordinates into coordinates in the coordinate system of the bottle to be inspected, and the transformation matrix includes a rotation matrix and a translation matrix. The transformation matrix for transforming scattered coordinates by the ICP algorithm is a prior art and will not be described in detail in the embodiments of this application.
[0041] In a specific embodiment, dividing the pixels in the pixel block into two categories specifically includes:
[0042] According to the gray value of each pixel in the 8-neighborhood of pixel a, calculate the neighborhood eigenvalue ρ of pixel a a ;
[0043]
[0044] Among them, n z represents the neighborhood z in the 8-neighborhood direction, I represents the grayscale value, Find the first-order derivative of the grayscale difference between pixel a and its adjacent neighborhood pixels, represents the neighboring points whose derivative result between pixel point a and the neighborhood is 0, G represents the number, Represents the number of neighborhood points without gray gradient, A is the first type of pixel, and the first type of pixel represents the pixel in the gray uniform area;
[0045] When the neighborhood eigenvalue of pixel i is greater than , confirm that pixel a is a first-class pixel; when the neighborhood eigenvalue of pixel a is less than or equal to , it is confirmed that pixel a is a second-type pixel, and the second-type pixel means that only two sides of it do not have grayscale gradient.
[0046] In a specific embodiment, calculating the pixel chaos degree and the grayscale uniformity degree based on two categories specifically includes: dividing all pixel points in the pixel block into two categories, calculating the pixel chaos degree of the pixel block based on the number of pixel points in the two categories, and calculating the grayscale uniformity degree of the pixel block according to the grayscale values of all pixel points and the number of pixel points.
[0047] The purpose of calculating the pixel chaos degree is to determine the unity or chaos of the internal structure of the pixel block; the purpose of calculating the grayscale uniformity is to distinguish between noise-type and non-noise-type pixel blocks based on the pixel uniformity within the pixel block. Obtain the pixel chaos degree and grayscale uniformity of each pixel block to determine the type of each pixel block based on the pixel chaos degree and grayscale uniformity: whether it is the entropy value or the variance, when the value is 0, it means that the pixel structure within the pixel block is absolutely uniform, and the closer it is to 0, the more uniform it is. After normalization using the exponential function, the pixel chaos degree and grayscale uniformity are within 0-1, and when the entropy value and variance are smaller, the pixel chaos degree and grayscale uniformity are closer to 1, so the threshold can be set to 0.8; when the pixel chaos degree and grayscale uniformity within the pixel block are both greater than the threshold, it means that the entropy value and grayscale variance within the pixel block are extremely small, and it also means that there are almost only first-class or second-class pixels inside the pixel block. The first-class pixels represent the pixels in the grayscale uniform area, and the second-class pixels represent the pixels in the grayscale uniform area. When the grayscale variance is extremely small, it can be determined that there are almost only the first type of pixels in the pixel block, and the pixel block is determined to be a pure noise pixel block; when the grayscale uniformity in the pixel block is greater than the threshold and the pixel chaos is less than the threshold, it means that the entropy value in the pixel block is extremely small and the variance is large, which means that there are almost only the first type or the second type of pixels in the pixel block, and the large variance means that the grayscale inside the pixel block is not uniform, and the pixel block is determined to be a defective pixel block; when the pixel chaos and grayscale uniformity in the pixel block are both less than the threshold, the entropy value and variance in the pixel block are both large, which means that the first type and the second type of pixels both occupy a certain content, and the internal grayscale is uneven, and the pixel block is determined to be a pixel block where defects and noise coexist.
[0048] In a specific embodiment, denoising image data based on the type of each pixel block specifically includes: clustering the pixel blocks based on the type of each pixel block to obtain corresponding type clusters, and obtaining an adaptive size of the mean filter according to the distribution of pixel blocks in each type cluster to perform adaptive mean filtering on the grayscale image to obtain a denoised image.
[0049] The type clusters include pure noise clusters, pure defect clusters, and noise and defect coexistence clusters. The calculation formula for the adaptive size is:
[0050]
[0051] Among them, D u is the adaptive size of mean filtering; D1 is the adaptive filtering window size of pure noise-like clusters; 0 is the adaptive filtering window size of defect-like clusters multiplied by 0; D3 is the adaptive filtering window size of noise and defect coexisting clusters; G is the number of pixel blocks that overlap the noise cluster and other categories of clusters. μ1 and overlap area S μ1 The ratio of G is the number of pixel blocks that overlap between the noise and defect coexistence cluster and other types of clusters μ3 and overlap area S μ3 The ratio of
[0052] The calculation formula of the adaptive filtering window size for pure noise clustering is:
[0053]
[0054] Where X represents the noise cluster, j represents the jth pixel block in the noise cluster, F is the total number of pixel blocks in the noise cluster, O is the cluster center, (x, y) is the coordinate position of the pixel block centroid of the pixel block in the noise cluster; S Xj is the pixel area of the jth pixel block in the noise cluster;
[0055] The calculation formula for the adaptive filtering window size of noise and defect coexistence clusters is:
[0056]
[0057] Where h represents the hth pixel block in the noise and defect coexistence cluster, L represents the number of pixel blocks in the noise and defect coexistence cluster, and W represents the noise and defect coexistence cluster; S Wh Represents the area of the hth pixel block in the cluster where noise and defects coexist.
[0058] In a specific embodiment, the coordinate point detection model specifically includes: the coordinate point detection model is based on the LetNet-5 model, adopts a feature extractor consistent with the LetNet-5 model, and has two branches: a classification branch and a regression branch; the two branches share the same feature extractor, both consisting of 2 fully connected layers with the same number of neurons, wherein the number of neurons in the first fully connected layer is 84, and the number of neurons in the second fully connected layer is 2.
[0059] Among them, the classification branch of the coordinate point detection model is used to determine whether there are coordinate points in the detection box. The classification branch of the coordinate point detection model needs to undergo a Soft max operation before outputting the result so that the output result conforms to the probability distribution. The output result is Respectively represent the probability of having and not having coordinate points in the detection box, and The maximum value of the two will be regarded as the model prediction result. The camera collects the video to be detected, and manually adds multiple detection frames in the first frame of the video. The MOSSE target tracking algorithm then updates the position of the detection frame in each frame, and the classification branch of the coordinate point detection model determines whether each detection frame contains a coordinate point.
[0060] The regression branch of the coordinate point detection model is used to predict the pixel coordinates of the center of the coordinate point in the detection box. The output of the regression branch is represents the pixel coordinates of the center of the coordinate point within the detection box, and The model prediction result is The detection box is enlarged. If the coordinate point cannot be determined after one expansion, the detection is stopped, and a detection box is manually added to the image to be detected. The classification branch of the coordinate point detection model then determines whether the detection box contains the coordinate point.
[0061] In a specific embodiment, obtaining the pixel coordinates of the center of the coordinate point to be detected specifically includes: collecting the image to be detected, adding a detection frame to the image, and then using the classification branch of the coordinate point detection model to determine whether the detection frame contains the coordinate point; if the classification branch of the coordinate point detection model determines that there is a coordinate point in the detection frame, the regression branch of the coordinate point detection model predicts the pixel coordinates of the center of the coordinate point and outputs it; if the classification branch of the coordinate point detection model determines that there is no coordinate point in the detection frame, the detection frame is expanded, and then the regression branch of the coordinate point detection model predicts the pixel coordinates of the center of the coordinate point.
[0062] In a specific embodiment, obtaining the grade evaluation value of the food glass bottle to be tested specifically includes:
[0063] A grade evaluation model is constructed based on each transformed coordinate and the corresponding defect feature, the influence degree of each defect feature is compared, a judgment matrix of each defect feature is constructed, and a weight vector of the defect feature is obtained after normalization processing;
[0064] The sensor is used to collect data on the defect features that affect the grade assessment value of the food glass bottles to be tested, and the collected defect features are quantized by membership vectors to obtain the fuzzy relationship matrix corresponding to the defect features in the current time period. Fuzzy comprehensive evaluation is performed based on the fuzzy relationship matrix and weight vector to obtain the grade assessment value of the food glass bottles to be tested.
[0065] In specific embodiment 1, in a specific embodiment, the grade evaluation model uses the analytic hierarchy process (AHP) to determine the weight of each defect feature. The steps of determining each weight in the present invention are:
[0066] Step 1: Determine the rating assessment model;
[0067] Establishing an evaluation structure for food glass bottles to be tested: The present invention sets the ultimate goal as the grade evaluation value of the food glass bottle to be tested. The first layer is the defect characteristics of the food glass bottle to be tested, and the second layer is the influence of the same defect characteristics on the grade evaluation value of the food glass bottle to be tested at different coordinate points of the bottle body.
[0068] The main evaluation set is the defect characteristics that affect the food glass bottles to be tested. They mainly include scratches, bubbles, breakage, seam problems, etc. Therefore, the main evaluation set of the food glass bottles to be tested is {scratches, bubbles, breakage, seams}.
[0069] The secondary evaluation set is the impact of the same defect feature on the grade evaluation value at different bottle body locations, that is, the secondary evaluation set of the food glass bottles to be tested {monitoring point 1, monitoring point 2, ..., monitoring point q}.
[0070] Step 2: Construct a judgment matrix: Based on the hierarchical evaluation model, compare the relative importance of each layer to obtain the weight of each layer, and then construct a judgment matrix;
[0071] Relative importance is measured on a scale of 1 to 9, with importance divided into 9 levels, with level 9 being the most important and levels below that becoming increasingly less important. All levels below that are equally important.
[0072] Analyze the relative importance of the same defect feature at different bottle positions on the food glass bottle to be inspected, and obtain the judgment matrix of scratches, bubbles, breakage, and seams. Determine the weight vector. For the judgment matrix that meets the consistency requirements, the eigenvector corresponding to the maximum eigenvalue is normalized to obtain the weight vector of the influencing factor. Determine the second-layer weight vector, determine the maximum eigenvalue and corresponding eigenvector of the judgment matrix of the coordinate point position of scratches, bubbles, breakage, and seams, and obtain the weight vector of the same defect feature at different bottle positions after normalization.
[0073] Determine the weight vector of the first layer of defect features to be tested, and based on the definition of the relative importance judgment scale of the hierarchical analysis method, compare the impact of the tested defect features of scratches, bubbles, damage and seams on the bottle grade evaluation value, and construct the judgment matrix C. Perform consistency check and get the weight vector
[0074] In a specific embodiment, establishing the grade assessment model specifically includes: the first layer in the grade assessment model is the types of defect characteristics of the food glass bottles to be detected, and the second layer is different coordinate points of the defect characteristics of the food glass bottles to be detected.
[0075] In a specific embodiment, according to "GB 4806.5-2016 National Food Safety Standard Glass Products", the grade evaluation value of the food glass bottle to be tested is subdivided into 5 discrete states with 1 as the unit. That is, the grade evaluation value is H = {1, 2, 3, 4, 5}, and the membership of each defect feature is determined by fuzzy statistics. The threshold determined after processing a single defect feature is divided into K intervals (the examples in the present invention are divided into 5 intervals, that is, K = 5) for evaluation, and the evaluation result of each interval is expressed as a membership vector K. s (s=1,2,3,4,5) represents.
[0076] Determine the interval to which the measured data at each coordinate point belongs, and use the membership vector X′ of the interval p Indicates the data. Further, M data are measured in a certain period of time, and the number of times they belong to each interval is w p (p=1,2,3...), recorded as the weight of the interval, the membership vector of the factor in this time period after weighted average is:
[0077]
[0078] The grade evaluation value is determined based on the two-level fuzzy comprehensive evaluation method, as follows:
[0079] Determine the set of factors:
[0080] Assume the current state of the food glass bottle to be tested is U, and divide the factor set U into g factor subsets (first layer):
[0081] U={u1,u2,u3……u g};
[0082] Each factor subset u i There are e factors (second level):
[0083] u i = {u i1 ,u i2 ……u in}.
[0084] u ij (i=1,2…g;j=1,2…e) represents the eth factor in the ith factor subset. The defect features in the food glass bottle to be tested are taken as the factor set U, u i Indicates defect characteristics, u ij Indicates the impact of each defect feature being tested on the grade assessment value at different coordinate points.
[0085] Since a two-layer model structure was established, a two-level fuzzy comprehensive evaluation was adopted.
[0086] First-level fuzzy comprehensive evaluation: The first-level fuzzy comprehensive evaluation is to evaluate the second layer. The present invention performs fuzzy comprehensive evaluation on the coordinate points, that is, the coordinate points of each measured defect feature.
[0087] Establish the second-level weight set and determine the second-level fuzzy relationship matrix: After quantizing the membership vectors of each defect feature at each coordinate point, the results are combined into a fuzzy relationship matrix R i .
[0088] Carry out the first-level fuzzy comprehensive evaluation: the second-level fuzzy relationship matrix R i and the weight vector of the second layer The weighted average model M(·,+) is used for first-level comprehensive evaluation:
[0089]
[0090] Then to B i ′Normalization processing Bi=[bi1,bi2,bi3,bi4,bi5], i=0,1,2,...,n.
[0091] Secondary fuzzy comprehensive evaluation: The secondary fuzzy comprehensive evaluation is to evaluate the first layer and conduct a fuzzy comprehensive evaluation on the characteristics of the defects being tested.
[0092] Establish the first layer weight set: Establish the first layer weight set The method is the same as the second layer;
[0093] Determine the first-layer fuzzy relationship matrix: The first-layer fuzzy relationship matrix is the second-layer evaluation result B i The elements in , namely:
[0094] R=(B1,B2,B3,B4) T ;
[0095] Perform secondary fuzzy comprehensive evaluation: The first-layer fuzzy relationship matrix R and the first-layer weight vector The weighted average model M(·,+) is used for secondary comprehensive evaluation:
[0096]
[0097] The grade evaluation value is as follows:
[0098] V=B×U T ;
[0099] The B vector is the current impact level vector obtained through fuzzy comprehensive evaluation, and U is the state grade of the food glass bottle to be tested obtained according to the membership degree.
[0100] A packaging defect detection system for food glass bottles, such as Figure 2 As shown, including:
[0101] The noise reduction processing module obtains the image data of the historical food glass bottle, performs grayscale conversion and pixel segmentation on the image data, obtains pixel blocks, divides the pixel points in the pixel blocks into two categories, calculates the pixel disorder degree and grayscale uniformity based on the two categories; determines the type of each pixel block according to the pixel disorder degree and grayscale uniformity; performs noise reduction on the image data based on the type of each pixel block to obtain a noise-reduced image;
[0102] The pixel coordinate acquisition module classifies the defects in the denoised image according to the preset defect type, performs semantic analysis on the classified image, obtains the defect features corresponding to the denoised image under the defect type, marks and obtains the coordinate points, and establishes a data set based on the coordinate points; builds a coordinate point detection model and trains it through the data set, collects the image to be detected, and obtains the pixel coordinates of the center of the coordinate point to be detected;
[0103] A coordinate conversion module, based on the food glass bottle to be detected in the image to be detected, confirms the first coordinate position of the pixel coordinate in the coordinate system of the bottle to be detected; determines a conversion matrix for converting the pixel coordinate into the coordinate in the coordinate system of the bottle to be detected, and obtains the conversion coordinate of the pixel coordinate based on the conversion matrix;
[0104] The grade assessment module uses the fuzzy comprehensive evaluation method to evaluate the transformed coordinates and the corresponding defect features to obtain the grade assessment value of the food glass bottle to be tested. When the grade assessment value is less than or equal to the preset assessment threshold, the food glass bottle to be tested will be smashed.
[0105] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0106] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for detecting packaging defects of food glass bottles, characterized in that: include: Obtain image data of historical food glass bottles, perform grayscale conversion and pixel segmentation on the image data, obtain pixel blocks, divide pixel points in the pixel blocks into two categories, and calculate pixel chaos and grayscale uniformity based on the two categories; Determine the type of each pixel block according to the pixel disorder degree and grayscale uniformity degree; Denoising the image data based on the type of each pixel block to obtain a denoised image; Classify the defects in the denoised image according to preset defect types, perform semantic analysis on the classified images, obtain defect features corresponding to the denoised image under the defect type, mark and obtain coordinate points, and establish a data set based on the coordinate points; build a coordinate point detection model and train it through the data set, collect the image to be detected, and obtain the pixel coordinates of the center of the coordinate point to be detected; Determine the first coordinate position of the pixel coordinate in the coordinate system of the bottle to be inspected based on the glass bottle to be inspected in the image to be inspected; Determine a conversion matrix for converting the pixel coordinates into coordinates in the coordinate system of the to-be-inspected bottle, and obtain conversion coordinates of the pixel coordinates based on the conversion matrix; Based on each of the transformed coordinates and the corresponding defect features, an evaluation is performed through a fuzzy comprehensive evaluation method to obtain a grade evaluation value of the food glass bottle to be tested. When the grade evaluation value is less than or equal to a preset evaluation threshold, the food glass bottle to be tested is smashed.
2. A method for detecting packaging defects of food glass bottles according to claim 1, characterized in that: Classifying the pixel points in the pixel block into two categories specifically includes: According to the gray value of each pixel in the 8-neighborhood of pixel a, calculate the neighborhood eigenvalue ρ of pixel a a ; Among them, n z represents the neighborhood z in the 8-neighborhood direction, I represents the grayscale value, Find the first-order derivative of the grayscale difference between pixel a and its adjacent neighborhood pixels, represents the neighboring points whose derivative result between pixel point a and the neighborhood is 0, G represents the number, Represents the number of neighborhood points without gray gradient, A is the first type of pixel, and the first type of pixel represents the pixel in the gray uniform area; When the neighborhood eigenvalue of pixel i is greater than , confirm that pixel a is a first-class pixel; when the neighborhood eigenvalue of pixel a is less than or equal to , it is confirmed that pixel a is a second-type pixel, and the second-type pixel means that only two sides of it do not have grayscale gradient.
3. The method for detecting packaging defects of food glass bottles according to claim 2, characterized in that: The calculation of the pixel chaos degree and the grayscale uniformity degree based on two categories specifically includes: dividing all the pixel points in the pixel block into two categories, calculating the pixel chaos degree of the pixel block based on the number of pixel points in the two categories, and calculating the grayscale uniformity degree of the pixel block according to the grayscale values of all the pixel points and the number of pixel points.
4. The method for detecting packaging defects of food glass bottles according to claim 1, characterized in that: The denoising of the image data based on the type of each pixel block specifically includes: clustering the pixel blocks based on the type of each pixel block to obtain corresponding type clusters, and obtaining an adaptive size of the mean filter according to the distribution of pixel blocks in each type cluster to perform adaptive mean filtering on the grayscale image to obtain the denoised image.
5. The method for detecting packaging defects of food glass bottles according to claim 1, characterized in that: The coordinate point detection model specifically includes: the coordinate point detection model is based on the LetNet-5 model, adopts a feature extractor consistent with the LetNet-5 model, and has two branches: a classification branch and a regression branch; the two branches share the same feature extractor, both of which are composed of 2 fully connected layers with the same number of neurons, wherein the number of neurons in the first fully connected layer is 84, and the number of neurons in the second fully connected layer is 2.
6. The method for detecting packaging defects of food glass bottles according to claim 5, characterized in that: The method of obtaining the pixel coordinates of the center of the coordinate point to be detected specifically includes: collecting the image to be detected, adding a detection frame to the image, and then using the classification branch of the coordinate point detection model to determine whether the detection frame contains the coordinate point; if the classification branch of the coordinate point detection model determines that there is a coordinate point in the detection frame, the regression branch of the coordinate point detection model predicts the pixel coordinates of the center of the coordinate point and outputs it; if the classification branch of the coordinate point detection model determines that there is no coordinate point in the detection frame, the detection frame is expanded, and then the regression branch of the coordinate point detection model predicts the pixel coordinates of the center of the coordinate point.
7. The method for detecting packaging defects of food glass bottles according to claim 1, characterized in that: The step of obtaining the grade evaluation value of the food glass bottle to be tested specifically includes: A grade evaluation model is constructed based on each of the transformed coordinates and the corresponding defect features, the influence degree of each defect feature is compared, a judgment matrix of each defect feature is formed, and a weight vector of the defect feature is obtained after normalization processing; The sensor is used to collect data on the defect features that affect the grade evaluation value of the food glass bottle to be tested, and the collected defect features are quantized by membership vectors to obtain the fuzzy relationship matrix corresponding to the defect features in the current time period. A fuzzy comprehensive evaluation is performed based on the fuzzy relationship matrix and weight vector to obtain the grade evaluation value of the food glass bottle to be tested.
8. A food glass bottle packaging defect detection system, using a food glass bottle packaging defect detection method according to any one of claims 1 to 7, characterized in that: include: A noise reduction processing module is used to obtain image data of historical food glass bottles, perform grayscale conversion and pixel segmentation on the image data, obtain pixel blocks, divide the pixel points in the pixel blocks into two categories, and calculate the pixel chaos degree and grayscale uniformity based on the two categories; Determine the type of each pixel block according to the pixel disorder degree and grayscale uniformity degree; Denoising the image data based on the type of each pixel block to obtain a denoised image; The pixel coordinate acquisition module classifies the defects in the denoised image according to the preset defect type, performs semantic analysis on the classified image, obtains the defect features corresponding to the denoised image under the defect type, marks and obtains the coordinate points, and establishes a data set based on the coordinate points; builds a coordinate point detection model and trains it through the data set, collects the image to be detected, and obtains the pixel coordinates of the center of the coordinate point to be detected; A coordinate conversion module, which confirms the first coordinate position of the pixel coordinate in the coordinate system of the bottle to be inspected based on the glass bottle to be inspected in the image to be inspected; determines a conversion matrix for converting the pixel coordinate into the coordinate in the coordinate system of the bottle to be inspected, and obtains the conversion coordinate of the pixel coordinate based on the conversion matrix; The grade evaluation module evaluates the transformed coordinates and the corresponding defect features through a fuzzy comprehensive evaluation method to obtain a grade evaluation value of the food glass bottle to be tested. When the grade evaluation value is less than or equal to a preset evaluation threshold, the food glass bottle to be tested is smashed.
Citation Information
Cited By
Medicine bottle defect detection method and system based on machine vision and deep learning
CN119580005A
Medicine bottle defect detection method and system based on machine vision and deep learning
CN119580005B
Prefabricated bag packaging defect image intelligent detection and grading judgment method
CN121884010A
Method for intelligent detection and grading determination of pre-made bag packaging defect images
CN121884010B
