Punching liquid foreign matter detection method based on image processing

By constructing an inertial differential flow field in the stamping fluid detection section and combining it with image processing algorithms to calculate the dynamic slip probability and visual morphology probability, the problems of bubble interference and metal omission detection are solved, achieving high-precision foreign object detection and reducing operation and maintenance costs.

CN122016849AInactive Publication Date: 2026-05-12GUANGZHOU DURANG MEDIA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
GUANGZHOU DURANG MEDIA TECH CO LTD
Filing Date
2026-01-29
Publication Date
2026-05-12
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing online visual inspection technologies have difficulty effectively distinguishing between bubbles and metal in stamping fluids, have a high rate of missed detection for translational states and dark metals, and are difficult to adjust parameters, leading to mold damage and product scrap.

Method used

By constructing an inertial differential flow field in the detection section and combining it with image processing algorithms, the dynamic slip probability and visual morphological probability of candidate targets are calculated. By utilizing fluid dynamics principles and visual morphological feature extraction, multi-dimensional feature extraction and adaptive judgment of foreign objects are achieved, reducing the dependence on hard thresholds.

Benefits of technology

It improves the robustness and accuracy of foreign object detection in stamping fluid, reduces operation and maintenance costs, and ensures mold safety and product quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122016849A_ABST
    Figure CN122016849A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image processing and industrial detection, in particular to a punching liquid foreign matter detection method based on image processing. The method comprises the following steps: arranging a bent flow channel unit at a detection section to construct an inertia differentiation flow field, acquiring a grayscale image sequence of stamping liquid in the inertia differentiation flow field, preprocessing, and extracting an independent motion area as a candidate target; calculating an actual velocity vector of the reference velocity vector field and the candidate target; calculating the dynamic slip probability according to the deviation between the actual velocity vector and the corresponding position in the reference velocity vector field; calculating a visual form probability according to the contour curvature entropy, the brightness variation coefficient and the shape factor of the candidate target; and carrying out fusion calculation on the dynamic slip probability and the visual form probability to obtain a final foreign matter confidence coefficient. According to the method, the fluid sorting principle based on density is combined with machine visual feature extraction, the metal foreign matter is effectively recognized, bubble interference is reduced, and the detection precision is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of image processing and industrial inspection technology, specifically to a method for detecting foreign matter in stamping fluid based on image processing. Background Technology

[0002] In stamping processes in high-end manufacturing fields such as automobile manufacturing and aerospace, the cleanliness of the stamping fluid circulation loop is directly related to the service life of the mold and the surface quality of the workpiece. Metal debris mixed in the stamping fluid is the main cause of mold damage and product scrap. Therefore, achieving online and accurate detection of metal foreign objects has important industrial value.

[0003] Currently, existing online visual inspection technologies face three major challenges: First, bubble interference. The numerous bubbles in the stamping fluid produce specular reflections that appear as grayscale values ​​extremely similar to metallic luster in the image, leading to a very high false alarm rate for traditional brightness-based detection algorithms. Second, the problem of motion stillness. Studies show that about 30% of metal debris maintains a translational, non-tumbling posture in the fluid, meaning these foreign objects have neither flashing characteristics nor obvious shape changes, making them highly susceptible to missed detection. Third, metal under-detection. Some long-circulating metal foreign objects have severely oxidized and blackened surfaces, exhibiting almost no reflective properties, with a flashing degree close to 0. These dark foreign objects are easily judged as background and under-detected in traditional detection algorithms that require simultaneous shape, flashing, and tumbling characteristics. Fourth, difficulty in parameter tuning. Existing algorithms typically rely on weighted summation to integrate multiple features, and the weighting coefficients require repeated adjustments by on-site engineers based on experience, lacking environmental universality.

[0004] In summary, existing technologies lack a foreign object detection solution that can simultaneously address issues such as bubble interference, missed metal detection, and difficulty in parameter adjustment. Summary of the Invention

[0005] To address the problems in existing technologies, such as the inability to effectively distinguish between bubbles and metal, high false negative rates for translational and dark metals, and reliance on manual parameter adjustment based on experience, this invention provides an image processing-based method for detecting foreign objects in stamping fluids. This method includes: A curved flow channel unit is set up in the detection section to construct an inertial differential flow field. A coaxial light source is set on one side of the curved flow channel unit, and an image acquisition device is set on the other side to acquire a grayscale image sequence of the stamping fluid under the inertial differential flow field and perform preprocessing to obtain independent motion regions as candidate targets. The actual velocity vector of the candidate target is calculated, and a reference velocity vector field corresponding to the inertial differential flow field is obtained. Based on the deviation between the actual velocity vector and the velocity vector at the location of the candidate target in the reference velocity vector field, the dynamic slip probability of the candidate target is calculated. The contour curvature entropy, brightness variation coefficient, and shape factor of the candidate target are extracted. Based on the contour curvature entropy, brightness variation coefficient, and shape factor, the visual morphological probability of the candidate target is calculated. Based on the dynamic slip probability and the visual morphological probability, the final foreign object confidence of the candidate target is calculated. The final foreign object confidence is compared with a preset judgment threshold, and the foreign object detection result is output.

[0006] This invention establishes a foreign object detection mechanism based on physical sorting and visual recognition by constructing an inertial differentiated flow field in the detection section and combining it with image processing algorithms. The core of this mechanism lies in introducing a dynamic slip probability based on fluid dynamics principles, causing foreign objects with mass to deviate in velocity relative to the background flow field. This allows for the identification of foreign objects that are easily missed in traditional pure visual detection, such as non-reflective metals with oxidized surfaces. Simultaneously, by combining visual morphological probability, multi-dimensional feature extraction is performed on the target's contour curvature entropy, brightness, and shape factor to distinguish between bright bubbles and metallic foreign objects. Through the comprehensive calculation of these two probabilities, this invention effectively improves the robustness and accuracy of foreign object detection in stamping fluids without relying on a single threshold judgment, achieving accurate detection of foreign objects of different materials and surface conditions.

[0007] Furthermore, the dynamic slip probability satisfies the following relationship:

[0008] in, The dynamic slip probability; The actual velocity vector; The velocity vector of the candidate target at the corresponding position in the reference velocity vector field; It is the Euclidean norm; These are the preset normalization parameters; It is the hyperbolic tangent function.

[0009] This invention utilizes the saturation characteristics of the hyperbolic tangent function to implement an adaptive judgment mechanism, avoiding the jitter problem near the critical value in traditional hard threshold judgment. At the same time, it normalizes the velocity deviation values ​​of different dimensions to a standard probability between 0 and 1, which facilitates subsequent multimodal data fusion.

[0010] Furthermore, the visual morphological probability satisfies the following relationship:

[0011] in, The probability of the visual morphology; The entropy of the contour curvature; The brightness variation coefficient; The shape factor; It is the natural logarithm function; It is the hyperbolic tangent function.

[0012] This invention utilizes the near-circular geometric properties of bubbles and introduces the natural logarithm function to mathematically reduce the probability of the visual shape of bubbles to near zero. This design effectively suppresses bubble interference and improves the accuracy of detection results.

[0013] Furthermore, the final foreign object confidence level satisfies the following relationship:

[0014] in, The final foreign object confidence level; The dynamic slip probability, The probability of the visual morphology is given.

[0015] This invention utilizes the concept of union in probability theory to calculate the final foreign object confidence score. As long as the candidate target exhibits obvious dynamic slip characteristics or visual morphological characteristics, the final foreign object confidence score will be high, effectively compensating for the limitations of a single feature under extreme conditions and ensuring the completeness of the detection results.

[0016] Furthermore, the normalization parameter is comprehensively calibrated through a statistical optimization experiment based on real samples.

[0017] Furthermore, the curved flow channel unit is specifically an S-shaped hyperbolic transparent pipe with a nonlinear flow channel structure.

[0018] Furthermore, the reference velocity vector field is obtained by performing fluid dynamics simulation on the geometric model of the curved flow channel unit.

[0019] This invention uses fluid dynamics simulation to obtain a reference velocity vector field, which can obtain the theoretical velocity vector of a fluid particle at any coordinate in the field of view under ideal conditions, and can make the calculated velocity deviation between the candidate target and the inertial differential flow field more accurate.

[0020] Furthermore, the shape factor is calculated based on the perimeter and area of ​​the candidate target.

[0021] Furthermore, the foreign object detection results include: If the final foreign object confidence level is greater than the determination threshold, then the candidate target is determined to be a metallic foreign object and an alarm signal is generated; If the final foreign object confidence level is less than or equal to the determination threshold, then the candidate target is determined to be a non-metallic foreign object.

[0022] Furthermore, the preprocessing includes: establishing a static background model of the curved flow channel unit, obtaining a foreground motion mask based on the difference between the grayscale image sequence and the static background model, and performing connected component analysis on the foreground motion mask to obtain the candidate target.

[0023] The present invention has the following technical effects: This invention differs from traditional detection methods that rely on image texture. By introducing a centrifugal force field through a curved flow channel, the mass properties of foreign objects are transformed into velocity slip features that can be captured by the image. That is, the huge density difference between metal and liquid is used for sorting, thereby enabling the detection of dark metals that are severely oxidized and almost invisible in the image. This effectively solves the problem of traditional optical detection being overly dependent on lighting conditions and material reflectivity. This invention utilizes mathematical principles to suppress circular bubbles, achieving adaptive filtering of interference from bright bubbles; simultaneously, it employs an additive aggregation and union fusion strategy to effectively identify the morphology of foreign objects, capturing both small metal shavings drifting with the current and large, rapidly sliding foreign particles. This invention has high engineering application value and universality. It obtains the reference velocity vector field through fluid dynamics simulation and adapts to different flow velocities through normalized parameters, effectively reducing the dependence on manual parameter adjustment. The entire detection process does not rely on expensive X-ray or ultrasonic equipment. High-precision online monitoring can be achieved solely with industrial cameras and algorithm design, reducing the operation and maintenance costs of precision stamping production lines and providing strong support for ensuring mold safety and product quality. Attached Figure Description

[0024] Figure 1 This is a flowchart of the foreign object detection method for stamping fluid based on image processing provided in the embodiments of the present invention; Figure 2This is a schematic diagram of the foreign object sorting principle based on inertial differences provided in an embodiment of the present invention. Detailed Implementation

[0025] This invention provides a method for detecting foreign objects in stamping fluid based on image processing. (See reference...) Figure 1 This includes steps S1-S4: S1: Data Acquisition and Preprocessing.

[0026] Specifically, an inertial differential flow field environment capable of generating centrifugal force is constructed in the stamping fluid circulation loop. Grayscale image sequences are acquired using a high-speed vision sensor. Independent motion regions are extracted as candidate targets through background modeling and motion segmentation algorithms. At the same time, a reference velocity vector field is obtained through fluid dynamics simulation.

[0027] 1. Constructing an inertial differentiated flow field environment (1) Install a curved flow channel unit in the detection section of the stamping fluid circulation loop. In this embodiment, an S-shaped double curvature transparent pipe with a nonlinear flow channel structure is selected as the curved flow channel unit. The pipe material is selected as high light transmittance quartz glass to reduce optical distortion. (2) The flow rate of the stamping fluid in the curved flow channel unit is controlled by a variable frequency pump. In this embodiment, the flow rate is controlled at 1.5m / s-3m / s. At this flow rate, the stamping fluid will form an obvious pressure gradient field when it flows through the curved path. (3) The density of the metallic foreign object is approximately 7.8 g / cm³. 3 The density of the stamping fluid is approximately 1 g / cm³. 3 As can be seen, the density of the metallic foreign object is much greater than that of the stamping fluid, which in turn causes the centripetal force required for the metallic foreign object to maintain its curved motion to be much greater than the force that the fluid pressure can provide. This causes the metallic foreign object to slide laterally away from the streamline due to its huge centrifugal inertia. Meanwhile, the density of the bubble is close to 0, and it is mainly dominated by the fluid viscosity force and follows the streamline closely. The difference in the physical motion trajectory of the two is the basis for subsequent algorithm recognition.

[0028] 2. Image sequence acquisition To effectively capture the changes in reflective luster on the metal surface caused by tumbling, as well as the specular reflection characteristics of the bubble surface, this embodiment sets a coaxial light source on one side of the curved flow channel unit and an image acquisition device on the other side. This embodiment uses a high frame rate industrial camera equipped with a global shutter CMOS sensor and a telecentric lens to capture grayscale image sequences. The sampling frequency is set to 200fps (f), and the exposure time is 50μs to ensure that the target outline captured in the high-speed fluid environment is clear and free of ghosting. The acquired grayscale image sequences are transmitted to the image processing unit in real time.

[0029] 3. Candidate Target Extraction The acquired grayscale image sequence is preprocessed to separate moving objects from a complex fluid background. The specific steps are as follows: (1) Background modeling: The static background inside the curved flow channel unit is modeled using the Gaussian mixture model to obtain the static background model. Since the inner wall of the curved flow channel unit may have fixed stains or reflections, the Gaussian mixture model can automatically learn and filter these static disturbances through time accumulation. (2) Foreground segmentation: Calculate the difference map between the current frame image and the static background model. In this embodiment, the Otsu method is used to perform adaptive threshold segmentation on the difference map to obtain the foreground motion mask. (3) Connected component analysis: Morphological opening operation is performed on the foreground motion mask to remove high-frequency noise, and then connected component marking is performed to calculate the pixel area of ​​each independent connected component. In this embodiment, the area threshold is set to 5 pixels, and independent connected regions with an area greater than the threshold are extracted and marked as candidate targets.

[0030] 4. Construction of the reference velocity vector field Since the stamping fluid is almost transparent, its flow velocity cannot be calculated directly. Therefore, it is necessary to construct a reference velocity vector field in advance through fluid dynamics simulation. In this embodiment, the tracer particle image velocimetry method is used for construction. The specific steps are as follows: (1) Injection of tracer particles: During the offline commissioning phase of the equipment, 1 g / cm³ of tracer particles are injected into the pure stamping fluid in the curved flow channel unit. 3 Polystyrene fluorescent microspheres with a diameter of 35 μm were used as tracer particles; (2) Start the circulating pump, adjust the flow rate of the pressurizing fluid to 2 m / s, and use the above-mentioned high frame rate industrial camera to continuously acquire image sequences containing tracer particles for 10 seconds. (3) Take 16×16 pixels as a grid, divide the acquired image into grids, and calculate the average value of the velocity vector of all tracer particles passing through each grid to obtain the reference velocity vector of the grid; finally, generate the reference velocity vector mapping table of the entire curved flow channel unit, which is denoted as the reference velocity vector field.

[0031] It should be noted that the specific hardware selection and parameter settings mentioned above are only preferred embodiments of the present invention and should not be construed as limiting the scope of protection of the present invention. For example, the curved flow channel unit is not limited to the S-shaped flow channel; any nonlinear flow channel structure that can generate a centrifugal force field, such as a spiral flow channel, a U-shaped flow channel, or a cyclone structure, can achieve the purpose of the present invention. The image acquisition device is not limited to a monocular industrial camera; a line scan camera or a binocular stereo vision camera is also applicable. In addition to using the tracer particle method, the reference velocity vector field can also be constructed based on the three-dimensional CAD model of the flow channel through a series of calculations. Any technical solution that utilizes the difference in fluid inertia combined with image processing for foreign object detection based on the concept of the present invention should be included within the scope of protection of the present invention.

[0032] S2: Calculation of dynamic slip probability.

[0033] Specifically, the optical flow tracing algorithm is used to calculate the actual velocity vector of the candidate target, and the deviation of the target relative to the ideal fluid is calculated by combining the reference velocity vector field. Finally, the physical deviation is mapped to the dynamic slip probability through a nonlinear activation function.

[0034] It should be noted that, since the density of metal is much greater than that of liquid, it will slip outward from the streamline due to centrifugal force at the bend, while the bubble follows the streamline. The so-called dynamic slip probability is essentially an assessment of the degree of deviation of the velocity vector caused by this mass difference.

[0035] 1. Calculate the actual velocity vector of the candidate target: Perform inter-frame motion tracking on the candidate target; This embodiment adopts the sparse streamer method, specifically the pyramid implementation of the Lucas-Kanade algorithm to adapt to the target displacement under different flow velocities; It should be noted that although calculating instantaneous velocity theoretically only requires two frames of images, considering the noise interference in industrial fluid environments, the actual velocity vector calculated solely from two adjacent frames is prone to jitter. Therefore, this embodiment employs a sliding window trajectory fitting strategy to smooth the acquired image sequence. The specific steps are as follows: (1) Feature point selection: Select the geometric centroid within the candidate target as the tracking feature point; (2) Trajectory extraction: Construct a sliding window of length N. In this embodiment, N=5. Use the sparse optical flow method to track the continuous position coordinate sequence of the tracking feature points of the candidate target within the interactive window. (3) Optical flow calculation: Based on the assumption of constant brightness, the state is estimated by least squares linear fitting of the coordinate sequence to obtain the smoothed displacement vector at the current time. The unit is pixels; (4) Velocity calculation: Combined with the sampling frequency f, calculate the actual velocity vector of the candidate target. The unit is pixels per second.

[0036] It can be seen that by smoothing the multi-frame image sequence, instantaneous velocity measurement noise caused by illumination fluctuations or fluid micro-turbulence is effectively filtered out, ensuring accuracy. It reflects the motion trend of the target's true geometric center of mass.

[0037] 2. Obtain the reference velocity vector: Based on the centroid position of the candidate target in the current frame image, index it in the reference velocity vector field; it should be noted that at this time, the unit of all vector data in the pre-stored reference velocity vector field is also pre-unified to pixels / second; this embodiment uses bilinear interpolation to calculate the arithmetic mean of the reference velocity vectors of the four grid points around the centroid position, and obtains the velocity vector of the candidate target at the corresponding position in the reference velocity vector field, which is denoted as the reference velocity vector.

[0038] 3. The relationship between the dynamic slip probability and the following formula is given:

[0039] in, This represents the dynamic slip probability; This is the actual velocity vector; The reference velocity vector; It is the Euclidean norm; These are the preset normalization parameters; It is the hyperbolic tangent function; The deviation of the candidate target's velocity vector from the reference velocity vector.

[0040] It can be seen that when Item less than When, the dynamic slip probability increases linearly; when Item greater than At that time, the dynamic slip probability increases rapidly and approaches 1; although It is an instantaneous probability calculated in real time for each frame of the image, but due to its input data It has been smoothed, therefore It also possesses temporal stability.

[0041] It should be noted that, This was obtained through a microbubble turbulence perturbation calibration experiment, and the specific steps are as follows: (1) Inject standard microbubbles into the pure stamping fluid and adjust the flow rate to 3 m / s; (2) Collect the motion trajectory of microbubbles and calculate the instantaneous transverse pulsation velocity of all microbubbles relative to the reference streamline, i.e. the non-inertial slip caused by fluid turbulence; (3) Statistically analyze the Gaussian distribution characteristics of the instantaneous transverse pulsation velocity, and take the 99th percentile of three times the standard deviation as the preset normalization parameter. ; This represents the maximum random perturbation velocity that a non-metallic object may produce in the current fluid environment. Any deviation in velocity exceeding this value is considered a maximum. This can be statistically determined to be significant inertial slip. In this embodiment, The value is 0.05 m / s.

[0042] Figure 2 This is a schematic diagram of the foreign object sorting principle based on inertial difference provided in this embodiment of the invention. As shown in the figure, since the density of the bubble is much smaller than that of the pressurized fluid, the fluid pressure it experiences is greater than the centrifugal force. Therefore, the bubble tends to follow the streamline or deviate towards the inner arc side of the bend. Its trajectory is highly coincident with the central streamline of the curved flow channel unit, exhibiting extremely low slippage. Since the density of the metal foreign object is much larger than that of the pressurized fluid, its inertia is greater. When flowing through the bend, the metal foreign object cannot change direction quickly and is thrown towards the outer arc side of the curved flow channel unit, i.e., the side away from the center of curvature, under the action of centrifugal force.

[0043] It should be noted that the above calculation model and parameter acquisition method have a certain degree of scalability; for example, the actual velocity vector can also be calculated by smoothing and predicting multiple frames of images using Kalman filtering. It can be replaced with the Sigmoid function or a piecewise linear function; It can also be designed as a function that changes dynamically with the flow rate to adapt to variable frequency flow conditions; these variations based on the core idea of ​​this invention should all fall within the protection scope of this invention.

[0044] S3: Visual morphology probability calculation.

[0045] Specifically, the spatiotemporal visual features of the candidate target within the sliding window are extracted, and the contour curvature entropy, brightness variation coefficient, and shape factor of the candidate target are calculated, thereby calculating the visual morphological probability.

[0046] It should be noted that bubbles are round due to surface tension, while metallic foreign objects are usually irregular in shape. Visual morphology probability utilizes this characteristic to exclude regular round bubbles through geometric and textural features, while retaining irregularly shaped or rough-surfaced metallic foreign objects.

[0047] 1. Extracting Tumble Feature: Tumble reflects the degree of geometric change of the candidate target during motion. In the acquired images, bubbles maintain a spherical or ellipsoidal shape due to surface tension, resulting in a relatively stable profile. However, metallic foreign objects, especially sheet-like or irregular debris, undergo significant changes in profile when tumble within curved flow channel units. Based on this, this implementation evaluates this feature by calculating the profile curvature entropy of the candidate target. The specific steps are as follows: (1) Contour extraction: Using the image sequence and sliding window collected in the experiment of calculating the actual velocity vector of the candidate target in S2, extract the edge contour point set of the candidate target for each frame of the image within the sliding window; (2) Curvature entropy calculation: For the contour of a candidate target in a certain frame, calculate the curvature of each point on the contour to obtain the curvature distribution histogram, and calculate the information entropy of the distribution. The larger the value of the information entropy, the more complex the contour of the candidate target is, such as jagged; the smaller the value of the information entropy, the smoother the contour of the candidate target is. (3) Contour curvature entropy calculation: Calculate the standard deviation of the curvature entropy of the image within the sliding window to obtain the contour curvature entropy, denoted as . ;like A larger value indicates that the contour complexity of the candidate target is constantly changing, i.e., tumbling has occurred; if A value close to 0 indicates that the contour shape of the candidate target remains stable, such as a bubble.

[0048] 2. Extracting Scintillation Features: Scintillation reflects the change in the light reflection characteristics of a candidate target's surface over time; metal surfaces are typically rough and have anisotropic reflective surfaces, producing a flickering effect when tumbling; while bubbles usually exhibit stable projection or specular reflection characteristics; this embodiment evaluates this feature by calculating the brightness variation coefficient of the candidate target, with the specific steps as follows: (1) Brightness statistics: Using the image sequence and sliding window collected in the experiment of calculating the actual velocity vector of the candidate target in S2, calculate the average gray value of the candidate target for each frame of the image in the sliding window to obtain the brightness sequence; (2) Calculation of the coefficient of variation of brightness: The ratio of the standard deviation to the arithmetic mean of the brightness sequence is calculated to obtain the coefficient of variation of brightness, denoted as . This reflects the relative fluctuation in the brightness of the candidate target.

[0049] 3. Shape Factor Calculation: The shape factor is used to distinguish between circular and non-circular candidate targets based on their geometry. In this embodiment, the classic roundness formula is used to calculate the shape factor of the candidate targets in the current frame. ,in Let be the perimeter of the candidate target's outline. Let be the area of ​​the candidate target; for the bubble, since it is an ideal circle, its... The value approaches 1. The value approaches 0; however, for metals, it is a non-circular foreign object. The value is greater than 1. The value is greater than 0, and the more irregular the shape, the larger the value.

[0050] 4. The relationship between visual morphological probabilities is as follows:

[0051] in, For visual morphological probability; The entropy of the contour curvature; The value is the luminance variation coefficient. For shape factor; It is the natural logarithm function; It is the hyperbolic tangent function.

[0052] Based on the additive aggregation mechanism This item is used to solve the problem of missed detection of dark metals: for metals with severely oxidized and blackened surfaces, they reflect almost no light, i.e. Approaching 0, but as long as it tumbles within the curved flow channel unit and has an irregular shape, its... The value is still very large; it can be seen that, through addition logic, as long as either the rolling or blinking feature exists, The value is very large, ensuring the ability to detect dark metals; Based on multiplication gating mechanism This item is used to solve the false alarm problem of bright bubbles: For bright bubbles, although their brightness is high, they may even produce pseudo-flickering due to fluctuations in the light source, i.e. The value is greater than 0, but due to its physical surface tension properties, its shape is always close to a circle, making... Approaching 0, this term is used as a multiplier to lower [the value / value]. The value of is used to effectively suppress bubble interference.

[0053] It should be noted that the above feature extraction algorithm and formula can be adjusted according to actual computing power requirements; for example, the contour curvature entropy can also be replaced by calculating the variance of the aspect ratio of the minimum bounding rectangle of the candidate target; the shape factor can be constructed by calculating other morphological operators such as the eccentricity or compactness of the candidate target. As long as it can satisfy the logic of zero or minimum value corresponding to circular target, it falls within the technical scope of this invention.

[0054] S4: Final foreign object confidence calculation.

[0055] Specifically, the probability union model is used to fuse the dynamic slip probability and the visual morphology probability to obtain the final confidence level reflecting the actual existence of the foreign object. At the same time, a binary judgment is performed according to the preset judgment threshold, and the foreign object detection result is finally output to drive the control system to execute the corresponding action.

[0056] To overcome the limitations of single physical or visual features under specific extreme conditions, this embodiment uses the union formula of independent events in probability theory to construct a fusion model to calculate the final foreign object confidence level. The specific relationship is as follows:

[0057] in, The final foreign object confidence level; For dynamic slip probability, For visual morphological probability.

[0058] The physical significance and technical advantage of using this fusion model in this embodiment lies in achieving logical complementarity across all operating conditions. The specific operating condition deduction is as follows: (1) Condition 1, translational state heavy metals: For a large but smooth metal sheet that maintains translation without tumbling within a curved flow channel unit, due to its large mass and significant inertial slippage, therefore... The value approaches 1; because it does not tumble and has no deformation, its visual features are unclear. The value approaches 0, and the final result is... The value approaches 1, indicating successful detection; (2) Condition 2, dark-colored small metals: For tiny metal shavings with small mass, minimal slippage, and a blackened, non-sparkling surface due to oxidation, they drift with the current and have minimal slippage. The value approaches 0; due to its irregular shape and tumbling, The value approaches 1, and the final result is... The value approaches 1, indicating successful detection; (3) Condition 3, high-brightness bubbles: For air bubbles mixed in the stamping fluid, because of their extremely low density and lack of inertial slippage, The value approaches 0; because its shape is a standard circle, therefore The value approaches 0, and the final result is... The value approaches 0, indicating successful filtering.

[0059] Finally, the final foreign object confidence score of the candidate target is compared with the preset judgment threshold T. If it is greater than the preset judgment threshold, the candidate target is judged to be a metallic foreign object; if it is less than or equal to the preset judgment threshold, the candidate target is judged to be a non-metallic foreign object. When a metallic foreign object is detected, the image processing unit immediately generates an alarm signal. This signal includes the timestamp of the metallic foreign object, its coordinate position within the curved flow channel unit, and its estimated size. In this embodiment, an industrial fieldbus is used to send the alarm signal to the main control PLC of the production line. When the PLC receives the signal, it performs actions such as shutdown protection, automatic switching of bypass filters, or triggering of audible and visual alarms according to a preset strategy to prevent metallic foreign objects from entering the precision mold area. At the same time, the image of the current frame containing the foreign object is stored as evidence for subsequent quality traceability.

[0060] It should be noted that the preset judgment threshold T was comprehensively calibrated through a statistical optimization experiment based on real samples. This experiment aimed to find an optimal segmentation point that minimizes the false alarm rate for air bubbles while ensuring an extremely low false alarm rate for metallic foreign objects. The specific steps are as follows: 1. Construct a benchmark sample library (1) Positive sample: metal foreign object group, a total of 1000 standard metal particles with different materials, sizes, shapes and surface states are prepared. In this embodiment, Q235 steel chips, 6061 aluminum alloy powder and T2 copper particles screened by standard sieve are selected as metal foreign object samples. The particle size range of the samples is uniformly covered from 0.5mm to 5mm. The surface states include the brand new high reflective state after cutting and the oxidized blackened state after 48 hours of salt spray aging treatment. The ratio of the two is 1:1. (2) Negative samples: Interference noise group. A group of air bubbles with a diameter uniformly distributed between 50μm and 2mm was prepared using a microbubble generator. At the same time, black, non-reflective, but low-density nitrile rubber particles worn off from hydraulic seals were obtained as non-metallic interference samples. The bubble concentration was uniformly distributed from sparse (less than 10 per frame) to dense (more than 50 per frame), for a total of 1000 negative samples.

[0061] 2. Collect confidence distribution data (1) The above positive and negative samples were respectively put into the curved flow channel unit, and the flow rate of the stamping fluid was kept at 2m / s; (2) Calculate the final foreign object confidence level for each sample to obtain the positive sample confidence level set and the negative sample confidence level set.

[0062] 3. Threshold Traversal and Evaluation Index Calculation (1) Set a candidate threshold t, with a value range of 0 to 1, and iterate in steps of 0.01; (2) For each candidate threshold, count the number of samples with confidence scores greater than t in the positive sample confidence set, denoted as TP; count the number of samples with confidence scores greater than t in the negative sample confidence set, denoted as FP; count the number of samples with confidence scores less than or equal to t in the positive sample confidence set, denoted as FN; (3) For each candidate threshold, calculate the F1 score. Specifically:

[0063] (4) Drawing A curve showing the change of t, selected The value of t corresponding to the peak value is used as the final preset judgment threshold T value; in this embodiment, T is 0.5. When the on-site hardware environment changes, such as the curvature of the curved flow channel unit changes or the high frame rate industrial camera is replaced, the above process can be repeated to quickly obtain the best threshold adapted to the current environment.

[0064] It should be noted that although this embodiment uses a simple and efficient probabilistic union formula as the fusion strategy, this is not the only implementation method. Where computing power allows, other methods can also be used. and The input feature vector is fed into a support vector machine, logistic regression, or lightweight neural network for classification and decision-making. In addition, the preset decision threshold T is not limited to a fixed value and can be dynamically adjusted according to the production line's preference for false alarm rate and false negative rate. For example, during the mold break-in period, the value of T can be reduced to improve detection sensitivity. All technical solutions that use the dynamic features and visual morphological features provided by this invention for comprehensive judgment are within the protection scope of this invention.

Claims

1. A method for detecting foreign objects in stamping fluid based on image processing, characterized in that, include: A curved flow channel unit is set in the detection section to construct an inertial differential flow field. A coaxial light source is set on one side of the curved flow channel unit and an image acquisition device is set on the other side to acquire grayscale image sequences of the stamping fluid under the inertial differential flow field and perform preprocessing to obtain independent motion regions as candidate targets. Calculate the actual velocity vector of the candidate target, obtain the reference velocity vector field corresponding to the inertial differential flow field, and calculate the dynamic slip probability of the candidate target based on the deviation between the actual velocity vector and the velocity vector at the location of the candidate target in the reference velocity vector field. Extract the contour curvature entropy, brightness variation coefficient, and shape factor of the candidate target, and calculate the visual morphological probability of the candidate target based on the contour curvature entropy, brightness variation coefficient, and shape factor. Based on the dynamic slip probability and the visual morphology probability, the final foreign object confidence level of the candidate target is calculated, the final foreign object confidence level is compared with a preset judgment threshold, and the foreign object detection result is output.

2. The image processing-based foreign object detection method for stamping fluid according to claim 1, characterized in that, The dynamic slip probability satisfies the following relationship: in, The dynamic slip probability; The actual velocity vector; The velocity vector of the candidate target at the corresponding position in the reference velocity vector field; It is the Euclidean norm; These are the preset normalization parameters; It is the hyperbolic tangent function.

3. The image processing-based foreign object detection method for stamping fluid according to claim 1, characterized in that, The probability of the visual morphology satisfies the following relationship: in, The probability of the visual morphology; The entropy of the contour curvature; The brightness variation coefficient; The shape factor; It is the natural logarithm function; It is the hyperbolic tangent function.

4. The image processing-based foreign object detection method for stamping fluid according to claim 1, characterized in that, The final foreign object confidence level satisfies the following relationship: in, The final foreign object confidence level; The dynamic slip probability, The probability of the visual morphology is given.

5. The image processing-based foreign matter detection method for stamping fluid according to claim 2, characterized in that, The normalization parameter was determined through a statistical optimization experiment based on real samples.

6. The image processing-based foreign matter detection method for stamping fluid according to claim 1, characterized in that, The curved flow channel unit is specifically an S-shaped hyperbolic transparent pipe with a nonlinear flow channel structure.

7. The image processing-based foreign matter detection method for stamping fluid according to claim 1, characterized in that, The reference velocity vector field is obtained by performing fluid dynamics simulation on the geometric model of the curved flow channel unit.

8. The image processing-based foreign matter detection method for stamping fluid according to claim 1, characterized in that, The shape factor is calculated based on the perimeter and area of ​​the candidate target.

9. The image processing-based foreign matter detection method for stamping fluid according to claim 1, characterized in that, The foreign object detection results include: If the final foreign object confidence level is greater than the determination threshold, then the candidate target is determined to be a metallic foreign object and an alarm signal is generated; If the final foreign object confidence level is less than or equal to the determination threshold, then the candidate target is determined to be a non-metallic foreign object.

10. The image processing-based foreign matter detection method for stamping fluid according to claim 1, characterized in that, The preprocessing includes: establishing a static background model of the curved flow channel unit, obtaining a foreground motion mask based on the difference between the grayscale image sequence and the static background model, and performing connected component analysis on the foreground motion mask to obtain the candidate target.