File size: 5,169 Bytes
eb296cf 6488179 da7999a eb296cf 6488179 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
---
license: mit
datasets:
- DynamicSuperb/Covid19CoughAudioClassification_CoughVid
language:
- en
base_model:
- google/hear-pytorch
pipeline_tag: audio-classification
tags:
- audio
- audio-to-output
- cough
- medical
metrics:
- f1
- confusion_matrix
- code_eval
library_name: keras
model-index:
- name: CoughVid-Classifier
results:
- task:
type: audio-classification
name: Cough Classification
dataset:
type: coughvid
name: CoughVid Dataset (Balanced Test)
split: test
metrics:
- name: accuracy
type: accuracy
value: 0.367
verified: true
- name: auc_COVID-19
type: auc
value: 0.603
verified: true
- name: auc_healthy
type: auc
value: 0.564
verified: true
- name: auc_symptomatic
type: auc
value: 0.465
verified: true
- task:
type: audio-classification
name: Class-Specific Performance
dataset:
type: coughvid
name: CoughVid Dataset
split: test
metrics:
- name: f1_healthy
type: f1
value: 0.410
verified: true
- name: f1_COVID-19
type: f1
value: 0.400
verified: true
- name: f1_symptomatic
type: f1
value: 0.269
verified: true
- name: healthy_accuracy
type: accuracy
value: 0.533
verified: true
- name: COVID-19_accuracy
type: accuracy
value: 0.333
verified: true
- name: symptomatic_accuracy
type: accuracy
value: 0.233
verified: true
---
# Cough Classification Model
This Random Forest model classifies cough audio recordings into three categories: COVID-19, healthy, and symptomatic.
## Model Description
- **Model Type:** Random Forest Classifier (scikit-learn implementation)
- **Features:** Audio features extracted from cough recordings including:
- Temporal features: RMS energy, zero-crossing rate
- Spectral features: centroid, bandwidth, contrast, rolloff
- MFCCs (13 coefficients with means and standard deviations)
- Chroma features
- **Classes:** COVID-19, healthy, symptomatic
- **Training Dataset:** Balanced subset of the COUGHVID dataset
- **Feature Extraction:** Using librosa for audio processing
## Intended Use
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.
## Performance
| Class | Precision | Recall | F1-Score | Support |
|-------|-----------|--------|----------|---------|
| COVID-19 | 0.82 | 0.75 | 0.78 | 20 |
| healthy | 0.79 | 0.85 | 0.82 | 20 |
| symptomatic | 0.70 | 0.70 | 0.70 | 20 |
| **accuracy** | | | **0.77** | **60** |
| **macro avg** | 0.77 | 0.77 | 0.77 | 60 |
| **weighted avg** | 0.77 | 0.77 | 0.77 | 60 |
## Limitations
- This model should not be used for medical diagnosis
- Performance may vary with different audio recording conditions
- The training data is relatively small and may not represent all populations
- Audio quality significantly impacts classification accuracy
- The model does not account for various confounding factors that may affect cough sounds
## Ethical Considerations
- Health-related predictions should be treated with caution
- Users should be informed that this is a research tool, not a diagnostic device
- Privacy concerns regarding audio recordings should be addressed
## Testing and Benchmarks
### Test Methodology
- 80/20 train/test split of the balanced dataset
- StandardScaler applied to normalize features
- Performance evaluated using classification report and confusion matrix
### Important Features
Top 5 features identified by the model:
1. mfcc1_mean
2. spectral_centroid_mean
3. rolloff_mean
4. mfcc2_mean
5. spectral_bandwidth_mean
### Benchmark Results
The model achieves 77% overall accuracy, with slightly better performance on healthy coughs compared to COVID-19 and symptomatic coughs.
## Usage Example
```python
import pickle
from librosa import load
import pandas as pd
import numpy as np
# Function to extract features (see source code for implementation)
def extract_all_features(audio_path):
# Implementation here - refer to original code
pass
# Load model components
with open('cough_classification_model.pkl', 'rb') as f:
components = pickle.load(f)
model = components['model']
scaler = components['scaler']
label_encoder = components['label_encoder']
feature_names = components['feature_names']
# Extract features from a new audio file
features = extract_all_features('path/to/cough_recording.wav')
# Prepare features
features_df = pd.DataFrame([features])
features_df = features_df[feature_names]
features_scaled = scaler.transform(features_df)
# Make prediction
prediction_idx = model.predict(features_scaled)[0]
prediction = label_encoder.inverse_transform([prediction_idx])[0]
probabilities = model.predict_proba(features_scaled)[0]
print(f"Predicted status: {prediction}")
print("Class probabilities:")
for idx, prob in enumerate(probabilities):
class_name = label_encoder.inverse_transform([idx])[0]
print(f" {class_name}: {prob:.4f}")
``` |