Detergent-oriented filling empty bottle sorting visual detection method and system

CN122882469APending Publication Date: 2026-10-09GUANGDONG LAYA NEW CHEM TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611098683.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-23
Publication Date
2026-10-09

AI Technical Summary

Technical Problem

[0005]本发明的目的是提供面向清洗剂的灌装空瓶分拣视觉检测方法及系统,通过自适应视觉检测与智能焦距调控,有效解决了分辨率调整与焦距未匹配导致的检测误差问题

Benefits of technology

本发明通过自适应视觉检测与智能焦距调控,有效解决了现有技术在瓶口裂缝检测过程中因分辨率调整与焦距未能同步匹配导致的检测误差问题。通过基准光源照射与工业相机实时采集,确保瓶口图像的均匀性和高质量成像;随后,利用图像预处理与标准化数据集合构建,提升数据一致性,为裂缝检测奠定稳固基础。本发明采用特征提取与深度学习相结合的方法,对瓶口裂纹进行精准识别和量化分析,大幅提高检测精度和稳定性。同时,本发明创新性地根据裂缝类型动态调整图像分辨率,并自适应调控镜头焦距,确保高分辨率下成像清晰,避免焦距失配导致的成像模糊或裂缝细节丢失。最终,本发明不仅提高了瓶口裂缝检测的准确率和可靠性,减少了误检与漏检率,还优化了视觉系统的实时性,使得检测系统能够适应高速生产线环境,为清洗剂灌装瓶的分拣和质量控制提供了高效、稳定、智能化的解决方案。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122882469A_ABST
    Figure CN122882469A_ABST
Patent Text Reader

Abstract

The application discloses a cleaning agent-oriented filling empty bottle sorting visual detection method and system, relates to the technical field of cleaning agent filling empty bottle sorting visual detection, and comprises the following steps: firstly, a preset light source is used to uniformly irradiate the empty bottles to be detected on a conveying belt, and an industrial camera is used to collect real-time images of the empty bottles to be detected. Through adaptive visual detection and intelligent focal length regulation and control, the application solves the detection error problem caused by resolution adjustment and unmatched focal length. The application adopts a reference light source and an industrial camera to collect, combines image preprocessing and standardized data collection, and improves data consistency. Through feature extraction and deep learning, the application accurately identifies and quantifies bottle mouth cracks, improves detection accuracy and stability. The application innovatively dynamically adjusts resolution and adaptively regulates focal length, and ensures that crack details are clearly presented. Finally, the method improves detection accuracy, reduces false positives and false negatives, optimizes real-time performance, adapts to high-speed production lines, and realizes intelligent detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of visual inspection technology for sorting empty bottles of cleaning agents, and specifically to a visual inspection method and system for sorting empty bottles of cleaning agents. Background Technology

[0002] Visual inspection for empty bottle sorting in the cleaning agent filling process refers to the automated sorting and quality inspection of empty bottles awaiting filling during the cleaning agent production process using computer vision technology. This system uses industrial cameras, image processing algorithms, and artificial intelligence models to acquire real-time images of empty bottles on the production line and performs inspection and analysis, including bottle type classification, bottle mouth integrity checks, foreign object detection, and bottle stain identification. Based on the inspection results, the system can automatically reject non-compliant empty bottles, ensuring that the bottles entering the filling stage meet quality standards. This improves the automation level and product qualification rate of the production line, reduces human intervention and losses, thereby improving production efficiency and product quality.

[0003] Existing technologies have the following shortcomings: In the process of using existing computer vision technology for bottle neck crack detection, the system typically dynamically adjusts the image resolution according to the crack type to obtain clearer data for analysis. However, because existing technologies cannot adaptively adjust the lens focal length, the focal length fails to match synchronously with the resolution adjustment, potentially leading to serious consequences. Focal length mismatch results in blurred images, making the crack area unclear and affecting the recognition accuracy of computer vision algorithms. Furthermore, low-contrast micro-cracks may be difficult to detect under low resolution or incorrect focal length conditions, thus being ignored by the system and going undetected. Over time, these micro-cracks may gradually expand during storage, transportation, or use, eventually leading to bottle breakage. Once the bottle neck crack enlarges, cleaning agents may leak, contaminating surrounding goods, especially in large-scale logistics warehousing, potentially causing the entire batch of products to be scrapped, resulting in severe economic losses and damaging brand reputation.

[0004] The information disclosed in the background section is only intended to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention

[0005] The purpose of this invention is to provide a visual inspection method and system for sorting empty bottles used in cleaning agents. Through adaptive visual inspection and intelligent focus control, it effectively solves the detection error problem caused by resolution adjustment and focus mismatch. It employs a reference light source for illumination and real-time acquisition by an industrial camera, combined with image preprocessing and standardized dataset construction to ensure data consistency. Through feature extraction and deep learning models, it achieves accurate identification and quantitative analysis of bottle mouth cracks, improving detection accuracy and stability. This invention innovatively dynamically adjusts image resolution and adaptively controls focus to ensure clear rendering of crack details. Ultimately, this method improves detection accuracy, reduces false positives and false negatives, optimizes system real-time performance, adapts to high-speed production lines, and achieves efficient and intelligent bottle mouth quality inspection, thus solving the problems mentioned in the background art.

[0006] To achieve the above objectives, the present invention provides the following technical solution: a visual inspection method for sorting empty bottles of cleaning agents, comprising the following steps: First, the empty bottles to be inspected on the conveyor belt are uniformly illuminated using a preset light source, and real-time images of the empty bottles to be inspected are acquired using an industrial camera. Under illumination, the vision inspection system acquires an image of the bottle opening of an empty bottle, preprocesses the acquired raw image data, and then forms a dataset from the processed standardized image data to prepare data for subsequent crack detection. Key features reflecting the presence of microcracks at the bottle opening are selected from the preprocessed image data using feature extraction algorithms. The selected key features are further analyzed and processed within the detection window to quantify the bottle mouth defect status. The quantified key feature data is then input into a pre-trained deep learning model to intelligently evaluate the bottle mouth defect status. When the deep learning model evaluation results show that there are microcracks at the bottle opening, the image resolution is dynamically optimized according to the crack type to accurately capture crack details. At the same time, the lens focal length is adaptively adjusted based on the resolution adjustment range to achieve precise focusing and ensure that crack features are clearly presented, providing high-quality visual data for subsequent detection and decision-making.

[0007] Preferably, the specific steps for uniformly illuminating the empty bottles to be inspected on the conveyor belt using a preset light source and acquiring real-time images of the empty bottles to be inspected using an industrial camera are as follows: First, when the empty bottle to be tested enters the testing area on the conveyor belt, a preset standardized light source is triggered to evenly illuminate the bottle mouth area, ensuring clear imaging and moderate contrast, and reducing ambient light interference and reflection effects. The type and intensity of the light source need to be optimized according to the material of the bottle and the characteristics of the cracks in order to maximize the highlighting of the details on the surface of the bottle mouth; At the same time, the industrial camera, under the control of a precise trigger signal, performs high-speed real-time image acquisition of empty bottles passing through the detection area.

[0008] Preferably, a feature extraction algorithm is used to select key features reflecting the presence of microcracks at the bottle opening from the preprocessed image data. The extracted features include changes in texture direction and polarized light reflection in the bottle opening area. The changes in texture direction and polarized light reflection in the bottle opening area are analyzed under the detection window to generate anisotropic texture offset reference values ​​and non-uniform polarized light reflection reference values, respectively. The bottle opening defect status is quantified by the anisotropic texture offset reference values ​​and non-uniform polarized light reflection reference values.

[0009] Preferably, the specific steps for analyzing the texture direction changes in the bottle mouth area under the detection window to generate anisotropic texture offset reference values ​​are as follows: First, within the detection window, the local texture direction of the bottle mouth area is extracted to capture the texture shift caused by microcracks, using a gradient mapping matrix. The gradient mapping matrix is ​​calculated based on the second-order partial derivative to quantize the changes in texture direction. The calculation expression is as follows: , In the formula, It is the grayscale value of the image, representing the pixel coordinates of the image. The grayscale value at that location, i.e., the brightness information of the pixel. Representative image in The first-order partial derivative in the direction, i.e., the brightness change along the horizontal direction. Representative image in The first-order partial derivative in the direction, i.e., the brightness change along the vertical direction. Yes The second-order partial derivative in the direction measures the rate of change of brightness in an image along the horizontal direction. Yes The second-order partial derivative in the direction measures the rate of change of brightness in an image along the vertical direction. It is a mixed second-order partial derivative, which measures the situation where the image changes simultaneously in two directions. It is a combination of second derivatives used to comprehensively measure the curvature changes in a local region. It is the gradient mapping matrix, representing the coordinates of the image. The gradient mapping value at that point is used to measure the degree of local gradient anomaly at that pixel. In obtaining the gradient mapping matrix Next, the anisotropic texture offset reference value is calculated to measure the degree of texture direction change in the local area of ​​the bottle opening. The calculation expression is as follows: , In the formula, It is an anisotropic texture offset reference value. It is the total number of rows in the detection area. It is the total number of columns in the detection area. It is a spatial weighting factor. It calculates the gradient direction offset angle.

[0010] Preferably, the specific steps for analyzing the polarization reflection changes within the detection window to generate a non-uniform reference value for polarization reflection are as follows: An industrial camera, paired with a polarized light source, illuminates the bottle opening area, capturing reflection images at different polarization angles. Since minute changes in the bottle opening surface structure alter the polarization state of light, a mathematical model is performed on the polarization reflection characteristics of each pixel. To quantify these changes, a local polarization phase shift matrix is ​​introduced. This matrix is ​​used to calculate the polarization phase shift in different regions of the bottle opening. The calculation expression is as follows: , In the formula, It is the local polarization phase shift matrix. , , and These are the polarization angles of industrial cameras. , , and Below, pixel coordinates The intensity of reflected light at that location It is to prevent tiny positive numbers with a denominator of zero. It is a complex phase angle calculation, which calculates the phase angle of the complex ratio formed by the numerator and denominator, that is, solving for the angle of the ratio in the complex plane; In obtaining the local polarization phase offset matrix Next, a global polarization reflection non-uniformity reference value is calculated to measure the amplitude of polarization reflection variation across the entire bottle mouth region. A double divergence integral transform is used to enhance the reflection non-uniformity in the crack region, and the polarization reflection non-uniformity reference value is defined and calculated as follows: , In the formula, It is a reference value for non-uniform polarized light reflection. Polarization phase offset matrix Laplace transform, It is a frequency factor. It is a sinusoidal integral term used to calculate the phase of polarized light reflection at different frequencies. The degree of oscillation below.

[0011] Preferably, the quantized anisotropic texture offset reference value and polarized light reflection non-uniformity reference value are input into a pre-learned deep learning model, and the microcrack risk coefficient is generated by the deep learning model. The microcrack risk coefficient is then used to intelligently assess the bottle mouth defect status.

[0012] Preferably, the microcrack risk coefficient generated when intelligently assessing the bottle mouth defect status using a pre-learned deep learning model is compared with a pre-set microcrack risk coefficient reference threshold to classify the current detected empty bottle mouth defect status. The classification steps are as follows: If the microcrack risk coefficient is greater than the reference threshold for the microcrack risk coefficient, the mouth of the currently detected empty bottle is classified as having a microcrack defect; if the microcrack risk coefficient is less than or equal to the reference threshold for the microcrack risk coefficient, the mouth of the currently detected empty bottle is classified as not having a microcrack defect.

[0013] Preferably, when the deep learning model evaluation results show that there are microcracks at the bottle opening, the image resolution is dynamically optimized according to the crack type, and the lens focal length is adaptively adjusted based on the resolution adjustment range. The specific steps are as follows: When a deep learning model detects a microcrack at the bottle opening, it first determines the microcrack risk coefficient. To adjust the image resolution and ensure that the details of the cracks can be accurately captured, a resolution optimization function is used to calculate the required target resolution, as shown in the following expression: , In the formula, This is the adjusted resolution. It is the lowest detection resolution. It is the highest supported detection resolution. The preset microcrack risk reference value, It is a dynamically adjusted index; Since adjusting the resolution affects the spatial resolution of the image, the lens focal length needs to be adjusted simultaneously to maintain optimal sharpness. The focal length adjustment amount is calculated based on the resolution adjustment amount and the estimated magnification of the bottle opening area, as shown in the following expression: , In the formula, It is the focal length adjustment amount. It's the default resolution. It is the initial focal length. It is the focal length increment adjustment factor. It is the focal length compensation factor. This is the change in resolution, calculated using the following formula: ; The adjusted resolution and focal length adjustment amount After calculation, the autofocus algorithm is executed to adjust the lens to the optimal focal length. The calculation expression is as follows: , In the formula, This is the adjusted focal length; Image quality is optimized using a sharpness evaluation function, with the following optimization formula: , In the formula, This is the current focal length. The image sharpness rating below, This is the current focal length. Pixel coordinates grayscale value at that location It is the gradient information of the image. It is an exponential decay factor. It is the natural base. It is the focal length deviation penalty coefficient.

[0014] A preferred visual inspection system for sorting empty bottles of cleaning agents includes an optical imaging and data acquisition module, an image preprocessing and standardization module, a crack feature extraction module, an intelligent defect analysis and evaluation module, and an adaptive imaging optimization module. The optical imaging and data acquisition module first uses a preset light source to uniformly illuminate the empty bottles to be inspected on the conveyor belt, and then uses an industrial camera to acquire real-time images of the empty bottles to be inspected. The image preprocessing and standardization module, under the illumination of the light source, after the visual inspection system acquires the image of the bottle mouth of the empty bottle, preprocesses the acquired raw image data, and then forms a data set of the processed standardized image data to prepare data for subsequent crack detection. The crack feature extraction module uses a feature extraction algorithm to filter out key features reflecting the presence of microcracks at the bottle opening from the preprocessed image data; The intelligent defect analysis and evaluation module further analyzes and processes the selected key features within the detection window, quantifies the bottle mouth defect status, and inputs the quantified key feature data into a pre-trained deep learning model to intelligently evaluate the bottle mouth defect status through the deep learning model. The adaptive imaging optimization module dynamically optimizes the image resolution based on the crack type when the deep learning model evaluation results indicate the presence of microcracks at the bottle opening. This allows for precise capture of crack details. Simultaneously, the lens focal length is adaptively adjusted based on the resolution adjustment range to achieve precise focusing and ensure clear presentation of crack features, providing high-quality visual data for subsequent detection and decision-making.

[0015] The technical effects and advantages provided by the present invention in the above technical solution are as follows: This invention effectively solves the detection error problem caused by the mismatch between resolution adjustment and focal length in the bottle mouth crack detection process of existing technologies through adaptive vision inspection and intelligent focal length control. By using a reference light source for illumination and real-time acquisition by an industrial camera, the uniformity and high-quality imaging of the bottle mouth image are ensured. Subsequently, image preprocessing and standardized dataset construction are used to improve data consistency, laying a solid foundation for crack detection. This invention employs a combination of feature extraction and deep learning to accurately identify and quantify bottle mouth cracks, significantly improving detection accuracy and stability. Simultaneously, this invention innovatively adjusts the image resolution dynamically according to the crack type and adaptively controls the lens focal length, ensuring clear imaging at high resolution and avoiding blurring or loss of crack details caused by focal length mismatch. Ultimately, this invention not only improves the accuracy and reliability of bottle mouth crack detection and reduces false and false detection rates, but also optimizes the real-time performance of the vision system, enabling the detection system to adapt to high-speed production line environments and providing an efficient, stable, and intelligent solution for the sorting and quality control of cleaning agent filling bottles. Attached Figure Description

[0016] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this invention. For those skilled in the art, other drawings can be obtained based on these drawings.

[0017] Figure 1 This is a flowchart of the visual inspection method for sorting empty bottles of cleaning agents according to the present invention.

[0018] Figure 2 This is a schematic diagram of the modules of the visual inspection system for sorting empty bottles of cleaning agents according to the present invention. Detailed Implementation

[0019] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, they are provided so that the description of this disclosure will be more complete and fully convey the concept of the exemplary embodiments to those skilled in the art.

[0020] This invention provides, for example Figure 1 The visual inspection method for sorting empty bottles of cleaning agents, as shown, includes the following steps: First, the empty bottles to be inspected on the conveyor belt are uniformly illuminated using a preset light source, and real-time images of the empty bottles to be inspected are acquired using an industrial camera. The specific steps for uniformly illuminating the empty bottles to be inspected on the conveyor belt using a preset light source and acquiring real-time images of the empty bottles using an industrial camera are as follows: First, when the empty bottle to be tested enters the testing area on the conveyor belt, a preset standardized light source (such as a ring light source, coaxial light source, or oblique light source) is triggered to uniformly illuminate the bottle mouth area, ensuring clear imaging and moderate contrast, and reducing ambient light interference and reflection effects. The type and intensity of the light source need to be optimized based on the bottle's material (transparent, translucent, or opaque) and crack characteristics to maximize the highlighting of details on the bottle opening surface; Meanwhile, under the control of precise trigger signals, industrial cameras (CCD or CMOS sensors) perform high-speed real-time image acquisition of empty bottles passing through the inspection area. The parameters of the industrial camera, such as shutter speed, exposure time, gain, and resolution, need to be preset to adapt to the operating speed of the production line, ensuring the acquisition of high-quality images without ghosting, overexposure, or underexposure, providing accurate raw data for subsequent image processing and crack detection.

[0021] A reference light source ensures stable and comparable brightness and contrast for the bottle opening and its defect features in the image, providing a solid data foundation for subsequent image processing and crack detection. Fluctuations in light source intensity lead to unstable image brightness; uneven light distribution results in significant brightness differences between different areas of the same bottle opening, increasing the difficulty of algorithm recognition. By pre-calibrating and fixing the light source intensity, the impact of environmental noise can be reduced, allowing deep learning models to operate under consistent imaging conditions and improving detection reliability.

[0022] Under illumination, the vision inspection system acquires an image of the bottle opening of an empty bottle, preprocesses the acquired raw image data, and then forms a dataset from the processed standardized image data to prepare data for subsequent crack detection. Under uniform illumination, the vision inspection system acquires raw images of the bottle opening using an industrial camera. However, due to the complexity of the production environment, the raw images may be affected by noise interference, uneven illumination, cluttered backgrounds, or lens distortion, thus requiring image preprocessing. First, the system performs denoising (such as Gaussian filtering and median filtering) to reduce random noise in the image and improve the clarity of crack edges. Second, brightness equalization (such as histogram equalization) and contrast enhancement make the bottle opening area in the image more prominent, preventing crack detection failure due to uneven local illumination. Furthermore, if camera angle or lens distortion causes image deformation, geometric correction is required to ensure the bottle opening contour presents a standard shape. After these preprocessing operations, the system stores the processed, standardized image data into a dataset, ensuring that subsequent crack detection algorithms can run in a consistent, high-quality data environment, improving detection accuracy and stability.

[0023] Preprocessing can significantly improve image quality and reduce interference from noise, astigmatism, and reflection, thus laying a good foundation for subsequent feature extraction and deep learning analysis.

[0024] In real-world production environments, images of bottle openings captured by industrial cameras are often affected by factors such as reflections, dust, or the curvature of the bottle surface. Without preprocessing, defects and noise in the images may be indistinguishable, leading to false positives or false negatives. Standardization processing also makes the distribution of images on the same production line more consistent, enhancing the adaptability of subsequent algorithms.

[0025] Key features reflecting the presence of microcracks at the bottle opening are selected from the preprocessed image data using feature extraction algorithms (such as edge detection, texture analysis, or deep learning-based convolutional feature extraction). The selected key features are further analyzed and processed within the detection window to quantify the bottle mouth defect status. The quantified key feature data is then input into a pre-trained deep learning model to intelligently evaluate the bottle mouth defect status. The key features reflecting the presence of microcracks at the bottle opening are selected from the preprocessed image data using a feature extraction algorithm. The extracted features include the changes in texture direction and polarized light reflection in the bottle opening area. The changes in texture direction and polarized light reflection in the bottle opening area are analyzed under the detection window to generate anisotropic texture offset reference values ​​and non-uniform polarized light reflection reference values, respectively. The defect status of the bottle opening is quantified by the anisotropic texture offset reference values ​​and non-uniform polarized light reflection reference values.

[0026] Localized shifts in texture orientation at the bottle neck area typically indicate the presence of microcracks. Cracks disrupt the original uniform structure of the bottle neck, causing abnormal changes in the material's surface texture. Normally, the texture of a bottle neck is arranged in a regular linear pattern formed during manufacturing, or exhibits a uniform scattering distribution on a smooth surface. However, when microcracks appear at the bottle neck, localized stress concentration and material fracture lead to abrupt changes in the surface texture, manifesting as shifts, misalignments, or irregular diffusion of the texture orientation at the fracture point. Furthermore, the presence of cracks alters the diffuse reflection pattern of light on the bottle neck surface, allowing texture extraction algorithms (such as Gabor filtering and LBP) in the visual inspection system to detect abnormal texture orientation distributions and identify potential cracks. This is particularly noticeable in highly transparent or semi-transparent bottle necks, where changes in refractive index at the crack further exacerbate the texture orientation shift, especially during polarized light detection or multi-angle imaging. Therefore, when an abnormal shift in the texture direction of the bottle mouth area is detected in a local area, it can be reasonably inferred that there are microcracks in that area. Furthermore, other features (such as grayscale changes, gradient enhancement, scattering anomalies, etc.) can be combined for a comprehensive judgment to improve the accuracy of detection.

[0027] The specific steps for analyzing the texture direction changes in the bottle mouth area under the detection window to generate anisotropic texture offset reference values ​​are as follows: First, within the detection window, the local texture direction of the bottle mouth area is extracted to capture the texture shift caused by microcracks, using a gradient mapping matrix. The gradient mapping matrix is ​​calculated based on the second-order partial derivative to quantize the changes in texture direction. The calculation expression is as follows: , In the formula, It is the grayscale value of the image, representing the pixel coordinates of the image. The grayscale value at that location, i.e., the brightness information of the pixel. Representative image in The first-order partial derivative in the direction, i.e., the brightness change along the horizontal direction. Representative image in The first-order partial derivative in the direction, i.e., the brightness change along the vertical direction. Yes The second-order partial derivative in the direction measures the rate of change of brightness in an image along the horizontal direction. Yes The second-order partial derivative in the direction measures the rate of change of brightness in an image along the vertical direction. It is a mixed second-order partial derivative, which measures the situation where the image changes simultaneously in two directions (i.e., the trend of gradient change). It is a combination of second derivatives used to comprehensively measure the curvature changes in a local region. It is the gradient mapping matrix, representing the coordinates of the image. The gradient mapping value at that point is used to measure the degree of local gradient anomaly at that pixel. The gradient mapping matrix This can highlight texture anomalies in cracked areas and provide basic data for subsequent calculation of the anisotropic texture offset index. The presence of microcracks causes abrupt changes in the local values ​​of this matrix, resulting in abrupt changes in texture direction, while in crack-free areas, the distribution of this matrix is ​​relatively smooth.

[0028] In obtaining the gradient mapping matrix Next, the anisotropic texture offset reference value is calculated to measure the degree of texture direction change in the local area of ​​the bottle opening. The calculation expression is as follows: , In the formula, It is an anisotropic texture offset reference value. It is the total number of rows in the detection area. It is the total number of columns in the detection area. It is a spatial weighting factor. It calculates the gradient direction offset angle.

[0029] Finally, the anisotropic texture offset reference value The larger the value, the more drastic the change in texture direction in the bottle opening area, indicating a significant shift in texture direction in this area, which may suggest the presence of microcracks at the bottle opening; if the anisotropic texture shift reference value... A smaller value indicates that the texture direction remains stable within a local area, suggesting that there are no cracks at the bottle opening. This calculation method can accurately capture texture changes caused by microcracks and is applicable to the detection of bottle opening cracks in various materials (such as glass and PET plastic) and under different lighting conditions.

[0030] The larger the anisotropic texture offset reference value generated after analyzing the texture direction changes in the bottle mouth area under the detection window, the more likely a microcrack exists in the detected bottle mouth; conversely, a smaller value indicates the absence of microcracks. This is because the normal texture of the bottle mouth typically exhibits a regular arrangement or uniform texture characteristics during the manufacturing process. However, when microcracks appear, the material structure in the local area is disrupted, leading to abrupt changes, distortions, or misalignments in the texture direction. The anisotropic texture offset reference value quantifies this abnormal change by analyzing the degree of local texture direction distribution shift in the bottle mouth area. The more obvious the crack, the greater the degree of local texture shift, and the higher the corresponding anisotropic texture offset reference value. Furthermore, the presence of cracks may cause changes in the optical scattering mode, making the texture direction exhibit a more pronounced shift trend under multispectral imaging, polarized light illumination, or oblique light sources.

[0031] Non-uniform changes in polarized light reflection can indicate the presence of microcracks at the bottle opening. This is based on the polarization characteristics of light and the influence of the material's surface microstructure on light. Under normal conditions, when light is reflected from a uniform, defect-free bottle opening surface, the polarization direction remains relatively consistent, and the reflection intensity exhibits a regular distribution. However, when microcracks exist at the bottle opening, the microstructure of that area changes. The crack edges cause scattering, birefringence, or phase shifts in the light during incident and reflection, thus altering the polarization direction and intensity distribution of the reflected light. This change manifests in polarized light imaging systems as localized brightness non-uniformity, abnormal reflection angles, or abrupt changes in polarization state. Especially on transparent or translucent bottle openings, the presence of cracks disrupts the optical homogeneity of the material, causing significant differences in the transmission and reflection characteristics of polarized light in different areas. Therefore, by observing the non-uniform changes in polarized light reflection, microcracks that are difficult to detect with the naked eye can be effectively detected, improving the sensitivity and accuracy of bottle opening crack detection.

[0032] The specific steps for analyzing changes in polarized light reflection within a detection window to generate a non-uniform reference value for polarized light reflection are as follows: An industrial camera, paired with a polarized light source, illuminates the bottle opening area, capturing reflection images at different polarization angles. Since minute changes in the bottle opening surface structure alter the polarization state of the light, a mathematical model is used to model the polarization and reflection characteristics of each pixel. To quantify these changes, a Local Polarization Phase Shift Matrix is ​​introduced. The partial polarization phase offset matrix is ​​used to calculate the polarization phase offset in different regions of the bottle opening. The calculation expression is as follows: , In the formula, This is a local polarization phase shift matrix, used to describe the phase change of polarized light reflection from the bottle opening surface at different polarization angles. , , and These are the polarization angles of industrial cameras. , , and Below, pixel coordinates The intensity of reflected light at that location It is to prevent tiny positive numbers with a denominator of zero. It is a complex phase angle calculation, which calculates the phase angle of the complex ratio formed by the numerator and denominator, that is, solves the angle of the ratio in the complex plane; The results of the above steps This reflects the differences in reflection intensity of different pixels at multiple polarization angles and converts it into phase information. If the bottle opening surface is uniform and crack-free, The phase shift should be evenly distributed in space; if there are microcracks at the bottle opening, the phase shift value will show abrupt changes or irregular distribution in the crack area, indicating that the polarization reflection of light has changed abnormally.

[0033] In obtaining the local polarization phase offset matrix Subsequently, a global polarization reflection non-uniformity reference value is calculated to measure the amplitude of polarization reflection variation across the entire bottle mouth region, using a double divergence integral transform. To enhance the non-uniformity of reflection in the crack region, and to define a reference value for the non-uniformity of polarized light reflection, the calculation expression is as follows: , In the formula, It is a reference value for non-uniform polarized light reflection. Polarization phase offset matrix The Laplace transform of the image was used to capture the spatial second-order rate of change of polarized light reflection, highlighting the crack edge region. It is a frequency factor, representing the oscillation frequency factor of the polarized light reflection phase, used to analyze the variation of polarized light at different spatial scales. It is a sinusoidal integral term used to calculate the phase of polarized light reflection at different frequencies. The degree of oscillation below.

[0034] This step comprehensively considers both local polarization phase abrupt changes (through Laplace transform) and global polarization distribution anomalies (through integration), enabling a more accurate quantification of the non-uniformity of polarized light reflection in the crack region. If there is no crack at the bottle opening... The change was stable, leading to The value is relatively small; if there are micro-cracks at the bottle opening, The changes are drastic, and the integral oscillations increase, making The value has increased significantly.

[0035] A larger non-uniformity reference value for polarized light reflection generated after analyzing the changes in polarized light reflection within the detection window generally indicates the presence of microcracks at the bottle opening; conversely, a smaller value may indicate that the bottle opening is intact. The principle is that the presence of microcracks disrupts the uniform reflection characteristics of polarized light on the bottle opening surface, causing abnormal changes in the optical reflection direction and intensity in localized areas. During the detection process, the system analyzes the polarized light reflection distribution in real time within the monitoring window, generating a non-uniformity reference value for polarized light reflection by calculating parameters such as reflection angle shift, reflected light intensity fluctuation, and polarization attenuation. A larger reference value indicates significant non-uniformity in the polarized light reflection on the bottle opening surface, possibly caused by enhanced scattering due to cracks, birefringence effects, or microstructural disturbances. Conversely, a smaller non-uniformity reference value indicates good optical uniformity on the bottle opening surface, with no detected abnormal polarization characteristic changes, suggesting the absence of obvious cracks at the bottle opening.

[0036] The quantized anisotropic texture offset reference value and polarized light reflection non-uniformity reference value are input into a pre-learned deep learning model. The deep learning model generates a microcrack risk coefficient, and the microcrack risk coefficient is used to intelligently assess the bottle mouth defect status.

[0037] Pre-learned machine learning models refer to deep learning or traditional machine learning models that have been trained and optimized on a large amount of known data and possess a certain generalization ability, used to identify and assess the risk of bottle mouth cracks. In the field of industrial visual inspection, these models are typically based on deep neural networks (DNNs), convolutional neural networks (CNNs), variational autoencoders (VAEs), random forests (RFs), support vector machines (SVMs), or ensemble learning methods. By learning from a large number of bottle mouth crack samples, they automatically extract crack features and build classification, regression, or anomaly detection models. Specifically, in crack detection scenarios, deep learning models need to be input with a large number of labeled crack images or feature data (such as anisotropic texture offset reference values, non-uniform polarized light reflection reference values, etc.) during the training phase, and the weight parameters are optimized through a loss function to enable them to accurately distinguish between "normal bottle mouths" and "bottle mouths with cracks." These models are repeatedly trained to eventually form an algorithmic framework with automatic learning capabilities, enabling them to intelligently analyze new bottle mouth data and assess crack status during the detection process.

[0038] In practical applications, pre-trained deep learning models can predict the risk coefficient of microcracks at the bottle opening by inputting quantized anisotropic texture offset reference values ​​and polarized light reflection non-uniformity reference values. This risk coefficient is typically a normalized value (e.g., 01 or 0100) representing the severity of the crack; a higher value indicates a greater likelihood of a crack. The model can combine different detection metrics (such as higher-order gradients, light scattering features, and texture changes) through multi-layer feature fusion to comprehensively assess the crack status. For example, CNNs can automatically extract spatial features from bottle opening images, while LSTM (Long Short-Term Memory) networks can be used to analyze time-series data (such as detection trends under changing lighting conditions), ultimately forming a highly accurate crack assessment system. Based on this risk coefficient, the system can further determine whether to adjust the image resolution or focal length, or whether to remove the bottle, ensuring the entire detection process is intelligent and efficient.

[0039] The deep learning model is not limited here, but it can achieve the function of offsetting anisotropic texture reference values. Non-uniform reference value for polarized light reflection A comprehensive analysis is conducted to generate a microcrack risk coefficient. Any deep learning model can be used. To implement the technical solution of this invention, this invention provides a specific implementation method. Microcrack risk factor The formula for generating the formula is as follows: , In the formula, , These are the anisotropic texture offset reference values. Non-uniform reference value for polarized light reflection The preset proportional coefficient, , All are greater than 0.

[0040] Preset proportional coefficient ( , The formula is used to balance and adjust the anisotropic texture offset reference value. Non-uniform reference value for polarized light reflection In microcrack risk coefficient Relative weights in the calculation. Different detection environments, material properties, or crack types can cause anisotropic texture shifts in the reference value. Non-uniform reference value for polarized light reflection The degree of their impact on crack risk varies, therefore it is necessary to adjust their influence on the final microcrack risk coefficient by setting a preset proportional coefficient. . contributions.

[0041] Specifically, , The value can be set based on experimental data, statistical analysis, or deep learning model training results to ensure that the calculated microcrack risk coefficient is accurate. It can accurately reflect the risk of bottle neck cracks. For example, if the polarization reflection characteristics of a certain type of bottle neck material under illumination are more sensitive to crack detection, it can be assigned... Higher weights allow for anisotropic texture offset reference values. Non-uniform reference value for polarized light reflection The contribution is greater if the crack mainly affects the surface texture of the bottle neck; conversely, if the crack mainly affects the surface texture of the bottle neck, it can increase the... The value of the anisotropic texture offset reference value. Non-uniform reference value for polarized light reflection It plays a dominant role in calculations. Furthermore, the logarithmic function in the denominator... This is used for normalization calculations to prevent excessively large values ​​and improve the stability and robustness of the calculations. Therefore, the purpose of setting a preset scaling factor is to optimize detection accuracy and reduce the risk factor of microcracks. The calculation adapts to different testing scenarios and material properties to ensure the accuracy and reliability of crack detection.

[0042] As can be seen from the microcrack risk coefficient, the larger the anisotropic texture offset reference value generated after analyzing the texture direction change in the bottle mouth area under the detection window, and the larger the non-uniformity reference value of polarized light reflection generated after analyzing the polarized light reflection change under the detection window, the larger the microcrack risk coefficient generated when intelligently evaluating the bottle mouth defect state through the pre-learned deep learning model, indicating that the probability of microcracks existing at the bottle mouth of the currently detected empty bottle is greater. Conversely, the probability of microcracks existing at the bottle mouth of the currently detected empty bottle is smaller.

[0043] The microcrack risk coefficient generated when intelligently assessing the bottle neck defect status using a pre-learned deep learning model is compared with a pre-set microcrack risk coefficient reference threshold to classify the current detected empty bottle neck defect status. The classification steps are as follows: If the microcrack risk coefficient is greater than the reference threshold for the microcrack risk coefficient, the mouth of the currently detected empty bottle is classified as having a microcrack defect; if the microcrack risk coefficient is less than or equal to the reference threshold for the microcrack risk coefficient, the mouth of the currently detected empty bottle is classified as not having a microcrack defect.

[0044] When the deep learning model evaluation results show that there are microcracks at the bottle opening, the image resolution is dynamically optimized according to the crack type to accurately capture crack details. At the same time, the lens focal length is adaptively adjusted based on the resolution adjustment range to achieve precise focusing and ensure that crack features are clearly presented, providing high-quality visual data for subsequent detection and decision-making. When the deep learning model's evaluation results indicate the presence of microcracks at the bottle opening, the system needs to further optimize detection accuracy to ensure accurate identification of the crack's type, size, and severity. Therefore, the system dynamically optimizes the image resolution based on the crack type to precisely capture crack details. Different types of cracks (such as capillary cracks, radial cracks, and through cracks) appear differently in images. Some microcracks may only be clearly visible in high-resolution mode, while larger cracks can be detected quickly at lower resolutions. By adjusting the resolution, the system can optimize the use of computational resources and improve detection efficiency while maintaining detection accuracy. For example, if the crack is initially detected as a suspected capillary crack, the system can switch to an ultra-high resolution mode (e.g., 50 megapixels) to obtain clearer crack boundaries, while for wider cracks, a moderate resolution (e.g., 12-20 megapixels) can be maintained to improve processing speed.

[0045] Meanwhile, to avoid image blurring caused by resolution adjustments, the system adaptively adjusts the lens focal length based on the resolution adjustment range to achieve precise focusing. Precise focal length matching is crucial for crack detection. If the focal length is not adjusted synchronously, the image in high-resolution mode may show blurred crack edges due to focus shift, affecting detection accuracy. Therefore, the system dynamically adjusts the lens focal length according to the focal length-resolution mapping relationship, ensuring the target crack area is always within the optimal sharpness range. For example, when the resolution increases, the focal length may need to be slightly shortened to ensure clear details at the crack edges, while when the resolution decreases, the focal length can be appropriately lengthened to obtain a wider field of view coverage.

[0046] The ultimate goal of this optimization process is to provide high-quality visual data for subsequent inspection and decision-making, ensuring the accuracy and stability of crack detection results and improving product quality control. Precise crack feature extraction not only facilitates automated quality assessment but also provides data support for production systems, such as analyzing potential causes of cracks (e.g., mold wear, bottle material defects), thereby optimizing production processes. Furthermore, this technology reduces false positives and missed detections, improves the inspection efficiency of production lines, reduces the risk of defective products due to cracks entering the market, and further enhances brand reputation and user safety.

[0047] When the deep learning model evaluation results indicate the presence of microcracks at the bottle opening, the image resolution is dynamically optimized based on the crack type. Simultaneously, the lens focal length is adaptively adjusted based on the resolution adjustment range. The specific steps are as follows: When a deep learning model detects a microcrack at the bottle opening, it first determines the microcrack risk coefficient. To adjust the image resolution and ensure that the details of the cracks can be accurately captured, a resolution optimization function is used to calculate the required target resolution, as shown in the following expression: , In the formula, This is the adjusted resolution. It is the lowest detection resolution. It is the highest supported detection resolution. The preset microcrack risk reference value, It is a dynamically adjusted index that determines the degree of nonlinearity in resolution changes; This step ensures that: when far below At that time, the resolution was close to This reduces the computational burden.

[0048] when Approaching Over time, the resolution is gradually improved to meet the needs of more refined crack detection.

[0049] when Much higher At that time, the system approached It provides the highest resolution for optimal crack detail.

[0050] This index adjustment mechanism enables the system to save computing resources when the crack risk is low, while automatically increasing the resolution and detection accuracy when the risk is high, thus ensuring the accuracy of the detection results.

[0051] Since adjusting the resolution affects the spatial resolution of the image, the lens focal length needs to be adjusted simultaneously to maintain optimal sharpness. The focal length adjustment amount is calculated based on the resolution adjustment amount and the estimated magnification of the bottle opening area, as shown in the following expression: , In the formula, It is the focal length adjustment amount. It's the default resolution. This is the initial focal length, i.e., the default resolution. The optical focal length below, It is a focal length increment adjustment factor that controls the non-linear growth of the focal length, ensuring that the increase in focal length is not too drastic when the resolution is improved. This is a focal length compensation factor (e.g., 0.65), used to control the stability of the focal length and prevent frequent changes from causing instability in the focal plane. This is the change in resolution, calculated using the following formula: This indicates an increment or decrease relative to the reference resolution; This step ensures that the focal length increases appropriately with increasing resolution, allowing the crack details in the bottle opening area to remain clearly visible even at higher resolutions. Meanwhile, Controlling the non-linearity of focal length adjustment prevents the system from frequently adjusting the focal length due to small changes in resolution, which could affect imaging stability.

[0052] The adjusted resolution and focal length adjustment amount After calculation, the autofocus algorithm is executed to adjust the lens to the optimal focal length. The calculation expression is as follows: , In the formula, It is the adjusted focal length, i.e., the optimal focal length; Image quality is optimized using a sharpness evaluation function, with the following optimization formula: , In the formula, This is the current focal length. The image sharpness rating below, This is the current focal length. Pixel coordinates grayscale value at that location It refers to the gradient information of the image; the higher the gradient value, the clearer the image. It is the exponential decay factor, representing the current focal length. Offset from adjusted focal length At that time, the exponential decay of image sharpness, It is the natural base. It is the focal length deviation penalty coefficient, which controls the exponential decay rate when the focal length deviates from the optimal value.

[0053] After adjusting the focal length, the system will iteratively optimize to find the optimal focal length. To maximize clarity score Once the focus adjustment is complete, the system locks the current parameters and reacquires high-resolution images to ensure that crack features are clearly presented within the detection window, providing high-quality visual data for subsequent quality assessment and decision-making.

[0054] This invention effectively solves the detection error problem caused by the mismatch between resolution adjustment and focal length in the bottle mouth crack detection process of existing technologies through adaptive vision inspection and intelligent focal length control. By using a reference light source for illumination and real-time acquisition by an industrial camera, the uniformity and high-quality imaging of the bottle mouth image are ensured. Subsequently, image preprocessing and standardized dataset construction are used to improve data consistency, laying a solid foundation for crack detection. This invention employs a combination of feature extraction and deep learning to accurately identify and quantify bottle mouth cracks, significantly improving detection accuracy and stability. Simultaneously, this invention innovatively adjusts the image resolution dynamically according to the crack type and adaptively controls the lens focal length, ensuring clear imaging at high resolution and avoiding blurring or loss of crack details caused by focal length mismatch. Ultimately, this invention not only improves the accuracy and reliability of bottle mouth crack detection and reduces false and false detection rates, but also optimizes the real-time performance of the vision system, enabling the detection system to adapt to high-speed production line environments and providing an efficient, stable, and intelligent solution for the sorting and quality control of cleaning agent filling bottles.

[0055] This invention provides, for example Figure 2 The visual inspection system for sorting empty bottles of cleaning agents shown includes an optical imaging and data acquisition module, an image preprocessing and normalization module, a crack feature extraction module, an intelligent defect analysis and evaluation module, and an adaptive imaging optimization module. The optical imaging and data acquisition module first uses a preset light source to uniformly illuminate the empty bottles to be inspected on the conveyor belt, and then uses an industrial camera to acquire real-time images of the empty bottles to be inspected. The image preprocessing and standardization module, under the illumination of the light source, after the visual inspection system acquires the image of the bottle mouth of the empty bottle, preprocesses the acquired raw image data, and then forms a data set of the processed standardized image data to prepare data for subsequent crack detection. The crack feature extraction module uses a feature extraction algorithm to filter out key features reflecting the presence of microcracks at the bottle opening from the preprocessed image data; The intelligent defect analysis and evaluation module further analyzes and processes the selected key features within the detection window, quantifies the bottle mouth defect status, and inputs the quantified key feature data into a pre-trained deep learning model to intelligently evaluate the bottle mouth defect status through the deep learning model. The adaptive imaging optimization module dynamically optimizes the image resolution based on the crack type when the deep learning model evaluation results indicate the presence of microcracks at the bottle opening. This allows for precise capture of crack details. Simultaneously, the lens focal length is adaptively adjusted based on the resolution adjustment range to achieve precise focusing and ensure clear presentation of crack features, providing high-quality visual data for subsequent detection and decision-making.

[0056] The visual inspection method for sorting empty bottles of cleaning agents provided in this embodiment of the invention is implemented by the aforementioned visual inspection system for sorting empty bottles of cleaning agents. For details of the specific methods and processes of the visual inspection system for sorting empty bottles of cleaning agents, please refer to the embodiments of the aforementioned visual inspection method for sorting empty bottles of cleaning agents, which will not be repeated here.

[0057] The above formulas are all dimensionless calculations. The formulas are derived from software simulations based on a large amount of collected data to obtain the most recent real-world results. The preset parameters in the formulas are set by those skilled in the art according to the actual situation.

[0058] The foregoing has only described certain exemplary embodiments of the present invention by way of illustration. Undoubtedly, those skilled in the art can modify the described embodiments in various ways without departing from the spirit and scope of the present invention. Therefore, the foregoing drawings and descriptions are illustrative in nature and should not be construed as limiting the scope of protection of the claims of the present invention.

[0059] It should be noted that, in this document, the use of relational terms such as "first" and "second" is merely for distinguishing one entity or operation from another, and does not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes the element.

[0060] It should be understood that in the various embodiments of this application, the order of the above-mentioned processes does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0061] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0062] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0063] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0064] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0065] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0066] The foregoing has only described certain exemplary embodiments of the present invention by way of illustration. Undoubtedly, those skilled in the art can modify the described embodiments in various ways without departing from the spirit and scope of the present invention. Therefore, the foregoing drawings and descriptions are illustrative in nature and should not be construed as limiting the scope of protection of the claims of the present invention.

Claims

1. A visual inspection method for sorting empty bottles of cleaning agents, characterized in that, Includes the following steps: First, the empty bottles to be inspected on the conveyor belt are uniformly illuminated using a preset light source, and real-time images of the empty bottles to be inspected are acquired using an industrial camera. Under illumination, the vision inspection system acquires an image of the bottle opening of an empty bottle, preprocesses the acquired raw image data, and then forms a dataset from the processed standardized image data to prepare data for subsequent crack detection. Key features reflecting the presence of microcracks at the bottle opening are selected from the preprocessed image data using feature extraction algorithms. The selected key features are further analyzed and processed within the detection window to quantify the bottle mouth defect status. The quantified key feature data is then input into a pre-trained deep learning model to intelligently evaluate the bottle mouth defect status. When the deep learning model evaluation results show that there are microcracks at the bottle opening, the image resolution is dynamically optimized according to the crack type to accurately capture crack details. At the same time, the lens focal length is adaptively adjusted based on the resolution adjustment range to achieve precise focusing and ensure that crack features are clearly presented, providing high-quality visual data for subsequent detection and decision-making.

2. The visual inspection method for sorting empty bottles of cleaning agents according to claim 1, characterized in that, The specific steps for uniformly illuminating the empty bottles to be inspected on the conveyor belt using a preset light source and acquiring real-time images of the empty bottles using an industrial camera are as follows: First, when the empty bottle to be tested enters the testing area on the conveyor belt, a preset standardized light source is triggered to evenly illuminate the bottle mouth area, ensuring clear imaging and moderate contrast, and reducing ambient light interference and reflection effects. The type and intensity of the light source need to be optimized according to the material of the bottle and the characteristics of the cracks in order to maximize the highlighting of the details on the surface of the bottle mouth; At the same time, the industrial camera, under the control of a precise trigger signal, performs high-speed real-time image acquisition of empty bottles passing through the detection area.

3. The visual inspection method for sorting empty bottles of cleaning agents according to claim 1, characterized in that, The key features reflecting the presence of microcracks at the bottle opening are selected from the preprocessed image data using a feature extraction algorithm. The extracted features include the changes in texture direction and polarized light reflection in the bottle opening area. The changes in texture direction and polarized light reflection in the bottle opening area are analyzed under the detection window to generate anisotropic texture offset reference values ​​and non-uniform polarized light reflection reference values, respectively. The defect status of the bottle opening is quantified by the anisotropic texture offset reference values ​​and non-uniform polarized light reflection reference values.

4. The visual inspection method for sorting empty bottles of cleaning agents according to claim 3, characterized in that, The specific steps for analyzing the texture direction changes in the bottle mouth area under the detection window to generate anisotropic texture offset reference values ​​are as follows: First, within the detection window, the local texture direction of the bottle mouth area is extracted to capture the texture shift caused by microcracks, using a gradient mapping matrix. The gradient mapping matrix is ​​calculated based on the second-order partial derivative to quantize the changes in texture direction. The calculation expression is as follows: ; In the formula, It is the grayscale value of the image, representing the pixel coordinates of the image. The grayscale value at that location, i.e., the brightness information of the pixel. Representative image in The first-order partial derivative in the direction, i.e., the brightness change along the horizontal direction. Representative image in The first-order partial derivative in the direction, i.e., the brightness change along the vertical direction. Yes The second-order partial derivative in the direction measures the rate of change of brightness in an image along the horizontal direction. Yes The second-order partial derivative in the direction measures the rate of change of brightness in an image along the vertical direction. It is a mixed second-order partial derivative, which measures the situation where the image changes simultaneously in two directions. It is a combination of second derivatives used to comprehensively measure the curvature changes in a local region. It is the gradient mapping matrix, representing the coordinates of the image. The gradient mapping value at that point is used to measure the degree of local gradient anomaly at that pixel. In obtaining the gradient mapping matrix Next, the anisotropic texture offset reference value is calculated to measure the degree of texture direction change in the local area of ​​the bottle opening. The calculation expression is as follows: ; In the formula, It is an anisotropic texture offset reference value. It is the total number of rows in the detection area. It is the total number of columns in the detection area. It is a spatial weighting factor. It calculates the gradient direction offset angle.

5. The visual inspection method for sorting empty bottles of cleaning agents according to claim 3, characterized in that, The specific steps for analyzing changes in polarized light reflection within a detection window to generate a non-uniform reference value for polarized light reflection are as follows: An industrial camera, paired with a polarized light source, illuminates the bottle opening area, capturing reflection images at different polarization angles. Since minute changes in the bottle opening surface structure alter the polarization state of light, a mathematical model is performed on the polarization reflection characteristics of each pixel. To quantify these changes, a local polarization phase shift matrix is ​​introduced. This matrix is ​​used to calculate the polarization phase shift in different regions of the bottle opening. The calculation expression is as follows: ; In the formula, It is the local polarization phase shift matrix. , , and These are the polarization angles of industrial cameras. , , and Below, pixel coordinates The intensity of reflected light at that location It is to prevent tiny positive numbers with a denominator of zero. It is a complex phase angle calculation, which calculates the phase angle of the complex ratio formed by the numerator and denominator, that is, solving for the angle of the ratio in the complex plane; In obtaining the local polarization phase offset matrix Next, a global polarization reflection non-uniformity reference value is calculated to measure the amplitude of polarization reflection variation across the entire bottle mouth region. A double divergence integral transform is used to enhance the reflection non-uniformity in the crack region, and the polarization reflection non-uniformity reference value is defined and calculated as follows: ; In the formula, It is a reference value for non-uniform polarized light reflection. Polarization phase offset matrix Laplace transform, It is a frequency factor. It is a sinusoidal integral term used to calculate the phase of polarized light reflection at different frequencies. The degree of oscillation below.

6. The visual inspection method for sorting empty bottles of cleaning agents according to claim 3, characterized in that, The quantized anisotropic texture offset reference value and polarized light reflection non-uniformity reference value are input into a pre-learned deep learning model. The deep learning model generates a microcrack risk coefficient, and the microcrack risk coefficient is used to intelligently assess the bottle mouth defect status.

7. The visual inspection method for sorting empty bottles of cleaning agents according to claim 6, characterized in that, The microcrack risk coefficient generated when intelligently assessing the bottle neck defect status using a pre-learned deep learning model is compared with a pre-set microcrack risk coefficient reference threshold to classify the current detected empty bottle neck defect status. The classification steps are as follows: If the microcrack risk coefficient is greater than the reference threshold for the microcrack risk coefficient, the mouth of the currently detected empty bottle is classified as having a microcrack defect; if the microcrack risk coefficient is less than or equal to the reference threshold for the microcrack risk coefficient, the mouth of the currently detected empty bottle is classified as not having a microcrack defect.

8. The visual inspection method for sorting empty bottles of cleaning agents according to claim 7, characterized in that, When the deep learning model evaluation results indicate the presence of microcracks at the bottle opening, the image resolution is dynamically optimized based on the crack type. Simultaneously, the lens focal length is adaptively adjusted based on the resolution adjustment range. The specific steps are as follows: When a deep learning model detects a microcrack at the bottle opening, it first determines the microcrack risk coefficient. To adjust the image resolution and ensure that the details of the cracks can be accurately captured, a resolution optimization function is used to calculate the required target resolution, as shown in the following expression: ; In the formula, This is the adjusted resolution. It is the lowest detection resolution. It is the highest supported detection resolution. The preset microcrack risk reference value, It is a dynamically adjusted index; Since adjusting the resolution affects the spatial resolution of the image, the lens focal length needs to be adjusted simultaneously to maintain optimal sharpness. The focal length adjustment amount is calculated based on the resolution adjustment amount and the estimated magnification of the bottle opening area, as shown in the following expression: ; In the formula, It is the focal length adjustment amount. It's the default resolution. It is the initial focal length. It is the focal length increment adjustment factor. It is the focal length compensation factor. This is the change in resolution, calculated using the following formula: ; The adjusted resolution and focal length adjustment amount After calculation, the autofocus algorithm is executed to adjust the lens to the optimal focal length. The calculation expression is as follows: ; In the formula, This is the adjusted focal length; Image quality is optimized using a sharpness evaluation function, with the following optimization formula: ; In the formula, This is the current focal length. The image sharpness rating below, This is the current focal length. Pixel coordinates grayscale value at that location It is the gradient information of the image. It is an exponential decay factor. It is the natural base. It is the focal length deviation penalty coefficient.

9. A visual inspection system for sorting empty bottles of cleaning agents, used to implement the visual inspection method for sorting empty bottles of cleaning agents according to any one of claims 1-8, characterized in that, It includes an optical imaging and data acquisition module, an image preprocessing and standardization module, a crack feature extraction module, an intelligent defect analysis and evaluation module, and an adaptive imaging optimization module. The optical imaging and data acquisition module first uses a preset light source to uniformly illuminate the empty bottles to be inspected on the conveyor belt, and then uses an industrial camera to acquire real-time images of the empty bottles to be inspected. The image preprocessing and standardization module, under the illumination of the light source, after the visual inspection system acquires the image of the bottle mouth of the empty bottle, preprocesses the acquired raw image data, and then forms a data set of the processed standardized image data to prepare data for subsequent crack detection. The crack feature extraction module uses a feature extraction algorithm to filter out key features reflecting the presence of microcracks at the bottle opening from the preprocessed image data; The intelligent defect analysis and evaluation module further analyzes and processes the selected key features within the detection window, quantifies the bottle mouth defect status, and inputs the quantified key feature data into a pre-trained deep learning model to intelligently evaluate the bottle mouth defect status through the deep learning model. The adaptive imaging optimization module dynamically optimizes the image resolution based on the crack type when the deep learning model evaluation results indicate the presence of microcracks at the bottle opening. This allows for precise capture of crack details. Simultaneously, the lens focal length is adaptively adjusted based on the resolution adjustment range to achieve precise focusing and ensure clear presentation of crack features, providing high-quality visual data for subsequent detection and decision-making.