Automatic Anomaly Detection of Respiratory Motion Based on Singular Spectrum Analysis

The realization of automatic anomaly detection of respiratory motion could be very useful to prevent accidental damage during radiation therapy. In this paper, we proposed an automatic anomaly detection method using singular value decomposition analysis. Before applying this method, the investigator needs a normal respiratory motion data of a patient. From these data, a trajectory matrix representing normal time-series feature is created. Decomposing the matrix, we obtained the feature of normal time series. Then, we applied the same procedure to real-time data and obtained real-time features. Calculating the similarity of those feature matrixes, an anomaly score was obtained. Patient motion was observed by a depth camera. In our simulation, two types of motion e.g. cough and sudden stop of breathing were successfully detected, while gradual change of respiratory cycle frequency was not detected clearly.


Introduction
Monitoring of a patient has been an important but tedious work for medical staffs.The automatic anomaly detection for respiratory motion is very critical to conduct radiation therapy safely.
The difficulty of anomaly detection causes from the fact that 1) almost all of respiratory curves show baseline drift, 2) amplitudes of respiratory motions vary sometimes up to 300%, 3) frequency of respiratory cycle sometimes changes [1].Because of these characteristics, simple threshold method tends to fail for detection of anomaly motion.
There has been some useful anomaly detection algorithm for industrial use.Those algorithms are classified into two categories: model based algorithm and model free algorithm.Typical examples of model based approach are auto regressive (AR) model [2] and Kalman filter algorithm [3]- [5].An example of model-free approach is singular spectrum analysis.The merit of model-free approach is an ability to deal with unexpected motion error and easy implementation.An example of this type of approach is singular spectrum analysis.It is a non-parametric method to extract characteristics of time-series data.There have been a few examples for an application of change point detection [6] [7], however, few researchers have reported on anomaly detection of respiratory motion.
In this paper, we tried to apply an anomaly detection algorithm based on singular spectrum analysis to a respiratory curve of a patient.

Measurement
In this study, we applied the singular decomposition technique to measured respiratory motion obtained by a depth camera (Microsoft Kinect v1).First, we will describe how we measured respiratory curve.In the next section, we will explain the detail of algorithm to detect anomaly motion.
To monitor the respiratory motion, contact-less sensor was desirable.As a low-price sensor, our group has been using a Kinect sensor.Kinect sensor obtained depth data to a target from a shift of projected infrared patterns and the accuracy was 3 -4 mm.To reduce the noise, we applied Ueda's algorithm to the raw data of Kinect sensor.The sampling rate was 5 fps.The detail of this system was described in Kumagai et al. [8].
For testing performance, one of the authors simulated two types of anomaly motion, e.g.cough, sudden stop of breathing.

Anomaly Detection Method
To detect an anomaly motion, we first extracted the feature of the time-series data with window length w based on singular value spectrum analysis [9] [10].
Let normal (or reference) time-series data be , , , We can define a trajectory matrix as , , The matrix holds the feature of normal time series data at a reference time τ with look-back time of w. k was set to 2 w [9] [10].Similarly, we can define a matrix representing current states (at time t) of respiratory motion as, ( ) For example, window length w was set to 40 (= 8 sec).k was set to 2 20 w = .Next, we decomposed the matrix 1 X and 2 X using singular value decomposition ( ) , , , k U = u u u  is an orthogonal matrix and ( )  is an orthogonal matrix and W is a diagonal matrix with singular values of 1 2 , , , k λ λ λ From this decomposition of matrix, the matrix 1 X can be approximated as ( ) This is an example of well-known spectrum decomposition of a matrix.For 2 X , in the similar manner, we obtain the following formula ( ) Figure 1 shows the singular values of 1 X and 2 X .From this figure, we set m to 5 to approximate the time series data.Therefore, the matrices were approximated as 5 1 1 Then we defined a matrix representing the feature of time series of the reference signals as , , .
Similarly, a matrix representing features of current status was defined as , , .
To measure the similarity of two time series, we calculated canonical angle of two matrices as where 2 ⋅ is a two norm of a matrix calculated by a root of the maximum singular value of the matrix.Note that the cosine of canonical angle is within 0 and 1, as an anomaly score, we can define ( ) This score represents the anomaly of the current time window compared with the reference time window.

Performance Test
The anomaly detection can be divided into six steps.If the anomaly score exceeds the threshold, then the algorithm judged anomaly event occurred.In the Step1, we measured a respiratory curve of a patient under normal situation (not suffered from anomaly events).
To test our algorithm, we measured the reference respiratory motion and normal respiratory motion by a volunteer.Then the time-series data were retrospectively analyzed using our algorithm.All algorithms were implemented using R language [11].
Based on the algorithm, we performed real-time prediction of respiratory motion using our respiratory monitoringsystem [8].The algorithm was implemented by python language.

Results
In our study, we applied an anomaly detection algorithm based on singular spectrum analysis.
Measurement data was obtained by a depth camera.As a reference of normal respiratory curve, a normal respiratory motion was recorded with a depth camera.The obtained data was shown in Figure 2. The interval of dashed lines represents an interval to be used for singular spectrum analysis.Obviously, the length of interval strongly affects calculation results of anomaly score.The choice of window length w will be discussed in the discussion section later.
To simulate anomaly motions, the four types of anomaly motion were tested.Figure 3 shows an anomaly score when cough events occurred.Figure 4 shows an anomaly score when breathing was suddenly stopped.As   can be seen, the two types of events (cough and sudden stop of breathing) was successfully detected as a sudden increase of anomaly score.On the other hand, gradual increase of respiratory period was not clearly detected by this method.
Real-time anomaly detection was tested as shown in Figure 5.The red curve represents the anomaly score.
Simulated breathing stop was successfully detected by this algorithm.

Discussion
Prior works have suggested that a general algorithm to detect anomaly motion would be difficult.This paper tried to overcome the difficulty using singular spectrum analysis.The window length w is a main parameter of the analysis.The result depends on the parameter.However, there has been no universal selection rule.Therefore, we analyzed a respiratory curve with different length and compared them by visual inspection.
Figure 6 shows anomaly scores with different time window w for a sudden stop of breathing event.As shown in Figure 6, smaller window length tends to increase time resolution of anomaly detection, while the score itself tends to be noisy.Therefore, window length of 8 sec (w = 40) seemed to be appropriate for this situation.We did the same way to the cough events and obtained the Figure 7.We found the same tendency in the figure and determined the window length to be 8 sec.The optimum window length, however, depends on a patient.
There has a limitation, however, in this algorithm.One of the demerit in our method is the difficulty of the simple and explicit interpretation of the anomaly model.There has no clear-cut threshold to alarm an error.Users should be aware of these difficulties.
The merit of this approach is the fact that no a priori modeling of anomaly motion is required.Because anomaly motion is defined as a deviation from the normal motion, an explicit pre-implementation of anomaly mode is considered to be difficult.Using this algorithm, an unexpected anomaly motion could be detected.Hence, this algorithm will be a good supporting tool for medical staffs.

Conclusion
We have demonstrated that automatic anomaly detection of respiratory motion using singular spectrum analysis was successful in the cough and sudden stop of breathing.The clinical use of this algorithm will be very hopeful.

Figure 2 .
Figure 2. A reference respiratory curve obtained by a depth camera.An interval between dashed lines were used to calculate the trajectory matrix X 1 .

Figure 3 .
Figure 3.An example of cough events simulated by a volunteer.Two peaks at around 60 s and 120 s represent the cough events.The blue curve represents the respiratory curve, while the red curve represents the anomaly score calculated by Equation (10).

Figure 4 .
Figure 4.An example of breathing stop simulated by a volunteer.The red curve represents the respiratory curve, while the blue curve represents the anomaly score calculated by Equation (10).

Figure 5 .
Figure 5.A snapshot of real-time anomaly detection.Depth data (blue curve) and Anomaly score (red curve) are shown.

Figure 6 .
Figure 6.Window length dependencies of anomaly score in the case of breathing stop.

Figure 7 .
Figure 7. Window length dependencies of anomaly score in the case of cough.
1. Measurement of normal (not including anomaly events) respiratory motion.2. Calculation of .