32 Vol. 5. No. 2 May–August 2014 Research Report HEART ABNORMALITY CLASSIFICATIONS USING FOURIER TRANSFORMS METHOD AND NEURAL NETWORKS Endah Purwanti1, Amadea Kurnia Nastiti2, Adri Supardi3 1 Biomedical Engineering Study Program, Faculty of Science and Technology, Universitas Airlangga, Surabaya 2 Bachelor of Biomedical Engineering Study Program, Faculty of Science and Technology, Universitas Airlangga, Surabaya 3 Physics Study Program, Faculty of Science and Technology, Universitas Airlangga, Surabaya abstract Health problems with cardiovascular system disorder are still ranked high globally. One way to detect abnormalities in the cardiovascular system especially in the heart is through the electrocardiogram (ECG) reading. However, reading ECG recording needs experience and expertise, software-based neural networks has designed to help identify any abnormalities of the heart through electrocardiogram digital image. This image is processed using image processing methods to obtain ordinate chart which representing the heart’s electrical potential. Feature extraction using Fourier transforms which are divided into several numbers of coefficients. As the software input, Fourier transforms coefficient have been normalized. Output of this software is divided into three classes, namely heart with atrial fibrillation, coronary heart disease and normal. Maximum accuracy rate of this software is 95.45%, with the distribution of the Fourier transform coefficients 1/8 and number of nodes 5, while minimum accuracy rate of this software at least 68.18% by distribution of the Fourier transform coefficients 1/32 and the number of nodes 32. Overall result accuracy rate of this software has an average of 86.05% and standard deviation of 7.82. Key words: Cardiac Abnormalities, Image Processing, Electrocardiogram, Fourier Transforms, Artificial Neural Networks abstrak Masalah kesehatan dengan gangguan sistem kardiovaskular masih menduduki peringkat tinggi secara global. Salah satu cara untuk mendeteksi kelainan pada sistem kardiovaskular terutama di hati adalah melalui membaca rekaman elektrokardiogram (EKG). Namun, membaca rekaman EKG membutuhkan pengalaman dan keahlian, jaringan saraf berbasis software telah dirancang untuk membantu mengidentifikasi kelainan jantung melalui gambar digital elektrokardiogram. Gambar ini diproses menggunakan metode pengolahan citra untuk mendapatkan grafik ordinat yang mewakili potensi listrik jantung. Ekstraksi fitur menggunakan transformasi Fourier yang terbagi menjadi beberapa jumlah koefisien. Sebagai input software, transformasi Fourier koefisien telah dinormalkan. Output dari program ini dibagi menjadi tiga kelas, yaitu jantung dengan fibrilasi atrium, penyakit jantung koroner dan normal. Tingkat akurasi maksimum dari software ini adalah 95,45%, dengan distribusi Fourier transform koefisien 1/8 dan jumlah node 5, sedangkan tingkat akurasi minimal software ini setidaknya 68,18% dengan distribusi Fourier transform koefisien 1/32 dan jumlah node 32. Secara keseluruhan hasil tingkat akurasi software ini memiliki rata-rata 86,05 % dan standar deviasi 7.82. Kata kunci: Abnormalitas jantung, pemrosesan citra, elektrokardiogram, fourier transform, Jaringan Saraf Tiruan introduction Health problems with cardiovascular system disorder is still ranked high, according to data from the World Health Organization (WHO) reported that approximately 31% of the cause of death globally was cardiovascular disease. Variety of prevention and detection of cardiac abnormalities such as by using the device as a diagnostic tool, where the most commonly used is the Electrocardiograph (ECG). Electrocardiograph (ECG) used to capture and record the potential changes of heart using leads which are placed on the patient’s body at a particular location. ECG results are in a form of image called the electrocardiogram.13 Although knowing how the ECG works is relatively easy, 33Purwanti E, et al.: Heart Abnormality Classifications using Fourier Transforms Method and Neural Networks but determining the information on the ECG recording data requires experience and knowledge about heart disease and its symptoms. Manual extraction of the essential information on ECG signal is inefficient because of the amount of data that must be observed.16 On the other side, this recent year’s studies using Artificial Neural Network (ANN) have been developed. ANN is a computational method of artificial intelligence based on human biological neural model of a computer or a machine that can duplicate human intelligence.18 From this phenomenon, one solution to analyze the heart’s electrical signals on the ECG is by using a software based on Artificial Neural Network (ANN) into a computational analysis to identify and classify abnormalities of the heart through the scanned ECG records. To reduce the computational load due to the amount of data that needs to be observed, feature extraction with image transformation is used. Several studies about the use of scanned ECG records has done by Endarko6 by image processing in order to obtain numerical data as an ANN input to detect coronary heart disease. At Karimah.11 Bachrowi2 and Asmaria1 research, using a ECG graph ordinate retrieval feature extraction as input to ANN. The use of image transformation as feature extraction previously done by Kaur10 and Sarkaleh15 by using wavelet transform. Some of these studies become the basis of this study as an attempt to help identify heart abnormalities. Feature extraction done with the Discrete Fourier Transform, and also because the Fourier transform can bring in the form of frequency characteristics of image that often appears in the image, which can’t be seen with the eye.5 The study consists of pre-processing, segmentation and morphological operations, feature extraction, and classification of cardiac abnormalities. Transformations done at ECG graph to obtain Fourier coefficients as an input feature for ANN. Input patterns were divided into 3 groups, namely normal heart, atrial fibrillation, and coronary heart disease. The whole program is created using MATLAB. methods Data Collection Research data collections include the acquisition of ECG image that has been diagnosed by a cardiologist manually. From the data collection obtained 87 data; 33 cardiac disorder atrial fibrillation, 13 coronary heart, and 41 normal heart. Initial preparation which is cutting the image, with the intention of making the entire cycle on one ECG lead, where in one lead consisted of three ECG cycles. Lead which used in this study is data from the lead II, with the length of 530 pixels. Software Design Broadly the image will be processed by pre-processing, grayscaling, followed by image segmentation with thresholding to obtain binary image, which then continued by morphological image processing. From the resulting image, ordinate value of the image soughted to show the electrical potential value of cardiac which will form the graphic visualization of ECG image. The starting point was taken from the tip of electrocardiogram isoelectric line, with upward deflection is positive and downward deflection is negative. So that obtained pixel value equal to the height of the image pixels on the electrocardiogram. Feature extraction in image processing is done by Fourier transformation on the value. Data were normalized before feature transformation results of are used as networks input data. Normalization aims to facilitate the Artificial Neural Networks in the training process, the process of finding the weight, and the testing process. Normalization performed on the input features and the target for the network whilst denormalization to the output value of the network to return to its original shape. Training process using Backpropagation network according to flowchart in Figure 1: Figure 1. Training process flowchart. 34 Indonesian Journal of Tropical and Infectious Disease, Vol. 5. No. 2 May–August 2014: 32–36 result and discussion Data Processing Result A total of 87 data is passing through a series of image processing, include grayscale, segmentation, dilation and erosion morphological operations, and feature extraction. From this amount of data are divided into two, namely 65 training data and 22 testing data. Both groups include all of data categories, which are heart with atrial fibrillation disorder, coronary heart disease, and normal heart. Testing data used in Test Validation, this aims to determine the accuracy of the program that has been created. Preprocessing This preprocessing includes grayscale using MATLAB process that aims to transform the RGB image into 8 bit image that has a scale range of 0-255. the RGB image into 8 bit image that has a scale range of 0-255. Figure 6 Normal heart image after grayscale process Figure 2. Normal heart image after grayscale process. Segmentation The image that has been through a preprocessing segmentation then has the background removed by segmentation. This process causing only the graph remains. Segmentation is done by delivering threshold value, so that the image obtained is a binary image which simply made up by black and white color. Figure 3. Segmentation process result. Morphology Operations Earlier segmentation process causes the binary image in Figure 7 produces intermittent graphs in some parts, that it is necessary to conduct morphology operations to rebuild disconnected parts of the graph. Operations performed include dilation and erosion. (a) (b) Figure 4. Morphological image improvement (a) Dilation (b) Erosion. Feature Extraction Feature extraction process aims to obtain the characteristic features of the image. Prepared image is a binary image that has been repaired through morphological operations. Initial stages feature extraction is to find the value of each pixel ordinate in the image which represents the potential value of EKG graph. Ordinate value search includes the starting point of the graph, which is point 0 on the image Y axis. Point 0 on Y axis adjusted to the isoelectric line of the ECG graph, so its value will be in accordance with the high of pixel graphs. Graph visualization derived from the matrix which contains the values obtained from the Y axis. Next, Fourier coefficients calculated from each value, in order to get 530 pieces of Fourier transform coefficients which in accordance to the number of pixels at the image length. On this Fourier transform results, conducted coefficient part retrieval as an input for artificial neural networks training and testing. Coefficient part retrieval aims to reduce the high computational load because of the many data features were trained, and find the smallest number of Figure 5. Graph visualization length. Figure 10 Fourier Transforms plotting Figure 5. Fourier Transforms plotting 35Purwanti E, et al.: Heart Abnormality Classifications using Fourier Transforms Method and Neural Networks input features that can provide the best results. A complete Fourier coefficient parts and number of features for neural network input is presented in Table 1. Backpropagation Network Formation Backpropagation Network Training The training process uses 65 data that divided into three classes. The data used for training consisted of 30 normal heart data, 9 coronary heart data and 25 atrial fibrillation data. In this study, the manipulated variable is number of neurons in a hidden layer network. The weights used are the random weights to bias, input and hidden weight. Thus in this study weight training which has the best accuracy results for each neuron are used. Activation function used is bipolar sigmoid function which ranged (-1,1), because network output target is -1 for atrial fibrillation, 0 for coronary heart and 1 for normal heart. Searching the best weight without normalization tends to be more difficult and less efficient because there is a quite far numbers range differences in the Fourier coefficients. Training accuracy results obtained from neural network training parameter changes can be found in Table 2. Table 2 shows that the greater number of neurons, the smaller MSE generated where this result applies to any number of features. The smaller number of features also led to smaller MSE generated. Weight searching also tends to be faster on fewer input features. This can be seen in the table above, which generating smaller MSE. The use of coefficient parts peaked at 1/16 coefficient, where on the use of 1/32 coefficient, MSE results are no smaller from the use of 1/16 coefficient. Backpropagation Network Testing The network testing process uses 22 data which haven’t been used for training. This testing data consists of 10 normal heart data, 4 coronary heart data and 8 atrial fibrillation data. The testing process is done with the same parameter variation as was done during the training process, yet only using the final weights of each variation, to obtain the best results without repeating the training process. Backpropagation network test results can be seen in Table 3. Table 1. Fourier coefficient parts and number of features for neural network input Coefficient parts Number of input features Whole coeffients 530 1/2 coeffients 265 1/4 coeffients 133 1/8 coeffients 66 1/16 coeffients 33 1/32 coeffients 16 Table 2. Training data results Neuron Coefficient Parts MSE Accuracy 3 1 0.0134 100% 1/2 0.0134 100% 1/4 0.0128 100% 1/8 0.0122 100% 1/16 0.0120 100% 1/32 0.0324 98.46% 5 1 0.0121 100% 1/2 0.0121 100% 1/4 0.0120 100% 1/8 0.0118 100% 1/16 0.0117 100% 1/32 0.0306 98.46% 10 1 0.0119 100% 1/2 0.0118 100% 1/4 0.0118 100% 1/8 0.0118 100% 1/16 0.0117 100% 1/32 0.0119 100% 20 1 0.0118 100% 1/2 0.0118 100% 1/4 0.0118 100% 1/8 0.0117 100% 1/16 0.0117 100% 1/32 0.0119 100% 30 1 0.0118 100% 1/2 0.0118 100% 1/4 0.0117 100% 1/8 0.0117 100% 1/16 0.0117 100% 1/32 0.0118 100% From Table 3 can also be seen the influence of the parameter changes; number of neurons on the number of features. The greater the number of features, the greater the number of neurons needed to achieve the highest level of accuracy. Rate of accuracy will decrease after reaching the optimal number of neurons. Based on the results of accuracy rate in Table 3, the highest accuracy rate of this network is 95.45%. This rate is can be found on several variations of Fourier coefficient parts and number of neurons. However, if associated with the MSE of training results in Table 2, and considering the amount of computational load, the highest accuracy rate and optimal parameters found in the 36 Indonesian Journal of Tropical and Infectious Disease, Vol. 5. No. 2 May–August 2014: 32–36 references 1. Pratanu, Sunoto, 1999, "Buku Ajar Ilmu Penyakit Dalam", FK UI, Jilid 1, edisi ke-3, Jakarta 2. Schamroth, L., 1990, An Introduction to Electrocardiography, Blackwell Science, Oxford. 3. Waslaluddin S dan Wahyudin A, 2010. Klasifikasi Pola Elektrik Jantung pada Elektrokardiogram (EKG) Menggunakan Jaringan Saraf Tiruan Berbasis Backpropagation, Bandung: Universitas Pendidikan Indonesia, 62–65. 4. Endarko, et al. 2006. Aplikasi Pengolahan Citra Elektrokardiograf dan Jaringan Saraf Tiruan untuk Identifikasi Penyakit Jantung Koroner. Jurnal Fisika dan Aplikasinya FMIPA ITS Surabaya. pp. 35–38. 5. Karimah, Fatimul, 2012, Implementasi Learning Vector Quantization sebagai Alat Bantu Identifikasi Kelainan Jantung Melalui Citra Elektrokardiogram, Skripsi, Fakultas Sains dan Teknologi Univeresitas Airlangga Surabaya 6. Bachrowi T, Purwanti E. 2012. Deteksi Sinyal Ecg Irama Myocardial Ischemia dengan Jaringan Saraf Tiruan. Program Studi Teknobiomedik Fakultas Sains dan Teknologi Universitas Airlangga, Surabaya. 32–34. 7. Asmaria T, Purwanti E. 2012. Deteksi Dua Belas Sadapan Sinyal Elektrokardiogram untuk Mengenali Kelainan Jantung Menggunakan Jaringan Saraf Tiruan dengan Metode Backpropagation. Program Studi Teknobiomedik Fakultas Sains dan Teknologi Universitas Airlangga, Surabaya. 45–56. 8. Kaur, Jasminder, Raina JPS, 2012. An Intelligent Diagnosis System for Electrocardiogram (ECG) Images Using Artificial Neural Network (ANN), International Journal of Electrical, Electronics and Computer Engineering, 1(1): 147–151. 9. Sarkaleh MK, Shahbahrami A, 2012. Classification of ECG Arrithmias using Discrete Wavelet transform and Neural Networks, International Journal of Computer Science, Engineering and Applications (IJCSEA) Vol. 2, No. 1. pp. 123–125. 10. Dougherty, Geoff. 2009. Digital Image Processing for Medical Applications, Cambridge University Press New York. coefficient parts of 1/8 with number of neurons 5, and the final MSE 0.0118. Lowest accuracy rate obtained on the use of coefficient parts of 1/32 and the number of neurons 30, which is 68.18%. From the overall results in Table 3, overall accuracy rate of this software has an average of 86.05% and a standard deviation of 7.82. conclusion Image features for neural network software in this study was obtained through image processing, which begins from grayscaling, segmentation, dilation, erosion and followed by ECG signal graphs feature extraction with Fourier transforms. This software using artificial neural networks Backpropagation, with processed scanned ECG records image as an input. This image converted to a one- dimensional time series signal to obtain the value that is equivalent to voltage value on the ECG image which is then transformed with Discrete Fourier Transform. Output of this software is a numerical value cardiac abnormalities classification. Maximum accuracy rate of this software is 95.45%, with the distribution of the Fourier transform coefficients 1/8 and number of nodes 5, while minimum accuracy rate of this software at least 68.18% by distribution of the Fourier transform coefficients 1/32 and the number of nodes 32. Overall result accuracy rate of this software has an average of 86.05% and standard deviation of 7.82. Tabel 3. Testing data accuracy Fourier Coefficient Parts 1 1/2 1/4 1/8 1/16 1/32 N eu ro n 3 81.81% 95.45% 81.81% 86.36% 86.36% 72.72% 5 86.36% 90.90% 95.45% 95.45% 81.81% 72.72% 10 90.90% 86.36% 90.90% 90.90% 81.81% 72.72% 20 90.90% 95.45% 86.36% 90.90% 90.90% 77.27% 30 95.45% 90.90% 90.90% 86.36% 81.81% 68.18%