Method and system for detecting bottom of glass bottle through AI, electronic equipment and storage medium

Detection of the bottom of the glass bottle through the AI ​​recognition model solves the problems of low efficiency and missed inspection in traditional manual detection, realizes efficient identification of the bottom defects of the bottle, and improves the quality and safety of the glass bottle.

CN118918100APending Publication Date: 2024-11-08FOSHAN SANLI INTELLIGENT EQUIPMENT TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411279727.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-12
Publication Date
2024-11-08

AI Technical Summary

Technical Problem

Traditional manual detection of glass bottle bottom defects is inefficient and easy to miss inspection, affecting the quality and safety of the container.

Method used

The AI-based recognition model is used to detect the bottom of the glass bottle. By acquiring detection images, training the model, pre-processing, normalization and forward propagation calculations, the bottle bottom defects are identified and marked, and the detection accuracy and efficiency are improved.

Benefits of technology

It significantly improves the success rate and efficiency of bottle bottom defect identification, reduces missed inspection problems, and helps enterprises quickly discover problematic glass bottles.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118918100A_ABST
    Figure CN118918100A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image recognition, in particular to a method and system for detecting the bottom of a glass bottle through AI, electronic equipment and a storage medium, and the method comprises the following steps: obtaining a detection image of the bottom to be detected of a target glass bottle; performing result detection on the detection image based on the trained recognition model to obtain a recognition result of the bottle bottom; wherein the recognition model is obtained by training on the basis of abnormal bottle bottom sample pictures. The recognition model is specially trained based on the abnormal bottle bottom sample pictures, so that the detection capability of the model on abnormal conditions can be remarkably improved by the training mode with strong pertinence. Wherein when an abnormal bottle bottom sample picture is marked, the marks of bubbles, sticky materials and cracks can be added. Recognition of common defects is improved, and recognition efficiency is improved. The bottle bottom is detected through recognition, bottle bottom defects can be effectively recognized, the problem of missing detection is reduced, and enterprises are helped to quickly find out defective glass bottles.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image recognition technology, and in particular to a method, system, electronic device and storage medium for detecting the bottom of a glass bottle through AI. Background Art

[0002] Glass containers go through many processes in the production process, and each link may cause quality defects such as missing threads, embedded tiny bubbles, residual stones, and occasional cracks at the bottom of the bottle due to various factors such as temperature control, raw material purity, and mold accuracy. These defects not only affect the sealing performance and aesthetics of the container, but may also pose a potential threat to the safety and quality of the subsequent filled products.

[0003] Traditional production involves manual inspection of bottle bottoms, but manual inspection has limited efficiency and is prone to missed inspections. Therefore, a detection method that can identify bottle bottoms is urgently needed. Summary of the invention

[0004] In view of the above defects, the purpose of the present invention is to propose a method, system, electronic device and storage medium for detecting the bottom of glass bottles through AI, so as to improve the success rate and efficiency of identifying bottom defects and ensure the quality of glass bottles.

[0005] To achieve this purpose, the present invention adopts the following technical solution: a method for detecting the bottom of a glass bottle by AI, comprising the following steps:

[0006] Acquire a detection image of the bottom of the target glass bottle to be tested;

[0007] Perform result detection on the detection image based on the trained recognition model to obtain the recognition result of the bottle bottom;

[0008] The recognition model is trained based on abnormal bottle bottom sample images.

[0009] Preferably, the recognition model includes an input layer, a reference network extraction feature layer, a Neck processing feature layer and an output prediction layer connected in sequence.

[0010] Preferably, the input layer is used to scale the detection image to a size of 1280*1024, and is provided with three anchor frames of different multiples;

[0011] The settings of the anchor boxes for 8x downsampling are: [25,27; 68,83; 85,110];

[0012] The settings of the anchor boxes for 16x downsampling are: [120,109; 162,179; 280,319];

[0013] The anchor boxes are set to [360,350; 450,408; 550,500] when downsampling by 32 times.

[0014] Preferably, the baseline network feature extraction layer consists of 10 layers, including at least a Conv convolutional network, a C3 module, and an SPPF module;

[0015] The 10 layers that constitute the feature extraction layer of the benchmark network are:

[0016] 1. Conv convolutional network;

[0017] 1. Conv convolutional network;

[0018] 3, C3 module;

[0019] 1. Conv convolutional network;

[0020] 6, C3 module;

[0021] 1. Conv convolutional network;

[0022] 9, C3 module;

[0023] 1. Conv convolutional network;

[0024] 3, C3 module;

[0025] 1,SPPF module.

[0026] Preferably, before using the recognition model, the recognition model needs to be trained, wherein the training steps are as follows:

[0027] Obtain sample images and preprocess the sample images, wherein the preprocessing includes defect marking and size adjustment;

[0028] Perform normalization on the preprocessed sample images to obtain normalized data;

[0029] Divide the normalized data into training set data, validation set data, and test set data;

[0030] All the data in the training set are grouped according to the batch size and sent to the recognition model in sequence for forward propagation calculation. When all the data are calculated once, one cycle is completed.

[0031] After a cycle of training is completed, the prediction results of the current model are compared with the real labeled labels using the validation set data to obtain the judgment parameters of the cycle, where the judgment parameters include accuracy, precision, average of average precision, recall rate and loss function, and it is judged whether the judgment parameters all meet the threshold. If they all meet the threshold, the next cycle of training is carried out. If they do not all meet the threshold, the model parameters are adjusted.

[0032] When the number of cycles reaches the threshold, the data in the test set is put into the model for reasoning to obtain the position and confidence of the defect in the image. When the confidence is greater than the confidence threshold, the recognition model completes the training. If the confidence is less than the confidence threshold, the recognition model is retrained.

[0033] Preferably, the normalization operation is specifically performed as follows:

[0034]

[0035] Where x is the original data of the sample image;

[0036] The formula for obtaining the accuracy is as follows:

[0037]

[0038] Among them, TP is the number of samples predicted to be positive samples and actually positive samples, FP is the number of samples predicted to be positive samples and actually negative samples; TN is the number of samples predicted to be negative samples and actually negative samples, and FN is the number of samples predicted to be negative samples and actually positive samples;

[0039] The formula for obtaining accuracy is as follows:

[0040]

[0041] The formula for obtaining the recall rate is as follows:

[0042]

[0043] The formula for obtaining the average value of average precision is as follows:

[0044]

[0045] Where Q is the set of defect categories, q represents the qth defect, and AP(q) represents the average precision of the qth defect;

[0046] The formula for obtaining the loss function is as follows:

[0047] L = λ*L1+(1-λ)*L2;

[0048]

[0049] Where L1 is the category loss function value, L2 is the position loss function value, λ is the proportional coefficient, pij represents the probability that the i-th sample belongs to the j-th class, f(x i ) is the predicted position of the i-th sample, y i is the actual position of the sample, n is the total number of samples processed, and c is the total number of categories;

[0050] The confidence calculation formula is as follows:

[0051] confidence=pro(object)*IoU;

[0052] in IoU represents the ratio of the intersection and union of the areas of the real box and the predicted box.

[0053] A system for detecting glass bottle threads by AI, using the method for detecting glass bottle threads by AI, comprising an input module and a recognition module;

[0054] The input module is used to obtain a detection image of the thread of the target glass bottle to be tested;

[0055] The recognition module is used to perform result detection on the detection image based on the trained recognition model to obtain the recognition result of the bottle mouth thread.

[0056] A terminal device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, a method for detecting glass bottle threads by using AI as described above is implemented.

[0057] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, a method for detecting glass bottle threads by using AI is implemented as described above.

[0058] One of the above technical solutions has the following advantages or beneficial effects: In the invention, a recognition model is set, and the recognition model is trained by using abnormal bottle bottom sample pictures. Since the recognition model is specially trained based on abnormal bottle bottom sample pictures, it is particularly good at identifying and distinguishing bottle bottoms that do not meet the standards or have defects. This highly targeted training method can significantly improve the model's ability to detect abnormal situations. When annotating abnormal bottle bottom sample pictures, the annotations of bubbles, sticky materials, and cracks can be added. This improves the recognition of common defects and improves the efficiency of recognition.

[0059] By detecting the bottle bottom through the recognition of the present invention, the defects of the bottle bottom can be effectively identified, the problem of missed detection can be reduced, and the enterprise can quickly find the problematic glass bottles. BRIEF DESCRIPTION OF THE DRAWINGS

[0060] Figure 1 is a flow chart of an embodiment of the method of the present invention.

[0061] Figure 2 It is a schematic diagram of the structure of an embodiment of the system of the present invention. DETAILED DESCRIPTION

[0062] The embodiments of the present invention are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals represent the same or similar elements or elements having the same or similar functions from beginning to end. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.

[0063] In the description of the embodiments of the present invention, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0064] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, unless otherwise specified, the meaning of "plurality" is two or more. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0065] like Figures 1-2 As shown, a method for detecting the bottom of a glass bottle by using AI comprises the following steps:

[0066] Acquire a detection image of the bottom of the target glass bottle to be tested;

[0067] Perform result detection on the detection image based on the trained recognition model to obtain the recognition result of the bottle bottom;

[0068] The recognition model is trained based on abnormal bottle bottom sample images.

[0069] In the invention, a recognition model is set up, and the recognition model is trained by using abnormal bottle bottom sample pictures. Since the recognition model is specially trained based on abnormal bottle bottom sample pictures, it is particularly good at identifying and distinguishing bottle bottoms that do not meet the standards or have defects. This highly targeted training method can significantly improve the model's ability to detect abnormal situations. When annotating abnormal bottle bottom sample pictures, the annotations of bubbles, sticky materials, and cracks can be added to improve the recognition of common defects and improve the efficiency of recognition.

[0070] By detecting the bottle bottom through the recognition of the present invention, the defects of the bottle bottom can be effectively identified, the problem of missed detection can be reduced, and the enterprise can quickly find the problematic glass bottles.

[0071] Preferably, the recognition model includes an input layer, a reference network extraction feature layer, a Neck processing feature layer and an output prediction layer connected in sequence. In addition, the Neck processing feature layer and the output prediction layer are conventional settings and are not limited too much here.

[0072] Preferably, the input layer is used to scale the detection image to a size of 1280*1024, and is provided with three anchor frames of different multiples;

[0073] The settings of the anchor boxes for 8x downsampling are: [25,27; 68,83; 85,110];

[0074] The anchor boxes are set to [120, 109; 162, 179; 280, 319] when downsampling by 16 times.

[0075] The anchor boxes are set to [360,350; 450,408; 550,500] when downsampling by 32 times.

[0076] In the setting of the anchor box, two numbers form a group, which respectively represent the length and width of the anchor box. For example, the anchor box with 8x downsampling is set with three sizes of anchor boxes, namely the first anchor box with a length of 25 and a width of 27, the second anchor box with a length of 68 and a width of 83, and the third anchor box with a length of 85 and a width of 110.

[0077] The anchor frames are generally divided into three types: large, medium, and small according to the sampling ratio. In each type, the actual applicable defect size can be used. The 8x downsampling anchor frame is suitable for defects smaller than or close to this size. When defects are not found in this size, it will be replaced with a 16x downsampling anchor frame. Similarly, when defects are not found in the 16x downsampling anchor frame, it will be replaced with a 32x downsampling anchor frame for sampling and searching.

[0078] In the inspection of the bottom of the bottle, the area of ​​the bottom of the bottle is relatively large compared to other positions of the glass bottle, and the features of the defect are easier to identify than the features of the bottom of the bottle. In addition, since the features in the bottom of the bottle are generally relatively large, a larger image scaling ratio and anchor box volume can be set to increase the inspection speed.

[0079] Preferably, the baseline network feature extraction layer consists of 10 layers, including at least a Conv convolutional network, a C3 module, and an SPPF module;

[0080] The 10 layers that constitute the feature extraction layer of the benchmark network are:

[0081] 1. Conv convolutional network;

[0082] 1. Conv convolutional network;

[0083] 3, C3 module;

[0084] 1. Conv convolutional network;

[0085] 6, C3 module;

[0086] 1. Conv convolutional network;

[0087] 9, C3 module;

[0088] 1. Conv convolutional network;

[0089] 3, C3 module;

[0090] 1,SPPF module.

[0091] The number before each module indicates the number of times the module is used in that layer. For example, 1, Conv convolutional network, means that the Conv convolutional network is used to perform feature map downsampling once in the first, second, fourth and sixth layers.

[0092] Since the present invention is aimed at detecting the bottom of the glass bottle, its defect features are relatively easy to obtain, so unlike the existing model, a Focus module is not set to slice, expand the input channel, splice, and perform convolution operations on the detection image. Instead, the detection image is directly input into the Conv convolutional network to reduce unnecessary calculation steps. At the same time, the network directly input into the Conv can capture simple edges, textures, etc., which conform to the shape of the bottom defect. Therefore, only by directly extracting features through the Conv convolutional network can effective features be extracted in the bottom defect recognition, so that the recognition model of the present invention can effectively and quickly identify the bottom defect of the bottle.

[0093] Preferably, before using the recognition model, the recognition model needs to be trained, wherein the training steps are as follows:

[0094] Obtain sample images and preprocess the sample images, wherein the preprocessing includes defect marking and size adjustment;

[0095] Perform normalization on the preprocessed sample images to obtain normalized data;

[0096] Normalization can eliminate the impact of differences in dimensions or numerical ranges between different samples, making the model easier to converge and improving training speed and effect.

[0097] Resizing refers to adjusting the size of the image input to the training model. The right image size can provide enough information for the model to accurately detect objects while meeting the computing resource constraints. Larger image sizes may provide more details, but will also increase computational complexity and memory requirements. Smaller image sizes may lose some details, but will reduce the computational burden. By resizing the image, you can balance the relationship between accuracy and efficiency.

[0098] Specifically, in one embodiment of the present invention, the image size is set to 224x224 pixels, because in the defect recognition training, the defects of glass containers that are easy to find are relatively small, so there is no need to set a too large image size format. In addition, when the size of the training image is larger than 224x224 pixels, the defective area of ​​the image can be cropped separately to meet the format size of 224x224 pixels. However, after the image is cropped, there may be distortion. Under certain lighting conditions, the distorted pixels are similar to the defects of the glass container. Therefore, after cropping, methods such as bilinear interpolation or bicubic interpolation must be used to reduce the distortion. If some parts of the image are still distorted after using bilinear interpolation or bicubic interpolation, the distorted position can be filled with the color that is the most different from the background color. For example, the background color of a training image is white. When there is still partial distortion after using bilinear interpolation or bicubic interpolation, black is used to fill the distorted part and the image is marked. This is to facilitate the defect recognition training of the training model in the later stage.

[0099] Divide the normalized data into training set data, validation set data, and test set data;

[0100] All the data in the training set are grouped according to the batch size and sent to the recognition model in sequence for forward propagation calculation. When all the data are calculated once, one cycle is completed.

[0101] After one cycle of training is completed, the validation set data is used to compare the prediction results of the current model with the real labeled labels to obtain the judgment parameters of the cycle, where the judgment parameters include accuracy, precision, average of average precision, recall rate and loss function, and judge whether the judgment parameters all meet the threshold. If they all meet the threshold, the next cycle of training is carried out. If they do not all meet the threshold, the model parameters are adjusted; wherein adjusting the model parameters means reducing the learning rate of the recognition model, so that the recognition model can be more meticulous when searching in the parameter space, which helps to find a better solution, or adjust the ratio between L1 and L2 parameters, etc.

[0102] When the number of cycles reaches the threshold, the data in the test set is put into the model for reasoning to obtain the position and confidence of the defect in the image. When the confidence is greater than the confidence threshold, the recognition model completes the training. If the confidence is less than the confidence threshold, the recognition model is retrained.

[0103] Preferably, the normalization operation is specifically performed as follows:

[0104]

[0105] Where x is the original data of the sample image;

[0106] The formula for obtaining the accuracy is as follows:

[0107]

[0108] Among them, TP is the number of samples predicted to be positive samples and actually positive samples, FP is the number of samples predicted to be positive samples and actually negative samples; TN is the number of samples predicted to be negative samples and actually negative samples, and FN is the number of samples predicted to be negative samples and actually positive samples;

[0109] The formula for obtaining accuracy is as follows:

[0110]

[0111] The formula for obtaining the recall rate is as follows:

[0112]

[0113] The formula for obtaining the average value of average precision is as follows:

[0114]

[0115] Where Q is the set of defect categories, q represents the qth defect, and AP(q) represents the average precision of the qth defect;

[0116] The formula for obtaining the loss function is as follows:

[0117] L = λ*L1+(1-λ)*L2;

[0118]

[0119] Where L1 is the category loss function value, L2 is the position loss function value, λ is the proportional coefficient, pij represents the probability that the i-th sample belongs to the j-th class, f(x i ) is the predicted position of the i-th sample, y i is the actual position of the sample, n is the total number of samples processed, and c is the total number of categories;

[0120] The confidence calculation formula is as follows:

[0121] confidence=pro(object)*IoU;

[0122] in IoU represents the ratio of the intersection and union of the areas of the real box and the predicted box.

[0123] A system for detecting glass bottle threads by AI, using the method for detecting glass bottle threads by AI, comprising an input module and a recognition module;

[0124] The input module is used to obtain a detection image of the thread of the target glass bottle to be tested;

[0125] The recognition module is used to perform result detection on the detection image based on the trained recognition model to obtain the recognition result of the bottle mouth thread.

[0126] A terminal device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, a method for detecting glass bottle threads by using AI as described above is implemented.

[0127] A computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements a method for detecting glass bottle threads by AI as described. In the description of this specification, the descriptions with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" etc. mean that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0128] Although the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.

Claims

1. A method for detecting the bottom of a glass bottle by AI, characterized in that: The steps include: Acquire a detection image of the bottom of the target glass bottle to be tested; Perform result detection on the detection image based on the trained recognition model to obtain the recognition result of the bottle bottom; The recognition model is trained based on abnormal bottle bottom sample images; The recognition model includes an input layer, a reference network extraction feature layer, a Neck processing feature layer and an output end prediction layer connected in sequence; The feature extraction layer of the baseline network consists of 10 layers, including at least the Conv convolutional network, the C3 module, and the SPPF module; The 10 layers that constitute the feature extraction layer of the benchmark network are:

1. Conv convolutional network; 1. Conv convolutional network; 3, C3 module; 1. Conv convolutional network; 6, C3 module; 1. Conv convolutional network; 9, C3 module; 1. Conv convolutional network; 3, C3 module; 1,SPPF module.

2. The method for detecting the bottom of a glass bottle by AI according to claim 1, characterized in that: The input layer is used to scale the detection image to a size of 1280*1024, and is provided with three anchor frames of different multiples; The settings of the anchor boxes for 8x downsampling are: [25,27; 68,83; 85,110]; The settings of the anchor boxes for 16x downsampling are: [120,109; 162,179; 280,319]; The anchor boxes are set to [360,350; 450,408; 550,500] when downsampling by 32 times.

3. The method for detecting the bottom of a glass bottle by AI according to claim 1, characterized in that: Before using the recognition model, it is necessary to train the recognition model. The training steps are as follows: Obtain sample images and preprocess the sample images, wherein the preprocessing includes defect marking and size adjustment; Perform normalization on the preprocessed sample images to obtain normalized data; Divide the normalized data into training set data, validation set data, and test set data; All the data in the training set are grouped according to the batch size and sent to the recognition model in sequence for forward propagation calculation. When all the data are calculated once, one cycle is completed. After a cycle of training is completed, the prediction results of the current model are compared with the real labeled labels using the validation set data to obtain the judgment parameters of the cycle, where the judgment parameters include accuracy, precision, average of average precision, recall rate and loss function, and it is judged whether the judgment parameters all meet the threshold. If they all meet the threshold, the next cycle of training is carried out. If they do not all meet the threshold, the model parameters are adjusted. When the number of cycles reaches the threshold, the data in the test set is put into the model for reasoning to obtain the position and confidence of the defect in the image. When the confidence is greater than the confidence threshold, the recognition model completes the training. If the confidence is less than the confidence threshold, the recognition model is retrained.

4. The method for detecting the bottom of a glass bottle by AI according to claim 3, characterized in that: The normalization operation is specifically performed as follows: Where x is the original data of the sample image; The formula for obtaining the accuracy is as follows: Among them, TP is the number of samples predicted to be positive samples and actually positive samples, FP is the number of samples predicted to be positive samples and actually negative samples; TN is the number of samples predicted to be negative samples and actually negative samples, and FN is the number of samples predicted to be negative samples and actually positive samples; The formula for obtaining accuracy is as follows: The formula for obtaining the recall rate is as follows: The formula for obtaining the average value of average precision is as follows: Where Q is the set of defect categories, q represents the qth defect, and AP(q) represents the average precision of the qth defect; The formula for obtaining the loss function is as follows: L = λ*L1+(1-λ)*L2; Where L1 is the category loss function value, L2 is the position loss function value, λ is the proportional coefficient, pij represents the probability that the i-th sample belongs to the j-th class, f(x i ) is the predicted position of the i-th sample, y i is the actual position of the sample, n is the total number of samples processed, and c is the total number of categories; The confidence calculation formula is as follows: confidence=pro(object)*IoU; in IoU represents the ratio of the intersection and union of the areas of the real box and the predicted box.

5. A system for detecting the bottom of a glass bottle by AI, using the method for detecting the bottom of a glass bottle by AI as claimed in any one of claims 1 to 4, characterized in that: It includes an input module and a recognition module; The input module is used to obtain a detection image of the bottom of the target glass bottle to be tested; The recognition module is used to perform result detection on the detection image based on the trained recognition model to obtain the recognition result of the bottle bottom.

6. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method for detecting the bottom of a glass bottle by using AI as described in any one of claims 1 to 4 is implemented.

7. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, a method for detecting the bottom of a glass bottle by using AI as described in any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • Fruit detection and yield estimation method and system based on machine vision

    CN114663814A

  • General target detection method for adaptive attention guidance mechanism

    WO2021139069A1