Content uploaded by Mohammed Bahoura
Author content
All content in this area was uploaded by Mohammed Bahoura on Apr 07, 2021
Content may be subject to copyright.
FPGA Implementation of an Automatic Wheezes
Detector based on MFCC and SVM
Ons Boujelben1
1Department of Engineering,
Universit´
e du Qu´
ebec `
a Rimouski,
300, all´
ee des Ursulines, Rimouski, Canada
Mohammed Bahoura1,2
2Department of Electronics,
Universit´
e Saad Dahlab de Blida,
Route de Soumˆ
aa, Blida, Algeria.
Abstract—The present paper proposes a new hardware im-
plementation to categorize lung sounds into wheeze and normal
groups. The suggested architecture employs the Mel-Frequency
Cepstral Coefficients (MFCC) for feature extraction and the
Support Vector Machine (SVM) for classification. In the current
study, the SVM parameters are obtained during the training
phase using the LIBSVM library in MATLAB, while the testing
phase is performed on FPGA. The used database is composed
of 12 normal respiratory sounds and 12 respiratory sounds
containing wheezes. The classification results obtained with FPGA
are compared to those obtained with MATLAB.
Keywords—Respiratory sounds, Wheezes, Classification, FPGA,
SVM, MFCC.
I. INTRODUCTION
Asthma is a Chronic Obstructive Pulmonary Disease
(COPD), where the number of the people affected is constantly
increasing. Computer-based lung sound analysis provides an
objective tool to diagnose the respiratory diseases. Many
researchers have been interested by the lung sounds recog-
nition problems, where different signal processing techniques
have been developed to classify lung sounds. Since 1980,
scientists try to identify automatically the presence of wheez-
ing [1]. To classify respiratory sounds, different combinations
of feature extraction and classification methods have been
proposed in the literature. Mel-frequency cepstral coefficients
(MFCC) was combined with support vector machine (SVM),
k-Nearest Neighbour (kNN) [2] and Gaussian mixture models
(GMM) [3]. The wavelet transform was proposed with artificial
neural networks (ANN) [4], [5], and other combination can be
found in [5], [6]. Among these techniques, the combination
MFCC-SVM has been efficiently applied to detect wheezes
sounds, it can achieve a classification accuracy higher than
95% [1].
Despite its advantages, the respiratory sounds analysis has
not reach yet the step in which it can be used the clinical
environment. On the other hand, real-time implementation of
various signal processing of feature extraction and pattern
classification remains a great challenge. Therefore, we are
interested in this research to carry out a hardware implementa-
tion of an automatic system for detecting and classifying lung
sounds into normal and wheezes. The literature review shows
that MFCC-based feature extraction for respiratory sounds has
been implemented on FPGA [7], while the SVM classifier
was implemented on FPGA for Persian handwritten digits
recognition [8].
This paper proposes an FPGA-based real-time system to
detect wheezes episode at asthmatic patients using Xilinx
System Generator (XSG). The hardware design is generated
and verified in MATLAB/SIMULINK.
II. FE ATUR E EXTRACTION ALGORITHM
MFCC-based method is performed to describe lung sounds
in order to approximate the response of human auditory
system. The extracted feature describes firmly the sound that
can be heard over the stethoscope [1].
Sampled at 6000 Hz, the lung sound is first segmented
into frames of Nsamples, and then multiplied by Hamming
window. For the mth segment s(m, n), the Discrete Fourier
Transform (DFT), S(m, k), is computed using the Fast Fourier
Transform (FFT) algorithm, the M-mel filter bank is applied
to the resulting energy spectrum. The logarithmic energy
output of the lth filter for the current frame mis defined as
e(m, l) = log(
N−1
X
k=0
|S(m, k)|2Hl(k)) (1)
where Hl(k)represent the frequency response of the given
filter, where l= 1, ..., M. The MFCC coefficients are obtained
by discrete cosine transform (DCT)
cm(n) =
M
X
l=1
e(m, l)cos(n(l−0.5)π/M)(2)
where nrepresent the index of the cepstral coefficient. In this
case, 15 MFCC have been used: cm(3), ..., cm(17).
III. CLASSIFICATION ALGORITHM
Support vector machine (SVM) technique was proposed for
regression and classification problems. It is based on a kernel
learning algorithm that classify binary or multiple data. The
SVM operates in both training and testing steps. During the
training step, SVM builds a predictive pattern using training
samples and the label values of the proper class, and then it
uses this model to classify the test set. Considering a linear
problem, the main purpose of SVM is to define an hyperplane
such that: the class labels of data {±1}are located on each
side of the hyperplane and the distance of the nearest vector
of the hyperplane (both classes) is maximum.
Fig. 1. Principle of classification using the SVM techniques for two classes
The parameters wand bin Fig. 1 are obtained by solving
the following dual Lagrange problem
max(Ld(α)) =
N
X
i=1
αi−1
2
N
X
j,i=1
αiαjyiyjxjxT
i(3)
based on (0≤αi≤C
PN
i=1 αiyi= 0
The equation that determines the optimal hyperplane separat-
ing the two classes with the highest margin is defined by :
M(x) = wTx+b(4)
The decision function in the context of linear data is defined
by the sign of the hyperplane in (4):
d(x) = sign(wTx+b)(5)
In the case of data non-linearly separated, SVM maps data
into a richer feature space (H) including non-linear features,
then constructs an hyperplane in that space.
ϕ:Rn→H(6)
x→ϕ(x)(7)
In this case the vector xis transformed into ϕ(x). The
kernel function is defined by the following inner product:
k(xi, xj) = ϕ(xi)×ϕ(xj)(8)
For non-linear data, the SVM make a decision satisfying the
following equation
d(x) = sign(wT×ϕ(x) + b(9)
The software tests show that the use of the linear kernel gives
the maximum classification accuracy. In this research, we pro-
pose to use the linear kernel function, because it demonstrates
a quite efficient for classifying respiratory sounds.
TABLE I. RESOURCE UTILIZATION SUMMARY AND MAXIMUM
FREQUENCY OBTAINED FOR THE VIRTEX -6 XC6VLX240T CHIP.
Resource utilization
Flip Flops (301,440) 13,398 (4.4%)
LUTs (150,720) 18,943 (12.6%)
Bonded IOBs (600) 561 (93.5%)
RAMB18E1s (832) 4 (0.5%)
DSP48E1s (768) 154 (20.0%)
Slice (37,680) 5,959 (15%)
Maximum Operating Frequency 30.361 MHz
IV. FPGA IMPLEMENTATION
Figure 2 shows the block diagram of hardware architecture
design for MFCC feature extraction and two-class SVM-based
classifier. The hardware implementation uses Xilinx System
Generator (XSG) tool and the Virtex-6 FPGA ML605 evalua-
tion board. Fig. 2 represents an optional subsystem designed
with SIMULINK blocks, which select one decision of classi-
fications for every frame. More details on the FPGA imple-
mentation of MFCC feature extraction technique and the SVM
classifier can be found in [7] and [8], respectively. The training
phase of the classifier is achieved offline with LIBSVM [9],
while the testing phase is done on hardware. Table I shows
the hardware resources used in Virtex-6XC6VLX240T device
and the maximum operating frequency of the implemented
architecture, as reported by Xilinx ISE Design Suite 13.4.
V. RE SU LTS AND DISCUSSION
To evaluate the proposed architecture, two classes of respi-
ratory sound (normal and wheezing) are used for training and
testing samples. Database is constructed from 12 records of
each class (total of 24 records), some wheezes sounds include
monophonic and polyphonic wheezes. The used lung sounds
are sampled at 6000 Hz. Wheezing sounds are manually
labelled. We named class1 with label {+1}for normal frame,
class2 with label {−1}for wheezing frame. The {±1}labels
represent the class of the tested frame.
The classification results of normal and pure wheezing
respiratory sounds, presented in Fig. 3(a,b), shows that both the
designed architectures with Xilinx System Generator (XSG)
and MATLAB software provide the same classification results.
The respiratory sound record presented in Fig. 3(c) contains
normal and wheezes sounds. In this case, both architectures
(XSG and MATLAB) can distinguish between the frame
containing normal lung sounds from those that containing
wheezes. The difference (one misclassified frame) can be
justified by the quantization errors in System Generator [8].
Finally, the designed architecture implemented with fixed-
point XSG gives equivalent performances than those obtained
with the floating-point MATLAB.
VI. CONCLUSION
In this paper, FPGA architecture of an automatic wheezes
detector based on MFCC and SVM has been proposed. Based
on the tested records, the classification performances obtained
with hardware implementation are analogous to those obtained
with the floating-point MATLAB. The designed architecture
Fig. 2. MFCC-SVM system based on Xilinx System Generator (XSG) blockest for wheezes classification. The complete implemented system is presented on
the top, the subsystem details are presented. The green blocks are build using the XSG blocks (blue). The white blocks are the standard SIMULINK blocks.
The feature extraction MFCC is the same as described in [7].
Fig. 3. Classification of normal (a) and wheezing (b and c) respiratory sounds into of segments into normal {+1}and wheezing {−1}frames. Every subfigure
contains the spectrogram of the tested sample (top) and the classification results using fixed-point of XSG (middle) and floating-point of MATLAB (bottom).
can be generalized to other respiratory sound classes. As a
future work, the proposed architecture will be tested on a large
database. The implementation of others feature extraction is
recommended to improve the identification accuracy.
ACKNOWLEDGMENT
This research is supported by the NSERC of Canada.
REFERENCES
[1] I. Mazic, M. Bonkovic, and B. Daja, “Two-level coarse-to-fine classifica-
tion algorithm for asthma wheezing recognition in children’s respiratory
sounds,” Biomedical Signal Processing and Control, vol. 21, pp. 105–
118, 2015.
[2] R. Palaniappan, K. Sundaraj, and S. Sundaraj, “A comparative study
of the svm and k-nn machine learning algorithms for the diagnosis
of respiratory pathologies using pulmonary acoustic signals,” BMC
bioinformatics, vol. 15, no. 1, p. 223, 2014.
[3] M. Bahoura and C. Pelletier, “Respiratory sounds classification using
cepstral analysis and gaussian mixture models,” in Engineering in
Medicine and Biology Society, 2004. IEMBS’04. 26th Annual Interna-
tional Conference of the IEEE, vol. 1, 2004, pp. 9–12.
[4] A. Kandaswamy, C. S. Kumar, R. P. Ramanathan, S. Jayaraman, and
N. Malmurugan, “Neural classification of lung sounds using wavelet
coefficients,” Computers in Biology and Medicine, vol. 34, no. 6, pp.
523–537, 2004.
[5] M. Bahoura, “Pattern recognition methods applied to respiratory sounds
classification into normal and wheeze classes,” Computers in biology and
medicine, vol. 39, no. 9, pp. 824–843, 2009.
[6] R. Palaniappan, K. Sundaraj, and N. U. Ahamed, “Machine learning in
lung sound analysis: a systematic review,” Biocybernetics and Biomedical
Engineering, vol. 33, no. 3, pp. 129–135, 2013.
[7] M. Bahoura and H. Ezzaidi, “Hardware implementation of MFCC feature
extraction for respiratory sounds analysis,” in 8th Workshop on Systems,
Signal Processing and their Applications, 2013, pp. 226–229.
[8] D. Mahmoodi, A. Soleimani, H. Khosravi, M. Taghizadeh et al., “FPGA
simulation of linear and nonlinear support vector machine,” Journal of
Software Engineering and Applications, vol. 4, no. 05, p. 320, 2011.
[9] C.-C. Chang and C.-J. Lin, “LIBSVM: A library for support vector
machines,” ACM Transactions on Intelligent Systems and Technology
(TIST), vol. 2, no. 3, p. 27, 2011.