greenarcade commited on
Commit
eb296cf
·
verified ·
1 Parent(s): d293a6b

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +122 -0
README.md ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ datasets:
4
+ - DynamicSuperb/Covid19CoughAudioClassification_CoughVid
5
+ language:
6
+ - en
7
+ base_model:
8
+ - google/hear-pytorch
9
+ pipeline_tag: audio-classification
10
+ tags:
11
+ - audio
12
+ - audio-to-output
13
+ - cough
14
+ - medical
15
+ ---
16
+
17
+ # Cough Classification Model
18
+
19
+ This Random Forest model classifies cough audio recordings into three categories: COVID-19, healthy, and symptomatic.
20
+
21
+ ## Model Description
22
+
23
+ - **Model Type:** Random Forest Classifier (scikit-learn implementation)
24
+ - **Features:** Audio features extracted from cough recordings including:
25
+ - Temporal features: RMS energy, zero-crossing rate
26
+ - Spectral features: centroid, bandwidth, contrast, rolloff
27
+ - MFCCs (13 coefficients with means and standard deviations)
28
+ - Chroma features
29
+ - **Classes:** COVID-19, healthy, symptomatic
30
+ - **Training Dataset:** Balanced subset of the COUGHVID dataset
31
+ - **Feature Extraction:** Using librosa for audio processing
32
+
33
+ ## Intended Use
34
+
35
+ This model is intended for research purposes only and should not be used for medical diagnosis. It demonstrates how machine learning can identify patterns in cough audio that might correlate with health status.
36
+
37
+ ## Performance
38
+
39
+ | Class | Precision | Recall | F1-Score | Support |
40
+ |-------|-----------|--------|----------|---------|
41
+ | COVID-19 | 0.82 | 0.75 | 0.78 | 20 |
42
+ | healthy | 0.79 | 0.85 | 0.82 | 20 |
43
+ | symptomatic | 0.70 | 0.70 | 0.70 | 20 |
44
+ | **accuracy** | | | **0.77** | **60** |
45
+ | **macro avg** | 0.77 | 0.77 | 0.77 | 60 |
46
+ | **weighted avg** | 0.77 | 0.77 | 0.77 | 60 |
47
+
48
+ ## Limitations
49
+
50
+ - This model should not be used for medical diagnosis
51
+ - Performance may vary with different audio recording conditions
52
+ - The training data is relatively small and may not represent all populations
53
+ - Audio quality significantly impacts classification accuracy
54
+ - The model does not account for various confounding factors that may affect cough sounds
55
+
56
+ ## Ethical Considerations
57
+
58
+ - Health-related predictions should be treated with caution
59
+ - Users should be informed that this is a research tool, not a diagnostic device
60
+ - Privacy concerns regarding audio recordings should be addressed
61
+
62
+ ## Testing and Benchmarks
63
+
64
+ ### Test Methodology
65
+ - 80/20 train/test split of the balanced dataset
66
+ - StandardScaler applied to normalize features
67
+ - Performance evaluated using classification report and confusion matrix
68
+
69
+ ### Important Features
70
+ Top 5 features identified by the model:
71
+ 1. mfcc1_mean
72
+ 2. spectral_centroid_mean
73
+ 3. rolloff_mean
74
+ 4. mfcc2_mean
75
+ 5. spectral_bandwidth_mean
76
+
77
+ ### Benchmark Results
78
+ The model achieves 77% overall accuracy, with slightly better performance on healthy coughs compared to COVID-19 and symptomatic coughs.
79
+
80
+ ## Usage Example
81
+
82
+ ```python
83
+ import pickle
84
+ from librosa import load
85
+ import pandas as pd
86
+ import numpy as np
87
+
88
+ # Function to extract features (see source code for implementation)
89
+ def extract_all_features(audio_path):
90
+ # Implementation here - refer to original code
91
+ pass
92
+
93
+ # Load model components
94
+ with open('cough_classification_model.pkl', 'rb') as f:
95
+ components = pickle.load(f)
96
+
97
+ model = components['model']
98
+ scaler = components['scaler']
99
+ label_encoder = components['label_encoder']
100
+ feature_names = components['feature_names']
101
+
102
+ # Extract features from a new audio file
103
+ features = extract_all_features('path/to/cough_recording.wav')
104
+
105
+ # Prepare features
106
+ features_df = pd.DataFrame([features])
107
+ features_df = features_df[feature_names]
108
+ features_scaled = scaler.transform(features_df)
109
+
110
+ # Make prediction
111
+ prediction_idx = model.predict(features_scaled)[0]
112
+ prediction = label_encoder.inverse_transform([prediction_idx])[0]
113
+ probabilities = model.predict_proba(features_scaled)[0]
114
+
115
+ print(f"Predicted status: {prediction}")
116
+ print("Class probabilities:")
117
+ for idx, prob in enumerate(probabilities):
118
+ class_name = label_encoder.inverse_transform([idx])[0]
119
+ print(f" {class_name}: {prob:.4f}")
120
+ ```
121
+
122
+