Using Encephalography to Classify Mind States Associated with Cycling Activities

Cycling is a very popular activity worldwide and cyclists often listen to music while riding. This usually involves the use of a portable music player or a cellphone, which may present safety problems. Since these devices may easily distract the attention of the cyclist. This is a matter that has not received much attention but has great relevance to traffic safety. In this study, the attention level of cyclists was measured and recorded as electroencephalograms (EEGs), and discrete wavelet transforms (DWTs) based on Daubechies wavelets were used to extract the EEG features. Six different cycling activity patterns were investigated and eigenfunctions were used to classify the attention level. After feature extraction by the DWTs, support vector machines (SVMs) and general regression neural networks (GRNNs) were employed to recognize different states of mind associated with specific cycling activities. In Case I, the recognition rates of the SVM and GRNN were used to determine the state of mind associated with two different cycling activities, riding in a straight line and riding around obstacles. In Case II, rider vigilance was investigated using the SVM and GRNN for eight different cycling scenarios. The experimental results validated the proposed method and showed the brainwave patterns to be clearly associated with different cycling activities. The experimental results showed that looking at a cellphone screen or engaging in a call caused riders to miss very obvious peripheral stimuli and the use of a cellphone by a cyclist is a clear danger to the rider and traffic safety.


Introduction
Cycling is a very popular activity worldwide and cyclists often listen to music while riding. This usually involves the use of a portable music player or a cellphone and this may present safety problems since devices may easily distract the attention of the cyclist. This matter has not received much attention (1)(2)(3)(4)(5) because most studies have concentrated on the effects of listening to music while driving a vehicle or a motorcycle, (6)(7)(8)(9)(10)(11)(12) and very few studies have investigated the effects of listening to music or operating a cellphone on cycling behavior. (13)(14)(15)(16)(17) In countries such as the Netherlands, the use of a smartphone and other MP3 players while riding a bicycle is very common and not forbidden; however, listening to music while cycling is illegal in Germany and New Zealand. (17) De Waard et al. observed that 7.7% of the cyclists were listening to an MP3 player while cycling in Groningen. (13) On the basis of an internet survey of 2500 cyclists, Goldenbeld and Ehlers reported that 40% of cyclists between 12 and 17 and 15% of those between 18 and 34 years of age always listened to music while they rode. The percentage of cyclists who sometimes listened to music was found to be 76% for 12 to 17 yearolds, 54% for cyclists between 18 and 34, 23% for those between 35 and 50, and 14% for the 50+ age group. (14) This report clearly showed that young cyclists listened to music while cycling more frequently than older riders.
Listening to music while riding is a factor that may be highly relevant to cycling accidents and has received little attention. Music can influence human behavior, and the potential of music to influence mood is described as one of the most important functions of music. (15) Hyman et al. found that pedestrians who were talking on a cellphone missed very clear peripheral stimuli. However, those who were listening to music did not miss the stimuli as frequently as those not doing so. (18) Music can benefit driving performance according to the mood-arousal hypothesis, since listening to music can lead to a more optimal arousal level. (19,20) However, the distraction hypothesis suggests that music can divert attention from the task of driving and affect driving safety. (19) However, for cyclists, the effects of listening to music are not very well known. In cycling, loud music may decrease the reaction time of the rider to central stimuli and increase the response time to peripheral stimuli at the same time. (7,21) In the internet survey by Goldenbeld and Ehlers, 55% of music-listening cyclists reported using two earbuds or over-ear headphones, 23% used only one ear bud, and the rest reported using a loudspeaker or different options from time to time. (14) De Waard et al. found that auditory perception was negatively affected, with less traffic auditory information being processed by riders listening to music or when engaged in a phone call, particularly when earbuds were being used. Most cyclists rely on sound to detect the approach or closeness of other vehicles. The main effect of music or a phone conversation would be to dull sound and the cyclist could miss warning signals relevant to cycling safety. (15) However, few studies have been made using electroencephalograms (EEGs) to investigate changes in brainwaves related to cycling behavior. Mental state is the most important factor in cycling safety, and a bad mood, distraction, or fatigue may be frequent causes of traffic accidents involving cyclists. Five different electrical patterns, or brainwaves, known to be associated with mental state can be detected across the human cortex. These brainwaves can be observed with an EEG device and in decreasing order of frequency are gamma, beta, alpha, theta, and delta. Each wave is associated with a specific mental function and all five waves are displayed by the normal conscious human brain. However, one particular wave will be dominant depending on the state of consciousness. Nithiya et al. used EEGs to study the alpha waves in patients with attention deficit and used this information in the design of relaxation therapy. (22) Crowley et al. studied attention and meditation using the Tower of Hanoi problem and an EEG detection system to determine degrees of attention. (23) Lin et al. proposed a realtime driver vigilance system to detect fatigue and sleepiness in an attempt to find ways of reducing traffic accidents. (24) This study has been organized as follows. Section 2 presents the feature extraction approach. First, discrete wavelet transforms (DWTs) based on Daubechies wavelets was used to extract the EEG features. Second, six eigenfunctions were used to compute eigenvalues for classification. As reported in Sect. 3, the classifiers of the brainwaves were studied to determine associations with different cycling activities. Two types of classifier, support vector machines (SVMs) and general regression neural networks (GRNNs), are introduced briefly. In Case I, the mind states of two types of cycling activity were studied, riding in a straight line and riding to avoid obstacles. As the experiment progressed, the EEG signals from the subjects were captured using a MindWave headset. The classifiers, SVMs and GRNNs, were then studied to recognize brainwave patterns for the two types of cycling activity. Rider vigilance with respect to the related activities was then investigated using the SVM and GRNN data from Case II as reported in Sect. 4. For each specific cycling movement, types of cycling-related activity were studied. It was assumed that there were two different classes of mind state, "relaxed" and "attentive", and pattern recognition was needed to define the classes of samples to train the classifiers. Once the classifiers had been trained, it was necessary to evaluate their performance on an independent (labeled) test set. The recognition performance data from the SVM and GRNN were then studied and discussed. In Sect. 5, the results are discussed and conclusions are drawn.

Principle of WT
The EEG signals collected from the subjects were nonstationary signals that varied with emotion. Fast Fourier transforms (FFTs) of the EEG signals in the time and frequency domains did not clearly reveal their features. Two feature capture methods, the short-time Fourier transform (STFT) and DWT, were used to analyze the changes in EEG signals associated with different cycling activities. The STFT, proposed by Gabor, (25) was used, whose equation is given by Eq. (1). Gabor used window-type functions to improve the FT analysis of nonstationary signals, because the FFT has the drawback of only providing a frequency information component without frequency changes over time. The STFT uses a window-type function to divide the signal into a number of time intervals, and the signal sequences for different FT segments are shown in Fig. 1.
Here, g(t − τ) is the window function used as the displacement function, τ is the shift factor, and ω is the modulation factor.
Because the STFT uses a fixed width for the window function ( Fig. 1), the resolution of the frequency domain depends on the size of the time frame. To obtain good resolution in the time domain, a narrow time frame can be used, but this results in poor resolution in the frequency domain. On the other hand, choosing a wider time frame for better resolution in the frequency domain gives poor resolution in the time domain. In 1984, Goupillaud et al. proposed the WT to overcome the problem of the STFT fixed time window. (26) The WT not only retains the STFT characteristic of localization analysis, but also overcomes the problem of the window function with different time intervals. The WT allows the adjustment of the size of the time frame for different frequency bands. At low frequencies, a long time frame is chosen to obtain good resolution, and a short time frame gives good resolution at high frequencies. Figure 1 shows the analysis characteristic of the WT compared with the STFT methods. (26) In 1988, Daubechies proposed the WT, a hierarchy of wavelets that have orthogonal and compact support. Daubechies wavelets are widely used in solving signal analysis problems such as self-similarity properties of a signal and abnormal signal discontinuities. (27) Generally, the properties of a wavelet are effectively limited in duration, have an average value of zero, and can be expressed as where ψ(t) is the wavelet function.

Principle of DWT
Before the classification of the attention level based on the measurements of brainwaves, the DWT was used to extract the features of the EEG signals. As a general rule, WTs are divided into continuous wavelet transforms (CWTs) and DWTs. A CWT involves the signal conversion method proposed by Meyer et al. and was first used in 1980. A CWT provides multiple resolutions in the time-frequency analysis of the instantaneous features of non-stationary signals. (28) The CWT shown in Eq. (3) transforms a continuous signal into a highly redundant signal with two continuous variables, translation and scaling. For a continuous function x(t), the CWT coefficient relative to the real-valued wavelet ψ(t) is given by Eq. (4). * , Here, s and τ are the scale and translation parameters, respectively. W ψ (s, τ) is the WT coefficient and ψ(t) is the fundamental mother wavelet. However, the CWT requires a long time for calculation because it generates large wavelet coefficients. The first DWT was derived by Haar in 1909. (29) He proposed what has become known as the Haar sequence. This is a sequence of wavelets of rescaled "square-shaped" functions, which together form a wavelet family or base. The mother wavelet function ψ(t) of the Hear wavelet can be described as with the scaling function The most commonly used DWT set was formulated by Daubechies in 1988. (28) This formulation is based on the use of recurrence relations to generate progressively finer discrete samplings of an implicit mother wavelet function; each sampling has twice the resolution of the previous scale. In her seminal paper, Daubechies derived a family of wavelets, the first of which is the Haar wavelet, also known as Db1. Interest in this field has grown enormously since then, and many variations of the original Daubechies wavelets have been developed. The DWT was introduced to overcome the long computing times needed for a CWT. It does not generate large amounts of redundant information and allows the system to decompose signals to a subband level.
In the DWT, the original signal is decomposed into different band characteristics using high-pass and low-pass filters. The high-pass filters are designed to allow the signal in a specified band to pass, but signals below a given threshold are filtered. The low-pass filters can also allow signals below a specified threshold to pass. After filtration, the original signal is decomposed into approximate and detailed signals at different levels. In the DWT, the mother wavelet is shifted and scaled in powers of two. This means that s and τ can be defined as s = 2 j and τ = 2 j k, where , j k Z ∈ . The filter bank implementation of wavelets computes the wavelet coefficients of a discrete set of child wavelets for a given mother wavelet ψ(t). The wavelet function of the DWT is where j is the scale parameter and k is the shift parameter. Therefore, the DWT can be defined as Consider an original signal x(t) that has been decomposed by the DWT by being passed through a series of filters. The low-pass filter has an impulse response g [n] and the signal also passes through a high-pass filter with an impulse response h(t).
The resulting outputs can be decomposed into approximation coefficients (from the low-pass filter) and detailed coefficients (from the high-pass filter). The original signal passes through both filters and the output is the convolution of the two signals given as where x[n] is the input sequence in the discrete-time system and g [n] and h[n] are the impulse responses of the low-pass and high-pass filters in the discrete-time domain, respectively. The original signal can be decomposed using g [n] and h[n], which are quadrature mirror filters. According to the Nyquist rule, half the samples can be discarded and the filtered output of the above is then down-sampled by a factor of 2. The resulting output is further filtered by new low-pass and high-pass filters with half the cutoff frequency of the previous ones. This filtration increases the frequency resolution, and the approximation coefficients are decomposed by further filtration until the desired level is reached. Figure 2 is known as a filter bank, where the binary trees represent a subspace with a different frequency localization. The DWT  (26) carries out hierarchically organized decomposition and the level j is chosen according to the desired cutoff frequency. Figure 2 shows an implementation of a three-level forward DWT based on a two-channel recursive filter bank, where g [n] and h[n] are low-pass and high-pass analysis filters, respectively. In the figure, the block ↓2 represents the factor 2 down-sampling operator. The input signal x[n] is recursively decomposed to a total of four subband signals: an approximation version A 3 [n] and detailed versions, D 1 [n], D 2 [n] , and D 3 [n], of three resolutions.

DWT analysis of EEG signals
The human brain contains many billions of neurons and the structure is divided into regions such as the prefrontal cortex, thalamus, cerebellum, and corpus callosum. An EEG system is used to detect prefrontal cortex activity. This region is associated with interpretation, judgment, attention, and relaxation. (22) In general, EEG signals can be divided into five bands: delta, theta, alpha, beta, and gamma. Delta waves usually appear during deep sleep and their frequency band is from 0.1 to 3 Hz. Brainwaves within the frequency band from 4 to 7 Hz are theta waves, which usually appear during drowsiness. The frequency band of alpha waves is from 8 to 12 Hz and alpha waves usually appear during relaxation or rest. Beta waves, which range in frequency from 13 to 30 Hz, are associated with concentration and active thinking. Gamma waves, from 31 to 50 Hz, appear during periods of high mental activity. The significance of each brainwave band is summarized in Table 1. (30) In this study, the Neurosky MindWave™ EEG-monitoring headset was used to retrieve the brainwave data. The headset can measure brainwave signals safely and easily and its Sky ThinkGear ASIC chip has been designed for health and wellness, as well as educational and popular EEG technology use. (31) According to the international 10-20 system, the NeuroSky headset is designed for use in position Fp1 to retrieve EEG signals. Position A1 is the reference ground (as shown in Fig. 3). Signals from the NeuroSky headset were transferred to a PC via Bluetooth and the raw data was analyzed using the following DWT method.
The sampling frequency of the NeuroSky EEG headset is 512 Hz and, in this study, the MATLAB wavelet toolbox was used to generate the Daubechies Db4 wavelet components of the EEG signals for decomposition analysis. The EEG signals were decomposed into five DWT levels based on the significance of the brainwave types (see Table 1). There are five dyadic wavelet levels and the input signal x(n) was recursively decomposed into six subband signals: an approximation signal A 5 (n) and five detailed signals, D 1 (n), D 2 (n), D 3 (n), D 4 (n), and D 5 (n). Each of these wavelet levels corresponds to f with its band given in Table 2.
where f S is the sampling frequency ( f S = 512) and N represents the number of data points in the original signal and is also the high frequency limit of the frequency band represented by level j. If the number of data points is chosen as N = 128, then the five detailed signals of the DWT can be mapped into the brainwave bands shown in Table 1. For example, the corresponding delta band is 0.1-3 Hz, which can be mapped into A 5 ; the theta band, 4-7 Hz, can be mapped into D 5 and the alpha band, 8-12 Hz, can be mapped into D 4 . Each of these wavelet levels corresponds to a frequency band as shown in Table 2. After DWT decomposition, it is necessary to find the specific eigenfunctions to compute the eigenvalues for classification.

EEG signal feature extraction using DWT obtained from eigenfunctions
Multiresolution DWT analysis was used to convert the original signals to an approximation signal A 5 (n) and five detailed signals, D 1 (n), D 2 (n), D 3 (n), D 4 (n), and D 5 (n). Then, the DWT for the EEG signals was used to observe the key features associated with the attention level of the cycling subject. However, EEG signals are non-stationary signals that vary with the emotion and the features of the signals could not be identified easily by only WDT analysis. Therefore, six eigenfunctions were applied to analyze the feature patterns for classification as shown in Eqs. (12)-(17).
Range (RAN): Standard deviation (SD): Median absolute deviation (MAD): Mean absolute value (MAV): To gain an understanding of the effects of different cycling-related activities, optimal pattern recognition was needed, and so the brainwaves were classified using the different feature patterns of the DWT components.

Experimental setup
The EEG signals were captured using the NeuroSky headset. The detectors were located at position PF1 on the subject's head to retrieve the raw EEG signals (see Fig. 3) and position A1 was used as the reference ground. Signals from the headset were transmitted to the computer via Bluetooth. The experimental arrangement and system block diagram are shown in Fig. 4. The experiments in case I were designed to investigate the prevailing brainwave patterns for two different types of cycling activity: riding along a straight path and taking a path around obstacles. Eight different cycling-related scenarios were used and the brainwaves of the subject were recorded under different cycling conditions, as shown in Fig. 5, to gain an understanding of the mind state associated with the two activities. The EEG signals were processed and analyzed to determine the relationship between the mental state and the riding situation. The experiment was carried out by six different subjects three times each. Each experiment, both along a straight path and along a path with obstacles, lasted between 16 and 20 s to ensure a steady riding speed. The distance traveled along the straight path was about 24 m. There were six obstacles on the path with obstacles that were 3 m apart. The stored EEG brainwave records from the subjects were analyzed and Figs. 6 and 7 respectively show the DWT decomposition of EEG signals collected from a subject riding along the straight path and a subject riding along the path with obstacles carrying out any other activity.
The theta, alpha, and beta waves are associated with attention (see Tables 1 and 2), and therefore the DWT was used to extract the feature bands of D 3 , D 4 , and D 5 for the computation of eigenvalues. Table 2 shows that D 5 covers the theta band, D 4 the alpha band, and D3 the beta band. To choose a suitable eigenfunction for the DWT components for the classification of the attention level, the eigenvalues of D 3 , D 4 , and D 5 were obtained using the eigenfunctions shown in Eqs. (12)- (17). To understand the effect of the cycling-related activity on the attention level, the SVMs and GRNNs were both employed to classify the brainwaves of the subjects from the EEG data collected during the riding experiments. Because the subjects necessarily  paid more attention to riding when bypassing obstacles than when riding in a straight line, two classification algorithms were used to distinguish activity requiring a high level of attention from that with a relaxed mind. The relationship between the two mind states revealed by the experiments can help us determine what type of activity would cause distraction detrimental to driving safety.

Classification of mind state using the SVM
Recently, kernel-based analysis has become popular in data mining applications because it provides a surprisingly rich way to interpolate between pattern analysis, signal processing, and pattern recognition methods. (33) One successful example of a kernel-based learning algorithm is the SVM, which has been employed in many classification problems. (34)(35)(36)(37)(38) SVMs are machinelearning algorithms proposed by Cortes and Vapnik to categorize data into two groups. (39) The main basic concept of the SVM is to find a hyperplane that can separate two or more different classes of data. The SVM must be trained using a set of samples that are marked as belonging to one category or another. After training, using a group of given data, the SVM can classify new data according to the established hyperplane.
where N is the size of the training set and y i is the class label of data x i , and assuming only two classes for classification, y i = {−1, +1}, if the data x i can be linearly separated by hyperplanes, the best hyperplane should separate the two classes with the maximum margin as shown in Fig. 8, i.e., the distance from the hyperplane to the closest samples is maximal. In Fig. 8, x • w + b = 0 is the hyperplane with the maximal margin of 2 / w and the circled samples are known as support vectors. In this study, a linear hyperplane cannot be found; therefore, a nonlinear mapping ϕ (see Fig. 9) is introduced to map the data into a linear space H where they are linearly separable. The SVM maps the training set into a higherdimensional feature space via the mapping ϕ, then a separating hyperplane w T ϕ(x) + b = 0 that maximizes the margin of separation between the classes can be found. One of the most important properties of SVMs is that only the inner product K(x 1 , x 2 ) = <ϕ(x 1 ), ϕ(x 2 )>, i.e., the kernel, is needed. The choice of the kernel is a specific problem for classification and the common kernel functions are linear, polynomial, the radial-based function (RBF), and the sigmoid function, which are described as follows. Linear: Polynomial: RBF: Sigmoid: In this study, two of the above kernel functions, the RBF and polynomial, were used for the SVM classifier to investigate the accuracy of classification.
Case I. Classification of the mind states for different cycling movements In the first study, three subjects performed the two cycling conditions three times. Figure  5 shows the details of these two conditions. The first involved riding in a straight line and the second involved avoiding obstacles. Each experiment lasted between 16 and 20 s to ensure a steady riding speed. The distance traveled along the straight path was about 24 m and there were six obstacles on the path, with 3 obstacles that were apart. At the same time, the EEG signals of the subjects were captured as 30 sequences of signals for each subject, giving 90 samples from each scenario and a total of 180 samples for classification. The DWT was used to extract the feature sequences of D 3 , D 4 , and D 5 , which were used to obtain the eigenvalues from Eqs. (12)- (17).
There were two brainwave patterns to be classified: the first was "relaxed", associated with cycling in a straight line, and the second was "attentive", associated with the task of avoiding obstacles. The following three testing modes were used: internal training, the half-external test, and the external test. In the half-external test, half the samples were used to train the SVM, but all the samples were used for testing. In the external test, half the samples were used for training and the other half were used for testing. Table 3 presents the SVM classification results using two different kernel functions: the polynomial and RBF. In the half-external test, half the samples (90/180) were used for training. In the external test, there was no repetition of the training and all 90 samples were tested. The recognition rate was defined as 100%

Number of correct classified samples Recognition rate
Number of total testing samples = × .
The examination of Table 3 (SVM recognition rate) shows that the RBF kernel function is better than the polynomial kernel function. Therefore, the RBF kernel was used for SVM recognition in the study. Table 4 shows the recognition rates for the SVMs using the different eigenfunctions to compute the features D 3 , D 4 , and D 5 . It can be seen that the MAV gives the best recognition rate. Figure 10 shows the resulting hyperplane, the testing data, the classified data, and the support vectors obtained by the proposed method, where the first scenario "relaxed" is denoted by "Med", and "Att" represents the second scenario "attentive". The coordinates in Fig. 10 are the values obtained by the eigenfunction MAV of D 3 , D 4 , and D 5 of the DWT. To compare the SVM recognition rate with those of other methods, the same problem was investigated using the GRNN in Sect. 3.3.

Classification of mind state using GRNN
There are three common types of artificial neural network (ANN), the supervised, unsupervised, and associated learning networks. The GRNN is a supervised learning network that evolves from a probabilistic neural network (PNN). (40) It is also an antecedent-supervised learning network with a layered neuron structure, as shown in Fig. 11. The GRNN architecture has four layers: input, pattern, summation, and output. It can handle linear and nonlinear regression problems, as well as classification.   In a classification with m-dimensional input vector training samples, the GRNN can use the samples to estimate the function values of unknown samples with a weighted average method as follows: Here y j is the jth function value of an unknown sample, w k is the kth weighted value of a given sample, y kj is the jth function value of the kth given sample, and q is the total number of given samples. The weighted w k value can be obtained as follows: where x i is the ith-dimensional spatial coordinate of the unknown sample, x ik is the ithdimensional coordinate of the kth sample for the given sample space, δ is the smoothing factor, and m is the sample space dimension. When the given samples are input to the GRNN for training, the learning rule used by the network will search for an appropriate smoothing parameter. Table 5 presents the recognition rates for the GRNN using the different eigenfunctions for the SWT features D 3 , D 4 , and D 5 . The recognition rates obtained by the GRNN for the eigenfunctions of MIN, RAN, SD, and MAD are much better than those obtained by the SVM. However, in the external test, the SVM had better recognition rates than the GRNN using the MAX and MAV eigenfunctions. To summarize, for the external test, the SVM using MAV is clearly the better classifier a recognition rate of 72.22%, compared with 70.00% for the GRNN.
In these experiments, the features D 3 , D 4 , and D 5 were used to compute the eigenvalues because the theta, alpha, and beta brainwaves are associated with an attentive state. However, to explore the overall significance and relative importance of the EEG components of D 3 , D 4 , and D 5 , classification was carried out using the SVM and GRNN with only two DWT components (see Table 6). The results show that D 3 and D 4 are more important than D5, but the SVM and GRNN classifiers using the D 3 + D 5 components of the SWT showed a better recognition rate than the other two cases. In a comparison of the SVM and GRNN, using the D 3 + D 4 components, the SVM using D 3 + D 4 + D 5 showed a small improvement of the recognition rate and is better than SVM using only D 3 + D 4 . However, the recognition rate of the GRNN using D 3 + D 4 + D 5 is much better than GRNN using D 3 + D 4 . As shown in Table 1, the human attentive state is closely associated with alpha and beta brainwaves. The experimental results shown in Table 6 are clearly consistent with Table 1.

Classification of Rider Vigilance Using SVM and GRNN
In the Case I experiments, the brainwaves of a rider following a straight path and one with obstacles were analyzed using the SVM and GRNN. In Case II, rider vigilance was investigated during various cycling-related activities, as shown in Fig. 5, also using the SVM and GRNN. Four different cycling-related activity patterns were studied: (1) riding without any other activity, (2) listening to music, (3) looking at a cellphone screen, and (4) communicating using a cellphone.
Case II. Classification of mind states for the different cycling-related activities In Case II, six subjects performed eight different scenarios with the different cycling-related activities described in Fig. 5. Scenarios 1-4 involve riding along a straight path while engaging in the following activities: (1) no additional activity, (2) listening to music, (3) looking at the screen of a cellphone, and (4) while communicating with a cellphone. Scenarios 5-8 involve following a path that has obstacles to be avoided and included the same activities as in scenarios 1-4. Similarly, this pattern recognition problem required that the classes of samples to train the SVM and GRNN classifiers be defined. Once the classifiers were trained, it was necessary to evaluate their performance on an independent (labeled) test set assuming that there were two different mind states, "relaxed" and "attentive". Table 7 shows the specified label for the eight scenarios. The EEG signals of the six riders were captured using the MindWave headset as they rode; 30 sequences of the EEG signal were captured for each incident. There were 180 samples of EEG signals for each scenario, making a total of 1440 samples for classification. The performance was evaluated as in Case I. There were three testing modes, internal training, the half-external test, and the external test. For the half-external test, half the samples were used to train the classifiers, but all were used for testing. Table 8 shows the experimental results for the SVM and GRNN. The experimental results showed that the GRNN had higher performance than the SVM in the internal training and half-external test, but the SVM performed slightly better than the GRNN in the external test.
The experimental results for the internal training and half-external test in Cases I and II showed that the GRNN had better recognition performance than the SVM. However, the SVM classifier had slightly better performance than the GRNN in the external test. Overall, the GRNN had superior performance to the SVM, and the following comments can be made: (1) Riding around obstacles requires more attention than riding along a straight path.
(2) Looking at the screen of a cellphone distracts the rider's attention and this can be dangerous in traffic. (3) Communicating with a cellphone requires action on the riders part. This diverts attention from the task of riding, which can be dangerous in traffic. (4) Riding along a straight path while listening to music may be safe because it does not require much attention. In summary, looking at a cellphone screen or communicating with a cellphone can cause a rider to miss important peripheral stimuli and can cause traffic accidents. Cellphones should not be used while cycling.

Conclusions
The NeuroSky EEG headset was used to capture the EEG brainwave signals of subjects as they rode along a predetermined track. To extract the features of the EEG signals, the Daubechies Db4 wavelet components were used in a decomposition analysis of the EEG signals. The brainwave types are shown in Table 1, and on their basis, the EEG signals were decomposed into five DWT levels. The input signal x(n) was recursively decomposed into six subband signals: an approximation signal A 5 (n) and five detailed signals, D 1 (n), D 2 (n), D 3 (n), D 4 (n), and D 5 (n). Human attention is related to the theta, alpha, and beta brainwaves, and the D 3 , D 4 , and D 5 DWT bands were used to compute the eigenvalues. The best eigenvalues for classification were found by determining the recognition rates of the SVM and GRNN using six different eigenfunctions, as shown in Tables 4 and 5. In Case I, the SVM and GRNN were used to recognize the mind states of two different cycling activities, riding along a straight path and riding along a path with obstacles. The SVM had a better recognition rate than the GRNN with the Max and MAV eigenfunctions. To summarize, for the external test, the SVM using MAV was the better classifier with a recognition rate of 72.22%, compared with 70.00% for the GRNN. In Case II, rider vigilance was investigated using the SVM and GRNN for eight different cycling scenarios. The experimental results showed that the GRNN exhibited better classification than the SVM in the internal training and half-external test, but the SVM had slightly better performance than the GRNN in the external test. From the experimental results, we conclude that cyclists should not use cellular phones when riding, because looking at the screen or actually communicating with a cellphone can reduce a rider's ability to notice obvious peripheral stimuli that occur in real traffic situations.