Using K-Nearest Neighbor Classification to Diagnose Abnormal Lung Sounds
<p>Lung sound classification [<a href="#B2-sensors-15-13132" class="html-bibr">2</a>].</p> "> Figure 2
<p>System architecture.</p> "> Figure 3
<p>Processing effects of wavelet de-noising for the same case with different threshold values (<span class="html-italic">M</span> = 6).</p> "> Figure 4
<p>Process of respiratory signal sensing.</p> "> Figure 5
<p>GUI design of the diagnosis system.</p> "> Figure 6
<p>Modified microphone stethoscope.</p> "> Figure 7
<p>Condenser microphone [<a href="#B21-sensors-15-13132" class="html-bibr">21</a>].</p> "> Figure 8
<p>Characteristics of bending-type sensor resistance [<a href="#B22-sensors-15-13132" class="html-bibr">22</a>].</p> "> Figure 9
<p>Respiratory sensor circuit.</p> "> Figure 10
<p>Implementation of respiratory sensor.</p> "> Figure 11
<p>Process of lung sound identification system.</p> "> Figure 12
<p>Relationship between human perception and actual frequency.</p> "> Figure 13
<p>Process of MFCC characteristic parameter capture.</p> "> Figure 14
<p>Triangular filter bank model.</p> "> Figure 15
<p>Flowchart of K-means algorithm.</p> "> Figure 16
<p>System A: Lung sound identification system.</p> "> Figure 17
<p>System B: Lung sound identification system with K-means algorithm clustering.</p> "> Figure 18
<p>User interface for prevention and diagnosis.</p> "> Figure 19
<p>Lung auscultation position.</p> "> Figure 20
<p>Littmann 3200 Bluetooth electronic stethoscope (3M) [<a href="#B26-sensors-15-13132" class="html-bibr">26</a>].</p> "> Figure 21
<p>Position for the placement of the wireless respiratory rate detection system.</p> "> Figure 22
<p>Wireless auscultation system user interface.</p> ">
Abstract
:1. Introduction
Relevant Disease/Abnormal Lung Sound | Crackles | Wheezes | Rhonchi |
---|---|---|---|
Pneumonia | ● | ● | |
Chronic bronchitis | ● | ● | |
Bronchiectasis | ● | ||
Congestive heart failure | ● | ● | |
Obstructive pulmonary disease | ● | ||
Asthma | ● | ||
Bronchial stenosis | ● |
2. Materials and Methods
2.1. System Design
2.1.1. Condenser Microphone
2.1.2. Digital Filter
- (a)
- Select an appropriate wavelet function and determine the number of wavelet decomposition layers M, then conduct the M-layer wavelet decomposition of the original one-dimensional signal S.
- (b)
- For the high-frequency coefficient of each layer of 1-M (j = 1, 2, ..., M), select a threshold T for quantitative processing to get useful high-frequency components. We adopt a soft threshold for quantification by comparing the absolute value with the threshold. Points below or equal to threshold became 0, and points greater than threshold become the difference between the point and the threshold. The mathematical equation is shown in Equation (1) [20]:
- (c)
- Based on the M-layer low-frequency coefficient of the wavelet decomposition and the high-frequency coefficient from the first layer to the M layer after the quantification processing, we can reconstruct the signals to obtain de-noised signals.
2.1.3. Lung Sound Signal Analysis
2.1.4. Respiratory Rate Monitor
2.1.5. Graphical User Interface (GUI) Design of the Diagnosis System
2.2. Implementation of the Integrated Stethoscope and Respiratory Rate Sensor System
2.3. Respiratory Rate Sensor
2.4. Implementation of Lung Sound Classification System
2.5. Lung Sound Signal Characteristics Extraction
- (1)
- Frame blocking: To observe sound signal characteristics, we collect a certain number of sampling points of signals for observation, referred to as framing. To limit signal changes between frames, frames are generally overlapped in the proportion of 1/2.
- (2)
- Compute energy: After framing, the energy of each frame is computed as the 13th parameter of MFCC:
- (3)
- Pre-emphasis: After the sound is sent, the higher-frequency part of the sound will be attenuated. Thus, the pre-emphasis method is used to compensate for the attenuated high-frequency part in identification or comparison. Pre-emphasis compensates for the loss of high-frequency by passing the sound signal through a high-pass filter, as shown in Equation (4). Let S(n) represent the sound signal, n be the time coefficient, in this case α = 0.95:
- (4)
- Hamming window: Discontinuity on both sides of the sound frame will produce additional signals, so the continuity of the audio spectrum will be destroyed. Window processing of the sound frames lowers the additional high-frequency signals on both sides of the sound frame to highlight the major signals at the center of the frame. By mixing, sound frame overlaps can produce the effect of continued border changes. Let N be all sampling points of a frame. A Hamming window is generally used to prevent overly dramatic changes in a window, as follows:
- (5)
- Fast-Fourier transform (FFT): FFT is the most commonly used sound signal processing technique. Let k be currently sampling point and n for all N sampling points within a period. It converts time domain signals into the frequency domain to facilitate energy distribution in the frequency spectrum, as shown below:
- (6)
- Triangular pass filter: The human auditory system can perceive frequencies ranging from 20–20,000 Hz, but is not equally sensitive to each frequency. The human ear is relatively sensitive to the low-frequency range, and less sensitive to changes at higher frequencies. In the sound identification system, the Mel-scale frequency is similar to the perceived frequency, and is the most commonly used simple frequency scale transformation equation, as described below.
- (7)
- Discrete cosine transform (DCT): After obtaining the filter energy, we can calculate its logarithm value and enter it into the discrete cosine transform to get the M orders of characteristic coefficients. In this paper, M = 26. The DCT equation is shown in Equation (10).
- (8)
- Delta cepstrum coefficients: MFCC does not produce accurate identification results. Thus, in addition to the 12th-order MFCC, we added the energy of the logarithm of the sound frame to get the 13th-order characteristic parameter, by obtaining the first-order differential cepstrum coefficients and the second-order differential cepstrum coefficients of the 13th characteristic parameters. We obtained a total of 39 orders of coefficients to represent the sound frame MFCC. The meaning of the differentiation is the change in the coefficients over time. The equation of differentiation is shown in Equation (12):
2.6. K-Means Algorithm
- (1)
- We randomly select K cluster centers as μj:
- (2)
- Repeat the following process until convergence:
- (a)
- For each x(i), compute the nearest cluster center and assign it to the nearest cluster center.
- (b)
- For each category μj, re-compute the mean value of the category and update the cluster center.
2.7. K-Nearest Neighbor Algorithm
- (1)
- First, determine the number of nearest points of test data x against training data K using a Euclidean distance equation to compute the distance. If there are two points in k dimensional space, x = [x1, x2, …, xk] and y = [y1, y2, …, yk], the Euclidean distance between the two can be represented by Equation (15):
- (2)
- When test data x has more representatives than a certain category of data (the number of K-nearest points accounting for the majority), it is judged that x is of the certain category.
3. Experiments
3.1. Experimental Data
KNN (K = 1) K-Means (K = 256) | Training Data | Test Data |
---|---|---|
Number | 20 | According to experimental conditions |
Time (s) | 10–20 | 10–20 |
MFCC dimensions | 39 | 39 |
Category | Four categories (normal sounds, crackles, wheezes, and rhonchi) | No prior classification |
3.2. Experimental Environment
A. Experiment 1
B. Experiment 2
C. Experiment 3
D. Experiment 4
E. Experiment 5
F. Experiment 6
3.3. Experimental Results
3.3.1. Experiment 1
Test Sound | System A (without K-Means) Identification Rates | System B (with K-Means) Identification Rates |
---|---|---|
20dB_AWGN normal lung sound (normal lung sound) | 80.2% | 95% |
20dB_AWGN abnormal lung sound (crackles) | 78.5% | 92% |
20dB_AWGN abnormal lung sound (wheezes) | 79.6% | 90.5% |
20dB_AWGN abnormal lung sound (rhonchi) | 70.3% | 91.5% |
Average identification rate | 77.1% | 92.3% |
System A (without K-Means) | System B (with K-Means) | |
---|---|---|
Training time | 0.17 s | 98.2 s |
Testing time | 10.6 s | 0.75 s |
3.3.2. Experiment 2
Sound File | Identification Rate | |
---|---|---|
Normal lung sounds (Normal lung sounds) | Normal1.wav—Normal10.wav | 100% |
Abnormal lung sounds (crackles) | Crackles1.wav—Crackles10.wav | 100% |
Abnormal lung sounds (wheezes) | Wheezes1.wav—Wheezes10.wav | 100% |
Abnormal lung sounds (rhonchi) | Rhonchi 1.wav—Rhonchi 10.wav | 100% |
3.3.3. Experiment 3
Sound File | Identification Rate | |
---|---|---|
AWGN normal lung sound (normal lung sound) | AWGN_Normal1.wav—AWGN_Normal 10.wav | 95% |
AWGN abnormal lung sound (crackles) | AWGN_Crackles1.wav—AWGN_Crackles 10.wav | 92% |
AWGN abnormal lung sound (wheezes) | AWGN_Wheezes1.wav—AWGN_Wheezes 10.wav | 90.5% |
AWGN abnormal lung sound (rhonchi) | AWGN_Rhonchi 1.wav—AWGN_Rhonchi 10.wav | 91.5% |
3.3.4. Experiment 4
Code Number | Degree | Condition |
---|---|---|
0000000000–0000000011 | 80%–100% | Good |
0000000111–0000011111 | 50%–70% | Warning |
0000111111–0011111111 | 20%–40% | Bad |
0111111111–1111111111 | 0%–20% | Serious |
3.3.5. Experiment 5
- (1)
- Obtain lung sound waveforms from the 3M stethoscope and the modified microphone stethoscope.
- (2)
- To combine the amplitudes of the waveform in various vertical lines to form the vector of the waveform signal, X = (0.0078, 0.00625, 0.054, ..., 0.23), Y = (0.0078, 0.0078, 0.0078, ..., 0.24). Let X vector be the 3M stethoscope and Y vector be the proposed stethoscope. X and Y formed the vector of the waveform.
- (3)
- Enter the waveform vector into the cosine function and compute the degree of similarity of the two.
Vector | |
---|---|
<X1,Y1> | 0.96 |
<X2,Y2> | 0.97 |
<X3,Y3> | 0.95 |
<X4,Y4> | 0.95 |
Average | 0.956 |
Product | Price | Sound Storage | Waveform Display | Simple Diagnosis | Error of Lung Sound Measurement Using The Devices (%) |
---|---|---|---|---|---|
3M Littmann 3200 | 20,000 | Available | Computer display | Unavailable | 4.4 |
Modified stethoscope | 2000 | Available | Computer display | Available |
Subject | Gender | Age | Height (cm) | Weight (kg) | Coughing in the Last 7 Days | Family History of Disease | Measurement Posture |
---|---|---|---|---|---|---|---|
A | Male | 24 | 170 | 64 | none | No | Sitting |
B | Male | 24 | 180 | 107 | none | Hypertension | Sitting |
C | Male | 24 | 171 | 70 | none | No | Sitting |
D | Male | 24 | 163 | 55 | none | No | Sitting |
E | Male | 25 | 172 | 90 | none | No | Sitting |
F | Male | 25 | 181 | 69 | none | Hypertension | Sitting |
G | Male | 23 | 177 | 67 | none | No | Sitting |
H | Male | 23 | 172 | 75 | none | No | Sitting |
I | Male | 24 | 172 | 54 | none | No | Sitting |
J | Male | 24 | 172 | 52 | none | No | Sitting |
K | Male | 24 | 163 | 61 | none | No | Sitting |
L | Male | 24 | 177 | 64 | none | No | Sitting |
M | Male | 24 | 172 | 71 | none | No | Sitting |
N | Male | 24 | 172 | 68 | none | No | Sitting |
O | Male | 25 | 173 | 68 | none | No | Sitting |
P | Male | 25 | 176 | 69 | none | No | Sitting |
Q | Male | 23 | 185 | 68 | none | No | Sitting |
R | Male | 23 | 169 | 59 | none | No | Sitting |
S | Male | 24 | 171 | 58 | none | No | Sitting |
T | Male | 24 | 170 | 67 | none | No | Sitting |
Subject | Identification Results | |
---|---|---|
Condenser microphone recordings | A | Good |
B | Good | |
C | Good | |
D | Good | |
E | Good | |
F | Good | |
G | Good | |
H | Good | |
I | Good | |
J | Good | |
K | Good | |
L | Good | |
M | Good | |
N | Good | |
O | Good | |
P | Good | |
Q | Good | |
R | Good | |
S | Good | |
T | Good |
Audio file name | The average recognition rate |
---|---|
Record1.wav | 97.6% |
Record2.wav | |
Record3.wav | |
Record4.wav | |
Record5.wav |
3.3.6. Experiment 6
Measurement Experiment with Wireless Respiratory Rate Detection System
Wireless Respiratory Rate Detection System Software
4. Discussion
4.1. Detection Accuracy
Model Prediction Capability | MAPE (%) |
---|---|
Highly accurate | 10% |
Good | 10%–20% |
Reasonable | 20%–50% |
Inaccurate | >50% |
Subject | Sensing Respiratory Cycle (Times/Min) | Actual Respiratory Cycle (Times /Min) | MAPE Value |
---|---|---|---|
A | 17 | 15 | 6.8% |
B | 16 | 15 | |
C | 18 | 17 | |
D | 15 | 16 | |
E | 17 | 19 | |
F | 14 | 14 | |
G | 16 | 15 | |
H | 16 | 17 | |
I | 14 | 15 | |
J | 15 | 14 | |
K | 16 | 14 | |
L | 17 | 17 | |
M | 16 | 17 | |
N | 15 | 14 | |
O | 16 | 17 | |
P | 14 | 16 | |
Q | 16 | 17 | |
R | 17 | 16 | |
S | 16 | 15 | |
T | 14 | 15 |
4.2. Comparison with Existing Auscultation Systems
Price (USD) | Sound Storage | Frequency Range | Waveform Display | Recording Time (Second ) | Capturing Function | Simple Diagnosis | Wireless Function | |
---|---|---|---|---|---|---|---|---|
CK625P [29] | 60 | Unavailable | 20–10,000 Hz | Unavailable | Unavailable | Unavailable | Unavailable | Unavailable |
3M-3200 [26] | 667 | Available | 20–1000Hz | Computer display | 10 | Unavailable | Unavailable | Bluetooth transmission |
Proposed system | 73 | Available | 200–2000 Hz | Computer display | 20 | Available | Available | Unavailable |
5. Conclusions
Acknowledgments
Author Contributions
Conflicts of Interest
References
- Ministry of Health and Welfare Taiwan. Ministry of Health and Welfare Taiwan Homepage. Available online: http://www.mohw.gov.tw/EN/Ministry/Index.aspx (accessed on 15 March 2015).
- Jarvis, C. Physical Examination and Health Assessment; Libby Houston: Sydney, Australia, 2012. [Google Scholar]
- Pasterkamp, H.; Kraman, S.S.; Wodicka, G.R. Respiratory sounds: Advances beyond the stethoscope. Am. J. Respir. Crit. Care Med. 1997, 156, 974–987. [Google Scholar] [CrossRef] [PubMed]
- World Health Organization (WHO). World Health Organization (WHO) Homepage. Available online: www.who.int/ (accessed on 15 March 2015).
- American Thoracic Society. American Thoracic Society Homepage. Available online: www.thoracic.org/ (accessed on 15 March 2015).
- National Institutes of Health (NIH). National Institutes of Health (NIH) Homepage. Available online: www.nih.gov/ (accessed on 15 March 2015).
- Riella, R.J.; Nohama, P.; Maia, J.M. Automatic wheezing recognition in recorded lung sounds. In Proceedings of the 25th Annual International Conference of the IEEE Engineering in Medicine and Biology Society, Cancun, Mexico, 17–21 September 2003; pp. 2535–2538.
- Bahoura, M.; Pelletier, C. New Parameters for respiratory sound classification. In Proceedings of Canadian Conference on Electrical and Computer Engineering, Montreal, QC, Canada, 4–7 May 2003; pp. 1457–1460.
- Bahoura, M.; Pelletier, C. Respiratory sounds classification using Gaussian mixture models. In Proceedings of Canadian Conference on Electrical and Computer Engineering, Niagara Falls, ON, Canada, 2–5 May 2004; pp. 1309–1312.
- Alsmadi, S.; Kahya, Y.P. Design of a DSP-based instrument for real-time classification of pulmonary sounds. Comput. Biol. Med. 2008, 38, 53–61. [Google Scholar] [CrossRef] [PubMed]
- Mayorga, P.; Druzgalski, C.; Morelos, R.; Gonzalez, O.; Vidales, J. Acoustics based assessment of respiratory diseases using GMM classifi cation. In Proceedings of 2010 Annual International Conference of the IEEE Engineering in Medicine and Biology Society (EMBC), Buenos Aires, Argentina, 31 August–4 September 2010; pp. 6312–6316.
- Suzuki, A.; Sumi, C.; Nakayama, K.; Mori, M. Real-time adaptive canceling of ambient noise in lung sound measurement. Med. Biol. Eng. Comput. 1995, 33, 704–708. [Google Scholar] [CrossRef] [PubMed]
- Nie, T.G. A Feasibility Study of Lung Sound Auscultation Systems. Master’s Thesis, National Central University, Chung-Li, Taiwan, 2001. [Google Scholar]
- Ji, G.R. A Prototype of Digital Stethoscope. Master’s Thesis, National Central University, Chung-Li, Taiwan, 2003. [Google Scholar]
- Yu, S.Z. Design and Implementation for a Lung Sound System. Master’s Thesis, National Taiwan Normal University, Taipei, Taiwan, 2008. [Google Scholar]
- Tsai, P.H. A Digital Electronic Stethoscope Based on an Audio Player. Master’s Thesis, National Central University, Chung-Li, Taiwan, 2007. [Google Scholar]
- Chang, G.C.; Lai, Y.F. Performance evaluation and enhancement of lung sound recognition system in two real noisy environments. Comput. Methods Progr. Biomed. 2010, 97, 141–150. [Google Scholar] [CrossRef] [PubMed]
- Yamashita, M.; Matsunaga, S.; Miyahara, S. Discrimination between healthy subjects and patients with pulmonary emphysema by detection of abnormal respiration. In Proceedings of 2011 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), Prague, Czech Republic, 22–27 May 2011; pp. 693–696.
- Abbas, A.; Fahim, A. An automated computerized auscultation and diagnostic system for pulmonary diseases. J. Med. Syst. 2010, 34, 1149–1155. [Google Scholar] [CrossRef] [PubMed]
- Aggarwal, R.; Singh, J.K.; Gupta, V.K.; Rathore, S.; Tiwari, M.; Khare, A. Noise Reduction of Speech Signal using Wavelet Transform with Modified Universal Threshold. Int. J. Comput. Appl. 2011, 20, 14–19. [Google Scholar] [CrossRef]
- ECE 2C. Available online: http://my.ece.ucsb.edu/York/Bobsclass/2C/ (accessed on 15 March 2015).
- Images SI Inc. Two-Directional Bi-Flex Sensors. Available online: http://www.imagesco.com/sensors/flex-sensor.html (accessed on 15 March 2015).
- Jain, A.K. Data Clustering: 50 Years beyond K-Means. Pattern Recogn. Lett. 2010, 31, 651–666. [Google Scholar] [CrossRef]
- Lehrer, S. Understanding Lung Sounds, 2nd ed.; Saunders: New York, NY, USA, 1993. [Google Scholar]
- GitHub project website. Available online: https://github.com/ntutebd308/lab308 (accessed on 27 May 2015).
- 3M.com. 3M Homepage. Available online: http://www.3m.com/ (accessed on 15 March 2015).
- Lewis, C.D. Industrial and business forecasting methods. J. Forecast. 1982, 2, 194–196. [Google Scholar]
- You-Shen Hospital. Pleural care. Available online: http://www.yuoshen.com.tw/RT%20Room/Dr%20yang/thoraciccare.htm (accessed on 15 March 2015).
- Spirit Medical Co., Ltd. Available online: http://www.ckspirit.com.tw/ (accessed on 15 March 2015).
- Tsai, K.C. Review of Respiratory Physiology. Unpublished Work. 1991. [Google Scholar]
© 2015 by the authors; licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution license (http://creativecommons.org/licenses/by/4.0/).
Share and Cite
Chen, C.-H.; Huang, W.-T.; Tan, T.-H.; Chang, C.-C.; Chang, Y.-J. Using K-Nearest Neighbor Classification to Diagnose Abnormal Lung Sounds. Sensors 2015, 15, 13132-13158. https://doi.org/10.3390/s150613132
Chen C-H, Huang W-T, Tan T-H, Chang C-C, Chang Y-J. Using K-Nearest Neighbor Classification to Diagnose Abnormal Lung Sounds. Sensors. 2015; 15(6):13132-13158. https://doi.org/10.3390/s150613132
Chicago/Turabian StyleChen, Chin-Hsing, Wen-Tzeng Huang, Tan-Hsu Tan, Cheng-Chun Chang, and Yuan-Jen Chang. 2015. "Using K-Nearest Neighbor Classification to Diagnose Abnormal Lung Sounds" Sensors 15, no. 6: 13132-13158. https://doi.org/10.3390/s150613132