Oil stain detection method for machine tool guide rail
Through the combination of hyperspectral cameras and deep learning models, accurate detection and continuous monitoring of oil stains on machine tool guide rails are achieved, solving the time and accuracy issues of manual inspections, improving the timeliness and accuracy of detection, and supporting preventive maintenance.
Patent Information
- Application Number
- CN202410796244.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-19
- Publication Date
- 2024-09-24
AI Technical Summary
In the existing technology, the detection of oil contamination on machine tool guide rails relies on manual regular inspections, which has problems such as waste of time and human resources, inaccurate detection results, and inability to detect changes in oil contamination in a timely manner.
A hyperspectral camera is used to acquire hyperspectral images of machine tool guide rails, spectral data are extracted for component analysis, and the absorption peak and distribution area of oil pollution are obtained, which are input into the preset oil pollution degree prediction model and analyzed through a deep learning model to achieve continuous monitoring. and early failure warning.
It achieves accurate detection and continuous monitoring of oil contamination on machine tool guide rails, can predict oil contamination accumulation trends, reduce reliance on manual inspections, improve detection accuracy and timeliness, and support preventive maintenance.
Smart Images

Figure CN118688136A
Abstract
Description
Technical Field
[0001] This article relates to oil pollution detection technology, especially to an oil pollution detection method for machine tool guide rails. Background Art
[0002] During the operation of CNC machine tools, the accumulation of oil on the surface of the guide rails is a common problem that seriously affects the performance of the machine tools. These oil stains may come from lubricating oil, cutting fluid, and dust in the environment, and gradually deposit on the surface of the guide rails as the machine tools are used. The accumulation of oil stains will increase the friction on the surface of the guide rails, thereby affecting the positioning accuracy and processing quality of the machine tools, and even accelerate the wear of the guide rails, reducing the service life of the machine tools.
[0003] At present, the detection of oil pollution on machine tool guide rails mainly relies on manual regular inspection. However, this inspection method has the following problems: first, manual inspection requires a lot of time and human resources, and is easily affected by subjective factors, and the accuracy of the inspection results is difficult to guarantee; second, due to the periodicity and limitations of manual inspection, it is often impossible to detect the changes and accumulation of oil pollution on the guide rails in time, resulting in the machine tool being discovered only when the oil pollution is serious, which has caused a certain degree of impact. Summary of the invention
[0004] In order to solve the above technical problems, the embodiment of the present application provides a method for detecting oil pollution on a machine tool guide rail, which comprises:
[0005] A hyperspectral camera is used to obtain hyperspectral images of machine tool guide rails;
[0006] Extracting spectral data of the hyperspectral image, and performing component analysis on the spectral data to obtain a spectral curve;
[0007] Obtaining the peak value of the absorption peak corresponding to each type of oil stain on the machine tool guide rail from the spectrum curve;
[0008] Processing the spectral data at each pixel of the hyperspectral image to obtain the distribution area of each type of oil stain on the machine tool guide rail in the hyperspectral image;
[0009] The peak value of the absorption peak corresponding to each type of oil stain on the machine tool guide rail and the distribution area of each type of oil stain in the hyperspectral image are input into a preset oil stain contamination degree prediction model to obtain the oil stain contamination degree of the machine tool guide rail.
[0010] In an illustrative embodiment, the peak value of the absorption peak corresponding to each type of oil stain on the machine tool guide rail and the distribution area of each type of oil stain in the hyperspectral image are input into a preset oil stain pollution degree prediction model, including:
[0011] The peak value of the absorption peak corresponding to each type of oil stain on the machine tool guide rail and the distribution area of each type of oil stain in the hyperspectral image are normalized and then input into a preset oil stain pollution degree prediction model.
[0012] In an illustrative embodiment, before inputting the peak value of the absorption peak corresponding to each type of oil stain on the machine tool guide rail and the distribution area of each type of oil stain in the hyperspectral image into a preset oil stain pollution degree prediction model, the oil stain detection method further includes:
[0013] Acquire multiple hyperspectral image samples of machine tool guide rails at different oil pollution levels, and manually assess the oil pollution level of the machine tool guide rails in each hyperspectral image sample to obtain an oil pollution level label for each hyperspectral image sample;
[0014] Obtain the peak value of the absorption peak of each oil pollution and the distribution area of each oil pollution in each hyperspectral image sample, and perform normalization processing on the peak value and the distribution area of the absorption peak;
[0015] The peak values of all absorption peaks after normalization of hyperspectral image samples, the distribution areas of all types of oil pollution and the oil pollution degree labels of hyperspectral image samples are used to train the oil pollution degree prediction model, so as to perform regression analysis between the peak values of all absorption peaks after normalization of hyperspectral image samples, the distribution areas of all types of oil pollution and the oil pollution degree labels of hyperspectral image samples.
[0016] In an illustrative embodiment, the oil pollution degree prediction model is a convolutional neural network;
[0017] The evaluation index between the model label and the prediction model is Loss = argmin||f(A,S)-T|| 2 , where f(A,S) is the oil pollution degree prediction model, and T is the oil pollution degree label to be predicted by the oil pollution degree prediction model.
[0018] In an illustrative embodiment, a ReLu activation function is used to construct a fully connected layer.
[0019] In an illustrative embodiment, the oil pollution degree is represented by a real number ranging from 0 to 1, and the closer the oil pollution degree is to 1, the greater the oil pollution degree is.
[0020] In an illustrative embodiment, processing the spectral data at each pixel of the hyperspectral image to obtain the distribution area of each type of oil stain on the machine tool guide rail in the hyperspectral image includes:
[0021] The color at each pixel of the hyperspectral image is set to a color corresponding to the spectral data at the pixel, so as to convert the hyperspectral image into a pseudo-color image;
[0022] Input the pseudo-color image into a preset image input deep learning model to obtain a classified image with the contaminated area of each oil pollution marked;
[0023] The area of each contaminated region in the classified image is calculated to obtain the distribution area of each oil pollution in the hyperspectral image.
[0024] In an illustrative embodiment, before the pseudo-color image is input into a preset image input deep learning model, the method further includes:
[0025] Manually annotate multiple false color image samples to obtain a data set of false color image samples annotating polluted areas and non-polluted areas of each type of oil pollution;
[0026] The data set is used to train an image input deep learning model, wherein the image input deep learning model is a pixel-level segmentation model.
[0027] In an illustrative embodiment, it also includes:
[0028] Based on the fact that the oil contamination degree of the machine tool guide rail is greater than or equal to a contamination degree threshold, an alarm message is issued.
[0029] In an illustrative embodiment, the method further includes: acquiring a hyperspectral image of the machine tool guide rail using a hyperspectral camera at preset time intervals.
[0030] In the technical solution of the present application, the peak value of the absorption peak corresponding to each type of oil stain on the machine tool guide rail and the distribution area of each type of oil stain in the hyperspectral image are input as input features into the oil stain pollution degree prediction model to obtain the prediction result of the oil stain pollution degree of the machine tool guide rail. The oil stain detection method determines the type of oil stain on the machine tool guide rail and the distribution area of each type of oil stain by analyzing the hyperspectral image of the machine tool guide rail, and determines the oil stain pollution degree of the machine tool guide rail based on the type of oil stain on the machine tool guide rail and the distribution area of each type of oil stain. Compared with the detection method based on traditional machine vision, the detection method based on a single sensor or the manual detection method, the detection of oil stains is more accurate.
[0031] Compared with the manual periodic monitoring of the oil contamination degree of machine tool guide rails, the oil contamination detection method in this embodiment can realize the continuous monitoring and analysis of the oil contamination of machine tool guide rails. It can not only detect the current oil contamination situation, but also predict the trend of oil contamination accumulation, thereby facilitating preventive maintenance and early fault warning.
[0032] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or be understood by implementing the present application. Other advantages of the present application can be realized and obtained by the schemes described in the description and the drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] The accompanying drawings are used to provide an understanding of the technical solution of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the technical solution of the present application and do not constitute a limitation on the technical solution of the present application.
[0034] Figure 1 This is a flow chart of a method for detecting oil pollution on a machine tool guide rail according to an embodiment of the present application;
[0035] Figure 2 This is a schematic diagram of the structure of a CNC machine tool according to an embodiment of the present application;
[0036] Figure 3 This is a flow chart of a method for detecting oil pollution on a machine tool guide rail according to an embodiment of the present application;
[0037] Figure 4 This is a flow chart of training an oil pollution degree prediction model in an embodiment of the present application;
[0038] Figure 5 A schematic diagram of a pseudo-color image in an embodiment of the present application;
[0039] Figure 6 This is a flowchart of a deep learning model for training image input in an embodiment of the present application. DETAILED DESCRIPTION
[0040] The present application describes multiple embodiments, but the description is exemplary rather than restrictive, and it is obvious to those skilled in the art that there may be more embodiments and implementations within the scope of the embodiments described in the present application. Although many possible feature combinations are shown in the drawings and discussed in the specific embodiments, many other combinations of the disclosed features are also possible. Unless specifically limited, any feature or element of any embodiment may be used in combination with any other feature or element in any other embodiment, or may replace any other feature or element in any other embodiment.
[0041] The present application includes and contemplates combinations of features and elements known to those of ordinary skill in the art. The embodiments, features and elements disclosed in the present application may also be combined with any conventional features or elements to form a unique invention scheme. Any features or elements of any embodiment may also be combined with features or elements from other invention schemes to form another unique invention scheme. Therefore, it should be understood that any feature shown and / or discussed in the present application may be implemented individually or in any appropriate combination. Therefore, except for the limitations made according to the attached claims and their equivalents, the embodiments are not subject to other restrictions. In addition, various modifications and changes may be made within the scope of protection of the attached claims.
[0042] In addition, when describing representative embodiments, the specification may have presented the method and / or process as a specific sequence of steps. However, to the extent that the method or process does not rely on the specific order of the steps described herein, the method or process should not be limited to the steps of the specific order described. As will be understood by those of ordinary skill in the art, other sequences of steps are also possible. Therefore, the specific sequence of the steps set forth in the specification should not be interpreted as a limitation to the claims. In addition, the claims for the method and / or process should not be limited to the steps of performing them in the order written, and those skilled in the art can easily understand that these sequences can be changed and still remain within the spirit and scope of the embodiments of the present application.
[0043] like Figure 1 As shown, Figure 1 A method for detecting oil stains on a machine tool guide rail in an embodiment of the present application is shown. The method for detecting oil stains on a machine tool guide rail comprises steps S1 to S5.
[0044] Step S1: using a hyperspectral camera 2 to obtain a hyperspectral image of a machine tool guide rail 3;
[0045] The oil pollution detection method can be implemented based on a CNC machine tool, and the oil pollution detection method is used to detect the oil pollution degree of the machine tool guide rail of the CNC machine tool. Figure 2 As shown, the CNC machine tool includes a machine guide rail 3, a protective shell 1 and a hyperspectral camera 2. The machine guide rail 3 and the hyperspectral camera 2 are both arranged in the protective shell 1. The hyperspectral camera 2 can be arranged on the inner wall of the protective shell 1. The hyperspectral camera 2 is arranged above the machine guide rail 3, and the lens of the hyperspectral camera 2 faces downward and toward the machine guide rail 3. During the use of the CNC machine tool, oil will gradually accumulate on the machine guide rail 3.
[0046] The hyperspectral camera 2 is directed toward the machine tool guide rail 3 to shoot and obtain a hyperspectral image of the machine tool guide rail 3. A hyperspectral image is a special type of image that contains rich spectral information. Each pixel in a hyperspectral image corresponds to a series of continuous spectral data. Spectral data refers to light intensity or reflectivity at different wavelengths.
[0047] Step S2: extracting spectral data of the hyperspectral image, and performing component analysis on the spectral data to obtain a spectral curve;
[0048] By performing component analysis on all spectral data in the hyperspectral image, a spectral curve can be obtained. The horizontal axis of the spectral curve is the wavelength, and the vertical axis can be the light intensity or reflectivity. The spectral curve shows the law of how the reflectivity or light intensity of the machine tool guide rail 3 and the oil on the machine tool guide rail 3 changes with the wavelength, reflecting the absorption and scattering characteristics of the machine tool guide rail 3 and the oil on the machine tool guide rail 3 to light.
[0049] Step S3: obtaining the peak value of the absorption peak corresponding to each type of oil stain on the machine tool guide rail 3 from the spectrum curve;
[0050] The absorption peak is the lowest peak or highest peak of the light intensity / reflectivity of the reflected light spectrum received by the spectral camera. Because different oil stains absorb light of different wavelengths to different degrees, the intensity and reflectivity of their reflected light are different. The type of oil stain can be determined by the peak value. Each type of oil stain on the machine tool guide rail 3 corresponds to an absorption peak on the spectrum curve.
[0051] According to the usage scenario of the CNC machine tool, the types of oil stains that may appear on the machine tool guide rail 3 can be determined in advance, that is, the types of oil stains that may appear on the machine tool guide rail 3 are determined. A feature database is established in advance, and the feature database has the absorption peak feature information of all possible oil stains on the machine tool guide rail 3. The peak feature information includes the position of the oil stain absorption peak, the peak value of the oil stain absorption peak, and the half-peak width of the oil stain absorption peak. The absorption peak feature information of each type of oil stain in the feature database can be calibrated in advance.
[0052] Identify all the absorption peaks on the spectrum curve, match the absorption peaks on the spectrum curve with the absorption peak characteristic information of the oil stain in the characteristic database, and extract all the absorption peaks on the spectrum curve that can match any absorption peak characteristic information in the characteristic database as the absorption peaks corresponding to the oil stain on the machine tool guide rail 3. The type of oil stain corresponding to the absorption peak on the spectrum curve is the same as the type of oil stain corresponding to the absorption peak characteristic information matched by the absorption peak. Then, obtain the peak value information of each absorption peak corresponding to the oil stain in the spectrum curve from the spectrum curve. The peak value of the absorption peak corresponding to each oil stain characterizes a type of oil stain on the machine tool guide rail 3.
[0053] Step S4: Processing the spectral data at each pixel of the hyperspectral image to obtain the distribution area of each oil stain on the machine tool guide rail 3 in the hyperspectral image;
[0054] Spectral matching can be performed on the spectral data at each pixel to determine whether there is oil stain at each pixel and the type of oil stain at each pixel, thereby obtaining the distribution of each type of oil stain on the machine tool guide rail 3 in the hyperspectral image, and thus calculating the distribution area of each type of oil stain on the machine tool guide rail 3 in the hyperspectral image. The distribution area of each type of oil stain in the hyperspectral image can be represented by the total number of pixels with such oil stain.
[0055] Step S5: inputting the peak value of the absorption peak corresponding to each oil stain on the machine tool guide rail 3 and the distribution area of each oil stain in the hyperspectral image into a preset oil stain contamination degree prediction model to obtain the oil stain contamination degree of the machine tool guide rail 3.
[0056] The oil pollution degree prediction model is a deep neural network that takes the peak value of the absorption peak corresponding to each type of oil pollution on the machine tool guide rail 3 and the distribution area of each type of oil pollution in the hyperspectral image as input, and the oil pollution degree of the machine tool guide rail 3 as output. The oil pollution degree prediction model is configured with the correlation between the peak value of the absorption peak corresponding to each type of oil pollution on the machine tool guide rail 3 and the distribution area of each type of oil pollution in the hyperspectral image and the oil pollution degree of the machine tool guide rail 3.
[0057] The peak value of the absorption peak corresponding to each type of oil stain on the machine tool guide rail 3 and the distribution area of each type of oil stain in the hyperspectral image are input as input features into the oil stain contamination degree prediction model to obtain the prediction result of the oil stain contamination degree of the machine tool guide rail 3.
[0058] The oil stain detection method in this embodiment determines the type of oil stain on the machine tool guide rail 3 and the distribution area of each oil stain by analyzing the hyperspectral image of the machine tool guide rail 3, and determines the degree of oil stain contamination of the machine tool guide rail 3 according to the type of oil stain on the machine tool guide rail 3 and the distribution area of each oil stain. Compared with the detection method based on traditional machine vision, the detection method based on a single sensor or the manual detection method, the detection of oil stains is more accurate.
[0059] Compared with the manual periodic monitoring of the oil contamination degree of the machine tool guide rail 3, the oil contamination detection method in this embodiment can realize the continuous monitoring and analysis of the oil contamination of the machine tool guide rail 3, which can not only detect the current oil contamination situation, but also predict the trend of oil contamination accumulation, thereby facilitating preventive maintenance and early fault warning.
[0060] In an illustrative embodiment, step S5 includes step S51 and step S52.
[0061] Step S51: normalizing the peak value of the absorption peak corresponding to each type of oil stain on the machine tool guide rail 3 and the distribution area of each type of oil stain in the hyperspectral image;
[0062] The following Sigmoid function can be used to normalize the data:
[0063] F(x)=(1+e -x ) -1
[0064] The Sigmoid function can be used to map the peak value of the absorption peak and the distribution area in the hyperspectral image to the interval of (0, 1). The peak value or distribution area of the absorption peak is input as the independent variable of the Sigmoid function, and the Sigmoid function can output a corresponding dependent variable in the interval of (0, 1).
[0065] Step S52: input the peak value of the absorption peak corresponding to each oil stain on the machine tool guide rail 3 after normalization and the distribution area of each oil stain in the hyperspectral image into a preset oil stain contamination degree prediction model to obtain the oil stain contamination degree of the machine tool guide rail 3.
[0066] The oil pollution detection method further includes steps S1a to S3a before step S1. Steps S1a to S3a are steps for training an oil pollution degree prediction model.
[0067] Step S1a: obtaining a plurality of hyperspectral image samples of the machine tool guide rail 3 at different oil pollution levels, and manually assessing the oil pollution level of the machine tool guide rail 3 in each hyperspectral image sample to obtain an oil pollution level label of each hyperspectral image sample;
[0068] Multiple hyperspectral image samples of the machine tool guide rail 3 at different oil pollution levels are collected by the hyperspectral camera 2. The combination of oil pollution types and the area of each oil pollution on multiple hyperspectral image samples may be different. The oil pollution level of the machine tool guide rail 3 in each hyperspectral image sample is manually assessed to mark the oil pollution level label of each hyperspectral image sample. An expert in CNC machine tool maintenance may score the oil pollution level of the machine tool guide rail 3 in each hyperspectral image sample. The score ranges from 0 to 1. The closer to 0, the lower the oil pollution level, and the closer to 1, the greater the oil pollution level. Experts may assess the oil pollution level based on the type of oil pollution and the size of the distribution area of each oil pollution.
[0069] Step S2a: obtaining the peak value of the absorption peak of each oil pollution and the distribution area of each oil pollution in each hyperspectral image sample, and normalizing the peak value and the distribution area of the absorption peak;
[0070] Normalizing the peak value and distribution area of the absorption peak of each hyperspectral image sample can accelerate model training.
[0071] Step S3a: The peak values of all absorption peaks after normalization of the hyperspectral image samples, the distribution areas of all types of oil pollution, and the oil pollution degree labels of the hyperspectral image samples are used to train the oil pollution degree prediction model, so as to perform regression analysis between the peak values of all absorption peaks after normalization of the hyperspectral image samples, the distribution areas of all types of oil pollution, and the oil pollution degree labels of the hyperspectral image samples.
[0072] The oil pollution degree prediction model is a deep neural network for regression analysis, and the deep neural network can adopt a convolutional neural network. The architecture of the convolutional neural network includes multiple convolutional layers, pooling layers and at least one fully connected layer. Using the supervised learning method, the peak values of the absorption peaks of the oil pollution after normalization of multiple hyperspectral image samples, the distribution area of the oil pollution and the oil pollution degree labels are input into the training model in turn to obtain the trained oil pollution degree prediction model and the oil pollution degree labels. The oil pollution degree prediction model performs regression analysis between the peak values of all absorption peaks after normalization of the hyperspectral image samples, the distribution areas of all types of oil pollution and the oil pollution degree labels of the hyperspectral image samples.
[0073] In an illustrative embodiment, the evaluation index between the model label and the prediction model is Loss = argmin||f(A,S)-T|| 2 , where f(A,S) is the oil pollution degree prediction model, A is the peak value of the absorption peak of the oil pollution after normalization, S is the distribution area of the oil pollution after normalization, and T is the oil pollution degree label to be predicted by the oil pollution degree prediction model. The evaluation index representation is minimized to minimize the sum of squared errors.
[0074] The benefits of using this evaluation indicator are: intuitive and easy to understand: the square error metric is an intuitive and widely used error metric that reflects the difference between the predicted value and the true value; the square error function is continuous and differentiable, which is beneficial for many optimization algorithms (such as gradient descent) because these algorithms rely on the gradient information of the error function; the square error has good mathematical properties, such as convexity (for linear models and some nonlinear models), which makes it easier to find the global minimum).
[0075] In an illustrative embodiment, in the process of constructing an oil pollution degree prediction model, a ReLu activation function is used to construct a fully connected layer to complete the construction of a regression network.
[0076] Using ReLU as the activation function can ensure efficient processing and transmission of gradients during the construction and training of deep neural networks, promoting rapid convergence.
[0077] In an illustrative embodiment, the oil pollution degree output by the oil pollution degree prediction model is represented by a real number between 0 and 1. The closer the oil pollution degree is to 1, the greater the oil pollution degree is; the closer the oil pollution degree is to 0, the smaller the oil pollution degree is; and the oil pollution degree equal to 0 indicates no oil pollution.
[0078] The use of real numbers from 0 to 1 to quantify the degree of oil pollution makes the expression of the degree of oil pollution more precise and intuitive. At the same time, it is also convenient to classify the degree of pollution. For example, when the degree of oil pollution is in the interval of [0.8,1.0], it is severe pollution; when the degree of oil pollution is in the interval of [0.6,0.8), it is moderate pollution; when the degree of oil pollution is in the interval of [0.4,0.6), it is light pollution; when the degree of oil pollution is in the interval of [0,0.4), it is normal.
[0079] In an illustrative embodiment, the oil pollution detection method further includes step S6 and step S7 after step S5.
[0080] Step S6: Determine whether the oil pollution degree of the machine tool guide rail 3 is greater than or equal to the pollution degree threshold, and proceed to step S7; otherwise, proceed to step S1;
[0081] The pollution degree threshold is a preset value, which may be the maximum oil pollution degree that the CNC machine tool can tolerate for normal operation. The pollution degree threshold may range from 0.4 to 0.8.
[0082] Step S7: Send out an alarm message.
[0083] The numerical control machine tool is provided with an alarm device, which can be a display screen or an audible and visual alarm device. The alarm information is issued by the alarm device. The alarm information can be graphic information or audible and visual information. The content of the alarm information can be, for example, that the machine tool guide rail 3 is seriously contaminated with oil.
[0084] In an illustrative embodiment, the oil pollution detection method further includes entering step S1 once at a preset time interval, that is, using the hyperspectral camera 2 to acquire a hyperspectral image of the machine tool guide rail 3 once at a preset time interval.
[0085] In this way, the oil pollution detection is performed once every preset time, and the preset time may be 60 minutes.
[0086] In an illustrative embodiment, step S4 includes steps S41 to S43.
[0087] Step S41: setting the color of each pixel of the hyperspectral image to a color corresponding to the spectral data at the pixel, so as to convert the hyperspectral image into a pseudo-color image;
[0088] The correspondence between spectral data and color codes is established in advance, and different spectral data correspond to different color codes. Each pixel of the hyperspectral image has spectral data. According to the correspondence between the spectral data and the color code, the color of each pixel of the hyperspectral image is set to the color corresponding to the color code corresponding to the spectral data at the pixel, so that the hyperspectral image can be converted into a pseudo-color image.
[0089] The contaminated areas of the same type of oil have the same color in the pseudo-color image, and the contaminated areas of different oils have different colors.
[0090] Step S42: inputting the pseudo-color image into a preset image input deep learning model to obtain a classified image with the pollution area of each oil pollution marked;
[0091] The image input deep learning model is a classification model, which is used to identify the oil contamination area and non-contamination area of the pseudo-color image. The pseudo-color image is input into the pre-trained image input deep learning model, and the image input deep learning model can output a classification image, in which the contamination area of each oil contamination of the machine tool guide rail 3 is marked.
[0092] like Figure 5 As described above, in the classified image, regions I, II, III, and N are polluted regions with different oil stains, and regions other than regions I, II, III, and N are non-polluted regions.
[0093] Step S43: Calculate the area of each contaminated region in the classified image to obtain the distribution area of each oil contamination in the hyperspectral image.
[0094] The area of the polluted region corresponding to each type of oil pollution in the classified image can be calculated by accumulating the pixel points covered by the polluted region corresponding to each type of oil pollution to obtain the distribution area of the oil pollution in the hyperspectral image.
[0095] In an illustrative embodiment, the oil stain detection method further includes steps S1b to S2b before step S1. Steps S1b to S2b are steps of inputting a training image into a deep learning model.
[0096] Step S1b: manually labeling a plurality of pseudo-color image samples to obtain a data set of pseudo-color image samples that label the polluted area and non-polluted area of each oil pollution;
[0097] The plurality of pseudo-color image samples may be converted from the plurality of hyperspectral image samples described above using the method in step S41. The polluted area of each oil pollution in each pseudo-color image sample is manually marked, and the non-polluted area is marked at the same time, so as to obtain a data set consisting of pseudo-color image samples with marked oil pollution areas and non-polluted areas. The labels indicate the range of the non-polluted area and the oil pollution area.
[0098] Step S2b: using the dataset to train the image input deep learning model;
[0099] The image input deep learning model is a deep neural network model that takes a pseudo-color image as input and a classified image as output. The image input deep learning model is a pixel-level segmentation model. The image input deep learning model can use a pixel-level segmentation FCN full convolutional neural network model or other pixel-level segmentation models such as U-net. Inputting the labeled pseudo-color image sample data set into the image input deep learning model for training can obtain a classification model that can distinguish between oil-polluted areas and non-polluted areas.
[0100] In an exemplary embodiment, in step S1, the hyperspectral camera 2 is used to obtain multiple hyperspectral images of the machine tool guide rail 3 each time. For example, the hyperspectral camera 2 can sequentially take n (n is greater than 1) hyperspectral images (P1, P2, ..., P n ), n hyperspectral images correspond to n groups of spectral data (G1, G2, ..., G n );
[0101] In step S2, the spectral data of each hyperspectral image is analyzed to obtain a plurality of spectral curves.
[0102] n groups of spectral data (G1, G2, ..., G n ) can obtain n spectral curves.
[0103] In step S3, the peak value of the absorption peak corresponding to each oil stain on the machine tool guide rail 3 is obtained from the multiple spectrum curves, and the peak value of the absorption peak corresponding to each oil stain is averaged to obtain the peak value average value of the absorption peak corresponding to each oil stain;
[0104] Assuming that there are k types of oil stains on the machine tool guide rail 3, in step S3, from each hyperspectral image P i The peak values of the absorption peaks of k spectral curves can be obtained from the spectral curve (H 1i ,H 2i ,...,H ki ), and then use the following formula to calculate the peak value average of the absorption peak corresponding to each oil stain in the n spectral curves:
[0105]
[0106] in, is the peak value average of the absorption peak of the kth oil stain, H ki is the absorption peak of the kth oil stain in the ith spectral curve, and n is the number of spectral curves.
[0107] In step S41, the plurality of hyperspectral images are converted into a plurality of pseudo-color images;
[0108] Hyperspectral image P n and the corresponding spectral data G n Spectral matching is performed, and different oil pollution areas are represented by different colors, thus obtaining a pseudo-color image (W1, W2, ..., W n ).
[0109] In step S42, the plurality of pseudo-color images are input into a preset image input deep learning model to obtain a plurality of classified images that mark the contaminated areas of each type of oil pollution;
[0110] In step S43, the area of each contaminated region in each classified image is calculated to obtain the distribution area of each oil pollution in the hyperspectral image, and the average distribution area of the same type of oil pollution in the hyperspectral image in multiple classified images is calculated.
[0111] Each classified image corresponds to the output of the pollution area of k types of oil pollution (S 1i ,S 2i ,...,S ki ), then the average distribution area of the kth oil pollution in the hyperspectral image is
[0112] In step S5, the peak value average of the absorption peak corresponding to each oil pollution is calculated. and the average distribution area of each oil pollution in the hyperspectral image The data are input into the oil pollution degree prediction model to obtain the oil pollution degree of the machine tool guide rail 3.
[0113] In this way, multiple hyperspectral images of the machine tool guide rail 3 are collected each time the oil pollution is detected, and the oil pollution degree of the machine tool guide rail 3 is predicted based on the multiple hyperspectral images, which can reduce the influence of noise such as ambient light and make the prediction result more accurate.
[0114] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In hardware implementations, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all components may be implemented as software executed by a processor, such as a digital signal processor or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As known to those skilled in the art, the term "computer storage medium" includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those of ordinary skill in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
Claims
1. A method for detecting oil pollution on a machine tool guide rail, characterized in that: include: A hyperspectral camera is used to obtain hyperspectral images of machine tool guide rails; Extracting spectral data of the hyperspectral image, and performing component analysis on the spectral data to obtain a spectral curve; Obtaining the peak value of the absorption peak corresponding to each type of oil stain on the machine tool guide rail from the spectrum curve; Processing the spectral data at each pixel of the hyperspectral image to obtain the distribution area of each type of oil stain on the machine tool guide rail in the hyperspectral image; The peak value of the absorption peak corresponding to each type of oil stain on the machine tool guide rail and the distribution area of each type of oil stain in the hyperspectral image are input into a preset oil stain contamination degree prediction model to obtain the oil stain contamination degree of the machine tool guide rail.
2. The oil pollution detection method according to claim 1, characterized in that: Inputting the peak value of the absorption peak corresponding to each type of oil stain on the machine tool guide rail and the distribution area of each type of oil stain in the hyperspectral image into a preset oil stain pollution degree prediction model, including: The peak value of the absorption peak corresponding to each type of oil stain on the machine tool guide rail and the distribution area of each type of oil stain in the hyperspectral image are normalized and then input into a preset oil stain pollution degree prediction model.
3. The oil pollution detection method according to claim 1, characterized in that: Before inputting the peak value of the absorption peak corresponding to each type of oil stain on the machine tool guide rail and the distribution area of each type of oil stain in the hyperspectral image into a preset oil stain pollution degree prediction model, the oil stain detection method further includes: Acquire multiple hyperspectral image samples of machine tool guide rails at different oil pollution levels, and manually assess the oil pollution level of the machine tool guide rails in each hyperspectral image sample to obtain an oil pollution level label for each hyperspectral image sample; Obtain the peak value of the absorption peak of each oil pollution and the distribution area of each oil pollution in each hyperspectral image sample, and perform normalization processing on the peak value and the distribution area of the absorption peak; The peak values of all absorption peaks after normalization of hyperspectral image samples, the distribution areas of all types of oil pollution and the oil pollution degree labels of hyperspectral image samples are used to train the oil pollution degree prediction model, so as to perform regression analysis between the peak values of all absorption peaks after normalization of hyperspectral image samples, the distribution areas of all types of oil pollution and the oil pollution degree labels of hyperspectral image samples.
4. The oil pollution detection method according to claim 3, characterized in that: The oil pollution degree prediction model is a convolutional neural network; The evaluation index between the model label and the prediction model is Loss = argmin||f(A,S)-T|| 2 , where f(A,S) is the oil pollution degree prediction model, and T is the oil pollution degree label to be predicted by the oil pollution degree prediction model.
5. The oil pollution detection method according to claim 4, characterized in that: The ReLu activation function is used to construct the fully connected layer.
6. The oil pollution detection method according to any one of claims 1 to 5, characterized in that: The oil pollution degree is represented by a real number ranging from 0 to 1. The closer the oil pollution degree is to 1, the greater the oil pollution degree is.
7. The oil pollution detection method according to any one of claims 1 to 5, characterized in that: Processing the spectral data at each pixel of the hyperspectral image to obtain the distribution area of each oil stain on the machine tool guide rail in the hyperspectral image includes: The color at each pixel of the hyperspectral image is set to a color corresponding to the spectral data at the pixel, so as to convert the hyperspectral image into a pseudo-color image; Input the pseudo-color image into a preset image input deep learning model to obtain a classified image with the contaminated area of each oil pollution marked; The area of each contaminated region in the classified image is calculated to obtain the distribution area of each oil pollution in the hyperspectral image.
8. The oil pollution detection method according to claim 7, characterized in that: Before feeding the pseudo-color image into the preset image input deep learning model, it also includes: Manually annotate multiple false color image samples to obtain a data set of false color image samples annotating polluted areas and non-polluted areas of each type of oil pollution; The data set is used to train an image input deep learning model, wherein the image input deep learning model is a pixel-level segmentation model.
9. The oil pollution detection method according to any one of claims 1 to 5, characterized in that: Also includes: Based on the fact that the oil contamination degree of the machine tool guide rail is greater than or equal to a contamination degree threshold, an alarm message is issued.
10. The oil pollution detection method according to claim 9, characterized in that: Also includes: A hyperspectral camera is used to obtain a hyperspectral image of the machine tool guide rail at preset intervals.
