Grinding workpiece edge shape detection method and system based on machine learning
Through a machine learning-based method, combined with image preprocessing, composite filtering and convolutional neural network, the problems of low accuracy and poor real-time performance in edge shape detection of grinding workpieces are solved, high-precision and robust edge detection are achieved, and changes in workpiece shape and surface state are adapted to.
Patent Information
- Application Number
- CN202411651557.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-19
- Publication Date
- 2025-03-11
AI Technical Summary
In the prior art, the detection of edge shape of grinding workpieces has problems such as low detection accuracy and poor real-time performance due to many surface interference factors and large shape changes.
Using machine learning-based methods, high-precision and robustness detection of grinding workpiece edges is achieved through image preprocessing, composite image filtering, edge detection of second-order differential operators and morphological gradients, and feature extraction and model construction of convolutional neural networks, and dynamically correct model parameters to adapt to the changes in the workpiece shape and surface state during the grinding process.
It significantly improves the accuracy and real-timeness of edge detection, effectively removes interference factors on the surface of the workpiece, adapts to the complex and changeable industrial environment, and improves the quality control capabilities in the field of precision machining.
Smart Images

Figure CN119600050A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of edge shape detection, and in particular to a method and system for detecting the edge shape of a grinding workpiece based on machine learning. Background Art
[0002] Grinding is a method of machining a workpiece using abrasive tools to remove excess material from the surface of the material to achieve the required dimensional accuracy, surface roughness and shape accuracy. This machining method is suitable for hard materials such as metal, glass, and ceramics. Grinding can achieve very high accuracy and finish, so it is widely used in precision machinery manufacturing.
[0003] Grinding workpieces refer to parts or components that need to be processed by grinding. These workpieces may come from various industries, such as automobile manufacturing, aerospace, electronic equipment manufacturing, etc. The materials of grinding workpieces usually include but are not limited to steel, cast iron, cemented carbide, ceramics, etc. The purpose of grinding may be to improve the surface quality of the workpiece, achieve precise dimensional requirements, or form a specific geometric shape.
[0004] Edge shape detection refers to the process of using various technologies and methods to identify and measure the shape, position and size of the edge of an object. In industrial production, edge shape detection is crucial to ensuring product quality, especially in the manufacturing process of precision parts. Through edge shape detection, it is possible to promptly detect whether there are defects in the workpiece, such as cracks, notches, deformations, etc., thereby ensuring product quality and safety.
[0005] The edge shape of the ground workpiece directly affects its dimensional accuracy. Through edge shape detection, it can be ensured that the edge of the workpiece meets the design requirements and avoid assembly problems or functional failures caused by dimensional deviations. Edge shape detection can help identify and control tiny defects on the workpiece surface, such as burrs, cracks, scratches, etc. These defects not only affect the appearance, but may also affect the performance of the workpiece. Through timely detection and correction, the surface quality of the workpiece can be significantly improved.
[0006] Therefore, it is necessary to improve the existing method for detecting the edge shape of a grinding workpiece to solve the above problems. Summary of the invention
[0007] The present invention overcomes the shortcomings of the prior art and provides a method and system for detecting the edge shape of a grinding workpiece based on machine learning, aiming to solve the problems of low detection accuracy and poor real-time performance in the prior art in the edge shape detection of the grinding workpiece due to many surface interference factors and large shape changes.
[0008] To achieve the above object, the technical solution adopted by the present invention is: a method for detecting the edge shape of a grinding workpiece based on machine learning, comprising:
[0009] S1, obtaining the original image of the grinding workpiece and performing preliminary image preprocessing;
[0010] S2, combining image filtering and mathematical morphology image processing to denoise the image and enhance edge information;
[0011] S3, based on the second-order differential operator and combined with the morphological gradient, edge detection is performed to obtain the edge contour of the workpiece;
[0012] S4, using convolutional neural network to extract features from images, automatically learn edge features of workpieces, and build and train edge detection models;
[0013] S5. During the machine grinding process, the workpiece image is acquired in real time and input into the trained edge detection model for detection. According to the detection results, the model is dynamically modified to adapt to the changes in the shape and surface state of the workpiece during the grinding process;
[0014] S6. Output the final edge detection result.
[0015] In a preferred embodiment of the present invention, in step S1, multi-view fusion is used to fuse the image information of the workpiece together to generate a comprehensive two-dimensional image as the original image of the ground workpiece; the multi-view fusion method is one of the weighted average method, the maximum value selection method and the fusion based on pixel classification.
[0016] In a preferred embodiment of the present invention, the preprocessing includes grayscale and preliminary denoising:
[0017] When the original image is in color, convert it to grayscale:
[0018] I gray =0.299R+0.587G+0.114B, where I gray is the grayscale value, R, G, B represent the intensity values of the red, green and blue channels respectively;
[0019] The initial denoising algorithm is median filtering:
[0020] Suppose there is an N×N filter window centered at pixel I(x,y) of the image, then the gray value output after median filtering is The median function means taking the median of all pixel values in the window; i, j represent the offset of the filter window relative to I(x, y).
[0021] In a preferred embodiment of the present invention, in step S2, a composite image processing method combining mathematical morphology opening and closing operations with Gaussian filtering and bilateral filtering is used to achieve a double denoising effect of the image while maintaining the clarity and continuity of the image edge;
[0022] Assume that the size of the Gaussian kernel is k×k and the standard deviation is σ, then the Gaussian kernel
[0023] Filtered pixel value i,j represents the offset of the filter window relative to I(x,y);
[0024] Assume that the kernel size of the bilateral filter is k×k and the standard deviation in the spatial domain is σ d , the standard deviation of the range is σ r , then the pixel value after bilateral filtering Among them, ω(i,j) is the weight of the offset;
[0025] The opening and closing operations of mathematical morphology are used to further remove noise from the image;
[0026] Open Operation
[0027] Closing operation
[0028] The two images processed by Gaussian filtering and bilateral filtering and then processed by mathematical morphology opening and closing operations are weighted fused to obtain the final processing result: f (x,y)=α·I′ g (x,y)+(1-α)·I′ b (x,y),I′ g ,I′ b They represent the Gaussian filtered image and bilateral filtered image after mathematical morphology opening and closing operations, respectively, and α is the weighting coefficient.
[0029] In a preferred embodiment of the present invention, in step S3,
[0030] S31, by calculating the edge information of the second-order differential;
[0031] S32, extracting image edge information through morphological gradient;
[0032] S33. Combining the second-order differential operator and the morphological gradient can fully utilize the advantages of both and improve the accuracy and robustness of edge detection;
[0033] The image is processed using a second-order differential operator and a morphological gradient respectively to obtain two edge images; the two edge images are fused using weighted averaging, maximum value selection or other fusion strategies to obtain a final edge contour image.
[0034] In a preferred embodiment of the present invention, for a two-dimensional image, the calculation formula of the Laplace operator is Among them, the original image is f, x, y are two-dimensional positions;
[0035] Morphological gradients enhance edges in images while suppressing noise;
[0036] Assume the original image is f and the structural element is B, then the morphological gradient
[0037] in, represents the expansion operation, Indicates corrosion operation;
[0038] The weighted average is used to obtain the final edge contour image; E f =βE del +(1-β)E g , where E f is the final edge image, E del is the edge image obtained using the second-order differential operator, E g is the edge image obtained using morphological gradient, and β is the weight coefficient.
[0039] In a preferred embodiment of the present invention, in step S4, the steps of performing feature extraction and edge detection model construction by using a convolutional neural network are:
[0040] S41, arranging the original image, the pre-processed image, and the edge contour image into a format suitable for inputting into the convolutional neural network, performing normalization processing, and then inputting the format into the model;
[0041] S42. Design the convolutional neural network architecture, including input layer, convolution layer, pooling layer, fully connected layer, and output layer, and build a convolutional neural network model.
[0042] S43, training the convolutional neural network model;
[0043] Through the loss function binary cross entropy loss training,
[0044] Where N is the number of samples, is the true label, p i is the predicted probability;
[0045] The network parameters are updated through forward propagation and back propagation to minimize the loss function.
[0046] In a preferred embodiment of the present invention, in step S5,
[0047] S51, inputting the acquired real-time workpiece image into the convolutional neural network model for edge detection;
[0048] S52. Evaluate the quality of the workpiece according to the edge detection result, including checking whether the workpiece has defects or deformation;
[0049] S53. Dynamically correct the convolutional neural network model through real-time images.
[0050] In a preferred embodiment of the present invention, the step of dynamic correction includes:
[0051] Calculate the detection error in, is the edge position predicted by the model, N is the number of samples, and y i is the real edge position;
[0052] To correct the model, update the model parameters θ to minimize the above error;
[0053] Get new parameters through gradient descent algorithm Where γ is the learning rate, is the gradient of the loss function with respect to the parameters.
[0054] The present invention provides a grinding workpiece edge shape detection system based on machine learning, comprising:
[0055] An image acquisition module, used to obtain the original image of the grinding workpiece;
[0056] An image preprocessing module is used to receive the original image from the image acquisition module and perform preliminary processing on it, including grayscale conversion and multi-view fusion, so as to generate a high-quality two-dimensional digital image;
[0057] Image enhancement module, which is used to further process the image based on preprocessing, including applying Gaussian filtering, bilateral filtering, and mathematical morphology opening and closing operations to achieve double denoising and edge enhancement of the image;
[0058] The edge detection module is used to perform edge detection on the image based on the second-order differential operator and morphological gradient technology to accurately obtain the edge contour of the workpiece;
[0059] The feature extraction and model building module is used to perform deep learning on the processed images using a convolutional neural network, automatically learn the features of the edge of the workpiece, and build an edge detection model;
[0060] A real-time detection module is used to receive the workpiece image collected in real time during the actual grinding process;
[0061] Model dynamic correction module, used to adjust model parameters according to real-time feedback to adapt to changes in workpiece shape and surface conditions during the grinding process;
[0062] The result display module is used to display the final results of edge detection, including the detected edge contour and workpiece quality assessment report.
[0063] The present invention solves the defects existing in the background technology and has the following beneficial effects:
[0064] (1) The present invention proposes a method for detecting the edge shape of a ground workpiece based on machine learning. The method achieves high-precision and robust detection of the edge of a ground workpiece by combining image preprocessing, composite image filtering, edge detection using second-order differential operators and morphological gradients, and feature extraction and model construction using a convolutional neural network. The method not only effectively removes interference factors such as scratches, cutting fluid, and chips on the workpiece surface, but also adapts to changes in the shape and surface state of the workpiece during the grinding process by dynamically correcting model parameters, significantly improving the accuracy and real-time performance of edge detection, and providing strong technical support for quality control in the field of precision machining.
[0065] (2) The present invention achieves a dual denoising effect on the image through a composite image processing method that combines mathematical morphology opening and closing operations with Gaussian filtering and bilateral filtering in step S2. This step not only effectively removes Gaussian noise and random noise in the image, but also further smoothes the image edge through mathematical morphology operations and fills small holes inside the edge, thereby significantly improving the signal-to-noise ratio of the image while maintaining the clarity and continuity of the image edge. Compared with the traditional single filtering method, this composite processing method shows stronger robustness and adaptability when processing images in complex industrial environments.
[0066] (3) The present invention enhances the accuracy and robustness of edge detection by combining step S2 with step S3. The composite image processing method adopted in step S2 not only removes the noise in the image, but also retains the integrity of the edge information. Step S3 uses a method combining a second-order differential operator with a morphological gradient for edge detection, which can effectively highlight the edge information in the image and accurately detect the edge of the workpiece even in the presence of slight scratches or noise. Compared with the traditional single edge detection method, the method of the present invention can more accurately identify the true edge of the workpiece, thereby improving the robustness and anti-interference ability of the detection.
[0067] (4) The present invention realizes an efficient conversion from edge detection to feature extraction by combining step S3 with step S4. Step S3 obtains a clear edge contour image by using advanced edge detection technology, while step S4 uses a convolutional neural network to perform in-depth feature extraction on these edge contour images. The convolutional neural network can automatically learn and extract high-level features of the edge, such as shape, texture, etc., which is crucial for subsequent quality assessment. It not only improves the efficiency of feature extraction, but also enables the model to better understand the edge characteristics of the workpiece, thus providing the possibility for precise quality control.
[0068] (5) In step S5, the present invention proposes a dynamic correction method for the convolutional neural network model based on real-time detection results, which can adjust the parameters of the model in real time according to the changes in the shape and surface state of the workpiece during the grinding process, so as to maintain the detection performance of the model; compared with the traditional static model, this dynamic correction method can more effectively cope with the complex and changeable situations in the industrial environment, and improve the real-time and accuracy of edge detection; further, by updating the model parameters through the gradient descent algorithm, it can also ensure the stability and convergence of the model during the correction process. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work.
[0070] Figure 1 is a flow chart of a preferred embodiment of the present invention. DETAILED DESCRIPTION
[0071] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0072] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein. Therefore, the protection scope of the present invention is not limited to the specific embodiments disclosed below.
[0073] Application Overview:
[0074] Grinding is a machining method widely used in the field of precision machining. It uses grinding wheels, abrasive belts, oilstones, sandpaper and other abrasive tools to cut the surface of the workpiece to obtain high-precision shape, size and surface roughness. With the development of industrial automation and intelligence, traditional manual detection methods are gradually replaced by automated detection technology. At present, edge detection technology based on image processing has been widely used in the quality control of ground workpieces. The workpiece image is collected by a camera, and the edge detection is performed using computer vision algorithms to evaluate whether the shape and size of the workpiece meet the standards.
[0075] Although the existing edge detection technology based on image processing has improved the detection efficiency and accuracy to a certain extent, it still faces many challenges in the actual industrial environment. First, impurities such as cutting fluid and chips generated during the grinding process will adhere to the surface of the workpiece, seriously affecting the quality of the image and causing inaccurate edge detection results. Secondly, scratches and other defects on the surface of the workpiece will also interfere with the normal operation of the edge detection algorithm, increasing the risk of false detection and missed detection. In addition, most of the existing edge detection methods rely on fixed thresholds and parameter settings, lack adaptability and robustness, and cannot effectively cope with complex and changing industrial environments.
[0076] In order to solve the above problems, this project proposes a method for detecting the edge shape of grinding workpieces based on machine learning. Through deep learning technology, it automatically learns and extracts the features of the workpiece edge, effectively removes the influence of interference factors such as surface scratches, cutting fluid, chips, etc., and improves the accuracy and robustness of edge detection.
[0077] Exemplary methods:
[0078] like Figure 1 As shown, a method for detecting edge shape of a grinding workpiece based on machine learning comprises:
[0079] S1, obtaining the original image of the grinding workpiece and performing preliminary image preprocessing;
[0080] S2, combining image filtering and mathematical morphology image processing to denoise the image and enhance edge information;
[0081] S3, based on the second-order differential operator and combined with the morphological gradient, edge detection is performed to obtain the edge contour of the workpiece;
[0082] S4, using convolutional neural network to extract features from images, automatically learn edge features of workpieces, and build and train edge detection models;
[0083] S5. During the machine grinding process, the workpiece image is acquired in real time and input into the trained edge detection model for detection. According to the detection results, the model is dynamically modified to adapt to the changes in the shape and surface state of the workpiece during the grinding process;
[0084] S6. Output the final edge detection result.
[0085] The original image is obtained by an industrial camera installed near the grinder. The industrial camera can be fixed or movable to capture images of the workpiece from different angles. In order to ensure image quality, the industrial camera needs to have sufficient resolution and good light adaptability to clearly capture the details of the workpiece surface under various lighting conditions.
[0086] Although the workpiece is three-dimensional, it is converted into a two-dimensional image for processing through shooting from multiple angles and a specific projection method.
[0087] In step S1, the original image obtained is a two-dimensional digital image, usually a grayscale image or a color image. For a grinding workpiece, since color information is not necessary for edge detection, a grayscale image is usually used as the original image. The grayscale image can reduce the amount of data and speed up the processing.
[0088] In step S1, multi-view fusion is used to fuse the image information of the workpiece together to generate a comprehensive two-dimensional image as the original image of the ground workpiece. The multi-view fusion method is one of the weighted average method, the maximum value selection method and the fusion based on pixel classification;
[0089] Specifically, take the weighted average method as an example:
[0090] All images are spatially aligned, that is, the position of the same object in different images is consistent;
[0091] Based on the image's clarity, brightness, and contrast features, a weight is calculated for each pixel in each image;
[0092] Perform weighted averaging on the corresponding pixels of all images to generate a fused image;
[0093] Among them, the weight I fused (x,y) is the pixel value of the fused image, ω i is the weight of the i-th image at position (x, y), I i (x,y) is the pixel value of the i-th image at position (x,y), and N is the number of images.
[0094] The choice of multi-view fusion method depends on the specific application scenario and requirements. The weighted average method is suitable for situations where multiple image information needs to be integrated, the maximum selection method is suitable for situations where the clearest features need to be retained, and the pixel classification-based fusion method is suitable for situations where appropriate pixel values need to be selected based on different features.
[0095] The main purpose of preprocessing is to improve image quality, remove noise, and make subsequent edge detection more accurate.
[0096] When the original image is in color, it needs to be grayscaled:
[0097] I gray =0.299R+0.587G+0.114B, where I gray is the grayscale value, R, G, B represent the intensity values of the red, green and blue channels respectively;
[0098] Image filtering is also performed in step S2 to remove noise, but the random noise in the image is reduced by the preliminary denoising algorithm in step S1, which helps to better preserve edge information in subsequent processing;
[0099] Specifically, the initial denoising algorithm is median filtering:
[0100] Suppose there is an N×N filter window centered at pixel I(x,y) of the image, then the gray value output after median filtering is The median function means taking the median of all pixel values in the window; i, j represent the offset of the filter window relative to I(x, y).
[0101] Step S2 involves further processing of the image, the purpose of which is to improve the image quality so as to perform edge detection more accurately.
[0102] The image edges of the workpiece with scratches after edge detection are very similar to the surface scratches, both of which are white thin lines. However, morphological operations can only remove a small white area protruding from the black area. Therefore, morphology cannot be used to remove surface scratches after edge detection. In order to remove scratches on the workpiece surface, the original image is processed by combining morphological operations and image filtering.
[0103] In step S2, a composite image processing method combining mathematical morphology opening and closing operations with Gaussian filtering and bilateral filtering is used to achieve a dual denoising effect on the image, avoiding the impact of scratches, flying debris and oil stains on the image, while maintaining the clarity and continuity of the image edge. The image is preprocessed using Gaussian filtering and bilateral filtering, and then the opening and closing operations of mathematical morphology are applied to further optimize the image. Finally, the images obtained by the two processing methods are weighted and fused in a certain proportion to achieve the best denoising and edge preservation effect.
[0104] Gaussian filtering is used to remove Gaussian noise in images, but due to its linear characteristics, it may cause the image edges to become blurred;
[0105] Assume that the size of the Gaussian kernel is k×k and the standard deviation is σ, then the Gaussian kernel
[0106] Filtered pixel value i,j represents the offset of the filter window relative to I(x,y);
[0107] Bilateral filtering is a nonlinear filtering technique that can remove noise while maintaining edge clarity. It combines the spatial distance of pixels and the difference in pixel values to determine the filtering weights.
[0108] Assume that the kernel size of the bilateral filter is k×k and the standard deviation in the spatial domain is σ d, the standard deviation of the range is σ r , then the pixel value after bilateral filtering Among them, ω(i,j) is the weight of the offset;
[0109] The opening and closing operations of mathematical morphology are used to further remove noise in the image, especially for the edge blur problem that may appear after Gaussian filtering. The opening operation can smooth the edge, and the closing operation can fill the small holes inside the edge.
[0110] Open Operation
[0111] Closing operation
[0112] The two images processed by Gaussian filtering and bilateral filtering and then processed by mathematical morphology opening and closing operations are weighted fused in a certain proportion to obtain the final processing result:
[0113] I f (x,y)=α·I′ g (x,y)+(1-α)·I b ′(x,y),I′ g ,I′ b They represent the Gaussian filtered image and bilateral filtered image after mathematical morphology opening and closing operations, respectively, and α is the weighting coefficient.
[0114] The improved image processing method takes into account the effective denoising of Gaussian filtering and the preservation of image edge clarity by bilateral filtering. By properly selecting the weight coefficient of image weighted fusion, the disadvantage of bilateral filtering in insufficient removal of high-frequency noise is also reduced. The improved algorithm has significantly improved denoising effect and maintains the clarity and continuity of image edges.
[0115] In step S3,
[0116] S31, by calculating the edge information of the second-order differential;
[0117] The second-order differential operator can highlight the places where the gray value of the image changes fastest, that is, the edge. The second-order differential operators include the Plasma operator and the Hessian matrix.
[0118] Take the Plath operator as an example:
[0119] For a two-dimensional image, the Laplacian operator is calculated as Among them, the original image is f, x, y are two-dimensional positions;
[0120] S32, extracting image edge information through morphological gradient;
[0121] Morphological gradients can enhance edges in images while suppressing noise;
[0122] Assume the original image is f and the structural element is B, then the morphological gradient
[0123] in, represents the expansion operation, Indicates corrosion operation;
[0124] S33. Combining the second-order differential operator and the morphological gradient can fully utilize the advantages of both and improve the accuracy and robustness of edge detection;
[0125] The image is processed using a second-order differential operator and a morphological gradient respectively to obtain two edge images; the two edge images are fused, and weighted average, maximum value selection or other fusion strategies can be used to obtain a final edge contour image;
[0126] Take weighted average as an example: E f =βE del +(1-β)E g , where E f is the final edge image, E del is the edge image obtained using the second-order differential operator, E g is the edge image obtained using morphological gradient, and β is the weight coefficient.
[0127] In step S4, the steps of feature extraction and edge detection model construction through convolutional neural network are as follows:
[0128] S41, arranging the original image, the pre-processed image, and the edge contour image into a format suitable for inputting into the convolutional neural network, performing normalization processing, and then inputting the format into the model;
[0129] The normalized formula is I is the original pixel value, μ is the average pixel value of the image, and σ is the standard deviation of the image pixel value;
[0130] S42. Design the convolutional neural network architecture, including input layer, convolution layer, pooling layer, fully connected layer, output layer, and build a convolutional neural network model;
[0131] The convolutional layer is used to extract local features of the image:
[0132] Where F(x,y,c) is the value of the cth channel of the output feature map at position (x,y), I(x+i,y+j,m) is the value of the mth channel of the input image at position (x,y), K(i,j,m,c) is the value of the mth and cth channels of the convolution kernel at position (i,j), and b(c) is the bias term;
[0133] Activation function ReLU(x)=max(0,x);
[0134] The pooling layer is used to reduce the dimension of the feature map. Commonly used pooling methods include maximum pooling and average pooling.
[0135] Take the maximum pooling as an example: F(x+i,y+j,c), where P(x,y,c) is the value of the cth channel of the pooled feature map at position (x,y), and is the value of the cth channel of the input feature map at position (x+i,y+j);
[0136] The fully connected layer is used to map the feature map to the output category: O = W·F+B, where O is the output vector, W is the weight matrix, F is the input feature vector, and b is the bias vector.
[0137] S43, training the convolutional neural network model;
[0138] Through the loss function binary cross entropy loss training,
[0139] Where N is the number of samples, y i is the true label, p i is the predicted probability;
[0140] The network parameters are updated through forward propagation and back propagation to minimize the loss function.
[0141] During the grinding process, the shape and surface state of the workpiece may change, which will affect the accuracy of edge detection. In order to maintain the detection performance of the model, the convolutional neural network model needs to be dynamically corrected according to the real-time detection results.
[0142] In step S5,
[0143] S51, inputting the acquired real-time workpiece image into the convolutional neural network model for edge detection;
[0144] S52. Evaluate the quality of the workpiece according to the edge detection result, including checking whether the workpiece has defects or deformation;
[0145] S53, dynamically modifying the convolutional neural network model through real-time images;
[0146] Calculate the detection error in, is the edge position predicted by the model, N is the number of samples, and y i is the real edge position;
[0147] To correct the model, update the model parameters θ to minimize the above error;
[0148] Get new parameters through gradient descent algorithm Where γ is the learning rate, is the gradient of the loss function with respect to the parameters.
[0149] Example systems:
[0150] A grinding workpiece edge shape detection system based on machine learning, comprising:
[0151] An image acquisition module, used to obtain the original image of the grinding workpiece;
[0152] An image preprocessing module is used to receive the original image from the image acquisition module and perform preliminary processing on it, including grayscale conversion and multi-view fusion, so as to generate a high-quality two-dimensional digital image;
[0153] Image enhancement module, which is used to further process the image based on preprocessing, including applying Gaussian filtering, bilateral filtering, and mathematical morphology opening and closing operations to achieve double denoising and edge enhancement of the image;
[0154] The edge detection module is used to perform edge detection on the image based on the second-order differential operator and morphological gradient technology to accurately obtain the edge contour of the workpiece;
[0155] The feature extraction and model building module is used to perform deep learning on the processed images using a convolutional neural network, automatically learn the features of the edge of the workpiece, and build an edge detection model;
[0156] A real-time detection module is used to receive the workpiece image collected in real time during the actual grinding process;
[0157] Model dynamic correction module, used to adjust model parameters according to real-time feedback to adapt to changes in workpiece shape and surface conditions during the grinding process;
[0158] The result display module is used to display the final results of edge detection, including the detected edge contour and workpiece quality assessment report.
[0159] The above is based on the ideal embodiment of the present invention. Through the above description, relevant personnel can make various changes and modifications without departing from the technical concept of the present invention. The technical scope of the present invention is not limited to the content in the specification, and the technical scope must be determined according to the scope of the claims.
Claims
1. A method for detecting edge shape of a grinding workpiece based on machine learning, characterized in that: include: S1, obtaining the original image of the grinding workpiece and performing preliminary image preprocessing; S2, combining image filtering and mathematical morphology image processing to denoise the image and enhance edge information; S3, based on the second-order differential operator and combined with the morphological gradient, edge detection is performed to obtain the edge contour of the workpiece; S4, using convolutional neural network to extract features from images, automatically learn edge features of workpieces, and build and train edge detection models; S5. During the machine grinding process, the workpiece image is acquired in real time and input into the trained edge detection model for detection. According to the detection results, the model is dynamically modified to adapt to the changes in the workpiece shape and surface state during the grinding process; S6. Output the final edge detection result.
2. The method for detecting edge shape of a grinding workpiece based on machine learning according to claim 1, characterized in that: In step S1, multi-view fusion is used to fuse the image information of the workpiece to generate a comprehensive two-dimensional image as the original image of the ground workpiece; the multi-view fusion method is one of the weighted average method, the maximum value selection method and the fusion based on pixel classification.
3. The method for detecting edge shape of a grinding workpiece based on machine learning according to claim 1, characterized in that: Preprocessing includes grayscale and preliminary denoising: When the original image is in color, convert it to grayscale: I gray =0.299R+0.587G+0.114B, where I gray is the grayscale value, R, G, B represent the intensity values of the red, green and blue channels respectively; The initial denoising algorithm is median filtering: Suppose there is an N×N filter window centered at pixel I(x,y) in the image, then the gray value output after median filtering is The median function means taking the median of all pixel values in the window; i, j represent the offset of the filter window relative to I(x, y).
4. The method for detecting edge shape of a grinding workpiece based on machine learning according to claim 1, characterized in that: In step S2, a composite image processing method combining mathematical morphology opening and closing operations with Gaussian filtering and bilateral filtering is used to achieve a double denoising effect on the image while maintaining the clarity and continuity of the image edge; Assume that the size of the Gaussian kernel is k×k and the standard deviation is σ, then the Gaussian kernel Filtered pixel value i,j represents the offset of the filter window relative to I(x,y); Assume that the kernel size of the bilateral filter is k×k and the standard deviation in the spatial domain is σ d , the standard deviation of the range is σ r , then the pixel value after bilateral filtering is in, ω(i,j) is the weight of the offset; The opening and closing operations of mathematical morphology are used to further remove noise from the image; Open Operation Closing operation The two images processed by Gaussian filtering and bilateral filtering and then processed by mathematical morphology opening and closing operations are weighted fused to obtain the final processing result: f (x,y)=α·I′ g (x,y)+(1-α)·I b ′(x,y), I′g, Ib′ respectively represent the Gaussian filter image and bilateral filter image after mathematical morphology opening and closing operations, and α is the weighting coefficient.
5. The method for detecting edge shape of a grinding workpiece based on machine learning according to claim 1, characterized in that: In step S3, S31, by calculating the edge information of the second-order differential; S32, extracting image edge information through morphological gradient; S33. Combining the second-order differential operator and the morphological gradient can fully utilize the advantages of both and improve the accuracy and robustness of edge detection; The image is processed using a second-order differential operator and a morphological gradient respectively to obtain two edge images; the two edge images are fused using weighted averaging, maximum value selection or other fusion strategies to obtain a final edge contour image.
6. The method for detecting edge shape of a grinding workpiece based on machine learning according to claim 5, characterized in that: For a two-dimensional image, the Laplacian operator is calculated as Among them, the original image is f, x, y are two-dimensional positions; Morphological gradients enhance edges in images while suppressing noise; Assume the original image is f and the structural element is B, then the morphological gradient Among them, ⊕ represents the expansion operation, Indicates corrosion operation; The weighted average is used to obtain the final edge contour image; E f =βE del +(1-β)E g , where E f is the final edge image, E del is the edge image obtained using the second-order differential operator, E g is the edge image obtained using morphological gradient, and β is the weight coefficient.
7. The method for detecting edge shape of a grinding workpiece based on machine learning according to claim 1, characterized in that: In step S4, the steps of feature extraction and edge detection model construction through convolutional neural network are as follows: S41, arranging the original image, the pre-processed image, and the edge contour image into a format suitable for inputting into the convolutional neural network, performing normalization processing, and then inputting the format into the model; S42. Design the convolutional neural network architecture, including input layer, convolution layer, pooling layer, fully connected layer, output layer, and build a convolutional neural network model; S43, training the convolutional neural network model; Through the loss function binary cross entropy loss training, Where N is the number of samples, is the true label, p i is the predicted probability; The network parameters are updated through forward propagation and back propagation to minimize the loss function.
8. The method for detecting edge shape of a grinding workpiece based on machine learning according to claim 1, characterized in that: In step S5, S51, inputting the acquired real-time workpiece image into the convolutional neural network model for edge detection; S52. Evaluate the quality of the workpiece according to the edge detection result, including checking whether the workpiece has defects or deformation; S53. Dynamically correct the convolutional neural network model through real-time images.
9. The method for detecting edge shape of a grinding workpiece based on machine learning according to claim 8, characterized in that: The steps of dynamic correction include: Calculate the detection error in, is the edge position predicted by the model, N is the number of samples, and y i is the real edge position; To correct the model, update the model parameters θ to minimize the above error; The new parameter θ is obtained by the gradient descent algorithm new =θ-γ·▽ θ L(θ), where γ is the learning rate, ▽ θ L(θ) is the gradient of the loss function with respect to the parameters.
10. A grinding workpiece edge shape detection system based on machine learning, based on a grinding workpiece edge shape detection method based on machine learning according to any one of claims 1 to 9, characterized in that: include: An image acquisition module, used to obtain the original image of the grinding workpiece; An image preprocessing module is used to receive the original image from the image acquisition module and perform preliminary processing on it, including grayscale conversion and multi-view fusion, so as to generate a high-quality two-dimensional digital image; Image enhancement module, which is used to further process the image based on preprocessing, including applying Gaussian filtering, bilateral filtering, and mathematical morphology opening and closing operations to achieve double denoising and edge enhancement of the image; The edge detection module is used to perform edge detection on the image based on the second-order differential operator and morphological gradient technology to accurately obtain the edge contour of the workpiece; The feature extraction and model building module is used to perform deep learning on the processed images using a convolutional neural network, automatically learn the features of the edge of the workpiece, and build an edge detection model; A real-time detection module is used to receive the workpiece image collected in real time during the actual grinding process; Model dynamic correction module, used to adjust model parameters according to real-time feedback to adapt to changes in workpiece shape and surface conditions during the grinding process; The result display module is used to display the final results of edge detection, including the detected edge contour and workpiece quality assessment report.
Citation Information
Cited By
Lightweight convolutional network-based DIC displacement field dynamic correction method and system
CN120451712A
Dic displacement field dynamic correction method and system based on lightweight convolutional network
CN120451712B
Large numerical control grinding machine thermal deformation measuring system and method based on machine vision
CN121018403A
A large numerical control grinding machine thermal deformation measurement system and method based on machine vision
CN121018403B