A metal processing quality detection method based on machine vision
By acquiring continuous image frames of metal workpieces and combining them with physical mechanism reasoning calculations, abnormal fluctuations in cutting force are inferred, a multi-dimensional quality anomaly feature space is constructed, the diffusion path and area growth rate of defect areas are identified and traced, and a metal processing quality inspection report is generated. This solves the problem that existing technologies cannot capture dynamic change features and achieves multi-dimensional information coverage in the inspection report.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- XINYU XINQUAN EQUIPMENT CO LTD
- Filing Date
- 2026-03-30
- Publication Date
- 2026-07-03
Smart Images

Figure CN122335707A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of metal processing quality inspection technology, and in particular to a metal processing quality inspection method based on machine vision. Background Technology
[0002] Current metal processing quality inspection methods mostly employ offline sampling inspection. Some solutions using machine vision technology only compare the contour dimensions of a single frame image of the metal workpiece, while others directly collect machining parameters such as cutting force and spindle speed through sensors, conducting single-dimensional monitoring of the working condition. In these technologies, the acquisition of continuous image frames only serves static contour determination, failing to form a dynamic contour deviation vector. Abnormal states of cutting force are obtained through direct acquisition, and the spindle speed and feed mechanism status are also determined solely through sensor data, without establishing a deductive correlation between contour deviation, cutting force, and equipment status.
[0003] Existing inspection methods can only determine the final contour defect state of the workpiece, failing to capture the dynamic changes of defects during processing. Directly collected process parameters are easily affected by the processing environment, resulting in limited data accuracy. Single-dimensional data support cannot achieve accurate clustering of abnormal patterns, the time window of anomaly occurrence is difficult to match with the defect evolution process, and inspection reports can only present defect results or single equipment parameters, failing to integrate multi-dimensional abnormal features and dynamic defect evolution information.
[0004] It is necessary to obtain the contour deviation vector based on continuous image frames, and to realize the chain inversion from contour deviation to abnormal fluctuation of cutting force and then to equipment status through physical mechanism reasoning. It is necessary to define the abnormal time window and extract the pixel-level diffusion path and area growth rate of defects in the corresponding image frames. The above features are combined with equipment status data to form an inspection report. Summary of the Invention
[0005] The purpose of this invention is to address the shortcomings of existing technologies by proposing a machine vision-based method for metal processing quality inspection.
[0006] To achieve the above objectives, the present invention adopts the following technical solution: a metal processing quality inspection method based on machine vision, comprising: Collect continuous image frames of a metal workpiece during the processing, and obtain a contour deviation vector based on the continuous image frames; The profile deviation vector is input into a physics-based inference engine, which combines material mechanical parameters and machining parameters to deduce the abnormal cutting force fluctuation curve that causes the profile deviation. Based on the abnormal cutting force fluctuation curve, a state inversion operation is performed to reconstruct the unstable speed state of the machining equipment spindle and the position drift trajectory of the feed mechanism at the corresponding moment. By combining the contour deviation vector, the abnormal fluctuation curve of the cutting force, and the unstable rotational speed, a multi-dimensional quality anomaly feature space is constructed. In the multi-dimensional quality anomaly feature space, cluster analysis is used to identify quality anomaly patterns that deviate from normal operating conditions. For each identified quality anomaly pattern, trace its start and end frames in the continuous image frame sequence to determine the time window in which the anomaly occurred. Based on the image frame sequence within the time window, the pixel-level diffusion path and area growth rate of the defect region are extracted; A metal processing quality inspection report is generated based on the pixel-level diffusion path, the area growth rate, and the equipment status data obtained from the state inversion.
[0007] As a further aspect of the present invention, obtaining the contour deviation vector based on the continuous image frames includes: The continuous image frames contain texture changes and edge contour information of the workpiece surface; The continuous image frames are subjected to grayscale processing and histogram equalization to enhance the contrast of defective areas in the image; The geometric contour of the workpiece in the continuous image frames is extracted using an edge detection operator and compared with the ideal contour model of a standard workpiece to calculate the contour deviation vector. Performing grayscale conversion and histogram equalization on the continuous image frames to enhance the contrast of defective regions in the image includes: Read the raw color space data of the consecutive image frames and convert it into a single-channel grayscale image; Calculate the grayscale histogram distribution of the grayscale image to identify regions with concentrated grayscale values and narrow dynamic range; A contrast-limited adaptive histogram equalization algorithm is used to locally stretch the low-contrast regions in the grayscale image. The processed grayscale image is compared with the original grayscale image by performing a difference operation, and the grayscale abrupt change region is extracted as a suspected defect candidate region. Morphological closing operations are performed on the suspected defect candidate regions to fill the internal micro-holes and smooth the edges, resulting in preprocessed image data. The preprocessed image data is then transmitted to a subsequent edge detection operator for geometric contour extraction.
[0008] As a further aspect of the present invention, the step of extracting the workpiece geometric contour from the continuous image frames using an edge detection operator and comparing it with the ideal contour model of a standard workpiece to calculate the contour deviation vector includes: The Cannibal operator is used to detect edge points in the preprocessed image data to generate a discrete set of edge point clouds. The discrete edge point cloud set is registered and aligned with the ideal contour model of the standard workpiece stored in the database; The nearest neighbor search algorithm is used to calculate the projection distance of each point in the discrete edge point cloud set onto the ideal contour model; All projected distances are symbolized, with distances pointing outwards from the workpiece being positive and distances pointing inwards being negative, forming the original deviation dataset. Gaussian filtering is applied to the original deviation dataset to remove random deviation points caused by image noise; The denoised data is organized into a contour deviation vector corresponding to the image coordinate space.
[0009] As a further aspect of the present invention, the contour deviation vector is input to a physical mechanism-based inference engine. This inference engine combines material mechanical parameters and machining process parameters to deduce the abnormal cutting force fluctuation curve that causes the contour deviation, including: High-frequency and low-frequency components are extracted from the contour deviation vector. The high-frequency component corresponds to instantaneous tool impact, and the low-frequency component corresponds to continuous tool deflection. Call the material mechanics parameter library to obtain the elastic modulus and yield strength data of the currently processed workpiece; Call the machining process parameter library to obtain the current depth of cut, feed rate and rake angle data; The high-frequency component, the low-frequency component, the elastic modulus, the yield strength, the depth of cut, the feed rate, and the rake angle are imported into the inference calculation engine. Within the inference calculation engine, a mapping relationship between profile deviation and cutting force is established based on the cutting dynamics equations; By numerically solving the mapping relationship, the magnitude of the cutting force required to produce the contour deviation at different time points is calculated, and the abnormal fluctuation curve of the cutting force is generated.
[0010] As a further aspect of the present invention, based on the abnormal cutting force fluctuation curve, a state inversion operation is performed to reconstruct the unstable rotational speed state of the machining equipment spindle at the corresponding moment and the position drift trajectory of the feed mechanism, including: Obtain a drive system model of the processing equipment, wherein the drive system model describes the transfer function relationship between motor torque, current and output speed; The abnormal fluctuation curve of the cutting force is used as an input disturbance and loaded into the input end of the drive system model; Run the simulation program to solve the dynamic response of the drive system model under the input disturbance, and output the actual rotational speed time series of the spindle; By comparing the actual spindle speed time series with the set commanded speed series, the difference between the actual spindle speed time series and the set commanded speed series is calculated to obtain the speed instability state; Meanwhile, based on the reverse force of the abnormal fluctuation curve of the cutting force on the feed mechanism, and combined with the stiffness coefficient of the feed mechanism, the elastic deformation of the feed screw is calculated. The elastic deformation is accumulated to the theoretical feed position to obtain the position drift trajectory of the feed mechanism; The acquisition of the driving system model of the processing equipment includes: The current signal, voltage signal, and output speed signal of the spindle motor of the processing equipment are collected under no-load operation to form a set of steady-state operating data; The steady-state operating data is decomposed in the frequency domain to extract the gain coefficient from current to torque and the transmission characteristics from torque to speed. Based on the mechanical transmission structure parameters provided by the processing equipment manufacturer, a simplified multibody dynamics model including the motor, coupling, spindle bearing, and load inertia is established. In the simplified multibody dynamics model, a nonlinear damping coefficient and a friction coefficient are introduced, and the steady-state operating data are fitted using the least squares method to calibrate the values of the nonlinear damping coefficient and the friction coefficient. The calibrated simplified multibody dynamics model is transformed into a transfer function expression describing the relationship between motor torque, current and output speed, and the transfer function expression is defined as the drive system model.
[0011] As a further aspect of the present invention, a multi-dimensional quality anomaly feature space is constructed by integrating the contour deviation vector, the abnormal cutting force fluctuation curve, and the unstable rotational speed state, including: Principal component analysis was performed on the contour deviation vector to extract several principal component scores representing the main shape errors. Time-domain features are extracted from the abnormal fluctuation curve of the cutting force, and the peak factor, impulse index and margin index are calculated as force feature vectors. The unstable rotational speed state is subjected to frequency domain transformation, and the fundamental frequency amplitude and the variance of rotational frequency fluctuation are extracted as the rotational speed feature vector. The principal component scores, the force feature vector, and the rotational speed feature vector are normalized to make them all of the same numerical order of magnitude. The three normalized feature vectors are concatenated column by column to form a high-dimensional feature vector, which constitutes the multi-dimensional quality anomaly feature space.
[0012] As a further aspect of the present invention, in the multi-dimensional quality anomaly feature space, cluster analysis is used to identify quality anomaly patterns that deviate from normal operating conditions, including: A large number of high-dimensional feature vectors are extracted from the historical data of normal processing and used as the training sample set for the clustering algorithm; A density-based noise-based spatial clustering algorithm is used to analyze the training sample set to determine the cluster centers and density distribution parameters under normal operating conditions. The high-dimensional feature vector to be detected is input into the clustering algorithm to calculate its Euclidean distance with each cluster center; Determine whether the high-dimensional feature vector belongs to any cluster of normal operating conditions. If it does not belong, mark it as an outlier. Collect all outliers and their corresponding raw data, summarize several typical quality anomaly patterns, and assign feature labels to each pattern.
[0013] As a further aspect of the present invention, the step of tracing the start and end frames of each identified quality anomaly pattern in the continuous image frame sequence to determine the time window in which the anomaly occurred includes: Traverse the continuous image frame sequence and extract the high-dimensional feature vector corresponding to each frame image; The matching degree between the high-dimensional feature vector of each frame and the feature label of each of the aforementioned quality anomaly modes is calculated. When the matching degree of several consecutive frames exceeds the set threshold, the moment when the first frame exceeds the threshold is recorded as the starting frame. Continue monitoring the matching degree. When the matching degree of several consecutive frames falls below the threshold, record the moment before the last frame exceeds the threshold as the end frame. The time period between the start frame and the end frame is defined as the time window in which the anomaly occurs, and the physical timestamp corresponding to the time window is recorded.
[0014] As a further aspect of the present invention, based on the image frame sequence within the time window, the pixel-level diffusion path and area growth rate of the defect region are extracted, including: All image frames within the time window are captured, and each frame is binarized to segment out the defect area. For each frame, perform connected component analysis on the defect region and calculate the centroid coordinates and pixel area of each connected component. Connect the centroid coordinates of the same defect in different frames to form the pixel-level diffusion path of the defect region; Select the defect area data at the start and end times of the time window, calculate the difference between the start and end times and divide it by the time difference to obtain the area growth rate. If multiple independent defect regions are detected, centroid tracking and area calculation operations are performed on each region separately.
[0015] As a further aspect of the present invention, a metal processing quality inspection report is generated based on the pixel-level diffusion path, the area growth rate, and the equipment status data obtained from the state inversion, including: The metal processing quality inspection report includes the correlation between the causes of defects and the equipment status; Establish a data association table to bind each pixel-level diffusion path and each area growth rate value to a set of corresponding device status data entries; In the data association table, analyze whether the direction of the pixel-level diffusion path is synchronized with the fluctuation frequency of the unstable rotation speed of the device spindle; Analyze whether the abrupt change point of the area growth rate coincides with the step point of the position drift trajectory of the feeding mechanism; Strongly correlated data are combined and extracted into a causal chain, which describes how abnormal equipment status leads to defect evolution. According to the predefined report format, the causal relationship chain, the maximum value of the contour deviation vector, and the start and end times of the time window are filled into the corresponding fields of the report template to form the metal processing quality inspection report.
[0016] Compared with the prior art, the advantages and positive effects of the present invention are as follows: The profile deviation vector is input into a physics-based inference engine. Combined with material mechanics parameters and machining parameters, an abnormal cutting force fluctuation curve is derived. Based on this curve, a state inversion operation is performed to reconstruct the unstable spindle speed and the positional drift trajectory of the feed mechanism. The dynamic characteristics of the profile deviation can be transformed into a fluctuation representation of the cutting force. The root cause of the abnormal cutting force can be deduced through physical mechanisms. The dynamic changes in spindle speed and feed mechanism can be correlated one-to-one with the profile deviation. The interference of the external environment on directly acquired parameters can be reduced. The intrinsic connection between abnormal cutting force and changes in equipment state can be fully presented. The abnormal representation of equipment operating state can be quantitatively correlated with the workpiece profile deviation.
[0017] Based on the image frame sequence within the time window corresponding to the quality anomaly pattern, pixel-level diffusion paths and area growth rates of the defect region are extracted. These pixel-level diffusion paths, area growth rates, and equipment status data obtained through state inversion are combined to generate a metal processing quality inspection report. The evolution trajectory of defects during processing can be completely captured, and the diffusion paths and area growth rates can refine the development morphology of defects. The inspection report can simultaneously carry the dynamic evolution characteristics of defects and equipment operating status data. The correlation between quality anomaly patterns, defect evolution, and equipment status can be intuitively displayed. The information dimensions of the inspection report can cover both workpiece defect dynamics and processing equipment operating conditions, and the correspondence between the defect development process and equipment anomalies can be completely recorded. Attached Figure Description
[0018] Figure 1 This is a flowchart of a machine vision-based metal processing quality inspection method according to the present invention; Figure 2 A flowchart for the inference calculation engine to derive the abnormal fluctuation curve of cutting force; Figure 3 This is a curve showing abnormal fluctuations in cutting force and its time-domain characteristics. Figure 4 A graph showing the evolution of defects and the rate of area growth; Figure 5 This is a diagram showing the synchronization between spindle speed fluctuations and defect propagation path direction. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments.
[0020] See Figure 1Starting with capturing continuous image frames of a metal workpiece during processing, a contour deviation vector is obtained through analysis of these frames. This vector quantifies the degree of deviation between the actual processed contour and the ideal contour. The contour deviation vector is input into a physics-based inference engine, which, combined with material mechanics parameters and processing parameters, inversely calculates the abnormal cutting force fluctuation curve that causes the contour deviation. Based on the abnormal cutting force fluctuation curve, a state inversion operation is performed to reconstruct the unstable spindle speed and positional drift trajectory of the feed mechanism at the corresponding moment. A multi-dimensional quality anomaly feature space is constructed by integrating the contour deviation vector, the abnormal cutting force fluctuation curve, and the unstable spindle speed. Within this feature space, cluster analysis identifies quality anomaly patterns deviating from normal operating conditions. For each identified quality anomaly pattern, its start and end frames in the continuous image frame sequence are traced to determine the time window of the anomaly. Based on the image frame sequence within the time window, the pixel-level diffusion path and area growth rate of the defect region are extracted. Based on pixel-level diffusion paths, area growth rates, and equipment status data obtained through state inversion, a metal processing quality inspection report containing the correlation between defect causes and equipment status is generated.
[0021] In one embodiment of the present invention, the above-described process for obtaining the contour deviation vector is applied to the surface quality inspection of aluminum alloy shaft parts machined on a CNC lathe. Continuous image frames of the metal workpiece during the machining process are acquired, containing information on the texture changes and edge contours of the workpiece surface. In a specific implementation, a high-speed industrial camera with a frame rate of 1000 frames per second is used to acquire a sequence of continuous side-view image frames of the machining area. The original format of the continuous image frame sequence is RGB color images, and the resolution of each frame is 1280 pixels multiplied by 1024 pixels. The continuous image frame sequence clearly captures the texture stripes formed on the workpiece surface due to tool cutting and the geometric contours of the workpiece edges.
[0022] The process involves converting consecutive image frames to grayscale and performing histogram equalization to enhance the contrast of defective areas. Specifically, the original color space data of the consecutive image frames is read. This data contains pixel values for the red, green, and blue channels. A weighted average method is used to convert the original color space data into a single-channel grayscale image. The conversion formula is as follows:
[0023] in: This represents the grayscale value of a pixel in a grayscale image, where R represents the red channel pixel value, G represents the green channel pixel value, and B represents the blue channel pixel value. This conversion simplifies color information into brightness information, facilitating subsequent edge extraction and deviation calculation.
[0024] The grayscale histogram distribution of a grayscale image is calculated to identify regions with concentrated grayscale values and a narrow dynamic range. In practice, the number of pixels at each grayscale level from 0 to 255 is counted to generate a grayscale histogram. By observing the histogram distribution, it is determined that the grayscale values of most effective regions are concentrated in a narrow range of 60 to 120. This range corresponds to the grayscale range of a normal workpiece surface, while the grayscale values of potential scratches or dents may fall outside this range. A contrast-limited adaptive histogram equalization algorithm is then used to locally stretch low-contrast regions in the grayscale image. In some embodiments, the grayscale image is divided into several sub-blocks of 8 pixels by 8 pixels. The local histogram of each sub-block is calculated independently, and the local histogram is cropped to limit the number of pixels at each gray level to prevent excessive enhancement of local contrast and introduction of noise. The cropped histogram is then equalized, and the final equalization result of the entire grayscale image is generated based on the interpolation relationship between adjacent sub-blocks. In the processed image, the grayscale differences of areas with low contrast, such as areas with subtle surface texture changes, are amplified, and the visual effect is enhanced.
[0025] The processed grayscale image is compared with the original grayscale image using a difference operation to extract grayscale abrupt change regions as potential defect candidate regions. Specifically, the original grayscale image and the grayscale image after contrast-limited adaptive histogram equalization are subtracted at the pixel level, and the absolute value of the difference is taken to obtain a difference image. A grayscale threshold, such as 20, is set in the difference image, and pixels with grayscale values greater than this threshold are marked. The regions formed by these pixels are the grayscale abrupt change regions and are considered potential defect candidate regions. This step helps to initially separate smooth changes introduced by image processing from drastic changes caused by defects. Morphological closing operations are performed on the potential defect candidate regions to fill their internal micro-holes and smooth the edges, resulting in preprocessed image data. In some embodiments, the morphological closing operation includes two sub-operations: dilation and erosion. A structuring element is used to operate on the binarized image of the suspected defect candidate region, where the structuring element is a circle with a diameter of 5 pixels. The dilation operation expands the boundary of the suspected defect candidate region outward, thereby connecting adjacent small regions and filling the small holes inside. The erosion operation then shrinks the slightly expanded boundary inward, restoring the approximate original boundary shape and smoothing the jagged edges. After the morphological closing operation, the defect region in the preprocessed image data is more complete and coherent, providing a better foundation for subsequent contour extraction.
[0026] Edge detection operators are used to extract the geometric contour of a workpiece from consecutive image frames, and the contour deviation vector is calculated by comparing it with the ideal contour model of a standard workpiece. The Cannibal operator is then used to detect edge points in the preprocessed image data, generating a discrete set of edge point clouds. In practice, the Cannibal operator involves smoothing the preprocessed image data with a Gaussian filter to suppress noise, calculating the gradient magnitude and direction of each pixel in the image, applying non-maximum suppression to refine the ridge zone in the gradient magnitude image, retaining only points with local maximum magnitudes, and finally using a dual-threshold algorithm to detect and connect edges. The high threshold is set to 0.5, and the low threshold is set to 0.2. Pixels with gradient magnitudes higher than the high threshold are identified as strong edge points, while pixels with gradient magnitudes between the high and low thresholds are identified as weak edge points. Only weak edge points connected to strong edge points are accepted as final edge points. After processing by the Cannibal operator, the clear geometric contour of the workpiece is extracted as a set of discrete edge point coordinates, i.e., a discrete set of edge point clouds.
[0027] The discrete edge point cloud set is registered and aligned with the ideal contour model of the standard workpiece stored in the database. In practice, the ideal contour model of the standard workpiece is a two-dimensional contour point set established based on computer-aided design drawings, with the workpiece design datum as the origin. An iterative nearest-neighbor algorithm is used to find a rigid body transformation that minimizes the average distance between the discrete edge point cloud set and the ideal contour model of the standard workpiece. This rigid body transformation includes translation and rotation parameters. Through multiple iterations of the iterative nearest-neighbor algorithm, the two point sets achieve optimal registration in spatial position, ensuring that subsequent deviation calculations are performed under the same coordinate system and datum. A nearest neighbor search algorithm is used to calculate the projected distance of each point in the discrete edge point cloud set onto the ideal contour model. In practice, for each edge point in the discrete edge point cloud set, the shortest Euclidean distance to all line segments (composed of adjacent ideal contour points) on the ideal contour model is calculated. This shortest distance is the projected distance of the edge point on the ideal contour model, reflecting the deviation of the point's actual position from the ideal contour line.
[0028] All projected distances are symbolized, with distances pointing outwards from the workpiece being positive and distances pointing inwards being negative, forming the original deviation dataset. In practice, based on the registered coordinate relationship, the normal direction of the ideal contour model is determined. For each edge point and its corresponding projected point, the direction of the edge point relative to the normal of the ideal contour model is determined. If the edge point is located on the side with the normal pointing outwards, its projected distance is assigned a positive value, indicating excess material; if the edge point is located on the side with the normal pointing inwards, its projected distance is assigned a negative value, indicating missing material. All edge points and their signed projected distances constitute an original deviation dataset containing position and deviation information. Gaussian filtering is then applied to the original deviation dataset to remove random deviation points caused by image noise. In the specific implementation, a one-dimensional Gaussian filter is constructed with a window size of 7 and a standard deviation of 1.5. All the projected distance values in the original deviation dataset are arranged into a sequence according to their corresponding edge points in the image. This sequence is then convolved with the one-dimensional Gaussian filter. The result of the convolution operation is a smoothing of the original projected distance sequence, which can effectively filter out the rapid and small fluctuations in the projected distance values caused by image acquisition noise or random errors in the edge detection process, resulting in a more stable set of deviation data.
[0029] In one embodiment of the present invention, to address the problem of out-of-tolerance contour dimensions that occurs when a precision milling machining center manufactures mold parts, the aforementioned inversion method for deriving cutting force and equipment status from contour deviation is applied. (See also...) Figure 2 The high-frequency and low-frequency components are extracted from the profile deviation vector. In the specific implementation, the profile deviation vector is a sequence containing 1000 sampling points. The profile deviation vector is transformed from the time domain to the frequency domain through fast Fourier transform to obtain its spectral distribution. A frequency boundary point is set in the spectrum with a frequency value of 10 Hz. The part of the spectrum with a frequency higher than 10 Hz is reconstructed into the high-frequency component in the time domain through inverse Fourier transform. The high-frequency component corresponds to the instantaneous tool impact. The part of the spectrum with a frequency lower than or equal to 10 Hz is reconstructed into the low-frequency component in the time domain through inverse Fourier transform. The low-frequency component corresponds to the continuous tool deflection phenomenon. It can be understood that this separation method can distinguish between the rapid fluctuation caused by impact and the slow drift caused by insufficient system rigidity in the profile deviation.
[0030] The system retrieves the elastic modulus and yield strength data of the workpiece from the material mechanics parameter library, and the current depth of cut, feed rate, and rake angle data from the machining process parameter library. In this implementation, the material mechanics parameter library records the properties of the workpiece material "S136 mold steel," with an elastic modulus of 210 GPa and a yield strength of 850 MPa. The machining process parameter library records the machining parameters for this operation, including a depth of cut of 0.3 mm, a feed rate of 150 mm / min, and a rake angle of 12 degrees. These parameters are directly read from the CNC machining program and the machine tool library. The high-frequency components, low-frequency components, elastic modulus, yield strength, depth of cut, feed rate, and rake angle are imported into the inference calculation engine. Within the inference calculation engine, based on the cutting dynamics equations, a mapping relationship between contour deviation and cutting force is established. In practical implementation, the cutting dynamics equations describe that under dynamic cutting conditions, cutting force fluctuations are the main cause of workpiece contour deviations. The inference engine adopts a simplified dynamic model, treating the workpiece contour deviation as a dynamic deformation response generated by the cutting force acting on the "workpiece-tool-machine tool" elastic system. The specific mapping expression is as follows:
[0031] in: Indicates dynamic cutting force. This indicates the elastic modulus of the workpiece material. This represents the average area of the workpiece's cutting cross-section. Indicates profile deviation. Indicates the overhang length of the workpiece. This represents the cutting force coefficient related to the material's yield strength. Indicates the depth of cut. This indicates the feed per tooth. Indicates the front angle. This represents the coefficient of friction between the cutting tool and the workpiece. , This indicates the weight of the influence of the tool geometry on the component forces in different directions. This represents the dynamic cutting force component, which is generated by the material removal process itself and is related to the direction of the profile deviation change rate, under dynamic cutting conditions. It is a sign function, representing the sign of the rate of change of the profile deviation. It is the first derivative of the profile deviation with respect to time. In the formula, the area... The feed per tooth is calculated from the workpiece diameter and depth of cut. The feed rate is obtained by dividing the spindle speed and the number of tool teeth. The inference engine substitutes the high-frequency and low-frequency components of the profile deviation into the above equation. The items are calculated.
[0032] By numerically solving the mapping relationship, the magnitude of the cutting force required to generate the profile deviation at different time points is calculated, generating an abnormal fluctuation curve of the cutting force. In some embodiments, the inference engine uses the fourth-order Runge-Kutta method to numerically integrate and solve the above cutting dynamics equations, discretizing time into a sequence with a step size of 0.001 seconds. At each time step, the profile deviation value obtained by superimposing the high-frequency component and the low-frequency component extracted at the current moment is calculated. and the approximate rate of change obtained by its numerical differentiation Substitute into the equation and solve for the dynamic cutting force at that moment. After iterating through all time points, the calculated series The values are connected sequentially over time to form a cutting force anomaly fluctuation curve that varies with time. This curve quantifies the dynamic cutting force fluctuations necessary to cause the observed profile deviation. Based on the cutting force anomaly fluctuation curve, a state inversion operation is performed to reconstruct the unstable speed state of the machining equipment spindle and the position drift trajectory of the feed mechanism at the corresponding time. A drive system model of the machining equipment is obtained, which describes the transfer function relationship between motor torque, current, and output speed. In practical implementation, a drive system model of the processing equipment is obtained. The current signal, voltage signal, and output speed signal of the spindle motor of the processing equipment under no-load operation are collected to form a set of steady-state operating data. The steady-state operating data is decomposed in the frequency domain to extract the gain coefficient from current to torque and the transmission characteristics from torque to speed. Combined with the mechanical transmission structure parameters provided by the processing equipment manufacturer, a simplified multibody dynamics model including the motor, coupling, spindle bearing, and load inertia is established. Nonlinear damping coefficient and friction coefficient are introduced into the simplified multibody dynamics model. The steady-state operating data is fitted by the least squares method to calibrate the values of nonlinear damping coefficient and friction coefficient. The calibrated simplified multibody dynamics model is transformed into a transfer function expression describing the relationship between motor torque, current, and output speed. The transfer function expression is defined as the drive system model.
[0033] The abnormal fluctuation curve of cutting force is used as the input disturbance, which is applied to the input of the drive system model. The simulation program is run to solve the dynamic response of the drive system model under the action of the input disturbance, and the actual spindle speed time series is output. In specific implementation, when the cutting force acts on the workpiece, it generates a counter-torque opposite to the spindle motor torque. This counter-torque is regarded as the input disturbance to the drive system. The simulation program multiplies the abnormal fluctuation curve of cutting force by the spindle radius to convert it into an equivalent disturbance torque curve. Then, this disturbance torque curve is input to the disturbance torque input of the drive system model. The differential equation of the drive system model is solved by numerical integration to calculate the curve of the spindle output speed changing with time under the combined action of rated current command and disturbance torque. This curve is the actual spindle speed time series.
[0034] By comparing the actual spindle speed time series with the set commanded speed series, the difference between the two is calculated to obtain the speed instability state. In some embodiments, the commanded speed series is a constant value read from the CNC machining program, such as 5000 revolutions per minute. In the simulated actual spindle speed time series, an instantaneous speed value is extracted every minute and subtracted from the commanded speed of 5000 revolutions per minute to obtain a speed difference sequence. This difference sequence describes the fluctuation of the spindle speed around the commanded value. The speed difference sequence and its statistical characteristics, such as fluctuation amplitude and fluctuation frequency, together constitute the description of the speed instability state.
[0035] Based on the reverse force of the abnormal cutting force fluctuation curve on the feed mechanism, and combined with the stiffness coefficient of the feed mechanism, the elastic deformation of the feed screw is calculated. In specific implementation, the component of the abnormal cutting force fluctuation curve in the feed direction constitutes the dynamic reverse force on the feed mechanism. The stiffness coefficient of the feed mechanism along the feed direction is a known constant, such as 80 Newtons per micrometer. According to Hooke's Law, the elastic deformation of the feed screw is equal to the dynamic reverse force divided by the stiffness coefficient of the feed mechanism. This calculation process can be understood as linear. Dividing the value of the abnormal cutting force fluctuation curve at each time point by the stiffness coefficient yields the elastic deformation of the feed screw at the corresponding time point. Accumulating the elastic deformation to the theoretical feed position yields the position drift trajectory of the feed mechanism. In practice, the theoretical feed position is calculated based on the feed speed command in the CNC machining program, under ideal, deformation-free conditions, as a position-time sequence. Starting from the zero point of position and the zero point of time, it is obtained by integrating according to the command speed. The calculated elastic deformation sequence is algebraically added to the theoretical feed position sequence at each corresponding time point. Since the elastic deformation is dynamic and can be positive or negative, the accumulated result is an actual position trajectory that fluctuates around the theoretical trajectory. This actual position trajectory is defined as the position drift trajectory of the feed mechanism. The position drift trajectory quantifies the actual position error caused by the deformation of the feed axis due to force.
[0036] In one embodiment of the present invention, the method described above for constructing a multi-dimensional feature space and performing abnormal pattern recognition is applied to address various quality fluctuation phenomena that occur when a machining center is mass-producing connecting rod workpieces. A multi-dimensional quality anomaly feature space is constructed by integrating the contour deviation vector, the abnormal cutting force fluctuation curve, and the unstable rotational speed. Principal component analysis is performed on the contour deviation vector to extract several principal component scores representing the main shape errors. In a specific implementation, the contour deviation vector is a sequence containing 512 elements, corresponding to the deviation values of 512 points sampled at equal angles along the circumferential direction of the workpiece's outer contour. Principal component analysis is performed on contour deviation vector samples collected from 200 normal machining cycles to calculate the covariance matrix of these 200 samples. Eigenvalue decomposition is then performed on the covariance matrix, and the corresponding eigenvectors are arranged in descending order of eigenvalues. The first three principal component directions are selected, as these three principal component directions contribute a cumulative 92% of the variance of the original contour deviation data. For any new contour deviation vector, it is projected onto these three principal component directions, and the resulting three projection coefficients are the principal component scores representing its main shape errors.
[0037] Time-domain features are extracted from the abnormal cutting force fluctuation curve, and the peak factor, impulse index, and margin index are calculated as force feature vectors. In the specific implementation, the abnormal cutting force fluctuation curve is a time series with 1024 sampling points. The root mean square value of this time series is calculated. The peak factor is defined as the absolute value of the peak value of the time series divided by the root mean square value, reflecting the intensity of the impact component in the signal. The absolute average value of the time series is calculated. The impulse index is defined as the absolute value of the peak value of the time series divided by the absolute average value, reflecting the impulse characteristics of the signal. The root square amplitude of the time series is calculated, which is the square root of the sum of the squares of the values at each point in the time series divided by the number of points. The margin index is defined as the absolute value of the peak value of the time series divided by the root square amplitude, reflecting the margin characteristics of the signal. The three dimensionless parameters, peak factor, impulse index, and margin index, together form a three-element force feature vector.
[0038] The unstable speed state is transformed in the frequency domain to extract the fundamental frequency amplitude and the frequency fluctuation variance as the speed feature vector. In specific implementation, the unstable speed state is a speed difference sequence, which describes the change of the difference between the actual spindle speed and the commanded speed over time. A fast Fourier transform is applied to the speed difference sequence to obtain its spectrum. In the spectrum, the fundamental frequency component corresponding to the rated spindle speed frequency is found. The fundamental frequency amplitude is the magnitude of this fundamental frequency component, which reflects the intensity of the periodic component synchronized with the spindle rotation in the speed fluctuation. The frequency fluctuation variance is the variance of the speed difference sequence, which describes the degree of dispersion of the speed around the commanded speed and is an overall measure of speed instability. The fundamental frequency amplitude and the frequency fluctuation variance together form a two-element speed feature vector.
[0039] The principal component scores, force eigenvectors, and rotational speed eigenvectors are normalized to ensure they are of the same numerical order of magnitude. In practice, the principal component scores consist of three values, the force eigenvectors consist of three values, and the rotational speed eigenvectors consist of two values. A max-min normalization method is used to process each eigencomponent individually. For any given eigencomponent, its maximum and minimum values are first found from all historical normal samples and the current sample to be tested. Then, the minimum value is subtracted from the eigencomponent, and the result is divided by the difference between the maximum and minimum values. This normalization process maps the value of each eigencomponent to between zero and one, ensuring that eigenvalues of different types and dimensions from contour deviation, cutting force, and rotational speed have equal weight in subsequent cluster analysis.
[0040] The three normalized feature vectors are concatenated column-wise to form a high-dimensional feature vector, which constitutes a multi-dimensional quality anomaly feature space. In some embodiments, the three normalized principal component scores constitute feature vector A, the three normalized force feature components constitute feature vector B, and the two normalized rotational speed feature components constitute feature vector C. Feature vectors A, B, and C are connected sequentially to form a high-dimensional feature vector containing eight feature components. Each processing sample can be represented by such an eight-dimensional feature vector. The set of all these eight-dimensional vectors constitutes an eight-dimensional quality anomaly feature space, and the position of the sample in this eight-dimensional space reflects its overall quality state.
[0041] In a multi-dimensional quality anomaly feature space, cluster analysis is used to identify quality anomaly patterns that deviate from normal operating conditions. A large number of high-dimensional feature vectors are extracted from historical data of normal processing, serving as the training sample set for the clustering algorithm. In specific implementation, the training sample set contains 5000 high-dimensional feature vectors randomly selected from normal production batches over the past three months. Each high-dimensional feature vector corresponds to a complete data record of a processing cycle. These high-dimensional feature vectors represent the normal data distribution in the feature space under conditions of no known defects and stable equipment operation. A density-based noise-based spatial clustering algorithm is used to analyze the training sample set to determine the cluster centers and density distribution parameters under normal operating conditions. In practical implementation, the density-based noise spatial clustering algorithm requires setting a neighborhood radius parameter and a minimum number of contained points parameter. The neighborhood radius parameter is set to 0.15, and the minimum number of contained points parameter is set to 15. The algorithm first calculates the Euclidean distance of each high-dimensional feature vector in the training sample set in eight-dimensional space, and finds the number of other points contained in the neighborhood of each point. If the number of points contained in the neighborhood of a point is not less than the minimum number of contained points parameter of 15, then the point is marked as a core point. A cluster is formed by the core point and the points that its density can reach. After the algorithm runs, the training sample set is divided into several clusters. The largest cluster contains more than 98% of the sample points. This largest cluster is defined as the core area under normal working conditions. Its cluster center is the mean vector of all points in the cluster. The density distribution parameter is described by the average distance and the maximum distance between the points in the cluster.
[0042] The high-dimensional feature vector to be detected is input into a clustering algorithm to calculate its Euclidean distance with each cluster center. In some embodiments, for a new processing cycle sample, the Euclidean distance between its normalized eight-dimensional feature vector and the identified normal operating condition cluster centers is calculated. The formula for calculating the Euclidean distance is:
[0043] Where: D represents the Euclidean distance between the high-dimensional feature vector to be detected and the cluster center under normal operating conditions. The first digit of the high-dimensional feature vector to be detected represents the second digit of the feature vector to be detected. Each normalized feature component The first element representing the cluster center vector under normal operating conditions Each normalized feature component, subscript Numbers 1 to 8 represent eight feature dimensions.
[0044] See Figure 3 This is a cutting force abnormal fluctuation curve and time-domain feature map, showing the time-domain comparison between normal and abnormal cutting force fluctuations during metal processing. It is a core visualization result in the cutting force inversion stage of quality inspection. The sharp fluctuations and high amplitude of the orange curve can be directly used as an intuitive criterion for abnormalities in the cutting process, providing input for subsequent equipment status inversion. Abnormal cutting force fluctuations are directly transmitted to the workpiece contour, causing an increase in the contour deviation vector, ultimately leading to surface quality defects. By monitoring these curves in real time, early warnings can be given before defects form, avoiding batch scrapping. Frequency domain analysis is performed on the abnormal cutting force signal to locate the dominant vibration frequency and determine whether it is due to spindle speed frequency, tool meshing frequency, or external interference. This fluctuation curve is input into the drive system model to invert the unstable state of the spindle speed and the position drift trajectory of the feed mechanism.
[0045] In one embodiment of the present invention, the method described above for determining the anomaly time window and extracting defect evolution information is applied to the identified "instantaneous tool impact" quality anomaly pattern. For each identified quality anomaly pattern, its start and end frames in the continuous image frame sequence are traced to determine the time window in which the anomaly occurs. The continuous image frame sequence is traversed, and the high-dimensional feature vector corresponding to each frame is extracted. In a specific implementation, the continuous image frame sequence of the machining process is acquired at a rate of 200 frames per second, totaling 10,000 frames, corresponding to a 50-second video recording of the machining process. For each frame in the sequence, its contour deviation, cutting force, and rotational speed characteristics are simultaneously calculated according to the aforementioned method, and after normalization, they are combined into an eight-dimensional high-dimensional feature vector, ultimately generating a sequence containing 10,000 high-dimensional feature vectors, each vector in the sequence carrying a precise physical timestamp and frame number.
[0046] The matching degree is calculated between the high-dimensional feature vector of each frame and the feature label of each quality anomaly mode. In the specific implementation, the feature label of the quality anomaly mode is a predefined mode feature vector. For example, the feature label of the "instantaneous impact of the tool" mode is an eight-dimensional vector, whose components are composed of the feature mean of a large number of outliers of the same mode. The matching degree is calculated using the cosine similarity method, which calculates the cosine value of the angle between the high-dimensional feature vector of the frame to be tested and the feature label vector of the "instantaneous impact of the tool" mode. The cosine similarity value ranges between -1 and +1. The closer the value is to +1, the more consistent the directions of the two vectors are, and the higher the matching degree. The matching degree calculation formula is:
[0047] Where: S represents the matching degree. The first dimensional feature vector of the frame to be tested represents the high-dimensional feature vector of the frame to be tested. One portion, The first element representing the feature label vector of the quality anomaly pattern Each component, subscript The numbers 1 to 8 represent eight feature dimensions. For all 10,000 frames of images, the matching degree S between the high-dimensional feature vector and the feature label of the "instantaneous impact of the cutting tool" mode is calculated frame by frame, resulting in a matching degree sequence of length 10,000.
[0048] When the matching degree of several consecutive frames exceeds a set threshold, the moment when the first frame exceeds the threshold is recorded as the starting frame. In specific implementation, a matching degree threshold is set. The matching degree sequence is scanned to a value of 0.85. When the matching degree S value of five consecutive frames (corresponding to 0.025 seconds) is greater than 0.85, it is determined that a quality anomaly mode has begun to appear. The first frame of these five consecutive frames, i.e., the frame where the matching degree first exceeds the threshold, is recorded as the starting frame of this "tool instantaneous impact" quality anomaly event. The timestamp corresponding to the starting frame is 17.325 seconds after the start of processing. The matching degree continues to be monitored. When the matching degree of several consecutive frames falls below the threshold, the time before the last frame exceeds the threshold is recorded as the ending frame. In some embodiments, the matching degree sequence continues to be monitored after the starting frame. When the matching degree S value of ten consecutive frames (corresponding to 0.05 seconds) is less than or equal to 0.85, it is determined that the quality anomaly mode has ended. The frame before these ten consecutive frames, i.e., the last frame where the matching degree exceeds the threshold, is recorded as the ending frame of this "tool instantaneous impact" quality anomaly event. The timestamp corresponding to the ending frame is 17.418 seconds after the start of processing. It's understandable that the criterion of ten consecutive frames below the threshold is stricter than that of five consecutive frames above the threshold, to prevent abnormal events from being prematurely judged as terminated due to noise in a single frame. The time period between the start frame and the end frame is defined as the time window for the anomaly to occur, and the corresponding physical timestamp is recorded.
[0049] Based on the image frame sequence within the time window, the pixel-level diffusion path and area growth rate of the defect region are extracted. All image frames within the time window are extracted, and each frame is binarized to segment the defect region. In specific implementation, 19 frames from frame 3465 to frame 3483 are extracted from the complete continuous image frame sequence to form the time window image frame sequence. For each frame in the time window image frame sequence, a fixed threshold segmentation method is applied: pixels with gray values below 50 are set to 1, representing possible defect regions; pixels with gray values above or equal to 50 are set to zero, representing background and normal workpiece regions, resulting in 19 binarized images. Connectivity analysis is performed on the defect region of each frame, and the centroid coordinates and pixel area of each connected component are calculated. In practice, the eight-neighbor connectivity rule is used to process each binarized image, identifying connected regions formed by all pixels with a value of one. For each identified connected region, the average of the row and column coordinates of all its pixels is calculated to obtain the centroid coordinates of the connected region. The centroid coordinates are taken with the top-left corner of the image as the origin and are in pixels. Simultaneously, the total number of pixels with a value of one within the connected region is counted to obtain the pixel area of the connected region, with the area in square pixels. Refer to Table 1, which shows the centroid coordinates and pixel area data of the main defect connected regions in some keyframe images within the time window.
[0050] Table 1: Example Table of Centroid and Area Data for Defect Regions
[0051] Connecting the centroid coordinates of the same defect across different frames forms a pixel-level diffusion path for the defect region. In some embodiments, the number of connected components in the defect region is always one in the time window image frame sequence, indicating that a single defect is evolving. Connecting the centroid coordinates recorded in Table 1 from frame 3465 to frame 3483 in chronological order in the image coordinate system with straight line segments forms a broken line from the starting point (512.3, 384.7) to the ending point (516.3, 384.4). This broken line describes the movement trajectory of the centroid of the defect region in the image plane, i.e., the pixel-level diffusion path of the defect region. The path shows that the centroid mainly moves along the positive X-axis direction (roughly corresponding to the workpiece feed direction), with very little change in the Y-axis direction.
[0052] See Figure 4This is a chart analyzing the evolution and area growth rate of defects. It shows the correlation between the area evolution and growth rate of metal processing defects within a time window, serving as a core visualization result in the defect propagation path analysis phase. The defect area exhibits a slow, linear growth, increasing from approximately 15 square pixels initially to approximately 105 square pixels at the end, with stable growth and no abrupt changes. The area growth rate shows a step-like increase, with four significant accelerations. The defect area grows from approximately 15 pixels to approximately 105 pixels in about 0.1 seconds, and these four step-like increases in the area growth rate likely correspond to step changes in equipment status. Identifying the most active defect time period allows for tracing image frames and equipment status data within that period. When the area growth rate exceeds a threshold, a real-time warning can be triggered to prevent further defect expansion.
[0053] In one embodiment of the present invention, a metal processing quality inspection report is generated using the above method for a detected "instantaneous tool impact" quality anomaly event. Based on pixel-level diffusion paths, area growth rates, and equipment status data obtained through state inversion, a metal processing quality inspection report is generated, which includes the correlation between defect causes and equipment status. A data association table is established to bind each pixel-level diffusion path and each area growth rate value to a set of corresponding equipment status data entries. In specific implementations, the data association table is a structured database table. Each record in the table corresponds to an identified quality anomaly event. The fields of the record include, but are not limited to: a unique event identifier, a quality anomaly pattern feature label, a start timestamp of the time window, an end timestamp of the time window, a sequence of coordinate points of the pixel-level diffusion path, an area growth rate value, and equipment status data entries obtained through state inversion. The equipment status data entries include complete time-series data of the unstable spindle speed state and complete time-series data of the feed mechanism's position drift trajectory. These time-series data are precisely time-aligned with the evolution process of the pixel-level diffusion path through timestamps. Taking the "instantaneous impact of the tool" event as an example, the unique identifier of the event is "Event_20240321_003". Its record stores the set of pixel-level diffusion path coordinate points from frame 3465 to frame 3483, the area growth rate is 967.7 square pixels per second, and the difference sequence between the actual spindle speed and the commanded speed from 17.325 seconds to 17.418 seconds, as well as the difference sequence between the actual position and the theoretical position of the feed mechanism.
[0054] In the data association table, we analyze whether there is a synchronization between the direction of the pixel-level diffusion path and the fluctuation frequency of the unstable spindle speed. In some embodiments, the centroid of the defect area displayed by the pixel-level diffusion path mainly moves along the positive X-axis of the image, and the direction of movement is relatively stable. However, the data on the unstable spindle speed shows that within the same time window, the difference sequence between the actual spindle speed and the commanded speed exhibits high-frequency, small-amplitude oscillations. The zero-crossing frequency of the spindle speed difference sequence, i.e., the number of times the speed difference changes from positive to negative or from negative to positive per unit time, is calculated to be 220 times per second. At the same time, we analyze the coordinate point sequence of the pixel-level diffusion path and calculate the rate of change of the vector direction angle between adjacent coordinate points. We find that the rate of change of the direction angle fluctuates slightly near zero degrees, and its fluctuation frequency has no direct correspondence with the zero-crossing frequency of the spindle speed difference sequence. The peak values of the two do not overlap in the spectrum, and their temporal variation rhythms are not synchronized. It can be understood that there is no obvious synchronous correlation between the directional stability of the pixel-level diffusion path and the high-frequency fluctuation of the spindle speed.
[0055] The analysis examines whether the abrupt change in the area growth rate coincides with the step point in the feed mechanism's position drift trajectory. In practice, the area growth rate is a single numerical value describing the average expansion rate of the defect area within the entire time window. To analyze abrupt change points, a finer time scale needs to be examined. The instantaneous area growth rate is calculated between every two consecutive image frames within the time window. The formula for calculating the instantaneous area growth rate is:
[0056] in: Indicates the Kth frame image relative to the 1st frame. The instantaneous area growth rate of a frame image. This represents the pixel area of the defect region in the Kth frame of the image. Indicates the first The pixel area of the defect region in the frame image. This represents the timestamp of the Kth frame. Indicates the first The frame's timestamp. (By analyzing...) Sequence analysis can identify abrupt changes in the area growth rate, i.e. The time point at which the value significantly increases is identified. Simultaneously, the position drift trajectory of the feed mechanism is examined; this trajectory is a sequence of the difference between the actual and theoretical positions of the feed mechanism over time. The step point where the slope abruptly increases is sought within this sequence. Analysis of the "Event_20240321_003" event indicates that the instantaneous area growth rate increases around timestamp 17.365. The sequence shows a peak, and at the same time, the position drift trajectory data of the feed mechanism shows that at the same time point, the position drift trajectory has a significant positive step, and the actual position has suddenly shifted positively by about 3.5 micrometers compared with the theoretical position. The sudden change in area growth is highly consistent with the position drift of the feed mechanism at the same time point.
[0057] See Figure 5 This is a chart analyzing the synchronization between spindle speed fluctuations and the direction of defect propagation. It shows a time-domain comparison of the spindle speed difference and the rate of change of the defect propagation path direction angle within a time window, used to verify whether there is a synchronous correlation between the two. The peak / valley times of the spindle speed difference do not coincide with the abrupt changes in the direction angle rate of change. For example, when the speed reaches a peak of 0.55 rpm at 17.33 seconds, the direction angle rate of change is only 50°, with no corresponding peak. When the direction angle reaches a peak of 62° at 17.395 seconds, the speed difference is -0.35 rpm, in the valley stage. The dominant frequency of the spindle speed difference is 220 Hz, while the spectrum of the direction angle rate of change has no significant peak; their spectra do not overlap, indicating no frequency synchronization. The directional stability of the defect propagation path has no obvious synchronous correlation with the high-frequency fluctuations of the spindle speed, indicating that in this "instantaneous tool impact" anomaly, spindle speed fluctuations are not the main factor causing the change in the defect propagation direction.
[0058] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention in any other way. Any person skilled in the art may make changes or modifications to the above-disclosed technical content to create equivalent embodiments that can be applied to other fields. However, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the protection scope of the present invention.
Claims
1. A machine vision-based metal working quality detection method, characterized by, include: Collect continuous image frames of a metal workpiece during the processing, and obtain a contour deviation vector based on the continuous image frames; The profile deviation vector is input into a physics-based inference engine, which combines material mechanical parameters and machining parameters to deduce the abnormal cutting force fluctuation curve that causes the profile deviation. Based on the abnormal cutting force fluctuation curve, a state inversion operation is performed to reconstruct the unstable speed state of the machining equipment spindle and the position drift trajectory of the feed mechanism at the corresponding moment. By combining the contour deviation vector, the abnormal fluctuation curve of the cutting force, and the unstable rotational speed, a multi-dimensional quality anomaly feature space is constructed. In the multi-dimensional quality anomaly feature space, cluster analysis is used to identify quality anomaly patterns that deviate from normal operating conditions. For each identified quality anomaly pattern, trace its start and end frames in the continuous image frame sequence to determine the time window in which the anomaly occurred. Based on the image frame sequence within the time window, the pixel-level diffusion path and area growth rate of the defect region are extracted; A metal processing quality inspection report is generated based on the pixel-level diffusion path, the area growth rate, and the equipment status data obtained from the state inversion.
2. The machine vision-based metal working quality detection method of claim 1, wherein, Based on the continuous image frames, a contour deviation vector is obtained, including: The continuous image frames contain texture changes and edge contour information of the workpiece surface; The continuous image frames are subjected to grayscale processing and histogram equalization to enhance the contrast of defective areas in the image; The geometric contour of the workpiece in the continuous image frames is extracted using an edge detection operator and compared with the ideal contour model of a standard workpiece to calculate the contour deviation vector. Performing grayscale conversion and histogram equalization on the continuous image frames to enhance the contrast of defective regions in the image includes: Read the raw color space data of the consecutive image frames and convert it into a single-channel grayscale image; Calculate the grayscale histogram distribution of the grayscale image to identify regions with concentrated grayscale values and narrow dynamic range; A contrast-limited adaptive histogram equalization algorithm is used to locally stretch the low-contrast regions in the grayscale image. The processed grayscale image is compared with the original grayscale image by performing a difference operation, and the grayscale abrupt change region is extracted as a suspected defect candidate region. Morphological closing operations are performed on the suspected defect candidate regions to fill the internal micro-holes and smooth the edges, resulting in preprocessed image data. The preprocessed image data is then transmitted to a subsequent edge detection operator for geometric contour extraction.
3. The machine vision-based metal working quality detection method of claim 2, wherein, The step involves extracting the workpiece's geometric contour from the continuous image frames using an edge detection operator, comparing it with the ideal contour model of a standard workpiece, and calculating the contour deviation vector, including: The Cannibal operator is used to detect edge points in the preprocessed image data to generate a discrete set of edge point clouds. The discrete edge point cloud set is registered and aligned with the ideal contour model of the standard workpiece stored in the database; The nearest neighbor search algorithm is used to calculate the projection distance of each point in the discrete edge point cloud set onto the ideal contour model; All projected distances are symbolized, with distances pointing outwards from the workpiece being positive and distances pointing inwards being negative, forming the original deviation dataset. Gaussian filtering is applied to the original deviation dataset to remove random deviation points caused by image noise; The denoised data is organized into a contour deviation vector corresponding to the image coordinate space.
4. The machine vision-based metal working quality detection method of claim 3, wherein, The profile deviation vector is input into a physics-based inference engine, which combines material mechanics parameters and machining parameters to deduce the abnormal cutting force fluctuation curve that causes the profile deviation, including: High-frequency and low-frequency components are extracted from the contour deviation vector. The high-frequency component corresponds to instantaneous tool impact, and the low-frequency component corresponds to continuous tool deflection. Call the material mechanics parameter library to obtain the elastic modulus and yield strength data of the currently processed workpiece; Call the machining process parameter library to obtain the current depth of cut, feed rate and rake angle data; The high-frequency component, the low-frequency component, the elastic modulus, the yield strength, the depth of cut, the feed rate, and the rake angle are imported into the inference calculation engine. Within the inference calculation engine, a mapping relationship between profile deviation and cutting force is established based on the cutting dynamics equations; By numerically solving the mapping relationship, the magnitude of the cutting force required to produce the contour deviation at different time points is calculated, and the abnormal fluctuation curve of the cutting force is generated.
5. The machine vision-based metal processing quality inspection method as described in claim 4, characterized in that, Based on the abnormal cutting force fluctuation curve, a state inversion operation is performed to reconstruct the unstable spindle speed and position drift trajectory of the feed mechanism at the corresponding moment, including: Obtain a drive system model of the processing equipment, wherein the drive system model describes the transfer function relationship between motor torque, current and output speed; The abnormal fluctuation curve of the cutting force is used as an input disturbance and loaded into the input end of the drive system model; Run the simulation program to solve the dynamic response of the drive system model under the input disturbance, and output the actual rotational speed time series of the spindle; By comparing the actual spindle speed time series with the set commanded speed series, the difference between the actual spindle speed time series and the set commanded speed series is calculated to obtain the speed instability state; Meanwhile, based on the reverse force of the abnormal fluctuation curve of the cutting force on the feed mechanism, and combined with the stiffness coefficient of the feed mechanism, the elastic deformation of the feed screw is calculated. The elastic deformation is accumulated to the theoretical feed position to obtain the position drift trajectory of the feed mechanism; The acquisition of the driving system model of the processing equipment includes: The current signal, voltage signal, and output speed signal of the spindle motor of the processing equipment are collected under no-load operation to form a set of steady-state operating data; The steady-state operating data is decomposed in the frequency domain to extract the gain coefficient from current to torque and the transmission characteristics from torque to speed. Based on the mechanical transmission structure parameters provided by the processing equipment manufacturer, a simplified multibody dynamics model including the motor, coupling, spindle bearing, and load inertia is established. In the simplified multibody dynamics model, a nonlinear damping coefficient and a friction coefficient are introduced, and the steady-state operating data are fitted using the least squares method to calibrate the values of the nonlinear damping coefficient and the friction coefficient. The calibrated simplified multibody dynamics model is transformed into a transfer function expression describing the relationship between motor torque, current and output speed, and the transfer function expression is defined as the drive system model.
6. The metal processing quality inspection method based on machine vision as described in claim 5, characterized in that, By combining the contour deviation vector, the abnormal cutting force fluctuation curve, and the unstable rotational speed, a multi-dimensional quality anomaly feature space is constructed, including: Principal component analysis was performed on the contour deviation vector to extract several principal component scores representing the main shape errors. Time-domain features are extracted from the abnormal fluctuation curve of the cutting force, and the peak factor, impulse index and margin index are calculated as force feature vectors. The unstable rotational speed state is subjected to frequency domain transformation, and the fundamental frequency amplitude and the variance of rotational frequency fluctuation are extracted as the rotational speed feature vector. The principal component scores, the force feature vector, and the rotational speed feature vector are normalized to make them all of the same numerical order of magnitude. The three normalized feature vectors are concatenated column by column to form a high-dimensional feature vector, which constitutes the multi-dimensional quality anomaly feature space.
7. The metal processing quality inspection method based on machine vision as described in claim 6, characterized in that, Within the multi-dimensional quality anomaly feature space, cluster analysis identifies quality anomaly patterns deviating from normal operating conditions, including: A large number of high-dimensional feature vectors are extracted from the historical data of normal processing and used as the training sample set for the clustering algorithm; A density-based noise-based spatial clustering algorithm is used to analyze the training sample set to determine the cluster centers and density distribution parameters under normal operating conditions. The high-dimensional feature vector to be detected is input into the clustering algorithm to calculate its Euclidean distance with each cluster center; Determine whether the high-dimensional feature vector belongs to any cluster of normal operating conditions. If it does not belong, mark it as an outlier. Collect all outliers and their corresponding raw data, summarize several typical quality anomaly patterns, and assign feature labels to each pattern.
8. The metal processing quality inspection method based on machine vision as described in claim 7, characterized in that, For each identified quality anomaly pattern, tracing its start and end frames in the continuous image frame sequence to determine the time window in which the anomaly occurred includes: Traverse the continuous image frame sequence and extract the high-dimensional feature vector corresponding to each frame image; The matching degree between the high-dimensional feature vector of each frame and the feature label of each of the aforementioned quality anomaly modes is calculated. When the matching degree of several consecutive frames exceeds the set threshold, the moment when the first frame exceeds the threshold is recorded as the starting frame. Continue monitoring the matching degree. When the matching degree of several consecutive frames falls below the threshold, record the moment before the last frame exceeds the threshold as the end frame. The time period between the start frame and the end frame is defined as the time window in which the anomaly occurs, and the physical timestamp corresponding to the time window is recorded.
9. The machine vision-based metal processing quality inspection method as described in claim 8, characterized in that, Based on the image frame sequence within the time window, the pixel-level diffusion path and area growth rate of the defect region are extracted, including: All image frames within the time window are captured, and each frame is binarized to segment out the defect area. For each frame, perform connected component analysis on the defect region and calculate the centroid coordinates and pixel area of each connected component. Connect the centroid coordinates of the same defect in different frames to form the pixel-level diffusion path of the defect region; Select the defect area data at the start and end times of the time window, calculate the difference between the start and end times and divide it by the time difference to obtain the area growth rate. If multiple independent defect regions are detected, centroid tracking and area calculation operations are performed on each region separately.
10. The metal processing quality inspection method based on machine vision as described in claim 9, characterized in that, Based on the pixel-level diffusion path, the area growth rate, and the equipment status data obtained from the state inversion, a metal processing quality inspection report is generated, including: The metal processing quality inspection report includes the correlation between the causes of defects and the equipment status; Establish a data association table to bind each pixel-level diffusion path and each area growth rate value to a set of corresponding device status data entries; In the data association table, analyze whether the direction of the pixel-level diffusion path is synchronized with the fluctuation frequency of the unstable rotational speed of the device spindle; Analyze whether the abrupt change point of the area growth rate coincides with the step point of the position drift trajectory of the feeding mechanism; Strongly correlated data are combined and extracted into a causal chain, which describes how abnormal equipment status leads to defect evolution. According to the predefined report format, the causal relationship chain, the maximum value of the contour deviation vector, and the start and end times of the time window are filled into the corresponding fields of the report template to form the metal processing quality inspection report.