Tumor respiratory motion prediction method based on bidirectional GRU network
Technical Field
The invention relates to the technical field of radiotherapy robot breath tracking, in particular to a tumor breath motion prediction method based on a bidirectional GRU network.
Background
The lung cancer is one of the main public health problems seriously threatening the global population health, and among the treatment means of lung tumors, radiotherapy is the treatment means with the highest use rate, and has the advantages of wide applicability, good treatment effect and the like. With the intellectualization and refinement of radiotherapy equipment, the concept of precise radiotherapy is proposed and applied to the treatment of lung tumors. The precise radiotherapy refers to a tumor treatment mode which combines radiotherapy medicine with computer network technology, physics and the like. Real-time image guidance and synchronous breath tracking are adopted in the treatment process, so that the treatment accuracy is ensured.
However, the change of the tumor position caused by the respiration of the human body brings great difficulty to the respiration tracking part of the precise radiotherapy, and the tumor movement completely destroys the effect of the dose distribution suitable for the shape of the three-dimensional static target area. Not only does the actual radiation dose to the target tumor be less than the planned dose reduce the efficiency of radiation therapy, but normal tissue surrounding the tumor enters the high dose region in the center of the field causing complications. Meanwhile, the breathing motion is a complex quasi-periodic motion without obvious regularity, and the breathing mode of the patient can change during the treatment process, such as frequency change, baseline drift and position amplitude offset. Therefore, it is necessary to introduce a prediction means of respiratory motion to compensate the tumor position of the radiotherapy device.
Although the traditional respiratory prediction means such as LMS, RLS, Kalman filtering and other methods are simple in algorithm construction, the traditional respiratory prediction means have the defects of low prediction precision, poor robustness and the like; and the network updating time of the RNN neural network prediction method based on LSTM and the like is too long, so that the online updating of the prediction model is difficult to realize on the basis of periodically acquiring tumor position data through X-rays.
Disclosure of Invention
The invention aims to provide a tumor respiration motion prediction method based on a bidirectional GRU network, which can predict tumor respiration and has higher prediction precision and robustness.
In order to solve the technical problem, the invention provides a tumor respiratory motion prediction method based on a bidirectional GRU network, which comprises the following steps:
acquiring historical data of tumor respiratory motion, performing smoothing and normalization processing on the historical data, and performing time-phase division on the data subjected to smoothing and normalization processing to obtain a preprocessed data set;
selecting a training set for neural network training from the preprocessed data set, and printing an expiration label and an inspiration label on the training set according to time phase division;
step three, constructing a bidirectional GRU prediction network, bringing the training set into the prediction network to update the parameters of the network, and obtaining the trained prediction network;
step four, collecting real-time data, inputting the real-time data into a trained prediction network, and obtaining the output of a respiratory motion prediction value;
acquiring actual tumor respiratory motion data regularly, and comparing the actual tumor respiratory motion data with a predicted value to obtain an error value; and setting an error threshold, and if the error value is higher than the error threshold, performing online updating on the actual tumor respiratory motion data by using the prediction network model.
Preferably, in the first step, the acquired historical data of tumor respiratory motion is in-vitro marker point motion data.
Preferably, in the first step, the "smoothing process" is a moving average method.
Preferably, in the first step, the Max-Min normalization method is adopted as the normalization processing.
Preferably, the "time-phase dividing the data after the smoothing processing and the normalization processing" specifically includes: the findpeak method is adopted to search a segmentation point corresponding to the inhalation and exhalation processes.
Preferably, in the second step, the training set is reconstructed into a three-dimensional tensor of (samples, times, input dim), where the dimensions of samples refer to samples of all input networks, the dimensions of times refer to sampling step lengths, and the input dim refers to input dimensions of data.
Preferably, the third step specifically includes:
s31, setting the number of GRU network layers, the number of units of each layer, training rounds, a training optimizer and the data length of each training by using a Keras library to obtain a prediction network;
and S32, inputting the training set data into the prediction network of S31, and reversely propagating the error back to the network by using a gradient descent method to correct the parameters of the prediction network.
Preferably, in the fifth step, the error threshold is a root mean square error.
Preferably, the root mean square error is 0.5 mm.
The invention has the beneficial effects that:
1. the method uses the bidirectional GRU network to predict the respiratory movement of the tumor, and has higher prediction precision and robustness compared with the traditional prediction methods such as RLS, LMS, Kalman method and the like.
2. Compared with other neural network prediction methods, the method has higher network updating speed, and can realize real-time prediction model updating of the neural network prediction model in radiotherapy; due to the continuity of the treatment process, online updating of the predictive model does not interrupt the treatment process.
Drawings
FIG. 1 is a flow chart of the present invention;
FIG. 2 is a comparison graph of moving average filtering after data smoothing;
FIG. 3 shows the result of the division of the respiratory motion phase of the tumor;
FIG. 4 is a schematic diagram of a GRU network structure;
FIG. 5 is a graph comparing predicted results with actual values;
FIG. 6 is a flow chart of online updating of a predictive model.
Detailed Description
The present invention is further described below in conjunction with the following figures and specific examples so that those skilled in the art may better understand the present invention and practice it, but the examples are not intended to limit the present invention.
Referring to fig. 1, the invention discloses a tumor respiratory motion prediction method based on a bidirectional GRU network, comprising the following steps:
step one, historical data of tumor respiratory motion is obtained, smoothing and normalization processing are carried out on the historical data, and time phase division is carried out on the data after the smoothing and normalization processing, so that a preprocessed data set is obtained.
The acquired historical data of the tumor respiratory motion is motion data of the in-vitro marker points.
And the "smoothing process" employs a moving average method. The moving average filtering is based on statistical rules, and continuous sampling data is regarded as a queue with the length fixed as N, after a new measurement, the head data of the queue is removed, the rest N-1 data are sequentially moved forward, and the new sampling data is inserted to be used as the tail of the new queue; then, arithmetic operation is carried out on the queue, and the result is used as the result of the measurement. Assuming that the input is x and the output is y, the calculation formula of the moving average filter is as follows:
fig. 2 is a comparison of the smoothed data with the original data.
The 'normalization processing' adopts a Max-Min normalization method. The principle is to perform linear transformation on original data, minA and maxA are respectively set as the minimum value and the maximum value of an attribute A, and an original value x of A is mapped to a value y of an interval [0,1] through maximum-minimum standardization, so that the formula is as follows:
wherein, the time phase division adopts a findpeak method to search a division point corresponding to the inspiration and expiration processes. The principle is as follows: after filtering and smoothing, firstly traversing the array, and finding that the (N-N, N) is increased progressively and the (N, N + N) is decreased progressively; or (N-N, N) is decreasing and (N, N + N) is increasing, it can be considered as the cut-off point of breathing. The result of the breathing phase partition is shown in fig. 3.
And secondly, selecting a training set for neural network training from the preprocessed data set, and printing an expiration label and an inspiration label on the training set according to the time phase division.
Specifically, 10% of the data of the whole treatment process is selected as a training set to be input into the network. And reconstructing the data into a three-dimensional tensor in the shape of (samples, timestamps, input dim), wherein the dimensions of the samples refer to all samples of the input network, the dimensions of the timestamps refer to sampling step length, and the input dim refers to the input dimensions of the data. And marking a corresponding label for the training set according to the result of the time phase division in the previous step, wherein the label of the expiration process is 1, and the label of the inspiration process is 0.
And step three, constructing a bidirectional GRU prediction network, and bringing the training set into the prediction network to update the parameters of the network to obtain the trained prediction network.
S31, setting the number of GRU network layers, the number of units of each layer, training rounds, a training optimizer and the data length of each training by using a Keras library to obtain a prediction network;
and S32, inputting the training set data into the prediction network of S31, reversely propagating the error back to the network by using a gradient descent method, and correcting the parameters of the prediction network until the output error of the network is minimum.
And step four, acquiring real-time data, inputting the real-time data into the trained prediction network, and obtaining the output of the respiratory motion prediction value.
And selecting a section of motion data stream from the current time to the previous k times, reconstructing the motion data stream into a data structure like a training set, and inputting the data structure into the prediction network. The prediction network outputs a predicted value of the motion position at the next moment. The predicted result versus real data ratio is shown in fig. 5.
Acquiring actual tumor respiratory motion data through X-rays regularly, and comparing the actual tumor respiratory motion data with a predicted value to obtain an error value; and setting an error threshold, and if the error value is higher than the error threshold, performing online updating on the actual tumor respiratory motion data by using the prediction network model. Or the continuous prediction error tends to increase, and the acquired real tumor respiratory motion data is used for performing online updating of the prediction model. Due to the continuity of the treatment process, online updating of the prediction network model does not interrupt the treatment process. The error threshold is a root mean square error. The root mean square error is 0.5 mm. The tumor respiratory motion prediction and radiotherapy process does not stop while the model is updated. After the updating of the prediction model is finished, the new prediction model is used for prediction output, and the step of comparing the acquired real motion data is repeated, so that circulation is realized. FIG. 5 is a flow chart of online updating of a predictive model.
The above-mentioned embodiments are merely preferred embodiments for fully illustrating the present invention, and the scope of the present invention is not limited thereto. The equivalent substitution or change made by the technical personnel in the technical field on the basis of the invention is all within the protection scope of the invention. The protection scope of the invention is subject to the claims.