--- license: cc-by-4.0 task_categories: - audio-classification tags: - covid-19 - health - audio - medical-diagnosis - speech - breathing - cough size_categories: - 10K= 1 ) # Separate by COVID status covid_positive = cough_ds.filter( lambda x: x['covid_status'].startswith('positive') ) healthy = cough_ds.filter( lambda x: x['covid_status'] == 'healthy' ) print(f"COVID-19 positive samples: {len(covid_positive)}") print(f"Healthy samples: {len(healthy)}") ``` ### Train Audio Classifier with Wav2Vec2 ```python from datasets import load_dataset from transformers import Wav2Vec2FeatureExtractor, Wav2Vec2ForSequenceClassification # Load breathing recordings ds = load_dataset("szzs1693/coswara-data", "audio") breathing_ds = ds["train"].filter( lambda x: x['audio_type'] == 'breathing-deep' and x['quality_score'] >= 1 ) # Create binary labels (COVID positive vs healthy) def create_labels(example): example['label'] = 1 if example['covid_status'].startswith('positive') else 0 return example breathing_ds = breathing_ds.map(create_labels) # Load pretrained model feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained("facebook/wav2vec2-base") model = Wav2Vec2ForSequenceClassification.from_pretrained( "facebook/wav2vec2-base", num_labels=2 ) # Preprocess audio def preprocess(batch): audio = [x["array"] for x in batch["audio"]] inputs = feature_extractor( audio, sampling_rate=16000, padding=True, return_tensors="pt" ) return inputs # ... continue with training loop ``` ### Multi-Task Learning (All Audio Types) ```python from datasets import load_dataset # Load all audio types audio_ds = load_dataset("szzs1693/coswara-data", "audio") # Filter for high quality train_ds = audio_ds["train"].filter(lambda x: x['quality_score'] >= 1) # Group by participant for multi-task learning from collections import defaultdict participant_data = defaultdict(list) for example in train_ds: participant_data[example['participant_id']].append(example) # Each participant now has up to 9 audio samples print(f"Participants with complete recordings: {sum(1 for v in participant_data.values() if len(v) == 9)}") ``` ### Join Audio with Full Metadata ```python from datasets import load_dataset import pandas as pd # Load both configurations metadata = load_dataset("szzs1693/coswara-data", "metadata") audio = load_dataset("szzs1693/coswara-data", "audio") # Convert to pandas metadata_df = metadata["train"].to_pandas() audio_df = audio["train"].to_pandas() # Join for full metadata access merged = audio_df.merge( metadata_df, left_on='participant_id', right_on='id', how='left', suffixes=('', '_full') ) # Now you have all 36 metadata fields for each audio sample print(f"Merged dataset shape: {merged.shape}") ``` ## Dataset Splits Splits are stratified by `covid_status` to maintain class distribution: - **Train (70%):** 1,922 participants, ~17,298 audio files - **Val (15%):** 412 participants, ~3,708 audio files - **Test (15%):** 412 participants, ~3,708 audio files **Important:** All 9 audio recordings from the same participant are kept in the same split to prevent data leakage. ## Data Collection ### Collection Method - **Platform:** Web-based submission - **Period:** April 13, 2020 - February 24, 2022 - **Participants:** Crowdsourced volunteers (within India and to a smaller extend from outside India) - **Recording Environment:** Uncontrolled (home/personal devices) - **Consent:** All participants provided informed consent ### Quality Control - Manual quality annotation by trained annotators - 3-point scale: 0 (bad), 1 (good), 2 (excellent) - Annotations available for filtering low-quality samples ### Known Limitations 1. **Uncontrolled Recording Environment:** Varying background noise, device quality 2. **Mixed Sample Rates:** Original recordings have variable sample rates (48kHz, 44.1kHz, 16kHz) due to different recording devices; all resampled to 16kHz for consistency 3. **Class Imbalance:** 52% healthy vs 25% COVID-positive 4. **Geographic Bias:** 91.6% from India 5. **Self-Reported Data:** Some metadata fields rely on participant reporting 6. **Temporal Coverage:** Primarily pre-vaccination era (2020) and Delta variant period (2021) 7. **Missing Data:** Some audio files may be NULL due to collection errors (~1-2%) ## Known Data Quality Issues - **Null Audio**: 392/24,714 recordings (1.6%) are null due to: - 2 files missing from source data - 390 files corrupt/unreadable by librosa - **Missing Metadata**: Many participants have incomplete metadata: - test_status: 51.5% missing - vacc: 64.9% missing Users should filter null values when using the dataset: ```python # Filter out null audio ds_clean = ds.filter(lambda x: x['audio'] is not None) # Filter out missing test status ds_tested = ds.filter(lambda x: x['test_status'] is not None) ``` ## Citation If you use this dataset, please cite: ### Original Paper ```bibtex @inproceedings{Sharma_2020, series={interspeech_2020}, title={Coswara — A Database of Breathing, Cough, and Voice Sounds for COVID-19 Diagnosis}, url={http://dx.doi.org/10.21437/Interspeech.2020-2768}, DOI={10.21437/interspeech.2020-2768}, booktitle={Interspeech 2020}, publisher={ISCA}, author={Sharma, Neeraj and Krishnan, Prashant and Kumar, Rohit and Ramoji, Shreyas and Chetupalli, Srikanth Raj and R., Nirmala and Ghosh, Prasanta Kumar and Ganapathy, Sriram}, year={2020}, month=oct, collection={interspeech_2020} } ``` ### Nature Scientific Data Publication ```bibtex @article{bhattacharya2023coswara, title={Coswara: A respiratory sounds and symptoms dataset for remote screening of SARS-CoV-2 infection}, author={Bhattacharya, Debarpan and Sharma, Neeraj Kumar and Dutta, Debottam and Chetupalli, Srikanth Raj and Mote, Pravin and Ganapathy, Sriram and Chandrakiran, C and Nori, Sahiti and Suhail, KK and Gonuguntla, Sadhana and Alagesan, Murali}, url={https://doi.org/10.1038/s41597-023-02266-0} DOI={10.1038/s41597-023-02266-0} journal={Scientific data}, volume={10}, number={1}, pages={397}, year={2023}, publisher={Nature Publishing Group UK London} } ``` ### Links - **Paper (arXiv):** https://arxiv.org/abs/2005.10548 - **Paper (Nature):** https://www.nature.com/articles/s41597-023-02266-0 - **Project Website:** https://coswara.iisc.ac.in/ ## License This dataset is released under the **Creative Commons Attribution 4.0 International (CC BY 4.0) License**. ## Ethical Considerations - All participants provided informed consent for data collection and research use - Participant identifiers are anonymized hash strings - Geographic data is limited to country/state/city level - Researchers should consider geographic and demographic biases when generalizing findings - This dataset is for research purposes only and should not be used for clinical diagnosis without proper validation ## Acknowledgments This dataset was collected and curated by the Indian Institute of Science (IISc) Bangalore. We thank all the volunteers who contributed their recordings to support COVID-19 research.