AI visual inspection method and system
Through the AI visual inspection method, image acquisition and deep learning algorithms are used to solve the accuracy and adaptability problems of traditional glass bottle inspection methods, achieve efficient and automated defect inspection, and improve the inspection accuracy and efficiency of the production line.
Patent Information
- Application Number
- CN202410818512.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-24
- Publication Date
- 2024-10-01
AI Technical Summary
Traditional glass bottle defect detection methods have problems such as low accuracy, high cost and error rate caused by manual intervention, and poor adaptability, making it difficult to achieve efficient and automated detection.
AI visual inspection method is used to identify defects in glass bottles, including chips, cracks, bubbles, etc., through image acquisition, denoising processing, feature extraction and deep learning algorithms, combined with high-resolution cameras and machine learning or deep learning models to achieve automation detection.
It improves the accuracy and efficiency of glass bottle defect detection, reduces the need for manual intervention, enhances the versatility and adaptability of detection, realizes efficient and automated production line detection, and ensures product quality.
Smart Images

Figure CN118735875A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of machine vision technology, and in particular relates to an AI vision detection method and system. Background Art
[0002] AI visual inspection technology mainly covers multiple fields such as computer vision, artificial intelligence and image processing. With the rapid development of science and technology, especially the improvement of computer performance and the continuous innovation of algorithms, AI visual inspection technology has been rapidly developed and improved. Computer vision, as the core of AI visual inspection technology, parses and understands images by simulating the human visual system. This includes identifying, locating, segmenting and 3D reconstruction of objects in images. With the development of deep learning technology, especially the widespread application of convolutional neural networks (CNN), the field of computer vision has achieved significant performance improvements in target detection and image classification.
[0003] In the field of wine bottle inspection, AI visual inspection methods are particularly widely used. Traditional wine bottle inspection methods mainly rely on manual labor, which has problems such as low efficiency and high false detection rate. Wine bottle inspection based on AI visual inspection technology can achieve fast and accurate inspection of bottles, including defects and dirt identification of various parts such as bottle mouth, bottle body, label, etc. Summary of the invention
[0004] In view of the problems existing in the prior art, the present invention provides an AI detection technology and equipment for wine bottle packaging based on machine vision.
[0005] The present invention is implemented as follows: an AI visual inspection method for improving the accuracy and efficiency of glass bottle defect detection, the method comprising the following steps:
[0006] 1. Image acquisition and preprocessing: Use a high-resolution camera to capture glass bottle images, and improve image quality through denoising and enhancement processing to provide clear image input for subsequent processing;
[0007] 2. Feature extraction: Extract key features of the glass bottle from the preprocessed image through image processing algorithms, including contour, size, shape, color difference and defect-related features;
[0008] 3. Defect detection: Combined with machine learning or deep learning algorithms, defect detection is performed on glass bottles based on the extracted features, identifying data points that deviate from the normal range, thereby determining defects;
[0009] 4. Result output and alarm: The test results are output to the display interface or stored in the database, and the alarm mechanism is triggered when defects exceeding the preset threshold are detected.
[0010] The denoising process in the image preprocessing step further includes:
[0011] 1. Multi-dimensional feature extraction: Use the tree module to receive the noisy image and extract multi-dimensional features through its branch structure;
[0012] 2. Feature extraction and enhancement: The binocular enhancement module processes the extracted multi-dimensional features, performs feature refinement and local feature enhancement, extracts key information and highlights the significant features of the image;
[0013] 3. Feature fusion: Combine the refined features with the salient features and use a specific algorithm to merge these features to obtain a high-quality denoised image.
[0014] Through the above denoising process, this method can further improve the accuracy and efficiency of glass bottle defect detection and realize efficient and automated production line defect detection.
[0015] The present invention provides an AI visual detection method, which comprises:
[0016] S1: Capture the image of the glass bottle using a high-resolution camera through the image acquisition module; and perform denoising and image enhancement through the image preprocessing module;
[0017] S2: Extract key features of the glass bottle using image processing algorithms through feature extraction module;
[0018] S3: Use machine learning or deep learning algorithms to detect defects in glass bottles based on the extracted features through the mold defect detection module;
[0019] S4: Once a defect is detected through the result output and alarm module, the corresponding result is generated and output to the display interface or database; at the same time, if the defect exceeds the preset threshold, the alarm mechanism will be triggered to remind the operator to handle it.
[0020] Further, the denoising is performed by the image preprocessing module, specifically including:
[0021] S11: Acquire a noisy image; input the noisy image into a preset image denoising network, wherein the image denoising network includes a tree module and a binocular enhancement module;
[0022] S12: extracting multivariate features from the noise image through the tree module to obtain multivariate image features;
[0023] S13: performing feature purification on the multi-image features through the binocular enhancement module to obtain image refinement features, and performing local feature enhancement on the multi-image features to obtain image saliency features;
[0024] S14: performing feature fusion on the image refinement features and the image saliency features to obtain a denoised image.
[0025] Further, the image enhancement is performed by the image preprocessing module, specifically including:
[0026] 1) Providing an image composed of a plurality of pixels arranged in a matrix, and converting the image into a grayscale image;
[0027] 2) Calculate the absolute value Q1 of the difference between the grayscale values of two adjacent rows of pixels in each column and the first grayscale value weight k1;
[0028] The calculation formula for the absolute value Q1 of the difference in grayscale values between two adjacent rows of pixels in the same column is:
[0029] Q1=abs(Gray(i,j)-Gray(i+1,j));
[0030] The calculation formula of the first grayscale value weight k1 is:
[0031]
[0032] The absolute value Q1 of the difference between the grayscale values of two adjacent rows of pixels in the same column ranges from 0 to 255, and n is a positive integer greater than 1;
[0033] The calculation formula is:
[0034]
[0035] Wherein, i and j are positive integers, representing the row and column numbers of the pixel, respectively; Gray(i,j) is the grayscale value of the pixel in the i-th row and j-th column; Gray(i+1,j) is the grayscale value of the pixel in the i+1-th row and j-th column; H1(a) is the number of pixels with grayscale value a; C1(X) is the sum of the number of pixels corresponding to each grayscale value from Gray(i,j) to Gray(i+1,j);
[0036] 3) Calculate the absolute value Q2 of the difference in grayscale values between two adjacent columns of pixels in each row and the second grayscale value weight k2;
[0037] The calculation formula for the absolute value Q2 of the difference in grayscale values between two adjacent columns of pixels in the same row is:
[0038] Q2=abs(Gray(i,j)-Gray(i,j+1));
[0039] The calculation formula of the second grayscale value weight k2 is:
[0040]
[0041] The absolute value Q2 of the difference in grayscale values between two adjacent columns of pixels in the same row ranges from 0 to 255, and n is a positive integer greater than 1 and is the same as the value in step 2);
[0042] The second grayscale value weight k2 is cumulatively calculated with the grayscale values of the pixels in the two adjacent columns in each row. The calculation formula is:
[0043]
[0044] Wherein, i and j are positive integers, representing the row and column numbers of the pixel, respectively; Gray(i,j) is the grayscale value of the pixel in the i-th row and j-th column; Gray(i,j+1) is the grayscale value of the pixel in the i-th row and j+1-th column; H3(a) is the number of pixels with grayscale value a; C3(X) is the sum of the number of pixels corresponding to each grayscale value from Gray(i,j) to Gray(i,j+1);
[0045] 4) Add C1(X) in step 2) and C3(x) in step 3) to obtain C(X);
[0046] C(X)=C1(X)+C3(X);
[0047] 5) Maximum value normalization, the calculation formula is:
[0048]
[0049] Then multiply N(X) by 255 to obtain the enhanced grayscale table out(X), and obtain the new output grayscale value out_gray(i,j) by looking up the table.
[0050] Furthermore, the image processing algorithm in S2 specifically includes:
[0051] Texture feature extraction method: feature extraction based on the texture information of the image;
[0052] Shape feature extraction method: feature extraction based on the shape information of the image;
[0053] Gradient feature extraction method: feature extraction based on image edge information;
[0054] Optical flow feature extraction method: Feature extraction based on image motion information. By analyzing the displacement information of pixels in the image sequence, this method can obtain the motion information in the image.
[0055] Furthermore, the defects in S3 specifically include: gaps, cracks, bubbles, stripes, scratches, oil stains, etc.
[0056] Furthermore, the S3 specifically includes: inputting the features into the TensorRT model finally output by the YOLOv5 defect detection model optimized by the deep learning inference optimizer TensorRT; and analyzing the image features using the TensorRT model.
[0057] Furthermore, the optimization process of the defect detection model based on YOLOv5 includes: adopting a data parallel distributed method; setting each NVIDIA Jetson Nano in a site to have a complete copy of the defect detection model, the entire input training set is divided into multiple data blocks, and the data blocks are allocated to different NVIDIA Jetson Nanos to calculate the model parameter changes. In each training iteration, NVIDIA Jetson Nano exchanges the locally calculated model parameter changes to obtain the parameter changes of the global machine learning model.
[0058] Another object of the present invention is to provide a mathematical model for implementing the AI visual inspection method, the model comprising:
[0059] An image acquisition module for capturing images of glass bottles using a high-resolution camera;
[0060] An image preprocessing module, connected to the image acquisition module, for performing denoising and image enhancement;
[0061] A feature extraction module, connected to the image preprocessing module, is used to extract key features of the glass bottle using an image processing algorithm;
[0062] The mold defect detection module is connected to the feature extraction module and uses machine learning or deep learning algorithms to detect defects in glass bottles based on the extracted features;
[0063] The result output and alarm module is connected to the mold defect detection module. Once a defect is detected, the corresponding result is generated and output to the display interface or database; at the same time, if the defect exceeds the preset threshold, the alarm mechanism will be triggered to remind the operator to handle it.
[0064] Another object of the present invention is to provide a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the AI visual detection method.
[0065] Another object of the present invention is to provide a computer-readable storage medium storing a computer program, which, when executed by a processor, enables the processor to perform the steps of the AI visual inspection method.
[0066] In combination with the above technical solutions and the technical problems solved, the advantages and positive effects of the technical solutions to be protected by the present invention are as follows:
[0067] First, the AI visual inspection method and data model provided by the present invention is an automated inspection system that integrates advanced computer vision technology and artificial intelligence algorithms. The system is mainly used to efficiently and accurately inspect bottles during the production process of bottled wine products, identifying defects such as gaps, cracks, bubbles, streaks, scratches, and oil stains to ensure product quality and consumer experience.
[0068] The present invention improves the production efficiency and quality level of bottled wine products through automated and high-precision detection means, reduces the labor intensity and error rate of manual detection, and provides strong support for the intelligent upgrade of the wine production industry.
[0069] Second, the existing technical problems solved by the present invention mainly include the following problems existing in the traditional glass bottle defect detection method:
[0070] 1. Low accuracy: Traditional glass bottle defect detection methods are affected by factors such as light and background noise, resulting in low accuracy and stability of the detection results.
[0071] 2. Manual intervention: Some traditional methods require manual setting of thresholds or manual adjustment of parameters, which increases labor costs and leads to subjectivity and inconsistency in results.
[0072] 3. Poor adaptability: For glass bottles of different types and specifications, traditional methods need to redesign and adjust the algorithm, which lacks versatility and adaptability.
[0073] The AI visual inspection method proposed in the present invention combines machine learning or deep learning algorithms through steps such as image acquisition and preprocessing, feature extraction, defect detection, and result output and alarm, and has the following technical effects:
[0074] 1. High-precision detection: High-resolution cameras are used to capture images, and denoising and enhancement processing are used to improve image quality, providing clear input images for subsequent processing. Image processing algorithms are used in the feature extraction stage to effectively extract key features of glass bottles from images, including contours, sizes, shapes, color differences, and defect-related features, thereby achieving accurate glass bottle defect detection.
[0075] 2. High degree of automation: Combined with machine learning or deep learning algorithms, automated detection of glass bottle defects is achieved, reducing the need for manual intervention, reducing labor costs, and improving detection efficiency and consistency.
[0076] 3. Strong versatility: Through reasonable design of algorithms and models, the detection method of the present invention has strong versatility and adaptability, and can be applied to glass bottles of different types and specifications, providing a reliable solution for the quality control of glass bottle production lines.
[0077] Therefore, the present invention has high practical value in the field of glass bottle defect detection, can effectively improve the quality and efficiency of glass bottle production, reduces production costs, and has broad market application prospects. BRIEF DESCRIPTION OF THE DRAWINGS
[0078] Figure 1 is a flow chart of the AI visual inspection method provided by an embodiment of the present invention;
[0079] Figure 2 is a flow chart of a method for performing denoising through an image preprocessing module provided by an embodiment of the present invention;
[0080] Figure 3 It is a mathematical model structure diagram for implementing the AI visual detection method provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0081] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0082] This AI visual inspection method focuses on improving the accuracy and efficiency of glass bottle defect detection. The following describes in detail the signal and data processing process in this method:
[0083] S1: Image acquisition and preprocessing
[0084] 1. High-resolution image acquisition:
[0085] The glass bottle images are captured using a high-resolution camera. This step ensures the clarity and detail of the images, providing high-quality input for subsequent processing.
[0086] 2. Image denoising and enhancement:
[0087] Denoising: In the preprocessing stage, the original images containing noise are obtained, and then these images are input into the preset image denoising network. The denoising network uses a combination of tree modules and binocular enhancement modules to effectively remove random noise and structural noise in the image.
[0088] Enhancement: Image enhancement aims to improve image quality and make key features more obvious in preparation for the feature extraction stage.
[0089] S2: Feature extraction
[0090] 3. Key feature extraction:
[0091] Apply image processing algorithms, such as edge detection, texture analysis, etc., to extract key features of the glass bottle from the processed image. These features include contour, size, shape, color difference, and any features related to glass bottle defects.
[0092] S3: Defect Detection
[0093] 4. Defect detection:
[0094] Combined with machine learning or deep learning algorithms, such as convolutional neural networks (CNN), defect detection of glass bottles is performed based on the extracted features. The algorithm analyzes the features and identifies any data points that deviate from the normal range, thereby determining defects.
[0095] S4: Result output and alarm
[0096] 5. Result output:
[0097] The inspection results will be output to the display interface or stored in the database for subsequent analysis and recording. These results provide detailed information about the detected defects, such as defect type, size, location, etc.
[0098] 6. Alarm mechanism:
[0099] If the detected defects exceed the preset threshold, the system will trigger the alarm mechanism, automatically notify the operator or trigger the corresponding response process.
[0100] Detailed denoising process (S11 to S14):
[0101] S11: Multi-dimensional feature extraction: The tree module receives the noisy image and extracts multi-dimensional features through its branch structure, where each branch is responsible for capturing different characteristics of the image.
[0102] S12: Feature extraction and enhancement: The binocular enhancement module processes the multi-features output by the tree module, performs feature refinement and local feature enhancement, extracts key information and highlights the salient features of the image.
[0103] S13: Feature fusion: Combine the refined features and the salient features, and use a specific algorithm (such as weighted averaging or deep learning methods) to merge these features to obtain a high-quality denoised image.
[0104] Through this series of refined processing steps, the AI visual inspection method not only improves the accuracy of glass bottle defect detection, but also speeds up the detection speed, thereby realizing efficient and automated defect detection on the production line.
[0105] In order to achieve the key feature extraction and defect detection described in steps 3 and 4, we can adopt the following specific implementation methods:
[0106] ###3. Key feature extraction
[0107] First, we need to preprocess the image to extract the key features of the glass bottle. This can be achieved by following the steps below:
[0108] 1. Image preprocessing:
[0109] Grayscale: Convert a color image to a grayscale image to reduce the amount of calculation, `cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)`.
[0110] Denoising: Use Gaussian filtering or median filtering to remove noise from the image, `cv2.GaussianBlur(gray,(5,5),0)`.
[0111] 2. Feature extraction:
[0112] Edge detection: Use the Canny edge detection algorithm to extract the outline of the glass bottle, `cv2.Canny(blurred,lower_threshold,upper_threshold)`.
[0113] Shape description: Calculate the features of the glass bottle contour, such as area, perimeter, bounding rectangle, etc., `cv2.contourArea(contour)`.
[0114] Texture analysis: Calculate image texture features, such as gray-level co-occurrence matrix (GLCM) features.
[0115] Color analysis: For color images, analyze the color histogram of different parts of the glass bottle.
[0116] ###4. Defect Detection
[0117] Based on the extracted features, deep learning methods are used for defect detection:
[0118] 1. Build the dataset:
[0119] The extracted features and corresponding labels (normal / abnormal) are integrated into a dataset for training the model.
[0120] 2. Select the model:
[0121] Choose a suitable convolutional neural network (CNN) architecture, such as VGG16, ResNet, etc., and select a model based on the complexity of the problem and the amount of data.
[0122] 3. Training model:
[0123] Use the dataset to train the CNN model, `model.fit(train_images,train_labels)`.
[0124] The model is validated and adjusted to achieve satisfactory accuracy.
[0125] 4. Defect detection:
[0126] Use the trained model to make predictions for new glass bottle images, `model.predict(new_image_features)`.
[0127] Identify defects based on the prediction results and output defect type and location information.
[0128] 5. Parameter optimization:
[0129] Tune hyperparameters in CNN such as learning rate, batch size, number of iterations, etc. to optimize model performance.
[0130] Use techniques such as cross-validation to avoid overfitting and ensure that the model has good generalization ability.
[0131] Through the above steps, an automatic glass bottle defect detection system based on image processing and deep learning can be realized, thereby improving the detection efficiency and accuracy on the production line.
[0132] like Figure 1 As shown, an embodiment of the present invention provides an AI visual detection method, the method comprising:
[0133] S1: Capture the image of the glass bottle using a high-resolution camera through the image acquisition module; and perform denoising and image enhancement through the image preprocessing module;
[0134] S2: Extract key features of the glass bottle using image processing algorithms through feature extraction module;
[0135] S3: Use machine learning or deep learning algorithms to detect defects in glass bottles based on the extracted features through the mold defect detection module;
[0136] S4: Once a defect is detected through the result output and alarm module, the corresponding result is generated and output to the display interface or database; at the same time, if the defect exceeds the preset threshold, the alarm mechanism will be triggered to remind the operator to handle it.
[0137] like Figure 2 As shown, the denoising is performed by the image preprocessing module, specifically including:
[0138] S11: Acquire a noisy image; input the noisy image into a preset image denoising network, wherein the image denoising network includes a tree module and a binocular enhancement module;
[0139] S12: extracting multivariate features from the noise image through the tree module to obtain multivariate image features;
[0140] S13: performing feature purification on the multi-image features through the binocular enhancement module to obtain image refinement features, and performing local feature enhancement on the multi-image features to obtain image saliency features;
[0141] S14: performing feature fusion on the image refinement features and the image saliency features to obtain a denoised image.
[0142] The image enhancement is performed by the image preprocessing module, specifically comprising:
[0143] 1) Providing an image composed of a plurality of pixels arranged in a matrix, and converting the image into a grayscale image;
[0144] 2) Calculate the absolute value Q1 of the difference between the grayscale values of two adjacent rows of pixels in each column and the first grayscale value weight k1;
[0145] The calculation formula for the absolute value Q1 of the difference in grayscale values between two adjacent rows of pixels in the same column is:
[0146] Q1=abs(Gray(i,j)-Gray(i+1,j));
[0147] The calculation formula of the first grayscale value weight k1 is:
[0148]
[0149] The absolute value Q1 of the difference between the grayscale values of two adjacent rows of pixels in the same column ranges from 0 to 255, and n is a positive integer greater than 1;
[0150] The calculation formula is:
[0151]
[0152] Wherein, i and j are positive integers, representing the row and column numbers of the pixel, respectively; Gray(i,j) is the grayscale value of the pixel in the i-th row and j-th column; Gray(i+1,j) is the grayscale value of the pixel in the i+1-th row and j-th column; H1(a) is the number of pixels with grayscale value a; C1(X) is the sum of the number of pixels corresponding to each grayscale value from Gray(i,j) to Gray(i+1,j);
[0153] 3) Calculate the absolute value Q2 of the difference in grayscale values between two adjacent columns of pixels in each row and the second grayscale value weight k2;
[0154] The calculation formula for the absolute value Q2 of the difference in grayscale values between two adjacent columns of pixels in the same row is:
[0155] Q2=abs(Gray(i,j)-Gray(i,j+1));
[0156] The calculation formula of the second grayscale value weight k2 is:
[0157]
[0158] The absolute value Q2 of the difference in grayscale values between two adjacent columns of pixels in the same row ranges from 0 to 255, and n is a positive integer greater than 1 and is the same as the value in step 2);
[0159] The second grayscale value weight k2 is cumulatively calculated with the grayscale values of the pixels in the two adjacent columns in each row. The calculation formula is:
[0160]
[0161] Wherein, i and j are positive integers, representing the row and column numbers of the pixel, respectively; Gray(i,j) is the grayscale value of the pixel in the i-th row and j-th column; Gray(i,j+1) is the grayscale value of the pixel in the i-th row and j+1-th column; H3(a) is the number of pixels with grayscale value a; C3(X) is the sum of the number of pixels corresponding to each grayscale value from Gray(i,j) to Gray(i,j+1);
[0162] 4) Add C1(X) in step 2) and C3(x) in step 3) to obtain C(X);
[0163] C(X)=C1(X)+C3(X);
[0164] 5) Maximum value normalization, the calculation formula is:
[0165]
[0166] Then multiply N(X) by 255 to obtain the enhanced grayscale table out(X), and obtain the new output grayscale value out_gray(i,j) by looking up the table.
[0167] The image processing algorithm in S2 specifically includes:
[0168] Texture feature extraction method: feature extraction based on the texture information of the image;
[0169] Shape feature extraction method: feature extraction based on the shape information of the image;
[0170] Gradient feature extraction method: feature extraction based on image edge information;
[0171] Optical flow feature extraction method: Feature extraction based on image motion information. By analyzing the displacement information of pixels in the image sequence, this method can obtain the motion information in the image.
[0172] The defects in S3 specifically include: gaps, cracks, bubbles, streaks, scratches, oil stains, etc.
[0173] The S3 specifically includes: inputting the features into the TensorRT model finally output by the YOLOv5 defect detection model optimized by the deep learning inference optimizer TensorRT; and analyzing the image features using the TensorRT model.
[0174] The optimization process of the defect detection model based on YOLOv5 includes: adopting a data parallel distributed method; setting each NVIDIA Jetson Nano in a site to have a complete copy of the defect detection model, the entire input training set is divided into multiple data blocks, and the data blocks are distributed to different NVIDIA Jetson Nanos to calculate the model parameter changes. In each training iteration, NVIDIA Jetson Nano exchanges the locally calculated model parameter changes to obtain the parameter changes of the global machine learning model.
[0175] like Figure 3 As shown, an embodiment of the present invention provides a mathematical model for implementing the AI visual detection method, the model comprising:
[0176] An image acquisition module for capturing images of glass bottles using a high-resolution camera;
[0177] An image preprocessing module, connected to the image acquisition module, for performing denoising and image enhancement;
[0178] A feature extraction module, connected to the image preprocessing module, is used to extract key features of the glass bottle using an image processing algorithm;
[0179] The mold defect detection module is connected to the feature extraction module and uses machine learning or deep learning algorithms to detect defects in glass bottles based on the extracted features;
[0180] The result output and alarm module is connected to the mold defect detection module. Once a defect is detected, the corresponding result is generated and output to the display interface or database; at the same time, if the defect exceeds the preset threshold, the alarm mechanism will be triggered to remind the operator to handle it.
[0181] An embodiment of the present invention provides a computer device, which includes a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the AI visual detection method.
[0182] An embodiment of the present invention provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the processor executes the steps of the AI visual detection method.
[0183] According to the denoising processing steps described above, a specific implementation example may adopt a deep learning-based method, such as using an autoencoder to perform multivariate feature extraction, feature purification and enhancement, and feature fusion.
[0184] 1. Multi-dimensional feature extraction stage: First, a deep autoencoder network structure can be designed to receive noisy images and extract multi-dimensional features. The autoencoder network consists of an encoder and a decoder. The encoder compresses the input image into a low-dimensional representation, while the decoder decodes these low-dimensional representations into a reconstructed image. During the training process, the autoencoder is optimized to minimize the reconstruction error between the input image and the reconstructed image, so that it learns the abstract feature representation of the data. These learned feature representations can be regarded as multi-dimensional features.
[0185] 2. Feature extraction and enhancement stage: Next, a binocular enhancement module can be used, which consists of two branches, one for feature refinement and the other for local feature enhancement. Refinement can include using convolutional layers to further refine feature representations, while local feature enhancement can highlight salient features in the image by introducing attention mechanisms or local contrast enhancement techniques.
[0186] 3. Feature fusion stage: Finally, the features from the two branches are fused. This can be done through a simple concatenation operation or a more complex attention mechanism. The fused feature representation will have higher quality and better denoising effect.
[0187] The specific algorithm implementation will use a deep learning framework, such as TensorFlow or PyTorch, and will be adjusted and optimized according to the actual situation. An example implementation code of the entire process is as follows (taking PyTorch as an example):
[0188]
[0189]
[0190]
[0191] ```In the above code, a simple autoencoder network structure is defined, and the mean square error is used as the loss function and the Adam optimizer is used for optimization. During the training process, the model will learn how to extract features from noisy images and reconstruct them to achieve the purpose of denoising.
[0192] It should be noted that the embodiments of the present invention can be implemented by hardware, software, or a combination of software and hardware. The hardware part can be implemented using dedicated logic; the software part can be stored in a memory and executed by an appropriate instruction execution system, such as a microprocessor or dedicated design hardware. It can be understood by a person of ordinary skill in the art that the above-mentioned devices and methods can be implemented using computer executable instructions and / or contained in a processor control code, such as a carrier medium such as a disk, CD or DVD-ROM, a programmable memory such as a read-only memory (firmware), or a data carrier such as an optical or electronic signal carrier. Such code is provided on the carrier medium. The device and its modules of the present invention can be implemented by hardware circuits such as very large-scale integrated circuits or gate arrays, semiconductors such as logic chips, transistors, etc., or programmable hardware devices such as field programmable gate arrays, programmable logic devices, etc., can also be implemented by software executed by various types of processors, and can also be implemented by a combination of the above-mentioned hardware circuits and software, such as firmware.
[0193] The above description is only a specific implementation mode of the present invention, but the protection scope of the present invention is not limited thereto. Any modifications, equivalent substitutions and improvements made by any technician familiar with the technical field within the technical scope disclosed by the present invention and within the spirit and principle of the present invention should be covered by the protection scope of the present invention.
Claims
1. An AI visual inspection method, It is characterized in that The method includes: Image acquisition and preprocessing: Use a high-resolution camera to capture glass bottle images, and improve image quality through denoising and enhancement processing to provide clear image input for subsequent processing; Feature extraction: Extract key features of the glass bottle from the pre-processed image using image processing algorithms, including contour, size, shape, color differences, and defect-related features; Defect detection: Combined with machine learning or deep learning algorithms, defect detection is performed on glass bottles based on extracted features, identifying data points that deviate from the normal range, thereby determining defects; Result output and alarm: The test results are output to the display interface or stored in the database, and the alarm mechanism is triggered when defects exceeding the preset threshold are detected.
2. The AI visual inspection method according to claim 1, It is characterized in that The denoising process in the image preprocessing step further includes: Multi-dimensional feature extraction: The tree module is used to receive the noisy image and extract multi-dimensional features through its branch structure; Feature extraction and enhancement: The binocular enhancement module processes the extracted multi-dimensional features, performs feature refinement and local feature enhancement, extracts key information and highlights the significant features of the image; Feature fusion: Combine the refined features and the salient features and use a specific algorithm to merge these features to obtain a high-quality denoised image.
3. The AI visual inspection method according to claim 1, It is characterized in that The denoising is performed by the image preprocessing module, specifically comprising: S11: Acquire a noisy image; input the noisy image into a preset image denoising network, wherein the image denoising network includes a tree module and a binocular enhancement module; S12: extracting multivariate features from the noise image through the tree module to obtain multivariate image features; S13: performing feature purification on the multi-image features through the binocular enhancement module to obtain image refinement features, and performing local feature enhancement on the multi-image features to obtain image saliency features; S14: performing feature fusion on the image refinement features and the image saliency features to obtain a denoised image.
4. The AI visual inspection method according to claim 1, It is characterized in that The image enhancement is performed by the image preprocessing module, specifically comprising: 1) Providing an image composed of a plurality of pixels arranged in a matrix, and converting the image into a grayscale image; 2) Calculate the absolute value Q1 of the difference between the grayscale values of two adjacent rows of pixels in each column and the first grayscale value weight k1; The calculation formula for the absolute value Q1 of the difference in grayscale values between two adjacent rows of pixels in the same column is: Q1=abs(Gray(i,j)-Gray(i+1,j)); The calculation formula of the first grayscale value weight k1 is: The absolute value Q1 of the difference between the grayscale values of two adjacent rows of pixels in the same column ranges from 0 to 255, and n is a positive integer greater than 1; The calculation formula is: Wherein, i and j are positive integers, representing the row and column numbers of the pixel, respectively; Gray(i,j) is the grayscale value of the pixel in the i-th row and j-th column; Gray(i+1,j) is the grayscale value of the pixel in the i+1-th row and j-th column; H1(a) is the number of pixels with grayscale value a; C1(X) is the sum of the number of pixels corresponding to each grayscale value from Gray(i,j) to Gray(i+1,j); 3) Calculate the absolute value Q2 of the difference in grayscale values between two adjacent columns of pixels in each row and the second grayscale value weight k2; The calculation formula for the absolute value Q2 of the difference in grayscale values between two adjacent columns of pixels in the same row is: Q2=abs(Gray(i,j)-Gray(i,j+1)); The calculation formula of the second grayscale value weight k2 is: The absolute value Q2 of the difference in grayscale values between two adjacent columns of pixels in the same row ranges from 0 to 255, and n is a positive integer greater than 1 and is the same as the value in step 2); The second grayscale value weight k2 is cumulatively calculated with the grayscale values of the pixels in the two adjacent columns in each row. The calculation formula is: Wherein, i and j are positive integers, representing the row and column numbers of the pixel, respectively; Gray(i,j) is the grayscale value of the pixel in the i-th row and j-th column; Gray(i,j+1) is the grayscale value of the pixel in the i-th row and j+1-th column; H3(a) is the number of pixels with grayscale value a; C3(X) is the sum of the number of pixels corresponding to each grayscale value from Gray(i,j) to Gray(i,j+1); 4) Add C1(X) in step 2) and C3(x) in step 3) to obtain C(X); C(X)=C1(X)+C3(X); 5) Maximum value normalization, the calculation formula is: Then multiply N(X) by 255 to obtain the enhanced grayscale table out(X), and obtain the new output grayscale value out_gray(i,j) by looking up the table.
5. The AI visual inspection method according to claim 1, It is characterized in that The image processing algorithm in S2 specifically includes: Texture feature extraction method: feature extraction based on the texture information of the image; Shape feature extraction method: feature extraction based on the shape information of the image; Gradient feature extraction method: feature extraction based on image edge information; Optical flow feature extraction method: Feature extraction based on image motion information. By analyzing the displacement information of pixels in the image sequence, this method can obtain the motion information in the image.
6. The AI visual inspection method according to claim 1, It is characterized in that The defects in S3 specifically include: gaps, cracks, bubbles, stripes, scratches, and oil stains; S3 specifically includes: inputting features into the TensorRT model that is finally output by the defect detection model of YOLOv5 optimized with the deep learning inference optimizer TensorRT; and using the TensorRT model to analyze image features.
7. The AI visual inspection method according to claim 6, It is characterized in that The optimization process of the defect detection model based on YOLOv5 includes: adopting a data parallel distributed method; setting each NVIDIA Jetson Nano in a site to have a complete copy of the defect detection model, the entire input training set is divided into multiple data blocks, and the data blocks are distributed to different NVIDIA Jetson Nanos to calculate the model parameter changes. In each training iteration, NVIDIA Jetson Nano exchanges the locally calculated model parameter changes to obtain the parameter changes of the global machine learning model.
8. A mathematical model for implementing the AI visual inspection method according to any one of claims 1 to 7, It is characterized in that The model includes: An image acquisition module for capturing images of glass bottles using a high-resolution camera; An image preprocessing module, connected to the image acquisition module, for performing denoising and image enhancement; A feature extraction module, connected to the image preprocessing module, is used to extract key features of the glass bottle using an image processing algorithm; The mold defect detection module is connected to the feature extraction module and uses machine learning or deep learning algorithms to detect defects in glass bottles based on the extracted features; The result output and alarm module is connected to the mold defect detection module. Once a defect is detected, the corresponding result is generated and output to the display interface or database; at the same time, if the defect exceeds the preset threshold, the alarm mechanism will be triggered to remind the operator to handle it.
9. A computer device, It is characterized in that The computer device includes a memory and a processor, the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the AI visual inspection method according to any one of claims 1 to 7.
10. A cross-domain AI visual inspection method for glass bottle production line and food packaging inspection method, It is characterized in that The following steps are involved: Image acquisition and preprocessing: Use a high-resolution camera to collect images of glass bottles and food packaging respectively, and improve image quality through denoising and enhancement processing to provide clear image input for subsequent processing; Feature extraction and recognition: For glass bottles, extract key features of contour, size, and shape for defect detection; for food packaging, identify packaging integrity, label position, and color difference features to determine packaging quality; Defect and quality control: Combined with machine learning or deep learning algorithms, the extracted features are analyzed to identify defects in glass bottles and anomalies in food packaging, thus achieving defect detection and quality control; Result output and feedback: The test results are output to the production line control system, and the production line parameters are automatically adjusted or the alarm mechanism is triggered according to the test results to achieve automated management and optimization.
Citation Information
Cited By
Wine bottle conveying line for packaging of brewery
CN119568681A
Insulator production system and production method
CN119626687A
Glass container surface defect detection method based on visual inspection
CN120142307A
Aggregate particle size analysis method and system based on small sample statistics
CN120953712A
