:

—Reconfigurable circuit designs for automatic seizure detection devices are essential to prevent epilepsy affected people from severe injuries and other health-related problems. In this proposed design, an automatic seizure detection algorithm based on the Linear binary Support Vector Machine learning algorithm (LSVM) is developed and implemented in a Field-Programmable Gate Array (FPGA). The experimental results showed that the mean detection accuracy is 86% and sensitivity is 97%. The resource utilization of the implemented design is less when compared to existing hardware implementations. The power consumption of the proposed design is 76mW at 100MHz. The experimental results assure that a physician can make use of this proposed design in detecting seizure events.


INTRODUCTION
Abnormal brain nerve cell functioning prompts seizures. Sudden abnormalities of electrical activity affecting certain regions of the brain are the root cause of seizures and the affected individuals may get injured during one. Some may experience jerky movements. Few may exhibit vague reactions. Two or more consecutive seizures are considered as Epilepsy. Electroencephalogram (EEG), Magnetic Resonance Imaging, Functional Magnetic Resonance Imaging, Computed Tomography may assist in seizure detection. Most of the physicians rely on EEG reports to diagnose epilepsy. Apart from that, the neurologists take the help of automatic epilepsy detection systems. There are several methods to analyze the EEG signal for seizure detection. Most reviewed methods are time domain, frequency domain, and time-frequency domain. To analyze the EEG signals, we can make use of time domain features, such as amplitude, regularity, synchronicity, coefficient of variance, and higher order spectra. In frequency domain analysis, we extract fast Fourier transform, power spectral density, average brand frequency, and dominant frequency features from the EEG signals. Time domain and frequency domain methods may not provide the exact location of a particular event. Time frequency domain methods were developed to overcome this problem. Most widely used time frequency domain methods are Spectrograph Gabor Atoms (SGA), Wigner Wille Distribution (WWD), and Wavelet Analysis (WA). Most of the authors refer to the wavelet method which is computationally intensive during fine analysis with less directionality. To classify features extracted from the EEG signals as seizure or non-seizure, machine learning methods are used. Support Vector Machine (SVM), is one of the machine learning algorithms, which provides better results since it learns by solving constrained quadratic programming whose performance is dependent on large size training sample. Hence, there is a need to develop an algorithm which is data intensive for smaller training sample sizes. From the physician's point of view, there is an immediate need to classify the seizure and non-seizure events from EEG signals for quick diagnosis. So it has become necessary to design a device that can help this classification process. To achieve this purpose, researchers are working on different classification methods. Neural networks, machine learning, and distance based classifications are some of them. Distance based classification is the simplest among these methods. SVM is widely used in designing automated systems for epilepsy detection.
II. LITERATURE REVIEW SVM, K-Nearest Neighbor (KNN), and Random Forest (RF) are generally used for classification problems. SVM method is basically divided to linear and non-linear. Both these methods are used in hardware design for automatic epilepsy detection. A non-linear Guassian function based SVM was implemented in SOC [1][2][3][4]. A hybrid SVM was implemented to detect seizure segments, where the kernel parameters were optimized using optimization techniques as Genetic or Particle Swarm algorithm or radial basis function [5][6][7][8]. Whale Optimization Algorithm (WOA) with radial basis function kernel SVMs were developed for seizure detection with 100% detection accuracy in [9]. This methodology includes complex wavelet transforms and time domain feature extraction. Universum SVM is proposed in [10] having 99% accuracy, with, however, high computational time. Binary SVM was proposed in [11], but improvement is needed in this algorithm to reduce computational time. algorithm should utilize a smaller number of features and less hardware resources, power consumption, detection accuracy, and feasibility of training the classifier. In this paper, a hardware implementation with minimum hardware resources, low power design, and facility to train the classifier for patient specific detection system is proposed.
III. METHODOLOGY The proposed method consists of the EEG Signal Acquisition Module, the Segmentation and Feature Extraction Module, the SVM training Module, and the Classification Module. Its block diagram is given in Figure 1.

A. Data
The proposed algorithm has used the database of the University of Bonn [12,13]. There are 5 sets of data available in this data base. The datasets available are of types Z, O, N, F, and S. Z and O segments are classified as normal, N and F segments consists of EEG segments which occur before seizure and the dataset S is composed of seizure events. Each segment consists of 100 single channel data recordings of 23.6s duration. The data sampling frequency is 173.6Hz and the bandwidth is 0.5Hz to 85Hz. Figure 2 depicts the power spectrum of Normal, Inter-ictal and Seizure signals. Amplitude spectrum of the EEG signals

B. Feature Extraction
The segmentation of EEG data is necessary for feature extraction. The impact of variable segment length is discussed in [14]. For this proposed design, the EEG signals are divided into 20s duration segments using the non-overlapping windowing method. Time domain features are then extracted from each segment for further processing. Mobility, standard deviation, sign slope change, sum of square root, mean of square root features are calculated for each segment's primary units.The sum of squared data point in a segment, and its mean value are taken as features. The remaining features are: • Hjorth mobility: The mean frequency of the time series is represented by the Mobility parameter: where x is the feature vector, which is segmented using windowing method. Variance is calculated by the squared deviation of data points from their mean values.
• Standard deviation: The amount of data spread is measured from standard deviation. It is defined by: where xx i is a data point, i goes from 1 to the total number of data points in a segment l, and u is the mean of data segment.
• Slope sign change in the direction of feature vectors. It is defined by (3):

C. Principle Component Analysis
The Principal Component Analysis (PCA) is a statistical method which is used to convert data vectors to linearly uncorrelated variables. PCA gives increased accuracy in classification of data points. It also reduces the dimension of data. In the proposed method, PCA is used for pre-processing the training and testing feature sets in order to get better classification results.

D. Moving Average
Moving average is a data transforming technique used in technical analysis. It consists of successive means of a segment in a time series. The moving average for the first 'n' data points in a time series is given as (x 1 +x 2 +...+x n )/n where x i is a data point in the series.

E. Log Transformation
Log transformation is a widely used method for data interpretation. This method is used to convert highly asymmetric distributions to less skewed. The logarithmic values of individual feature values are calculated for data transformation.

F. Binary Linear SVM Classifier
The classification of normal, pre-ictal and seizure signals were obtained using binary Linear Support Vector Machine points which are close in the hyper plane. The binary LSVM will classify the EEG signals either as Non Seizure or Seizure signals. Non Seizure signals are classified as +1 and Seizure signals as -1. The SVM classifier with linear kernel was proposed in [15]. Authors in [16] proposed a simple data adjustment algorithm on the binary LSVM classifier. Optimization of weight vectors and bias were not necessary. Data adjustment was used to calculate weight vectors and bias values. This proposed classification algorithm is based on [16] with a modification in the classification step. The classifier program can be implemented using any programming language which uses simple mathematical operations. Due to its reduced complexity, this classification algorithm can be implemented in hardware. for i=1 to n, where n is the number of sample data points in the training data set for j=1 to n, For training, 50% of EEG data were used and the remaining 50% were used for testing. The LSVM classifier was trained using feature sets of the training dataset. The training and testing datasets each consist of 1.64 hours of EEG recordings. Separate segments were used for training and testing. The training and testing data are comprised of Normal EEG segments, Pre-ictal EEG segments, and Seizure segments (see Table I).

A. Simulation Results
Seizure detection accuracy is calculated in order to assess the performance of the proposed classification method. Bonn epilepsy database [12] was utilized. The data were segmented into 20s segments using non-overlapping rectangular windowing method. In addition, time domain features were calculated for each segment to form the feature vector. The results are shown in Figure 3. The data transformation methods of PCA and data smoothing using simple moving average were applied to the feature vector before classification. The proposed classifier performance on discriminating Normal and Seizure EEG signals is given in Table II. The proposed SVM classification is tested with 3 types of data transformation methods. In PCA method, the accuracy of the classifier is 80% and its sensitivity is 92%. In moving average method, the accuracy is 86% and the sensitivity is 97%. Log transformation method shows an accuracy of 86% and a sensitivity of 92%. Hence, Log transformation method produces better results in classification of Inter-ictal EEG signals and Seizure signals.

B. Hardware Implementation
The proposed algorithm is implemented in a Zynq board -ZC 706 FPGA. High Level Synthesis (HLS) software is very useful in ASIC design [17].The algorithm is written in C language and it is implemented using Vivado HLS. This design is divided into the Training and Testing Phases.  Table (LUT) where the programming logic is implemented. The LUT is constructed using a multiplexer and static RAM. Since static RAM is volatile memory, the program logic will be loaded from the memory to SRAM while executing the algorithm. A FlipFlop (FF) is a single bit memory used to hold the status of program execution. FlipFlops are used to construct memory LUTs. Since this proposed design is a patient specific detection system, the hardware design utilizes the Block RAM of the Zynq board to store the training parameters. The weight and bias values will be stored in the RAM. Xilinx Zynq board consists of a DSP processor to handle the signal processing feature extraction applications. The DSP processor consists of adder, subtractor, multipler, barrel shifter, FIR filter, square root calculation block, and a multiply and accumulation unit. Input and output pins were used to interface real time signals into the FPGA board for online detection. The entire proposed design is written in C and Vivado HLS generated the IP Blocks. The IP blocks were then called in the Vivado simulator block design. The simulations and implementation are completed using the Vivado simulator. The resource utilization of each module is given in Table III. Due to the smaller number of features and simple classification, the proposed method will require a small number of the FPGA's resources. The power utilization comparison with existing methods is given in Table  IV. V. CONCLUSION An automatic seizure detection hardware system to classify non-seizure and seizure EEG signals will help the medical practitioners to diagnose epilepsy disorders. The EEG signal is segmented in 20s segments and features were calculated for each segment. The Linear SVM is used to classify the EEG signal as a Seizure or Non-Seizure event. A high level synthesis based detection algorithm is developed and it is implemented in Zynq 706 hardware. The performance of this system is tested by using the Bonn EEG data base [12]. The results show that the proposed method achieves high detection selectivity of 97% with a minimum number of features. In addition, this design has better performance in comparison with the existing methods. Due to less dynamic power, this design can be developed as application specific integrated circuit design for a standalone device, which may be used by physicians.