Intelligent packaging production line defect detection method and system based on image recognition model
The intelligent packaging production line defect detection method based on image recognition model solves the problems of low detection rate and high false judgment rate of small defects in traditional methods, and realizes efficient and accurate defect detection and production line process optimization, with high adaptability to containers of different shapes and materials.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HUNAN SHUNKAI TECH CO LTD
- Filing Date
- 2025-06-30
- Publication Date
- 2026-07-14
AI Technical Summary
On liquid product packaging production lines, traditional image acquisition methods cannot effectively capture minute defects, especially suspended particles at the 5-10 micrometer level, and are easily affected by reflections from the container surface, resulting in high false positive rates and low detection rates, which cannot meet the quality control requirements of high-end liquid products.
A defect detection method for intelligent packaging production lines based on image recognition models is adopted. By acquiring data on the geometric shape of packaging containers and the characteristics of liquid products, intelligent polarization lighting compensation and dynamic image acquisition are performed to construct a motion image recognition model, extract dynamic target motion vector data, distinguish external contaminants from internal suspended matter, generate defect removal tasks, and optimize the production line process.
It significantly improves the detection rate of particles smaller than 10 micrometers, meeting the quality requirements of high-end liquid products from over 95%, reducing the false judgment rate to below 3%, achieving fully automated operation and high adaptability to the production line, adapting to the high-speed production rhythm, and building a complete closed-loop quality control system.
Smart Images

Figure CN120782735B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of production line defect detection technology, and in particular to a method and system for detecting defects in intelligent packaging production lines based on an image recognition model. Background Technology
[0002] Liquid product packaging production lines typically operate at high speeds, with a single line processing hundreds or even thousands of packaging units per minute. In this high-speed production environment, reflections and refractions on the surface of transparent containers severely interfere with image acquisition quality. Secondly, containers of different shapes and materials exhibit varying degrees of optical distortion. Furthermore, external contaminants such as water droplets and fingerprints on the container surface are often difficult to distinguish from internal suspended matter. Most importantly, tiny suspended matter (especially those below 10 micrometers) is almost invisible under static conditions, and traditional image acquisition methods cannot effectively capture these minute defects. However, traditional methods for detecting defects in liquid products mainly include manual visual inspection and static image acquisition under fixed light sources. These methods have significant limitations in practical applications: manual visual inspection is inefficient and easily influenced by subjective factors, resulting in poor consistency of test results; image acquisition under fixed light sources is easily interfered with by reflections from the container surface, leading to a large number of false positives and a high misjudgment rate; these methods have extremely limited detection capabilities for tiny suspended matter (especially at the 5-10 micrometer level) under static conditions, with a detection rate typically below 85%, far from meeting the quality control requirements of high-end liquid products. Summary of the Invention
[0003] Based on this, the present invention provides a method and system for detecting defects in an intelligent packaging production line based on an image recognition model, in order to solve at least one of the above-mentioned technical problems.
[0004] To achieve the above objectives, a defect detection method for an intelligent packaging production line based on an image recognition model includes the following steps:
[0005] Step S1: Obtain the geometric shape data of the packaging container and the characteristic data of the liquid product; perform surface defect analysis on the empty packaging container based on the geometric shape data of the packaging container to generate the inherent defect area of the container; wherein, the inherent defect area of the container includes the high curvature distortion area and the inherent defect area.
[0006] Step S2: After the empty packaging container completes the liquid product packaging operation, intelligent polarization lighting compensation is performed based on the liquid product characteristic data and the inherent defect area of the container, and the disturbance response time-series image sequence is captured simultaneously; a motion image recognition model is constructed, and the motion image recognition model is used to identify the motion region of the disturbance response time-series image sequence to obtain a time-series motion region segmentation map.
[0007] Step S3: Extract dynamic target motion vector data based on the temporal motion region segmentation map; detect internal and external impurities and defects based on the dynamic target motion vector data to obtain a list of internal product defects;
[0008] Step S4: When the internal defect list data of the product is not empty, generate a defect removal task; execute the corresponding defect product removal control according to the defect removal task, and then perform defect station identification on the production line to achieve defect process optimization in the upstream process of the production line.
[0009] Preferably, the present invention also provides a defect detection system for an intelligent packaging production line based on an image recognition model, which executes the defect detection method for an intelligent packaging production line based on an image recognition model as described above. The defect detection system for an intelligent packaging production line based on an image recognition model includes:
[0010] The packaging container pre-analysis module is used to acquire packaging container geometric data and liquid product characteristic data; based on the packaging container geometric data, it performs surface defect analysis on empty packaging containers to generate inherent defect areas of the container; among which, the inherent defect areas of the container include high curvature distortion areas and inherent defect areas;
[0011] The dynamic image acquisition module is used to perform intelligent polarization illumination compensation based on the liquid product characteristic data and the inherent defect area of the container after the empty packaging container has completed the liquid product packaging operation, and simultaneously capture the disturbance response time-series image sequence; construct a motion image recognition model, and use the motion image recognition model to identify the motion region of the disturbance response time-series image sequence to obtain a time-series motion region segmentation map;
[0012] The defect feature detection module is used to extract dynamic target motion vector data based on the time-series motion region segmentation map; and to detect internal and external impurity defects based on the dynamic target motion vector data to obtain product internal defect list data.
[0013] The production line defect control module generates a defect removal task when the internal defect list data of a product is not empty; it executes the corresponding defective product removal control according to the defect removal task, and then identifies the defective workstations on the production line to achieve defect process optimization in the upstream process of the production line.
[0014] This invention, based on preprocessing analysis of container geometry and liquid properties, enables the system to accurately identify inherent defect areas within the container, effectively eliminating interference factors caused by the container's shape and material, fundamentally reducing the false positive rate. Secondly, the innovative intelligent polarization illumination compensation mechanism overcomes the problems of reflection and refraction on transparent container surfaces, significantly improving image acquisition quality and solving the technical challenge of inaccurate capture under traditional fixed light sources. Furthermore, through the acquisition and analysis of perturbation response time-series image sequences, the system can transform invisible micro-suspended particles under static conditions into detectable dynamic targets, increasing the detection rate of particles smaller than 10 micrometers from below 85% to over 95%, meeting the stringent quality requirements of high-end liquid products. The motion image recognition model in the method effectively distinguishes external contaminants such as water droplets and fingerprints on the container surface from internal suspended particles through dynamic target motion vector data analysis, greatly reducing false positives. The false positive rate is reduced from 15-20% in traditional methods to below 3%. The fully automated operation of the system eliminates the subjectivity and inefficiency of manual visual inspection, adapting to the high-speed production pace of processing thousands of packaging units per minute. Of particular note is that this method establishes a complete closed-loop quality control system, which not only accurately eliminates defective products but also optimizes upstream processes on the production line through defect identification, reducing defects at their source. The method's high adaptability to containers of different shapes and materials allows for flexible switching between different product lines, greatly improving the versatility and economic efficiency of the production line. Therefore, the present invention provides an intelligent packaging production line defect detection method based on an image recognition model. This method accurately identifies high-curvature distortion regions and inherent defect regions through adaptive analysis of container geometry. It dynamically adjusts polarization light field control parameters and vibration excitation frequency by combining liquid property data, achieving intelligent polarization illumination compensation. A dual-stream architecture convolutional neural network is used to process disturbance response time-series image sequences, extracting time-series motion region segmentation maps. Morphological analysis of target motion vector data and depolarization index calculation accurately distinguish between external attachments and internal defects. An innovative target-background velocity pairing analysis is introduced to identify translucent gelatinous materials with a relative fluid velocity ratio stable between 30% and 70%. A defect frequency statistics and Bayesian network model are constructed to achieve systematic defect root cause localization and closed-loop control for process optimization, significantly improving the accuracy and intelligence level of defect detection in the packaging production line. Attached Figure Description
[0015] Figure 1 This is a schematic diagram of the steps in the intelligent packaging production line defect detection method based on image recognition model of the present invention;
[0016] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0017] The technical method of the present invention will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.
[0018] Furthermore, the accompanying drawings are merely illustrative of the invention and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor methods and / or microcontroller methods.
[0019] It should be understood that although the terms "first," "second," etc., may be used herein to describe various units, these units should not be limited by these terms. These terms are used merely to distinguish one unit from another. For example, without departing from the scope of the exemplary embodiments, a first unit may be referred to as a second unit, and similarly, a second unit may be referred to as a first unit. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.
[0020] To achieve the above objectives, please refer to Figure 1 This invention provides a defect detection method for intelligent packaging production lines based on image recognition models, comprising the following steps:
[0021] Step S1: Obtain the geometric shape data of the packaging container and the characteristic data of the liquid product; perform surface defect analysis on the empty packaging container based on the geometric shape data of the packaging container to generate the inherent defect area of the container; wherein, the inherent defect area of the container includes the high curvature distortion area and the inherent defect area.
[0022] Step S2: After the empty packaging container completes the liquid product packaging operation, intelligent polarization lighting compensation is performed based on the liquid product characteristic data and the inherent defect area of the container, and the disturbance response time-series image sequence is captured simultaneously; a motion image recognition model is constructed, and the motion image recognition model is used to identify the motion region of the disturbance response time-series image sequence to obtain a time-series motion region segmentation map.
[0023] Step S3: Extract dynamic target motion vector data based on the temporal motion region segmentation map; detect internal and external impurities and defects based on the dynamic target motion vector data to obtain a list of internal product defects;
[0024] Step S4: When the internal defect list data of the product is not empty, generate a defect removal task; execute the corresponding defect product removal control according to the defect removal task, and then perform defect station identification on the production line to achieve defect process optimization in the upstream process of the production line.
[0025] In this embodiment of the invention, the defect detection method for intelligent packaging production lines based on image recognition models includes the following steps:
[0026] Step S1: Obtain the geometric shape data of the packaging container and the characteristic data of the liquid product; perform surface defect analysis on the empty packaging container based on the geometric shape data of the packaging container to generate the inherent defect area of the container; wherein, the inherent defect area of the container includes the high curvature distortion area and the inherent defect area.
[0027] In this embodiment of the invention, the system acquires geometric shape data of the packaging container and liquid product characteristic data through a barcode scanner and a sensor array. The geometric shape data includes information such as the container's outer contour coordinates, material type, and wall thickness distribution, while the liquid characteristic data covers physical properties such as viscosity, density, and transmittance coefficient. Based on the angular change rate and curvature characteristics of the contour points in the geometric shape data, the system automatically classifies and identifies circular, square, and irregularly shaped containers, and sets radial scanning mode, corner point encryption scanning mode, and adaptive path scanning mode respectively. The 3D structured light scanner is equipped with a 650-nanometer red laser projector and a 12-megapixel sensor, and performs high-precision shape scanning of the empty packaging container according to the adaptive scanning strategy, achieving a scanning accuracy of 0.1 millimeters, generating 3D point cloud data containing spatial coordinates and reflection intensity information. The system employs a spline surface reconstruction algorithm based on the least squares method to fit the point cloud data to the surface, calculates the rate of change of container wall thickness, and identifies high curvature distortion regions with a wall thickness change rate exceeding 5% or a curvature radius of less than 20 mm. Simultaneously, it identifies inherent defect regions such as depressions, damage, and label occlusion through depth thresholding, edge detection algorithms, and reflection intensity difference analysis. Finally, it generates complete data on the inherent defect region of the container, including both high curvature distortion regions and inherent defect regions.
[0028] Step S2: After the empty packaging container completes the liquid product packaging operation, intelligent polarization lighting compensation is performed based on the liquid product characteristic data and the inherent defect area of the container, and the disturbance response time-series image sequence is captured simultaneously; a motion image recognition model is constructed, and the motion image recognition model is used to identify the motion region of the disturbance response time-series image sequence to obtain a time-series motion region segmentation map.
[0029] In this embodiment of the invention, after the liquid product packaging process is completed, the system queries the liquid physical property data and container physical property data according to the product batch number and container specification identifier, respectively, to establish a database containing complete parameters such as viscosity value, density value, transmittance coefficient, material type, wall thickness distribution, and surface roughness. Based on the liquid viscosity value, a threshold judgment is performed. When the viscosity is less than 100 mPa·s, a high-frequency excitation configuration of 75 Hz and 0.2 mm is generated; otherwise, a cyclotron excitation configuration of 15 Hz and 1.0 mm is generated. The excitation frequency is dynamically optimized by calculating the liquid inertial damping ratio, forming a multi-frequency superposition vibration excitation frequency combination. The system extracts the optimal polarization angle based on the container material type, combines it with the surface roughness level to generate a scattering suppression light source angle matrix, calculates the light intensity gain coefficient of the thickest region of the container wall, and generates compensated structured light intensity data and dynamic exposure time parameters. A light source array composed of 120 light-emitting diodes executes an adaptive polarization illumination scheme, eight piezoelectric actuators generate controlled liquid disturbances, and a high-speed camera continuously captures the disturbance response time-series image sequence at a rate of 4,000 frames per second for 250 milliseconds. The motion image recognition model employs a convolutional neural network with an encoder-decoder architecture, trained on a sample database containing 100,000 labeled images. It identifies motion regions in time-series image sequences of perturbation response and generates time-series motion region segmentation maps.
[0030] Step S3: Extract dynamic target motion vector data based on the temporal motion region segmentation map; detect internal and external impurities and defects based on the dynamic target motion vector data to obtain a list of internal product defects;
[0031] In this embodiment of the invention, the system performs pixel-level temporal median filtering on the first twenty frames of the temporal motion region segmentation map to generate a dynamically stable background reference frame. A binarized dynamic pixel map is extracted by subtracting the pixel-level grayscale values of two consecutive frames and using an absolute change greater than twenty as a threshold. Connected pixels with a spatial distance of less than five pixels are clustered into eight connected components to obtain a dynamic target pixel set. Based on the dynamically stable background reference frame, a three-component Gaussian mixture model is used to calculate the foreground probability. Pixels with a foreground probability exceeding 0.7 are marked as moving points. Internal holes are filled using a morphological closing operation with a 5x5 cross kernel. A global nearest neighbor algorithm is used to track the centroids of regions between consecutive frames and connect them to form a tracking path. The velocity and acceleration at the centroid position are calculated using a center difference algorithm to generate dynamic target motion vector data. The system performs morphological analysis on the motion vector data to calculate the velocity attenuation coefficient and path curvature. Combined with the target region depolarization index, a multi-condition priority judgment is made. When the target motion pattern is a smooth curve and the depolarization index is greater than 0.15, it is determined to be an internal defect; otherwise, it is determined to be an external attachment. Threshold judgment is made based on the vertical velocity component after the vibration stops. If the velocity is greater than 1.5 mm / s, it is marked as heavy impurity; if the velocity is less than zero, it is marked as benign bubble; otherwise, it is marked as suspended impurity. After removing targets smaller than 5 micrometers and benign bubbles, valid defect confirmation information is generated and finally linked to form the product internal defect list data.
[0032] Step S4: When the internal defect list data of the product is not empty, generate a defect removal task; execute the corresponding defect product removal control according to the defect removal task, and then perform defect station identification on the production line to achieve defect process optimization in the upstream process of the production line.
[0033] In this embodiment of the invention, when the product's internal defect list data is not empty, the system automatically generates a defect rejection task. It obtains the current production line speed through a photoelectric encoder and calculates the rejection execution delay time based on the fixed distance of 2.5 meters between the rejection device and the inspection station. The system then binds the defect rejection task with the product's internal defect list data to generate a production line product rejection control command. Upon receiving the control command, the pneumatic push rod rejection device uses a solenoid valve to control compressed air, driving a 300mm stroke push rod to push the defective product off the main conveyor belt within 0.2 seconds with a 500 Newton push force. Simultaneously, it binds the corresponding single-piece defect traceability file. The system uses a sliding window algorithm to statistically analyze one hundred consecutive rejected products. It calculates the frequency of defect types and the nine-square grid position distribution using a hash table. When the frequency of a certain type of defect or a certain location area exceeds 20%, it is determined to be a systemic problem, generating systemic defect root cause pointing data. Based on the association rule mining algorithm, potential faulty workstations are identified, and a mapping relationship between defect types and fifteen main production workstations is established. When metal particle defects are abnormal, the fault is pointed to the raw material filtration and filling equipment cleaning workstations. When container deformation defects occur frequently, the fault is pointed to the temperature control and pressure parameters of the container forming workstations. Production process optimization suggestion data containing parameter adjustment suggestions, equipment maintenance suggestions, and material inspection suggestions is generated.
[0034] Preferably, step S1 includes the following steps:
[0035] Step S11: Classify round containers, square containers, and irregularly shaped containers based on the geometric shape data of the packaging containers to obtain container shape classification data;
[0036] Step S12: When the container shape classification data is a circular container, set the radial scanning mode with the shoulder area of the container as the key detection target; when the container shape classification data is a square container, set the corner point encryption scanning mode with the corner area of the container as the key detection target; when the container shape classification data is an irregularly shaped container, identify the geometric contour of the container and set the adaptive path scanning mode.
[0037] Step S13: Construct an adaptive scanning strategy based on the radial scanning mode, the corner point encryption scanning mode, and the adaptive path scanning mode;
[0038] Step S14: Based on the adaptive scanning strategy, use a 3D structured light scanner to perform adaptive shape scanning on the empty packaging container to obtain the 3D point cloud data of the container;
[0039] Step S15: Perform surface fitting on the container's 3D point cloud data and calculate the container wall thickness change rate to identify high curvature distortion areas where the container wall thickness change rate exceeds 5% or the curvature radius is less than 20mm.
[0040] Step S16: Identify the depressions, damages, and label-occluded areas on the container surface based on the container's 3D point cloud data to obtain the inherent defect areas.
[0041] In this embodiment of the invention, when classifying based on the geometric shape data of packaging containers, an industrial camera array is first used to capture multi-angle two-dimensional images of the containers. Each camera has a resolution of 4096×3072 pixels and a shooting frequency of 30 frames / second. After image acquisition, an edge detection algorithm is used to extract the container contour feature point set, with a contour point sampling interval of 0.5 mm. Subsequently, a feature matching algorithm is applied to analyze the contour features and calculate the roundness index and corner feature values. The roundness index is calculated using the least squares method to fit the roundness deviation; a deviation of less than 2.5% is used to determine a circular container. The corner feature values are calculated using the Harris corner detection algorithm; if four corners are detected and the included angle between the corners is 90°±3°, the container is determined to be square; otherwise, it is determined to be an irregularly shaped container. The classification results are stored in a numerical encoding format: circular containers are coded as 1, square containers as 2, and irregularly shaped containers as 3, while the geometric principal parameters are also recorded.
[0042] For the radial scanning mode of circular containers, the central axis of the container is first determined, and a polar coordinate system with the central axis as the origin is established. The scanning path is set to a circular scan from 0° to 360°. The scanning density in the shoulder area (the transition area from the body to the neck of the container) is set to 1.2 mm per angle, and in the non-shoulder area, it is set to 2.5 mm per angle. For the corner-density scanning mode of square containers, the precise coordinates of the four corners are first located through image processing. Each corner area is set as a square area with a side length of 25 mm. The scanning spacing in this area is 0.3 mm, forming a high-density scanning grid; the scanning spacing in areas outside the corners is 1.5 mm. For irregularly shaped containers, a surface normal vector distribution map is obtained using a pre-scan coarse scan. The curvature value at each point is calculated, and a curvature gradient field is constructed. In areas where the curvature change rate exceeds 8% / mm, the scanning spacing is set to 0.2 mm. In other areas, the scanning spacing is linearly adjusted according to the curvature value to ensure that the scanning path is always perpendicular to the surface normal vector.
[0043] The adaptive scanning strategy is constructed through a multi-layer parameter matrix. First, a scanning path matrix P is established, with dimensions n×3, where n is the number of scanning points, and each row contains xyz three-dimensional coordinates. Then, a scanning angle matrix A is constructed to record the scanner's projection angle, ensuring the incident angle is between 15° and 75°. The light intensity matrix L is dynamically adjusted based on the surface material's reflectivity r, calculated as L = L0 × (1 - 0.5r), where L0 is the baseline light intensity, set to 150 lumens. The scanning density matrix D varies with the surface curvature c, calculated as D = D0 × (1 + 2c), where D0 is the baseline scanning density, set to 2 points / square millimeter. For circular containers, the scanning strategy extends outwards from the shoulder as the center; for square containers, the strategy expands outwards from the four corners as scanning centers; for irregularly shaped containers, the strategy automatically generates a scanning path based on the curvature gradient, forming a complete scanning instruction set containing 11,000 to 15,000 discrete scanning points.
[0044] The adaptive shape scanning employs a binocular structured light scanner equipped with two 2-megapixel industrial cameras, a 45° field of view, and a depth of field ranging from 50 to 200 mm. The scanner is mounted at the end effector of a six-axis robotic arm with a repeatability of ±0.03 mm. The empty packaging container is fixed on a rotating worktable with a rotational speed accuracy of ±0.05° / second. Before scanning, the system performs pose calibration and establishes a transformation matrix between the world coordinate system and the scanner coordinate system. During scanning, blue structured light (wavelength 465 nm) is projected onto the container surface, forming a 120-strip pattern with a stripe width of 0.8 mm. The binocular cameras simultaneously acquire images of the deformed stripes at a frequency of 45 Hz. A phase unfolding algorithm is used to calculate the 3D coordinates of each pixel, achieving a spatial resolution of 0.05 mm. The scanned data is transmitted in real-time to the processing unit for point cloud registration and fusion, ultimately forming a complete 3D point cloud model of the container containing approximately 2.5 million points.
[0045] The 3D point cloud data processing first involves preprocessing, using voxel downsampling to homogenize the point cloud density, with a voxel size set to 0.2 mm. Moving least squares is then used for surface fitting, with the fitting error controlled within 0.02 mm. A fourth-order Bezier surface model is used for surface fitting, with a control point grid spacing of 1.5 mm. The container wall thickness is calculated through registration of the inner and outer surface point clouds; the inner surface point cloud is acquired using a dedicated inner wall scanning device. The wall thickness variation rate is calculated as follows: 5000 measurement points are uniformly sampled on the surface model, and the ratio of the local wall thickness to the nominal wall thickness is calculated at each measurement point. Regions with a variation rate exceeding 5% are automatically marked. Curvature is calculated using a second-order surface fitting method, calculating the principal curvatures k1 and k2, with a curvature radius R = 1 / max(|k1|, |k2|). When R < 20 mm, it is identified as a high-curvature distortion region. The system generates a distortion region distribution map, including three parameters: spatial coordinates, area, and severity.
[0046] Inherent defect region identification is achieved through multi-feature fusion. The normal vector of each point in the point cloud is calculated using the K-nearest neighbor algorithm, with K set to 30. Regions where the angle between the normal vectors of adjacent points changes by more than 25 degrees are marked as suspected depressions. A region growing algorithm is used to expand the depression boundary, and connected regions with an area greater than 4 square millimeters are confirmed as depression defects. Damaged regions are identified through point cloud density discontinuity analysis. A point cloud density threshold of 50 points / square millimeter is set within a local region (5 mm × 5 mm). Regions with a density below this value and sharp abrupt edges are identified as damaged. Label occlusion regions are identified through abnormal reflection intensity; the reflection intensity of the label region is more than 35% higher than that of the container body. Defect region feature extraction includes four quantitative indicators: center coordinates, area size, depth / height, and edge sharpness. The system integrates all defect regions to form an inherent defect dataset. Each defect record includes a type code (Depression 1, Damage 2, Label Occlusion 3), spatial coordinates, area, and severity score (1-10 points).
[0047] Preferably, step S2, which involves intelligent polarization illumination compensation based on liquid product characteristic data and inherent defect areas of the container, and simultaneous capture of disturbance response time-series image sequences, includes:
[0048] Based on the product batch number data in the liquid product characteristic data, the viscosity value, density value, and light transmittance coefficient of the liquid can be retrieved as the liquid physical property characteristic data.
[0049] Based on the container specification identification data in the liquid product characteristic data, the container material type, wall thickness distribution range, and surface roughness grade are queried as the container physical characteristic data;
[0050] Based on the liquid physical property data, polarization excitation strategy processing was performed to obtain vibration excitation frequency combination data and transmittance compensation brightness value, respectively.
[0051] The container's physical property data is processed by polarization light field control parameters through transmittance compensation brightness values to generate polarization light field control feature parameters. These polarization light field control feature parameters include the scattering suppression light source angle matrix, compensated structured light intensity data, and dynamic exposure time parameters.
[0052] Extract the normal to the high curvature distortion region in the inherent defect region of the container, and then calculate the polarized light incident angle data based on the scattering suppression light source angle matrix;
[0053] For inherent defect areas in the container's inherent defect region, the polarization direction is adjusted to avoid them, and an adaptive polarization illumination scheme is constructed based on the compensated structured light intensity data.
[0054] After the empty packaging container completes the liquid product packaging operation, it receives a position confirmation signal of the container entering the production line inspection station and obtains the container's positioning status data.
[0055] Based on the container's in-situ state data, an adaptive polarization illumination scheme is used to drive a light source array to illuminate the container with a polarized light field. At the same time, a piezoelectric ceramic array is used to execute vibration excitation frequency combination data to generate controlled disturbances in the liquid inside the container, thus obtaining a controlled liquid disturbance state.
[0056] Under controlled liquid disturbance conditions, dynamic response time sequence images are generated by continuously capturing the dynamic exposure time parameters for 250 milliseconds using a high-speed camera.
[0057] In this embodiment of the invention, a barcode scanner (0.1 mm resolution) scans the product batch number printed on the container. The batch number is in the format "YYMMDDxxxx", where the first 6 digits represent the production date and the last 4 digits are the product code. The scanning result is transmitted to the central control server of the production line via TCP / IP protocol. The control server accesses the enterprise resource planning system database, executes SQL query commands, and extracts the liquid property parameters of the corresponding batch from the product formula table. The obtained liquid viscosity value is accurate to 0.1 mPa·s, and the density value is accurate to 0.001 g / cm³. 3 The transmittance coefficient is stored as values from 21 sampling points spaced 10 nm apart within the wavelength range of 400-700 nm. Query results are standardized and converted into JSON format data packets. Standardization includes unit conversion and outlier removal (values exceeding ±10% of historical data are replaced by the average of the last 5 batches).
[0058] The system identifies the specification codes on the bottom or side of the container using optical character recognition (OCR). These codes are formatted as "material code-capacity code-structural code," such as "PET-500-A2." The identification results are then matched against a container parameter database using a specification code parsing engine. This database stores detailed parameter tables for all used containers. The system retrieves the container's material type (10 types including PET, HDPE, PP, and glass), wall thickness distribution range (accurate to 0.01mm, including minimum, maximum, and average wall thickness values), and surface roughness grade (12 grades from N1 to N12 according to international standard ISO4287). For new containers, the system uses an RFID reader (reading distance 0-15cm) to read the RFID tags attached to the container mold, directly obtaining complete container parameters. All parameters are stored in a structured data format, containing 52 detailed technical parameters.
[0059] The system employs a polarization excitation strategy based on the acquired liquid viscosity, density, and transmittance coefficients. First, the fluid dynamics model is used to calculate the liquid surface waveform characteristics under different vibration frequencies. The calculation utilizes the Navier-Stokes equation discretization method with a mesh resolution of 0.5 mm. Vibration excitation frequency combination data is generated, including three dominant frequencies (8 Hz, 22 Hz, and 47 Hz) and their respective amplitude values (0.08 mm, 0.12 mm, and 0.05 mm). The system calculates the compensation brightness value based on the deviation between the liquid transmittance coefficient and the transmittance curve of a standard transparent aqueous solution. The calculation formula is: Compensation brightness percentage = Base brightness × (1 + 0.5 × (1 - Average transmittance)) × (1 + 0.3 × Viscosity coefficient), where the viscosity coefficient = (Actual viscosity - 1.0) / 10. When the viscosity is below 1.0 mPa·s, 1.0 mPa·s is used. The average transmittance is the average value of 21 sampling points within the wavelength range of 400-700 nm. The compensation brightness value is controlled within the range of 80%-150%.
[0060] Based on the aforementioned transmittance-compensated brightness values (range 80%-150%) and container physical property data, optical field control parameters were processed. First, an optical propagation model was constructed, converting the container wall thickness distribution data into an optical path difference matrix with a resolution of 1mm × 1mm. Refractive index parameters were set according to the container material type (PET 1.57, HDPE 1.54, PP 1.49, glass 1.52). A scattering coefficient matrix was set according to the surface roughness level (N1-N12), with a scattering coefficient of 0.02 for level N1, increasing by 0.03 for each level up to 0.35 for level N12. The optimal illumination angle was calculated using a Monte Carlo ray tracing algorithm (1,000,000 sampled rays), generating a scattering suppression light source angle matrix (24×18 matrix, covering a 360°×180° spatial angle). Based on the transmittance-compensated brightness values and the container material's light transmission characteristics, compensated structured light intensity data was calculated (reference intensity 300 lux, compensation range 240-450 lux). Finally, the dynamic exposure time parameters were set, with a baseline exposure time of 5ms, which was dynamically adjusted within the range of 3-8ms as the transmittance changed, and a resolution of 0.1ms.
[0061] Normals were extracted from high-curvature distortion regions (regions with a wall thickness variation rate exceeding 5% or a curvature radius less than 20 mm). A local surface fitting algorithm was employed, taking point cloud data within a 2 mm radius centered on each point in the distortion region and fitting it using a quadratic polynomial with a fitting accuracy controlled within 0.02 mm. The normal vector was obtained by differentiating the fitted surface, accurate to four decimal places. The extracted normal data formed a normal vector field, stored as an N×3 matrix (N being the number of points in the distortion region, with each row storing the x, y, and z components of a unit normal vector). The normal vector field was then matched point-to-point with the aforementioned scattering suppression light source angle matrix (24×18) to determine the optimal polarized light incident angle for each distortion point. Cosine similarity was used in the calculation, with the light source position being optimal when the included angle was less than 15°. Finally, polarized light incident angle data was generated, including the optimal light source position index and corresponding polar coordinate angle values (azimuth and elevation) for each distortion point.
[0062] Polarization direction adjustment is implemented to avoid inherent defects (dents, damage, and label obstruction areas). First, the surface normal distribution of each defect area is calculated, and principal component analysis is used to determine the principal direction of the normal. Based on Brewster's angle principle, the angle between the polarized light and the incident plane is set so that the polarization direction of the reflected light is perpendicular to the principal direction of the normal in the defect area, thereby maximizing the light intensity penetrating the defect area. In specific implementation, 16 sets of polarizers (polarization efficiency > 99.5%) are installed at the front end of the light source, and the rotation angle of the polarizers is controlled by a stepper motor (accuracy 0.1°). Combining the aforementioned compensated structured light intensity data, a complete adaptive polarization lighting scheme is constructed, including: a light source position matrix (coordinates of 48 spatial points), a light source intensity matrix (48 brightness levels for each light source), a polarization angle matrix (polarizer angle values for each light source), and an lighting timing table (controlling the activation sequence and duration of the 48 light sources, accurate to the millisecond level).
[0063] Containers that have completed packaging operations enter the inspection station via a conveyor belt (speed 0.5m / s). A dual detection device is installed at the entrance of the inspection station, consisting of an infrared through-beam sensor (detection distance 5-500mm, response time 2ms) and an inductive proximity switch (detection distance 0-15mm, response time 5ms). When the front end of the container passes the infrared through-beam sensor, the first-level detection signal is triggered; when the container reaches the preset detection position, the inductive proximity switch is triggered, generating the second-level detection signal. The time difference between the two signals is used to calculate the container conveying speed, accurate to 0.01m / s. The inspection station is also equipped with a high-precision laser displacement sensor (measuring range 50-150mm, accuracy 0.01mm) to measure the height of the container's top, ensuring the container is placed vertically and meets the height requirements. After processing by a signal conditioning circuit (sampling rate 1kHz, resolution 16-bit), the three sets of sensor signals are transmitted to the PLC controller via a fieldbus (response time <10ms) to form a container positioning status data packet, containing three key parameters: position coordinates, arrival timestamp, and attitude angle.
[0064] After receiving the container's positioning status data, the PLC controller triggers a detection execution command. First, based on the position coordinates and attitude angles in the container's positioning status data, the light source position matrix in the adaptive polarization lighting scheme is fine-tuned to compensate for the deviation between the actual and theoretical positions of the container (allowable deviation ranges of ±5mm and ±2°). Then, according to the lighting sequence table, 48 groups of polarization light sources are activated sequentially (each group includes a high-brightness LED light source, a focusing lens, a polarizer, and a light intensity adjuster). The polarization direction, illumination angle, and light intensity of each light source are precisely controlled according to the aforementioned calculation results. Simultaneously, the piezoelectric ceramic vibrator array (5×5 grid arrangement, each vibrator measuring 10mm×10mm, with a maximum displacement of 0.15mm) installed at the bottom of the detection platform is activated, generating a precise three-frequency superimposed vibration waveform according to the vibration excitation frequency combination data (8Hz, 22Hz, 47Hz). The vibration is transmitted from the bottom of the container to the liquid, forming a specific ripple pattern on the liquid surface, creating a controlled liquid disturbance state. The entire excitation process lasts for 250 milliseconds, and the vibration amplitude is controlled within the safe range specified in the product's technical requirements (maximum acceleration not exceeding 0.5g).
[0065] While a piezoelectric ceramic vibrator array excites the liquid to generate controlled disturbances, a high-speed camera system is activated to continuously capture the images. The high-speed camera system consists of three synchronized industrial cameras (2048×1536 pixels resolution, 200 frames / second frame rate, 12-bit bit depth), capturing images of the container from different angles (0°, 120°, and 240°). The three cameras are synchronized using a high-precision clock synchronization circuit (synchronization accuracy <10 microseconds). Based on dynamic exposure time parameters (reference value 5ms, range 3-8ms), the camera exposure time is automatically adjusted according to the real-time detected light intensity to ensure constant image brightness. Within a 250-millisecond capture time, each camera continuously acquires 50 frames, totaling 150 frames, forming a complete disturbance response time-series image sequence. The acquired images are transmitted in real-time to an image processing workstation via a Camera Link interface (transmission rate 680MB / s).
[0066] Preferably, the polarization excitation strategy processing based on liquid property characteristic data includes:
[0067] Based on the viscosity value of the liquid in the liquid physical property data, a threshold judgment is made. When the viscosity value is less than 100 mPa·s, a longitudinal excitation configuration with a frequency of 75 Hz and an amplitude of 0.2 mm is generated to obtain high-frequency excitation waveform data; otherwise, a cyclotron excitation configuration with a frequency of 15 Hz and an amplitude of 1.0 mm is generated to obtain cyclotron excitation waveform data.
[0068] A basic excitation mode strategy is constructed based on high-frequency excitation waveform data and cyclone excitation waveform data.
[0069] The ratio of density to viscosity in the liquid's physical property data is calculated to obtain the liquid's inertial damping ratio.
[0070] The excitation frequency of the basic excitation mode strategy is optimized by using the liquid inertia damping ratio to generate a dynamically optimized excitation frequency.
[0071] By combining the dynamically optimized excitation frequency with the basic excitation mode strategy, vibration excitation frequency combination data is obtained.
[0072] The light source brightness adjustment value is calculated based on the transmittance coefficient in the liquid's physical property data to compensate for light attenuation in the liquid, thus obtaining the transmittance compensation brightness value; whereby the light source brightness increases by 3% for every 0.05 decrease in the transmittance coefficient.
[0073] In this embodiment of the invention, precise viscosity values are extracted from liquid physical property data using a capillary viscometer (accuracy ±0.5 mPa·s) and a rotational viscometer (shear rate range 10-1000 s). -1Viscosity data is double-checked. Viscosity value judgment is implemented using a comparator circuit, with the comparator threshold precisely set to 100 mPa·s and a hysteresis bandwidth of ±2 mPa·s to prevent threshold jitter. When the detected viscosity value is less than 100 mPa·s, the digital waveform generator (16-bit precision, 5 MHz sampling rate) immediately generates a longitudinal excitation waveform with a frequency of 75 Hz and an amplitude of 0.2 mm. The longitudinal excitation waveform uses a sine function with continuous phase, a start-up time of 10 milliseconds, and a smooth transition to full-amplitude oscillation. When the viscosity value is greater than or equal to 100 mPa·s, the system automatically switches to cyclotron excitation mode, generating a cyclotron excitation waveform with a frequency of 15 Hz and an amplitude of 1.0 mm. The cyclotron excitation waveform uses an elliptical trajectory with a major-to-minor axis ratio of 3:2 and a clockwise rotation direction. Both waveform data are stored as a 4096-point sampling sequence, labeled as high-frequency excitation waveform data and cyclotron excitation waveform data, respectively.
[0074] High-frequency excitation waveform data and cyclotron excitation waveform data were loaded into a waveform library containing 8192 waveform points with a time resolution of 0.1 milliseconds. Waveform characteristic analysis was then performed to extract spectral features, energy distribution, and phase characteristics. The high-frequency excitation waveform data showed that the main energy was concentrated in the 75±2 Hz frequency band, accounting for 92% of the energy; the cyclotron excitation waveform data showed that the main energy was distributed in the 15±0.5 Hz frequency band, accounting for 85% of the energy. The system established parameterized descriptions for the two basic excitation modes, including five basic parameters: waveform type, dominant frequency, amplitude, phase, and duration.
[0075] Density value ρ (unit: g / cm³, accuracy 0.001 g / cm³) and viscosity value η (unit: mPa·s, accuracy 0.5 mPa·s) are extracted from liquid property data. The liquid inertial damping ratio ξ is calculated using the formula ξ = ρ / η × K, where K is a proportionality coefficient, set to 0.01, used for unit conversion and dimensional balance. During the calculation, the system first performs temperature correction on the original density and viscosity values at 20℃. The correction coefficient is obtained from a table based on a pre-established temperature-property relationship curve. After temperature correction, the system divides the density value by the viscosity value and then multiplies it by the proportionality coefficient K to obtain the dimensionless liquid inertial damping ratio ξ. The inertial damping ratio is typically between 0.1 and 10, reflecting the liquid's flow response characteristics.
[0076] Based on the liquid inertial damping ratio ξ and a fluid dynamics model, a mapping relationship between the liquid resonant frequency and the inertial damping ratio is established. A lookup table method is used, with a table size of 100×100. The horizontal axis represents the inertial damping ratio (0.1-10), and the vertical axis represents the frequency adjustment coefficient (0.5-2.0). When ξ < 1.0, the liquid exhibits underdamped characteristics, and the system reduces the fundamental excitation frequency, adjusting the coefficient f. a=0.8+0.2ξ; When ξ=1.0, the liquid exhibits critical damping characteristics. Keeping the basic excitation frequency constant, the adjustment coefficient f a =1.0; When ξ>1.0, the liquid exhibits overdamped characteristics, and the system increases the fundamental excitation frequency, adjusting the coefficient f. a =1.0 + 0.1(ξ - 1). Multiply the frequency value in the basic incentive pattern strategy by the adjustment coefficient f. a The dynamically optimized excitation frequency f′ is obtained. The system simultaneously calculates the subharmonic frequency f′ / 2 and the harmonic frequency 2f′, forming a complete frequency optimization strategy with frequency accuracy controlled within 0.01 Hz.
[0077] The dynamic optimization excitation frequency f′ is combined with the waveform type, amplitude, and phase information from the basic excitation mode strategy to construct the dominant frequency vibration component. The dominant frequency vibration component uses a sinusoidal waveform, with amplitude A1 consistent with the basic excitation mode (0.2 mm for high-frequency mode, 1.0 mm for cyclotron mode). Harmonic components are then added to the system, including the second harmonic (frequency 2f′, amplitude 0.3A1) and the third harmonic (frequency 3f′, amplitude 0.15A1). For the high-frequency excitation mode, an additional half-harmonic (frequency f′ / 2, amplitude 0.25A1) is added; for the cyclotron excitation mode, an additional third-order harmonic (frequency f′ / 3, amplitude 0.2A1) is added. All frequency components are weighted and superimposed to form a composite waveform, with the weighting coefficients dynamically adjusted by the liquid inertial damping ratio ξ. The superimposed waveform is processed by a Butterworth low-pass filter (cutoff frequency 200 Hz, order 4) to ensure a smooth signal transition. The final generated vibration excitation frequency combination data includes four parameters: frequency, amplitude, phase, and waveform type, with 8192 sampling points and a time resolution of 0.1 milliseconds.
[0078] The transmittance coefficient τ (range 0-1, accuracy 0.01) is extracted from the liquid's physical property data. This coefficient is obtained through spectrophotometry, with a measurement wavelength range of 400-700 nm and wavelength intervals of 10 nm. Transmittance compensation follows a proportional increasing principle, i.e., for every 0.05 decrease in the transmittance coefficient, the light source brightness increases by 3%. The calculation formula is B=B0×[1+0.03×(1-τ) / 0.05], where B is the transmittance compensation brightness value (unit: lumen), and B0 is the reference brightness value (set to 500 lumens). During the calculation process, the system first subtracts the transmittance coefficient τ from 1 to obtain the attenuation rate, then divides it by 0.05 to obtain the number of gradients that need to be compensated, and multiplies it by 3% to obtain the total compensation percentage. Specific example: When the transmittance coefficient τ = 0.75, the attenuation rate is 0.25, the number of gradients to be compensated is 0.25 / 0.05 = 5, the total compensation percentage is 5 × 3% = 15%, and the final transmittance compensation brightness value B = 500 × (1 + 15%) = 575 lumens.
[0079] Preferably, the polarization field control parameter processing of the container physical characteristic data by compensating for the brightness value through transmittance includes:
[0080] The optimal polarization angle is extracted based on the container material type in the container physical property data to suppress surface specular reflection of the material to the greatest extent, thus obtaining the material-optimized polarization reference angle.
[0081] By optimizing the polarization reference angle of the material based on the surface roughness level, a scattered light source suppression processing is performed to obtain a scattered light source suppression angle matrix;
[0082] The optical path difference between the thinnest and thickest regions of the container wall is calculated based on the wall thickness distribution range in the container's physical property data. Then, an additional light intensity gain coefficient is calculated for the region with the thickest container wall.
[0083] The packaging container structure is compensated based on the light intensity gain coefficient and the transmittance compensation brightness value to generate compensated structural light intensity data.
[0084] Dynamic exposure time parameters are set by dynamically optimizing the excitation frequency based on the vibration excitation frequency combination data.
[0085] In this embodiment of the invention, the material type code is read from the container's physical property data. The code ranges from 1 to 12, with each code corresponding to a specific material. The refractive index n of the material is obtained through a material-refractive index mapping table. For polyethylene terephthalate (PET), n = 1.57; for high-density polyethylene (HDPE), n = 1.52; for glass, n = 1.53; and for epoxy resin, n = 1.58. The Brewster angle θ is calculated using the formula θ = arctan(n), with a calculation accuracy of 0.1°. For PET, the Brewster angle is 57.5°; for HDPE, it is 56.7°; for glass, it is 56.9°; and for epoxy resin, it is 57.7°. The system also considers the anisotropy of the material. An elliptic polarization analyzer is used to measure the polarization response of the material at different azimuth angles. 36 measurement points are used, covering the range of 0°-360°. Fourier analysis is performed on the measurement data to extract the principal polarization direction, which is then combined with the Brewster angle to form the material-optimized polarization reference angle.
[0086] Surface roughness grades, ranging from R1 to R9, were extracted from the container's physical property data, corresponding to Ra values from 0.1 μm to 5.0 μm. For each roughness grade, its 360° full-space scattering characteristics were measured beforehand using an integrating sphere scattering measurement instrument. The measurement wavelength was set to 550 nm, with an incident angle resolution of 5° and an exit angle resolution of 1°. The measurement data formed a scattering distribution matrix M, with dimensions of 72×360, representing the scattering intensity at 72 incident angles and 360 exit angles. Principal component analysis was applied to matrix M to extract the principal eigenvectors of the scattering modes. The system then determined the minimum scattering direction θ based on the principal eigenvectors.min The material is optimized to the polarization reference angle θ min The orientation offset is Δθ, where Δθ = (Ra - 0.1) × 2.5°, and Ra is the surface roughness value in μm. For example, when Ra = 1.2 μm, Δθ = (1.2 - 0.1) × 2.5° = 2.75°. Based on the optimized angle, the system generates a 12 × 12 scattering suppression light source angle matrix, where each element represents the optimal incident angle of the light source at a specific spatial location, with an angular accuracy of 0.5°.
[0087] The wall thickness distribution range is extracted from the container's physical property data, which includes wall thickness values at 22 measurement points on the container surface with a measurement accuracy of ±0.01 mm. The system first identifies the thinnest wall region, d. min and the thickest region d max Calculate the wall thickness difference Δd = d max -d min For polyethylene terephthalate (PET) material with a refractive index n = 1.57, the optical path difference is calculated using the formula ΔL = (n-1) × Δd, where ΔL is the optical path difference in mm. For example, when d... min =0.8mm, d max When the wall thickness is 1.5mm, Δd = 0.7mm, and the optical path difference ΔL = (1.57 - 1) × 0.7mm = 0.399mm. The light intensity gain coefficient G is calculated using an exponential function model, with the formula G = e^(α × ΔL), where α is the attenuation coefficient, with a value of 0.8 / mm. In the example above, G = e^(0.8 × 0.399) = 1.37, indicating that the thickest region requires an increase of 37% in light intensity compensation. The system applies the light intensity gain coefficient G to all regions where the wall thickness exceeds the average by 20%, forming a light intensity compensation distribution map.
[0088] The container surface was divided into an 8×8 grid, with each grid cell approximately 10mm×10mm in size. For each grid cell, the local gain coefficient G was extracted from the light intensity gain coefficient distribution map based on its location. ij (i, j are grid coordinates, ranging from 1 to 8). The transmittance-compensated luminance value B is used as the reference luminous intensity, in lumens. The compensated luminous intensity I is calculated for each grid cell. ij =B×G ij This forms the initial structured light intensity matrix. The system further considers the change in illumination angle caused by the container geometry, calculating the incident angle correction coefficient Cθ = 1 / cos(θ), where θ is the incident angle of the light rays, determined by the angle between the container surface normal vector and the light source direction. The final formula for calculating the compensated structured light intensity data is I. ij '=I ij ×Cθ, where the unit is milliwatts per square centimeter.
[0089] The dynamically optimized excitation frequency f′, in Hertz, is extracted from the vibration excitation frequency combination data. To avoid motion blur during image acquisition, the system sets the maximum allowable exposure time T. max Set as 1 / 4 of the oscillation period, the calculation formula is T. max = 1 / (4×f′), in seconds. For example, when f′ = 75 Hz, T max = 1 / (4×75) = 0.00333 seconds = 3.33 milliseconds. Considering the multi-frequency harmonic characteristics of liquid disturbance, the system sets the actual exposure time T to T0. max 80%, that is, T = 0.8 × T max The system also considers the reciprocal relationship between light intensity and exposure time. When the transmittance compensation brightness value B increases by 50%, the exposure time decreases by 33% accordingly. The final dynamic exposure time parameter is set using a piecewise function: when f′ < 30 Hz, T = 2.5 ms; when 30 ≤ f′ < 60 Hz, T = 1.5 ms; when f′ ≥ 60 Hz, T = 0.8 ms. The system precisely controls the exposure time to the microsecond level and achieves phase locking with the frame synchronization signal of the high-speed camera, ensuring that each frame is captured at a specific phase of the liquid disturbance.
[0090] Preferably, step S2, which involves constructing a motion image recognition model and using it to identify motion regions in a time-series image sequence of a disturbance response, includes:
[0091] Acquire a standard defect sample image set containing impurity samples of known type, size and location, as well as a clean background image set free of any impurities;
[0092] Optical flow calculations were performed on each frame of the standard defect sample image set and the clean background image set to obtain sample optical flow icon annotation data;
[0093] A motion image recognition model is obtained by training a convolutional neural network based on sample optical flow icon annotation data.
[0094] The disturbance response time-series image sequence is input into the motion image recognition model, which intelligently identifies and segments regions with independent motion patterns to obtain a time-series motion region segmentation map.
[0095] In this embodiment of the invention, the acquisition of standard defect sample images is completed using a dedicated defect sample preparation device. This device includes a precision liquid injection system (injection accuracy ±0.01 ml) and an automatic positioning platform (positioning accuracy ±0.05 mm). First, five types of standard impurity samples are prepared: solid particles (diameter 0.5-3.0 mm, materials include polyethylene, glass, and metal), bubbles (diameter 0.3-5.0 mm), fibers (length 1.0-10.0 mm, diameter 0.05-0.2 mm), oil droplets (diameter 0.5-2.0 mm), and gels (irregular shape, area 0.5-8.0 square millimeters). Precisely measured impurity samples are injected into standard transparent containers using a micro-syringe. The containers are filled with a transparent liquid (refractive index 1.33 ± 0.02). A robotic arm control system positions the impurities at 25 preset locations within the containers, covering the container's central axis, near-wall area, bottom area, top area, and corner areas. Image acquisition utilized a 4K high-speed camera system (3840×2160 pixels resolution, 120 frames per second). 200 consecutive frames were acquired for each impurity type at each location, resulting in a total of 25,000 standard defect sample images. The clean background image set used the same container and liquid, but without any added impurities, and was acquired under identical lighting and disturbance conditions, resulting in 5,000 background images to ensure dataset integrity.
[0096] The image sequence is preprocessed, including Gaussian filtering (kernel size 5×5, standard deviation 1.2) for noise reduction and histogram equalization to enhance contrast. A four-layer pyramid structure is then constructed with a scaling factor of 0.5. Gradient calculations are performed at each layer, using the Sobel operator to extract horizontal and vertical gradients. The optical flow equation is solved using weighted least squares with a weight window size of 15×15 pixels, 20 iterations, and a convergence threshold of 0.01 pixels. The calculated optical flow field contains two components, u and v, representing pixel displacements in the horizontal and vertical directions. To improve computational accuracy, sub-pixel interpolation is used, achieving an accuracy of 0.1 pixels. For impurity regions in the standard defect sample image set, the system uses a predefined mask for annotation. The mask precisely covers the impurity region and extends outward by 2 pixels to form a transition band. Each annotated region is assigned a unique identifier and impurity type code. The final generated sample optical flow icon annotation data includes four parts: the original optical flow field, the impurity region mask, the impurity type code, and the inter-frame time interval.
[0097] The convolutional neural network training employs a two-stream architecture, comprising spatial and temporal branches. The spatial stream uses a modified ResNet-50 residual network as its backbone, with input being a single-frame image at a resolution of 640×480 pixels. The temporal stream uses a 3D convolutional network (3D-CNN), with input being 10 consecutive frames of optical flow fields, also at a resolution of 640×480 pixels. The spatial stream contains 5 convolutional blocks, each containing 3 to 6 convolutional layers with a 3×3 kernel size, a stride of 1, and padding of 1. The first convolutional layer outputs 64 feature maps, with subsequent layers increasing the number of feature maps to 128, 256, 512, and 1024 respectively. The temporal stream contains 4 3D convolutional layers with a 3×3×3 kernel size. The first layer outputs 64 feature maps, with subsequent layers similarly increasing the number. The features from the two branches are merged through a feature fusion module, which includes an attention mechanism to assign dynamic weights to the spatial and temporal features. The network was trained using a batch size of 32 and an initial learning rate of 0.001, with a cosine annealing strategy used to reduce the learning rate every 50 epochs. The loss function employed a combination of weighted cross-entropy and structural similarity loss, with a weight ratio of 7:3. Training was performed in parallel on four GPUs, each with 32GB of memory, for 120 epochs, processing a total of 2,400,000 samples. The final model had 86M parameters, was converted to ONNX format for storage, and achieved an inference speed of 25 frames per second.
[0098] The perturbation response time-series image sequence processing first undergoes preprocessing operations, including spatial resolution normalization (adjusted to 640×480 pixels), color space conversion (RGB to YUV), and temporal resolution normalization (interpolation to 200 frames / second). The processed sequence is input to the motion image recognition model using a sliding window (window size 10 frames, stride 5 frames). Model inference is executed on a high-performance computing unit in batch processing mode, processing 8 time windows per batch. The model output consists of two parts: pixel-level motion region masks and region-level classification results. The motion region mask resolution is the same as the input, with each pixel containing a confidence value between 0 and 1, representing the probability that the pixel belongs to a motion region. The system uses an adaptive thresholding method (threshold value of 0.65) to convert continuous values into binary masks. Temporal consistency processing is performed on masks of adjacent frames, using temporal median filtering (window width 5 frames) to eliminate transient noise. The region-level classification results include the category (solid particle, bubble, fiber, oil droplet, gel) and confidence score (between 0 and 1) for each detected region. The system uses a connected component analysis algorithm to extract each independent motion region, assigns a unique identifier to each region, and records the region's center coordinates, area, bounding box, and motion trajectory. The resulting temporal motion region segmentation map contains motion region masks and attribute data for all frames within 250 milliseconds.
[0099] Preferably, step S3, extracting dynamic target motion vector data based on the temporal motion region segmentation map, includes:
[0100] Pixel-level temporal median filtering is performed on the first 20 frames of the temporal motion region segmentation map to obtain a dynamically stable background reference frame.
[0101] The pixel-level grayscale values of two consecutive frames in the temporal motion region segmentation map are subtracted, and the absolute change in grayscale value is greater than 20 as a threshold to extract the binarized dynamic pixel map.
[0102] Clustering connected pixels with a spatial distance of less than 5 pixels in the binarized dynamic pixel image yields a dynamic target pixel set.
[0103] Gaussian mixture foreground probability calculation is performed on the dynamic target pixel set in the temporal motion region segmentation map based on the dynamic stable background reference frame, and pixels with foreground probability exceeding the threshold of 0.7 are marked as motion points to obtain temporal foreground pixel mask data.
[0104] Morphological closing operations are performed on each frame of the temporal foreground pixel mask data to fill the holes inside the moving target and connect the broken parts, thereby obtaining an optimized moving target region set.
[0105] Based on the optimized moving target region set, the global nearest neighbor algorithm is used to track the region centroid between consecutive frames, and the coordinates of all successfully associated centroids are connected into a path to obtain the original tracking path data chain;
[0106] Based on the original tracking path data chain, differential processing is performed in the time dimension to calculate the velocity and acceleration at the center of mass position, thereby generating dynamic target motion vector data.
[0107] In this embodiment of the invention, 20 frames of images are arranged in chronological order to form a three-dimensional data block with dimensions H×W×20, where H and W are the image height and width (typically 640×480 pixels), respectively. For each spatial location (x, y) in the data block, the grayscale value sequence G(x, y, t) of that location in the 20 frames is extracted, where t∈[1, 20]. Temporal median filtering is performed by calculating the median for the time sequence of each pixel location, B(x, y) = Median[G(x, y, 1), G(x, y, 2), ..., G(x, y, 20)], where B(x, y) is the grayscale value of the background reference frame at location (x, y). The filtering uses a fast median lookup algorithm with a computational complexity of O(n), where n is the number of frames. To improve computational efficiency, the system divides the image into 64×64 pixel blocks and processes them in parallel in a multi-threaded environment. The filtering result is stored as a 16-bit grayscale image with a precision of 0.01 grayscale units. For areas with drastic changes in lighting, the system applies an additional adaptive weight adjustment to reduce the impact of outliers. The weight adjustment coefficient is dynamically calculated based on the grayscale standard deviation.
[0108] For two consecutive frames I(t) and I(t+1) in the temporal motion region segmentation map, pixel-level grayscale value subtraction is performed to calculate the difference D(x, y, t) = |I(x, y, t+1) - I(x, y, t)|, where |·| represents the absolute value operation. The difference calculation uses 16-bit precision to avoid overflow. The system then applies a fixed threshold segmentation with a threshold set to 20. When the difference D(x, y, t) > 20, the corresponding position is marked as 255 (foreground) in the binarized image; otherwise, it is marked as 0 (background). To reduce noise impact, the system applies a 5×5 Gaussian filter (σ = 1.0) to smooth the original image before the difference calculation. The difference process considers information from three adjacent frames simultaneously, constructing a three-frame difference operator D3(x, y, t) = max(|I(x, y, t+1) - I(x, y, t)|, |I(x, y, t+2) - I(x, y, t+1)|), to enhance the stability of the difference. For low-contrast regions, the system applies local contrast enhancement with an enhancement factor of 1.5 and a local window size of 11×11 pixels.
[0109] Extract the set of coordinates P = {p1, p2, ..., p...} of all foreground pixels with a value of 255 from the binarized dynamic pixel map. n}, where p i =(x i y i () represents the coordinates of the i-th foreground pixel. Spatial distance is calculated using Euclidean distance. The clustering process sets ε = 5 pixels as the neighborhood radius and MinPts = 8 as the minimum number of core points. The algorithm starts with a random unvisited point p, searches for all points within its ε-neighborhood, and if the number of points in the neighborhood is greater than or equal to MinPts, then p is a core point and a new cluster is created; otherwise, it is marked as a noise point. For each core point, it recursively adds all its density-reachable points to the same cluster. The clustering process utilizes a grid index to accelerate neighborhood lookups, dividing the image into a 10×10 pixel grid and constructing a hash table to store the pixels within each grid, reducing the lookup complexity from O(n^2) to O(n^2). 2 The computation time is reduced to O(n). The system calculates the convex hull and minimum bounding rectangle for each clustering result, and records geometric features such as area, perimeter, and aspect ratio.
[0110] Based on the dynamically stable background reference frame B and the current processing frame I, a pixel-level difference feature vector F(x, y) = [I(x, y) - B(x, y), G1(x, y), G2(x, y)] is constructed, where G1 and G2 are the gradient magnitudes in the horizontal and vertical directions, respectively, calculated using the Sobel operator. For each pixel in the dynamic target pixel set, the system establishes a mixture model of K = 3 Gaussian distributions, and the weights, mean, and covariance matrix of each distribution are estimated using the expectation-maximization (EM) algorithm. The model parameters are initialized using K-means clustering results, with 5 iterations and a convergence threshold of 0.01. The foreground probability P(x, y) is calculated using the following formula: Where ω i Let N(F|μ, Σ) be the weight of the i-th Gaussian distribution, N(F|μ, Σ) be the multivariate Gaussian probability density function, μ be the mean vector, and Σ be the covariance matrix. The system uses a diagonal covariance matrix to simplify computational complexity. The foreground probability threshold is set to 0.7. Pixels with probability values P(x, y) > 0.7 are marked as foreground (255), otherwise they are marked as background (0), forming temporal foreground pixel mask data. The system updates the Gaussian mixture model parameters every 10 frames, and the learning rate α is set to 0.05.
[0111] Construct a 7×7 pixel elliptical structuring element S, with a major axis of 7 pixels and a minor axis of 5 pixels. Set all pixel values within the element to 1. The closing operation consists of a dilation operation followed by an erosion operation, processing each frame M of the temporal foreground pixel mask data. The dilation operation is defined as... That is, the set of all positions z where the intersection of S and M is not empty when the origin of the structuring element S is moved to position z. The erosion operation is defined as follows: That is, when the origin of the structuring element S is moved to position z, S is completely contained within the set of all positions z in M. The closing operation is represented as... The system employs a fast morphological algorithm to decompose two-dimensional operations into two one-dimensional operations, reducing the computational complexity from O(n^2) to O(n^2). 2 m 2 ) decreased to O(nm)2 +n 2 The image is defined as n), where n and m are the dimensions of the image and the structuring element, respectively. During processing, the system performs 8-bit alignment on the image and uses the SIMD instruction set to process 8 pixels in parallel, improving computational efficiency. After the closing operation, the system applies area filtering to remove connected regions with an area less than 20 pixels and fill internal holes with an area less than 10 pixels.
[0112] In each frame of the optimized moving target region set, the centroid coordinates C(i,t) = (x(i,t), y(i,t)) of all target regions are extracted, where i is the region identifier and t is the frame number. For target regions in two adjacent frames t and t+1, a cost matrix Cost is constructed, where the matrix element Cost(i,j) represents the association cost between the i-th target in frame t and the j-th target in frame t+1. The cost calculation formula is Cost(i,j) = w1·d(i,j) + w2·Δs(i,j) + w3·Δa(i,j), where d(i,j) is the Euclidean distance between centroids, Δs(i,j) is the area change rate, Δa(i,j) is the appearance similarity difference, and the weight coefficients w1 = 0.6, w2 = 0.3, and w3 = 0.1. The system sets a maximum association distance threshold d. max = 30 pixels, when d(i,j)>d max When the time complexity is zero, Cost(i, j) is set to infinity. The Hungarian algorithm solves the minimum cost matching problem, with a time complexity of O(n^2). 3 ), where n is the number of targets. For unmatched targets, the system creates a new trajectory or terminates the existing trajectory. The trajectory creation threshold is 3 frames, and the trajectory termination threshold is 5 frames. The system uses Kalman filtering to predict the target position, and the state vector is [x, y, v]. x v γ ], where v x and v γ For the velocity component, the diagonal elements of the process noise covariance matrix Q are set to [2, 2, 1, 1], and the diagonal elements of the measurement noise covariance matrix R are set to [3, 3]. Finally, the original tracking path data chain is generated, with each path containing the target ID, time span, and centroid coordinate sequence.
[0113] For each path in the original tracing path data chain, P(i) = {C(i, t1), C(i, t2), ..., C(i, t3)} nThe data is processed using a central difference scheme: v(i,t) = (C(i,t+1) - C(i,t-1)) / (2·Δt), where Δt is the inter-frame time interval, typically 5 milliseconds. Acceleration is calculated as a(i,t) = (v(i,t+1) - v(i,t-1)) / (2·Δt). To reduce noise, the system uses a Savitzky-Golay filter to smooth the coordinate data, with a filter window size of 7 and a polynomial order of 3. For path lengths less than 7, a smaller window size is used, max(3,n), where n is the path length. The system calculates the statistical characteristics of the path, including the average velocity |v|. avg Maximum speed |v| max Average acceleration |a| avg Maximum acceleration |a| max And the rate of change of direction θ'. Motion anomaly detection is based on Mahalanobis distance, with a distance threshold set to 2.5. The system combines all parameters to form dynamic target motion vector data. The data structure includes target ID, timestamp, position, velocity, acceleration, and statistical features.
[0114] Preferably, step S3, which involves detecting internal and external packaging defects based on dynamic target motion vector data, includes:
[0115] Based on the dynamic target motion vector data, it is determined to be an external attachment identification label and an internal defect identification label;
[0116] When a label is identified as having external attachments, a cleaning recommendation signal is generated and sent to the terminal device;
[0117] When the label is for internal defects, the velocity component in the vertical direction after the vibration stops is extracted from the dynamic target motion vector data to obtain the target settlement velocity value.
[0118] Threshold judgment is performed on the target settling velocity value. If the velocity is greater than 1.5 mm / s, it is marked as heavy impurity; if the velocity is less than 0, it is marked as benign bubble; otherwise, it is marked as suspended impurity, generating preliminary defect classification labeling data.
[0119] For targets marked as heavy impurities and suspended impurities in the preliminary defect classification and labeling data, the size is calculated based on the maximum pixel area in the temporal motion region segmentation map and the preset object distance parameter to obtain the estimated defect size data.
[0120] Targets smaller than 5 micrometers in the estimated defect size data are removed, and targets with benign bubble marks are filtered out to obtain valid defect confirmation information;
[0121] The initial defect classification and labeling data is linked with the valid defect confirmation information to form the product's internal defect list data.
[0122] In this embodiment of the invention, the temporal features of the motion vector are extracted, including the target trajectory duration T (unit: milliseconds), displacement distance D (unit: pixels), average velocity V (unit: pixels / millisecond), and direction change frequency F (unit: times / millisecond). For external attachments, the features are T>200 milliseconds, D<5 pixels, V<0.02 pixels / millisecond, and F<0.01 times / millisecond, meaning the motion duration is long but the displacement is small. The features of internal defects are T>50 milliseconds, D>10 pixels, V>0.05 pixels / millisecond, and F depends on the perturbation frequency. The system uses a support vector machine classifier for judgment. The classifier input is an 8-dimensional feature vector [T, D, V, F, σT, σD, σV, σF], where σ represents the standard deviation. The classifier training set contains 2000 labeled samples, the kernel function is a radial basis function (RBF), and the regularization parameter C=10, γ=0.1. The classification results are output in binary label form: external attachment determination label (value 1) or internal defect determination label (value 2). The classification accuracy reaches 97.5%, and the determination results serve as branch conditions for subsequent processing.
[0123] The system initiates the cleaning suggestion signal generation process. First, the location of the external attachment is precisely pinpointed. Pixel coordinates are converted to actual physical coordinates via coordinate transformation; the transformation matrix is pre-calibrated to achieve an accuracy of ±0.5 mm. The system then calculates the attachment area A (in square millimeters), shape factor S (perimeter squared divided by area), and surface reflectivity R (range 0-1). Based on these parameters, a cleaning difficulty score E = 0.4A + 0.3S + 0.3R is constructed, with a score range of 0-10. The system queries a pre-set cleaning strategy library based on the score. This library contains five standard cleaning solutions: light air blowing (E<3), standard air blowing (3≤E<5), strong air blowing (5≤E<7), air blowing + vibration (7≤E<9), and manual intervention (E≥9). The cleaning suggestion signal includes three parts: attachment coordinates (X, Y, Z), area size, and recommended cleaning solution number.
[0124] When a dynamic target is determined to be an internal defect (judgment label value of 2), the system enters the settlement velocity analysis process. First, the vibration cessation time t0 is identified. This is determined by analyzing the output signal of the accelerometer; vibration cessation is defined as the acceleration amplitude dropping below the background noise level (±0.05g) for 20 milliseconds. The system extracts the dynamic target position data within 100 milliseconds after vibration cessation, forming a time series P(t) = {(x1, y1, t1), (x2, y2, t2), ..., (x...}. n y n , tn )}, where t1 ≥ t0, t n -t1 ≤ 100 milliseconds. The vertical direction is defined as the y-axis direction of the image coordinate system, determined by calibrating the gravity direction with a calibration accuracy of ±0.5°. The vertical direction velocity component v γ is calculated by linear regression of the position data, where and are the average values of time and y-coordinate respectively. To improve the calculation accuracy, the system uses a robust linear regression algorithm to resist the influence of outliers, and the weighting coefficient is inversely proportional to the square of the residual. The pixel velocity needs to be multiplied by the scale factor k = D / d to be converted into the actual velocity (mm / s), where D is the actual size of the object and d is the corresponding pixel size, obtained through a calibration pattern.
[0125] Preprocess the sedimentation velocity value v, including unit conversion (converted to mm / s) and noise filtering (mean filtering with a window size of 5 sample points). The velocity threshold boundaries are accurately set as v1 = 1.5 mm / s and v2 = 0 mm / s, forming three classification criteria. When v > v1 (i.e., v > 1.5 mm / s), the system marks the target as a heavy impurity and encodes it as 1; when v < v2 (i.e., v < 0 mm / s), the system marks the target as a benign bubble and encodes it as 2; when v2 ≤ v ≤ v1 (i.e., 0 ≤ v ≤ 1.5 mm / s), the system marks the target as a suspended impurity and encodes it as 3. The judgment process takes into account the velocity measurement error, and a probability decision is adopted near the boundary values (±0.1 mm / s), introducing a fuzzy classification factor. The classification result also records the confidence score, and the calculation formula is C = min(1, |v - v β | / 0.2), where v β is the nearest boundary value. The system combines the target ID, classification code, and confidence score into the preliminary defect classification marker data, and the data format is a triple <ID, code, confidence>, stored as a structured array.
[0126] Extract the complete contours of each target marked as a heavy impurity (code 1) and a suspended impurity (code 3) from the sequential motion region segmentation map. For each contour, calculate the total number of pixels N and the number of pixels N max in the largest connected region. The object distance parameter p is obtained through camera calibration. The Zhang's calibration method is used, and a 9×12 checkerboard calibration plate with each grid size of 10 mm × 10 mm is used. The calibration result includes the internal parameter matrix K and the distortion coefficient D = [k1, k2, p1, p2, k3]. The conversion coefficient α from pixels to actual size is α = Z / f, where Z is the distance from the object to the camera (unit: mm) and f is the focal length (unit: pixels). Considering the refraction effect of light in the liquid, the refraction correction coefficient β = 1 / n is introduced, where n is the liquid refractive index (1.33 for water). The actual area of the defect S = N max×(α×β) 2 The unit is square millimeters. Assuming the defect is approximately spherical, the diameter is calculated using the following formula: The unit is millimeters.
[0127] The defect size prediction data is filtered by size, and a minimum size threshold d is set. min = 5 micrometers. For size d <d min Targets marked as "minor defects" are excluded and not counted as valid defects. Minor defect determination uses strict comparison operators to ensure that boundary cases (d = 5 micrometers) are preserved. The system then performs a label filtering process, excluding all targets with benign bubble labels (code 2). The filtering process is implemented using bitmasking operations, achieving a processing speed of 10,000 targets per second. For each target that passes the double filtering, the system extracts a complete feature set, including ID number, size d, position coordinates (x, y, z), classification code C, and motion feature vector. (representing average velocity, average acceleration, and average direction, respectively), shape feature vector S = [roundness, eccentricity, convexity], and optical feature vector O = [average brightness, contrast, texture complexity]. All features are combined to form a target descriptor, which is 64 bytes long.
[0128] A mapping relationship is established between preliminary defect classification and labeling data and valid defect confirmation information, using the target ID as the association key. The association is implemented using a hash table, with a query time complexity of O(1). For each valid defect, the system extracts its complete classification information (heavy impurities or suspended impurities) and size information, and adds the following supplementary data: three-dimensional coordinates (X, Y, Z) of the defect area center, accurate to 0.1 mm; defect volume V = πd. 3 / 6, accurate to 0.001 cubic millimeters; defect density estimation ρ, calculated backward from settlement velocity, in grams per cubic centimeter; hazard level score H = w1d + w2ρ + w3L, where w1 = 0.5, w2 = 0.3, w3 = 0.2 are weighting coefficients, and L is the hazard coefficient of the defect location (1.0 for the central area, 0.6 for the edge area). The system assigns a unique defect code to each defect, in the format "DC-yyMMdd-hhmmss-nnn", where the prefix represents the defect code, the middle part is the timestamp, and the suffix is the serial number. All defect information is integrated into a JSON format product internal defect list, including product batch number, inspection time, total number of defects, and detailed defect list. The data is transmitted to the production management system and simultaneously displayed visually on the user interface.
[0129] Of particular importance are the labels for identifying external attachments and internal defects based on dynamic target motion vector data, which include:
[0130] Morphological analysis is performed on the dynamic target motion vector data to calculate its velocity attenuation coefficient and path curvature, which are used to distinguish between smooth curvilinear motion affected by liquid vortex and linear motion affected by gravity, thus obtaining a target motion mode classification.
[0131] The polarization intensity values of the pixels covered by the dynamic target motion vector data in the disturbance response time-series image sequence are retrieved, and the rate of change of polarization state of light before and after penetrating the target is calculated to obtain the depolarization index of the target region.
[0132] Based on the target motion pattern classification and the depolarization index of the target area, a multi-condition priority judgment is made. If the target motion pattern is a smooth curve and its depolarization index is greater than the threshold of 0.15, it is judged as an internal defect. Otherwise, it is judged as an external water droplet or surface attachment, thereby generating an external attachment judgment label and an internal defect judgment label.
[0133] In this embodiment of the invention, the complete motion trajectory P(t) = {(x1, y1, t1), (x2, y2, t2), ..., (x...} of each target is extracted. n y n , t n Cubic spline interpolation was performed on the trajectory points, with the number of interpolation points set to three times the original number, and the interpolation accuracy controlled to 0.01 pixels. The velocity decay coefficient λ was calculated for the smoothed trajectory using an exponential fitting model: v(t) = v0e^(-λt), where v(t) is the velocity at time t, v0 is the initial velocity, and λ is the decay coefficient, in units of seconds. The fitting employed a nonlinear least squares method, with 50 iterations and a convergence threshold of 0.001. The path curvature κ was calculated using the formula κ(t) = |x'(t)y""t) - y'(t)x""t)| / [x'(t)] 2 +y'(t) 2 ]^(3 / 2), where x'(t) and y'(t) are the first derivatives of position, and x''(t) and y''(t) are the second derivatives, calculated using the central difference method. The system calculates the mean curvature. Standard deviation σκ, if And if σκ < 0.02, then it is determined to be linear motion (code 1); if If the change in motion direction is periodic, it is classified as smooth curve motion (code 2); if it falls between the two, it is classified as mixed motion (code 3). The classification result is output as the target motion pattern classification.
[0134] Frames corresponding to the time of dynamic target motion vector data are extracted from the disturbance response time-series image sequence. Each frame contains four channels of data I0, I10, I20, I30, I40, I50, I60, I70, I80, I90, I10, I10, I2 ... 45 I 90 I 135, the spatial resolution is 640×480 pixels, and the grayscale resolution is 12 bits. Based on the data of these four channels, the Stokes parameters S0, S1, S2, and S3 are calculated. The calculation formulas are S0 = I0 + I 90 , S1 = I0 - I 90 , S2 = I 45 - I 135 , and S3 is obtained through circular polarization analysis. The formula for the degree of polarization P is The value range is 0 - 1. The system extracts the average degrees of polarization PR and PB of the target region R and the background region B around the target. The background region is defined as an annular region with a 10-pixel expansion outside the target boundary. The formula for the depolarization index DOP is DOP = (PB - PR) / PB, which represents the relative change rate of the polarization state of the light after passing through the target. For actual impurities in the liquid, the depolarization effect is obvious; while for surface attachments, the incident light does not need to penetrate the target, and the depolarization effect is weak.
[0135] Set the depolarization index threshold TD = 0.15. This threshold is determined by analyzing 1000 known samples (500 internal defect samples and 500 external attachment samples), and the area under the ROC curve reaches 0.93. The judgment logic adopts a two-level structure: the first level judges the classification result of the target motion mode, and the second level judges the depolarization index. When the target motion mode is a smooth curve (encoded as 2) and the depolarization index DOP > TD (i.e., DOP > 0.15), the system determines the target as an internal defect and generates an internal defect determination label (encoded as 10); otherwise, the system determines the target as an external water droplet or surface attachment and generates an external attachment determination label (encoded as 20). To improve the classification robustness, the system introduces the calculation of the confidence score C. The formula is C = w1·f(M) + w2·g(DOP), where f(M) is the motion mode scoring function, g(DOP) is the depolarization index scoring function, and w1 = 0.6, w2 = 0.4 are the weight coefficients. When M = 2, f(M) = 1; when M = 1, f(M) = 0; when M = 3, f(M) = 0.5. The function g(DOP) = (DOP - TD + 0.05) / 0.1, restricted within the range of 0 - 1. The system combines the target ID, determination label, and confidence score into a triple <ID, label, confidence> and arranges them in descending order of confidence to form the final determination result.
[0136] Especially important is that after associating the preliminary defect classification marked data with the valid defect confirmation information as the product internal defect list data, it also includes:
[0137] Perform pixel-level optical flow calculation on the disturbance response time-series image sequence and obtain the background liquid flow field map through Gaussian smoothing processing;
[0138] The velocity vector is extracted from the dynamic target motion vector data, and the background velocity at the corresponding position is found from the background liquid flow field map to obtain the target-background velocity pairing.
[0139] Calculate the difference between the two velocity vectors in the target-background velocity pair to obtain the target-relative fluid velocity difference;
[0140] The target relative fluid velocity difference is determined. If its velocity modulus remains stably between 30% and 70% of the background flow velocity, a translucent gel-like mark is generated.
[0141] Add translucent gel-like material markings to the product's internal defect list data.
[0142] In this embodiment of the invention, the perturbation response time-series image sequence is preprocessed, including Gaussian filtering (kernel size 5×5, standard deviation σ = 1.2) for noise reduction and histogram equalization to enhance contrast. Subsequently, a four-layer image pyramid is constructed, with each layer having a resolution ratio of 0.5 and a minimum layer resolution of 80×60 pixels. The system calculates optical flow for adjacent frames (t and t+1), with a window size of 15×15 pixels, 20 iterations, and a convergence threshold of 0.01 pixels, obtaining the displacement vector field (u, v) for each pixel, where u is the horizontal displacement and v is the vertical displacement. To remove outliers, the system applies a dual-threshold filtering method, with a low threshold of 0.1 pixels and a high threshold of 10 pixels. The optical flow calculation results are then Gaussian smoothed (kernel size 9×9, standard deviation σ = 2.5) to eliminate local discontinuities and form a continuous and smooth background liquid flow field map. The flow field map is visualized using HSV color coding, where hue H represents flow direction (0-360 degrees), saturation S represents normalized flow velocity, and brightness V is fixed at 1. The resolution is the same as the original image, achieving pixel-level accurate representation.
[0143] Extract the velocity vector V0(v) of each target from the dynamic target motion vector data. x v γ The unit is pixels per second, with a precision of 0.01 pixels per second. The target center position P0(x0, y0) is mapped to the corresponding position P'0(x'0, y'0) in the background liquid flow field map after coordinate transformation. The transformation matrix is calculated using the four-point correspondence method, with a precision of ±0.5 pixels. Since the target center position usually does not exactly coincide with the grid points of the flow field map, the system uses bilinear interpolation to calculate the background flow velocity at this position.
[0144] For each target-background velocity pairing data<ID,P0,V0,V'0> Perform vector subtraction to calculate the relative velocity vector ΔV = V0 - V'0, where V0 is the target velocity vector and V'0 is the background flow velocity vector. The vector subtraction is performed on both the x and y components to obtain the two components of the relative velocity. and The system calculates the magnitude of the relative velocity vector as |ΔV| = √(Δv). x 2 +Δv γ 2 ) and direction θ = atan2(Δv γ Δv x ), where the module length is in pixels per second and the direction is in radians.
[0145] Stability analysis was performed on the target relative fluid velocity difference data, and the coefficient of variation of the relative velocity ratio r within 10 consecutive frames was calculated. Where σ r Standard deviation The average value is used. When CV < 0.15, the system is considered to be in a steady state. The system then determines the relative velocity ratio. Whether it falls within the 30% to 70% range, i.e. The determination employs a strict interval comparison and introduces a critical value correction: when or The system calculates the difference between the target's optical properties (transparency, refractive index change) and the liquid's refractive index. If the difference is less than 0.05, the interval boundary can be relaxed. The system also analyzes the target's morphological features, including edge ambiguity (calculated using the Sobel operator with a threshold of 20) and internal texture uniformity (using Local Binary Pattern (LBP) features with a consistency threshold of 0.8). When the target meets the velocity ratio requirement, has blurred edges, and uniform internal texture, the system generates a translucent gel-like marker, coded as 50. The confidence score is calculated using the following formula: The value range is 0-1.
[0146] The system performs object-level matching between the translucent gelatinous substance marker and existing product internal defect inventory data, based on the target ID. If the target already exists in the inventory but is categorized differently, the system performs a category update, replacing the original category with "translucent gelatinous substance" (type code 50) and updating the hazard level score, calculated using the formula H. 50 =H0 × 1.5, where H0 is the original hazard score, and the multiplier of 1.5 reflects the specific hazard of the gelatinous substance. The system also adds attribute fields specific to gelatinous substances, including optical transparency T (range 0-1, precision 0.01), edge blurring B (range 0-100, precision 0.1), and relative velocity ratio. (Range 0-1, precision 0.001). For newly identified gelatinous targets, the system creates a complete defect record, including standard defect attributes (ID, location, size, timestamp) and gelatinous-specific attributes.
[0147] Preferably, step S4 includes the following steps:
[0148] Step S41: Obtain the current production line speed and the physical distance between the rejection device and the inspection station, and then calculate the rejection execution delay time for the defect rejection task.
[0149] Step S42: Bind the defect removal task to the product's internal defect list data to generate a production line product removal control instruction;
[0150] Step S43: Execute the corresponding defective product rejection control based on the production line product rejection control instruction, and bind the individual defect information of the corresponding defective product to obtain the individual defective product traceability file;
[0151] Step S44: Statistically analyze the traceability files of individual defective products of 100 consecutive rejected products, extract the frequency of defect type and location, and analyze whether there are similar defects with an occurrence frequency of more than 20%. If so, it is determined to be a systemic problem, and the root cause data of systemic defects is obtained.
[0152] Step S45: Identify potential faulty workstations based on the root cause data of systemic defects to provide production process optimization suggestions for upstream processes on the production line to adjust parameters or inspect materials.
[0153] In this embodiment of the invention, the current production line speed is obtained through a high-precision encoder installed on the conveyor belt. The encoder resolution is 0.01 m / pulse, and the sampling frequency is 1000 Hz. The speed value V is smoothed by Kalman filtering, with the filtering parameters set to process noise covariance Q = 0.01 and measurement noise covariance R = 0.1, ensuring a speed measurement accuracy of ±0.5 mm / s. The physical distance D between the rejection device and the inspection station is measured by a laser rangefinder with a distance measurement accuracy of ±0.5 mm and a measured value of 1250 mm. The rejection execution delay time T is calculated using the formula T = D / V + T0, where T0 is the inherent system delay time, including data processing delay (15 ms), control signal transmission delay (5 ms), and actuator response delay (25 ms), totaling 45 ms. For example, when the production line speed V = 0.5 m / s, the rejection execution delay time T = 1.25 / 0.5 + 0.045 = 2.545 seconds.
[0154] Defect rejection tasks are extracted from the real-time database, including product identification codes (QR codes or RFID tags), detection timestamps, and estimated arrival times at rejection points. The product internal defect list data includes detailed defect information (type, location, size) and severity scores. Data binding uses the product identification code as the primary key and is implemented using a hash table, with a query time complexity of O(1). The system generates standardized production line product rejection control instructions, adopting the industrial automation standard protocol format. Each instruction contains five key fields: instruction header (fixed value 0xFFA5), target rejector ID (1-16), trigger time (millisecond precision timestamp), and rejection intensity parameters (levels 1-5). The rejection intensity parameters are determined based on product quality and defect size, and the calculation formula is... Where W represents the product weight (grams) and S represents the maximum defect size (micrometers).
[0155] Upon receiving the product rejection control command from the production line, a high-precision timer with an accuracy of 0.1 milliseconds is immediately activated. The timer's set value is the calculated rejection execution delay time T. When the timer completes, the control unit outputs a control signal through a 24-bit digital-to-analog converter, driving a high-speed solenoid valve (response time less than 5 milliseconds) to open. Compressed air (pressure 0.6MPa) is then sprayed through a nozzle array (5×3 arrangement, 10mm spacing), generating precise rejection force. The rejection process is recorded by a high-speed camera (1000 frames / second), and image processing algorithms verify the success or failure of rejection in real time. The system simultaneously merges the product's internal defect list data, rejection parameters, and execution results into a single-item defect traceability file in XML format. The file includes basic product information (batch number, production date, specifications), defect details (type, quantity, location, size), detection parameters (detection time, equipment used, operator), and processing results (rejection time, rejection method, verification status).
[0156] The system continuously extracts the defect traceability files of the 100 most recently removed products from the database, extracting defect type (heavy impurities, suspended impurities, bubbles, etc.) and defect location data (X, Y, Z values in Cartesian coordinates). Defect type frequency statistics use a histogram method, classifying defects into 12 basic categories, calculating the frequency of each category and dividing by the total number of defects to obtain the percentage frequency. Defect location analysis uses a spatial clustering algorithm, dividing the container space into 8 regions (upper center, upper edge, middle center, middle edge, lower center, lower edge, neck, bottom), and counting the defect frequency in each region. The system performs a chi-square test with a significance level of α = 0.05 to test whether the defect distribution conforms to the random distribution hypothesis. When the frequency of a certain type of defect or a certain region exceeds 20%, and the chi-square test p-value is less than 0.05, the system determines it as a systematic problem and generates root cause data for the systematic defects.
[0157] The systemic defects are attributed to a pre-trained Bayesian network model input into the data. This model contains 87 key workstation nodes on the production line and 204 causal relationship edges. The network structure is constructed using historical production data and expert knowledge. The model calculates the posterior probability P(W) of each workstation node becoming a source of failure. i |E), where W i Let represent the i-th workstation, and E represent the observed defect evidence. The calculation employs a variable elimination algorithm with a complexity of O(n×2^w), where n is the number of nodes and w is the network width. The system identifies workstations with a posterior probability exceeding a threshold of 0.7 as potential faulty workstations, sorting them from highest to lowest probability. For each potential faulty workstation, the system extracts the normal range and current values of relevant process parameters (such as temperature, pressure, speed, and formula ratio) from the knowledge base and calculates the deviation rate. The system generates specific parameter adjustment suggestions based on the defect type-process parameter correlation matrix, with the adjustment amount calculated linearly based on the deviation rate. For material issues, the system provides a detailed checklist, including inspection methods, judgment criteria, and handling measures. The final generated production process optimization suggestion data includes faulty workstation information, specific parameter adjustment suggestions, material inspection requirements, and expected improvement effects, output in structured document format.
[0158] Therefore, the embodiments should be considered as exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of the equivalents of the application are intended to be included within the invention.
[0159] The above description is merely a specific embodiment of the present invention, enabling those skilled in the art to understand or implement the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features of the invention herein.
Claims
1. A defect detection method for intelligent packaging production lines based on image recognition models, characterized in that, Includes the following steps: Step S1: Obtain the geometric shape data of the packaging container and the characteristic data of the liquid product; perform surface defect analysis on the empty packaging container based on the geometric shape data of the packaging container to generate the inherent defect area of the container; wherein, the inherent defect area of the container includes the high curvature distortion area and the inherent defect area. Step S2: After the empty packaging container completes the liquid product packaging operation, intelligent polarized lighting compensation is performed based on the liquid product characteristic data and the inherent defect area of the container, and the disturbance response time-series image sequence is captured simultaneously; a motion image recognition model is constructed, and the motion region is identified in the disturbance response time-series image sequence using the motion image recognition model to obtain a time-series motion region segmentation map; Step S2, which involves intelligent polarized lighting compensation based on the liquid product characteristic data and the inherent defect area of the container, and simultaneous capture of the disturbance response time-series image sequence, includes: Based on the product batch number data in the liquid product characteristic data, the viscosity value, density value, and light transmittance coefficient of the liquid can be retrieved as the liquid physical property characteristic data. Based on the container specification identification data in the liquid product characteristic data, the container material type, wall thickness distribution range, and surface roughness grade are queried as the container physical characteristic data; Based on the liquid physical property data, polarization excitation strategy processing was performed to obtain vibration excitation frequency combination data and transmittance compensation brightness value, respectively. The container's physical property data is processed by polarization light field control parameters through transmittance compensation brightness values to generate polarization light field control feature parameters. These polarization light field control feature parameters include the scattering suppression light source angle matrix, compensated structured light intensity data, and dynamic exposure time parameters. Extract the normal to the high curvature distortion region in the inherent defect region of the container, and then calculate the polarized light incident angle data based on the scattering suppression light source angle matrix; For inherent defect areas in the container's inherent defect region, the polarization direction is adjusted to avoid them, and an adaptive polarization illumination scheme is constructed based on the compensated structured light intensity data. After the empty packaging container completes the liquid product packaging operation, it receives a position confirmation signal of the container entering the production line inspection station and obtains the container's positioning status data. Based on the container's in-situ state data, an adaptive polarization illumination scheme is used to drive a light source array to illuminate the container with a polarized light field. At the same time, a piezoelectric ceramic array is used to execute vibration excitation frequency combination data to generate controlled disturbances in the liquid inside the container, thus obtaining a controlled liquid disturbance state. Under controlled liquid disturbance conditions, dynamic capture is performed continuously for 250 milliseconds using a high-speed camera based on dynamic exposure time parameters to generate a disturbance response time-series image sequence. Step S2 involves constructing a motion image recognition model and using this model to identify moving regions within the disturbance response time-series image sequence, including: Acquire a standard defect sample image set containing impurity samples of known type, size and location, as well as a clean background image set free of any impurities; Optical flow calculations were performed on each frame of the standard defect sample image set and the clean background image set to obtain sample optical flow icon annotation data; A motion image recognition model is obtained by training a convolutional neural network based on sample optical flow icon annotation data. The disturbance response time-series image sequence is input into the motion image recognition model, which intelligently identifies and segments regions with independent motion patterns to obtain a time-series motion region segmentation map. Step S3: Extract dynamic target motion vector data based on the temporal motion region segmentation map; detect internal and external packaging impurities and defects based on the dynamic target motion vector data to obtain a product internal defect list; the detection of internal and external packaging impurities and defects in step S3 includes: Based on the dynamic target motion vector data, it is determined to be an external attachment identification label and an internal defect identification label; When a label is identified as having external attachments, a cleaning recommendation signal is generated and sent to the terminal device; When the label is for internal defects, the velocity component in the vertical direction after the vibration stops is extracted from the dynamic target motion vector data to obtain the target settlement velocity value. Threshold judgment is performed on the target settling velocity value. If the velocity is greater than 1.5 mm / s, it is marked as heavy impurity; if the velocity is less than 0, it is marked as benign bubble; otherwise, it is marked as suspended impurity, generating preliminary defect classification labeling data. For targets marked as heavy impurities and suspended impurities in the preliminary defect classification and labeling data, the size is calculated based on the maximum pixel area in the temporal motion region segmentation map and the preset object distance parameter to obtain the estimated defect size data. Targets smaller than 5 micrometers in the estimated defect size data are removed, and targets with benign bubble marks are filtered out to obtain valid defect confirmation information; The preliminary defect classification and labeling data is linked with the valid defect confirmation information to form an internal product defect list data; Step S4: When the internal defect list data of the product is not empty, generate a defect removal task; execute the corresponding defect product removal control according to the defect removal task, and then perform defect station identification on the production line to achieve defect process optimization in the upstream process of the production line.
2. The defect detection method for intelligent packaging production lines based on image recognition models according to claim 1, characterized in that, Step S1 includes the following steps: Step S11: Classify round containers, square containers, and irregularly shaped containers based on the geometric shape data of the packaging containers to obtain container shape classification data; Step S12: When the container shape classification data is a circular container, set the radial scanning mode with the shoulder area of the container as the key detection target; when the container shape classification data is a square container, set the corner point encryption scanning mode with the corner area of the container as the key detection target; when the container shape classification data is an irregularly shaped container, identify the geometric contour of the container and set the adaptive path scanning mode. Step S13: Construct an adaptive scanning strategy based on the radial scanning mode, the corner point encryption scanning mode, and the adaptive path scanning mode; Step S14: Based on the adaptive scanning strategy, use a 3D structured light scanner to perform adaptive shape scanning on the empty packaging container to obtain the 3D point cloud data of the container; Step S15: Perform surface fitting on the container's 3D point cloud data and calculate the container wall thickness change rate to identify high curvature distortion areas where the container wall thickness change rate exceeds 5% or the curvature radius is less than 20mm. Step S16: Identify the depressions, damages, and label-occluded areas on the container surface based on the container's 3D point cloud data to obtain the inherent defect areas.
3. The defect detection method for intelligent packaging production lines based on image recognition models according to claim 1, characterized in that, Polarization excitation strategy processing based on liquid physical property data includes: Based on the viscosity value of the liquid in the liquid physical property data, a threshold judgment is made. When the viscosity value is less than 100 mPa·s, a longitudinal excitation configuration with a frequency of 75 Hz and an amplitude of 0.2 mm is generated to obtain high-frequency excitation waveform data; otherwise, a cyclotron excitation configuration with a frequency of 15 Hz and an amplitude of 1.0 mm is generated to obtain cyclotron excitation waveform data. A basic excitation mode strategy is constructed based on high-frequency excitation waveform data and cyclone excitation waveform data. The ratio of density to viscosity in the liquid's physical property data is calculated to obtain the liquid's inertial damping ratio. The excitation frequency of the basic excitation mode strategy is optimized by using the liquid inertia damping ratio to generate a dynamically optimized excitation frequency. By combining the dynamically optimized excitation frequency with the basic excitation mode strategy, vibration excitation frequency combination data is obtained. The light source brightness adjustment value is calculated based on the light transmittance coefficient in the liquid's physical property data to compensate for the light attenuation in the liquid. The light transmittance compensation brightness value is obtained; for every 0.05 decrease in the light transmittance coefficient, the light source brightness increases by 3%.
4. The defect detection method for intelligent packaging production lines based on image recognition models according to claim 1, characterized in that, The polarization field control parameter processing of container physical property data through transmittance compensation brightness value includes: The optimal polarization angle is extracted based on the container material type in the container physical property data to suppress surface specular reflection of the material to the greatest extent, thus obtaining the material-optimized polarization reference angle. By optimizing the polarization reference angle of the material based on the surface roughness level, a scattering suppression light source angle matrix is obtained. The optical path difference between the thinnest and thickest regions of the container wall is calculated based on the wall thickness distribution range in the container's physical property data. Then, an additional light intensity gain coefficient is calculated for the region with the thickest container wall. The packaging container structure is compensated based on the light intensity gain coefficient and the transmittance compensation brightness value to generate compensated structural light intensity data. Dynamic exposure time parameters are set by dynamically optimizing the excitation frequency based on the vibration excitation frequency combination data.
5. The defect detection method for intelligent packaging production lines based on image recognition models according to claim 1, characterized in that, Step S3, which involves extracting dynamic target motion vector data based on the temporal motion region segmentation map, includes: Pixel-level temporal median filtering is performed on the first 20 frames of the temporal motion region segmentation map to obtain a dynamically stable background reference frame. The pixel-level grayscale values of two consecutive frames in the temporal motion region segmentation map are subtracted, and the absolute change in grayscale value is greater than 20 as a threshold to extract the binarized dynamic pixel map. Clustering connected pixels with a spatial distance of less than 5 pixels in the binarized dynamic pixel image yields a dynamic target pixel set. Gaussian mixture foreground probability calculation is performed on the dynamic target pixel set in the temporal motion region segmentation map based on the dynamic stable background reference frame, and pixels with foreground probability exceeding the threshold of 0.7 are marked as motion points to obtain temporal foreground pixel mask data. Morphological closing operations are performed on each frame of the temporal foreground pixel mask data to fill the holes inside the moving target and connect the broken parts, thereby obtaining an optimized moving target region set. Based on the optimized moving target region set, the global nearest neighbor algorithm is used to track the region centroid between consecutive frames, and the coordinates of all successfully associated centroids are connected into a path to obtain the original tracking path data chain; Based on the original tracking path data chain, differential processing is performed in the time dimension to calculate the velocity and acceleration at the center of mass position, thereby generating dynamic target motion vector data.
6. The defect detection method for intelligent packaging production lines based on image recognition models according to claim 1, characterized in that, Step S4 includes the following steps: Step S41: Obtain the current production line speed and the physical distance between the rejection device and the inspection station, and then calculate the rejection execution delay time for the defect rejection task. Step S42: Bind the defect removal task to the product's internal defect list data to generate a production line product removal control instruction; Step S43: Execute the corresponding defective product rejection control based on the production line product rejection control instruction, and bind the individual defect information of the corresponding defective product to obtain the individual defective product traceability file; Step S44: Statistically analyze the traceability files of individual defective products of 100 consecutive rejected products, extract the frequency of defect type and location, and analyze whether there are similar defects with an occurrence frequency of more than 20%. If so, it is determined to be a systemic problem, and the root cause data of systemic defects is obtained. Step S45: Identify potential faulty workstations based on the root cause data of systemic defects to provide production process optimization suggestions for upstream processes on the production line to adjust parameters or inspect materials.
7. A defect detection system for an intelligent packaging production line based on an image recognition model, characterized in that, For executing the image recognition model-based intelligent packaging production line defect detection method as described in claim 1, the image recognition model-based intelligent packaging production line defect detection system comprises: The packaging container pre-analysis module is used to acquire packaging container geometric data and liquid product characteristic data; based on the packaging container geometric data, it performs surface defect analysis on empty packaging containers to generate inherent defect areas of the container; among which, the inherent defect areas of the container include high curvature distortion areas and inherent defect areas; The dynamic image acquisition module is used to perform intelligent polarization illumination compensation based on liquid product characteristic data and inherent defect areas of the container after the empty packaging container has completed the liquid product packaging operation, and simultaneously captures a time-series image sequence of disturbance response; it constructs a motion image recognition model and uses the motion image recognition model to identify motion regions in the time-series image sequence of disturbance response, obtaining a time-series motion region segmentation map; the intelligent polarization illumination compensation based on liquid product characteristic data and inherent defect areas of the container, and the simultaneous capture of the time-series image sequence of disturbance response include: Based on the product batch number data in the liquid product characteristic data, the viscosity value, density value, and light transmittance coefficient of the liquid can be retrieved as the liquid physical property characteristic data. Based on the container specification identification data in the liquid product characteristic data, the container material type, wall thickness distribution range, and surface roughness grade are queried as the container physical characteristic data; Based on the liquid physical property data, polarization excitation strategy processing was performed to obtain vibration excitation frequency combination data and transmittance compensation brightness value, respectively. The container's physical property data is processed by polarization light field control parameters through transmittance compensation brightness values to generate polarization light field control feature parameters. These polarization light field control feature parameters include the scattering suppression light source angle matrix, compensated structured light intensity data, and dynamic exposure time parameters. Extract the normal to the high curvature distortion region in the inherent defect region of the container, and then calculate the polarized light incident angle data based on the scattering suppression light source angle matrix; For inherent defect areas in the container's inherent defect region, the polarization direction is adjusted to avoid them, and an adaptive polarization illumination scheme is constructed based on the compensated structured light intensity data. After the empty packaging container completes the liquid product packaging operation, it receives a position confirmation signal of the container entering the production line inspection station and obtains the container's positioning status data. Based on the container's in-situ state data, an adaptive polarization illumination scheme is used to drive a light source array to illuminate the container with a polarized light field. At the same time, a piezoelectric ceramic array is used to execute vibration excitation frequency combination data to generate controlled disturbances in the liquid inside the container, thus obtaining a controlled liquid disturbance state. Under controlled liquid disturbance conditions, dynamic capture is performed continuously for 250 milliseconds using a high-speed camera based on dynamic exposure time parameters to generate a disturbance response time-series image sequence. A motion image recognition model is constructed, and this model is used to identify moving regions within the disturbance response time-series image sequence, including: Acquire a standard defect sample image set containing impurity samples of known type, size and location, as well as a clean background image set free of any impurities; Optical flow calculations were performed on each frame of the standard defect sample image set and the clean background image set to obtain sample optical flow icon annotation data; A motion image recognition model is obtained by training a convolutional neural network based on sample optical flow icon annotation data. The disturbance response time-series image sequence is input into the motion image recognition model, which intelligently identifies and segments regions with independent motion patterns to obtain a time-series motion region segmentation map. The defect feature detection module is used to extract dynamic target motion vector data based on the time-series motion region segmentation map; and to detect internal and external impurity defects based on the dynamic target motion vector data to obtain product internal defect list data. The production line defect control module generates a defect removal task when the internal defect list data of a product is not empty; it executes the corresponding defective product removal control according to the defect removal task, and then identifies the defective workstations on the production line to achieve defect process optimization in the upstream process of the production line.