Datasets:
Upload 12 files
Browse files- README.md +12 -10
- ac_noise_loud/351790__reiyamanor__small-room-tone-vintage-air-condition-at.wav +3 -0
- ac_noise_low/351790__reiyamanor__small-room-tone-vintage-air-condition-at-15dB.wav +3 -0
- ac_noise_medium/351790__reiyamanor__small-room-tone-vintage-air-condition-at-10dB.wav +3 -0
- ac_noise_minimal/351790__reiyamanor__small-room-tone-vintage-air-condition-at-20dB.wav +3 -0
- convert_to_parquet.py +13 -7
- create_metadata.py +1 -2
- data/train-00000-of-00001.parquet +2 -2
- metadata.csv +4 -3
- tags_labels.csv +4 -2
- test_dataset.py +26 -0
README.md
CHANGED
|
@@ -8,24 +8,26 @@ configs:
|
|
| 8 |
path: data/train-00000-of-00001.parquet
|
| 9 |
---
|
| 10 |
|
| 11 |
-
#
|
| 12 |
|
| 13 |
-
This dataset contains **
|
| 14 |
|
| 15 |
## Dataset Statistics
|
| 16 |
|
| 17 |
-
- **Total Audio Files**:
|
| 18 |
-
- **Total Classes**:
|
| 19 |
- **Format**: WAV (converted to Parquet for Hugging Face Datasets)
|
| 20 |
|
| 21 |
## Classes and Descriptions
|
| 22 |
|
| 23 |
-
The dataset covers the following
|
| 24 |
|
| 25 |
| Label | Description |
|
| 26 |
| :--- | :--- |
|
| 27 |
-
| `
|
| 28 |
-
| `
|
|
|
|
|
|
|
| 29 |
|
| 30 |
## Structure
|
| 31 |
|
|
@@ -35,13 +37,13 @@ A `metadata.csv` file provides the file paths, labels, and descriptions.
|
|
| 35 |
### Columns
|
| 36 |
|
| 37 |
- `audio`: Path to the audio file.
|
| 38 |
-
- `label`: The category label of the
|
| 39 |
-
- `description`: A text description of the
|
| 40 |
|
| 41 |
## Usage
|
| 42 |
|
| 43 |
```python
|
| 44 |
from datasets import load_dataset
|
| 45 |
|
| 46 |
-
ds = load_dataset("sdialog/
|
| 47 |
```
|
|
|
|
| 8 |
path: data/train-00000-of-00001.parquet
|
| 9 |
---
|
| 10 |
|
| 11 |
+
# Foreground Noise Dataset
|
| 12 |
|
| 13 |
+
This dataset contains **4** audio recordings of **4** different foreground noise classes (AC noise variations).
|
| 14 |
|
| 15 |
## Dataset Statistics
|
| 16 |
|
| 17 |
+
- **Total Audio Files**: 4
|
| 18 |
+
- **Total Classes**: 4
|
| 19 |
- **Format**: WAV (converted to Parquet for Hugging Face Datasets)
|
| 20 |
|
| 21 |
## Classes and Descriptions
|
| 22 |
|
| 23 |
+
The dataset covers the following foreground noises:
|
| 24 |
|
| 25 |
| Label | Description |
|
| 26 |
| :--- | :--- |
|
| 27 |
+
| `ac_noise_loud` | Loud AC noise |
|
| 28 |
+
| `ac_noise_low` | Low AC noise |
|
| 29 |
+
| `ac_noise_medium` | Medium AC noise |
|
| 30 |
+
| `ac_noise_minimal` | Minimal AC noise |
|
| 31 |
|
| 32 |
## Structure
|
| 33 |
|
|
|
|
| 37 |
### Columns
|
| 38 |
|
| 39 |
- `audio`: Path to the audio file.
|
| 40 |
+
- `label`: The category label of the foreground noise.
|
| 41 |
+
- `description`: A text description of the foreground noise.
|
| 42 |
|
| 43 |
## Usage
|
| 44 |
|
| 45 |
```python
|
| 46 |
from datasets import load_dataset
|
| 47 |
|
| 48 |
+
ds = load_dataset("sdialog/foreground")
|
| 49 |
```
|
ac_noise_loud/351790__reiyamanor__small-room-tone-vintage-air-condition-at.wav
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:87fd0268b220978cef82ff911f86e372da3c145a63cf3b83bd352b96f7bfee88
|
| 3 |
+
size 40824738
|
ac_noise_low/351790__reiyamanor__small-room-tone-vintage-air-condition-at-15dB.wav
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b05aa59f4c2e0a37e83e04e5b40886e5e560af4d2bc5d14abefd9abc7272a08a
|
| 3 |
+
size 27072114
|
ac_noise_medium/351790__reiyamanor__small-room-tone-vintage-air-condition-at-10dB.wav
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:809378f31f1d0148efb76543b16a26a61c08d2a51505c70cbb99479f41bef3a7
|
| 3 |
+
size 27072114
|
ac_noise_minimal/351790__reiyamanor__small-room-tone-vintage-air-condition-at-20dB.wav
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8a5cc3b5b246476a82c585043d68238e0f8e734418f925d5814284f1cc4ab4b9
|
| 3 |
+
size 27072114
|
convert_to_parquet.py
CHANGED
|
@@ -1,28 +1,32 @@
|
|
| 1 |
-
from datasets import Dataset, Audio, Features, Value, Version
|
| 2 |
import os
|
| 3 |
import csv
|
|
|
|
| 4 |
|
| 5 |
# Point to the current directory
|
| 6 |
dataset_path = os.path.dirname(os.path.abspath(__file__))
|
| 7 |
|
| 8 |
# Dataset metadata
|
| 9 |
VERSION = Version("1.0.0")
|
| 10 |
-
DESCRIPTION = "
|
| 11 |
-
HOMEPAGE = "https://huggingface.co/datasets/sdialog/
|
| 12 |
LICENSE = "CC BY-NC-SA 4.0"
|
| 13 |
|
| 14 |
# Define features
|
| 15 |
features = Features({
|
| 16 |
"audio": Audio(sampling_rate=16000),
|
|
|
|
| 17 |
"label": Value("string"),
|
| 18 |
"description": Value("string"),
|
| 19 |
})
|
| 20 |
|
|
|
|
| 21 |
def dataset_generator():
|
| 22 |
csv_path = os.path.join(dataset_path, "metadata.csv")
|
| 23 |
if not os.path.exists(csv_path):
|
| 24 |
-
raise FileNotFoundError(
|
| 25 |
-
|
|
|
|
|
|
|
| 26 |
with open(csv_path, "r", encoding="utf-8") as f:
|
| 27 |
reader = csv.DictReader(f)
|
| 28 |
for row in reader:
|
|
@@ -30,17 +34,19 @@ def dataset_generator():
|
|
| 30 |
# Ensure the path is absolute for reading
|
| 31 |
# audio_path is relative to the dataset root
|
| 32 |
full_path = os.path.join(dataset_path, audio_path)
|
| 33 |
-
|
| 34 |
# Read audio bytes to ensure embedding
|
| 35 |
with open(full_path, "rb") as audio_file:
|
| 36 |
audio_bytes = audio_file.read()
|
| 37 |
-
|
| 38 |
yield {
|
| 39 |
"audio": {"path": None, "bytes": audio_bytes},
|
|
|
|
| 40 |
"label": row["label"],
|
| 41 |
"description": row["description"]
|
| 42 |
}
|
| 43 |
|
|
|
|
| 44 |
print("Creating dataset from generator (embedding bytes)...")
|
| 45 |
ds = Dataset.from_generator(dataset_generator, features=features)
|
| 46 |
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
import csv
|
| 3 |
+
from datasets import Dataset, Audio, Features, Value, Version
|
| 4 |
|
| 5 |
# Point to the current directory
|
| 6 |
dataset_path = os.path.dirname(os.path.abspath(__file__))
|
| 7 |
|
| 8 |
# Dataset metadata
|
| 9 |
VERSION = Version("1.0.0")
|
| 10 |
+
DESCRIPTION = "Foreground noise dataset."
|
| 11 |
+
HOMEPAGE = "https://huggingface.co/datasets/sdialog/foreground"
|
| 12 |
LICENSE = "CC BY-NC-SA 4.0"
|
| 13 |
|
| 14 |
# Define features
|
| 15 |
features = Features({
|
| 16 |
"audio": Audio(sampling_rate=16000),
|
| 17 |
+
"file_path": Value("string"),
|
| 18 |
"label": Value("string"),
|
| 19 |
"description": Value("string"),
|
| 20 |
})
|
| 21 |
|
| 22 |
+
|
| 23 |
def dataset_generator():
|
| 24 |
csv_path = os.path.join(dataset_path, "metadata.csv")
|
| 25 |
if not os.path.exists(csv_path):
|
| 26 |
+
raise FileNotFoundError(
|
| 27 |
+
f"{csv_path} not found. Run create_metadata.py first."
|
| 28 |
+
)
|
| 29 |
+
|
| 30 |
with open(csv_path, "r", encoding="utf-8") as f:
|
| 31 |
reader = csv.DictReader(f)
|
| 32 |
for row in reader:
|
|
|
|
| 34 |
# Ensure the path is absolute for reading
|
| 35 |
# audio_path is relative to the dataset root
|
| 36 |
full_path = os.path.join(dataset_path, audio_path)
|
| 37 |
+
|
| 38 |
# Read audio bytes to ensure embedding
|
| 39 |
with open(full_path, "rb") as audio_file:
|
| 40 |
audio_bytes = audio_file.read()
|
| 41 |
+
|
| 42 |
yield {
|
| 43 |
"audio": {"path": None, "bytes": audio_bytes},
|
| 44 |
+
"file_path": audio_path,
|
| 45 |
"label": row["label"],
|
| 46 |
"description": row["description"]
|
| 47 |
}
|
| 48 |
|
| 49 |
+
|
| 50 |
print("Creating dataset from generator (embedding bytes)...")
|
| 51 |
ds = Dataset.from_generator(dataset_generator, features=features)
|
| 52 |
|
create_metadata.py
CHANGED
|
@@ -34,8 +34,7 @@ if os.path.exists(train_dir):
|
|
| 34 |
if not os.path.isdir(label_dir) or label.startswith('.'):
|
| 35 |
continue
|
| 36 |
|
| 37 |
-
# Only process directories that are likely audio labels
|
| 38 |
-
# Here we just check if it's not the 'data' output folder or hidden
|
| 39 |
if label == "data":
|
| 40 |
continue
|
| 41 |
|
|
|
|
| 34 |
if not os.path.isdir(label_dir) or label.startswith('.'):
|
| 35 |
continue
|
| 36 |
|
| 37 |
+
# Only process directories that are likely audio labels
|
|
|
|
| 38 |
if label == "data":
|
| 39 |
continue
|
| 40 |
|
data/train-00000-of-00001.parquet
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:15defd1a8836dbf9537a3088741348d75cb4aee1d37d85070bc70bfd237a453a
|
| 3 |
+
size 71949792
|
metadata.csv
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
audio,label,description
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
| 1 |
audio,label,description
|
| 2 |
+
ac_noise_loud/351790__reiyamanor__small-room-tone-vintage-air-condition-at.wav,ac_noise_loud,Loud AC noise
|
| 3 |
+
ac_noise_low/351790__reiyamanor__small-room-tone-vintage-air-condition-at-15dB.wav,ac_noise_low,Low AC noise
|
| 4 |
+
ac_noise_medium/351790__reiyamanor__small-room-tone-vintage-air-condition-at-10dB.wav,ac_noise_medium,Medium AC noise
|
| 5 |
+
ac_noise_minimal/351790__reiyamanor__small-room-tone-vintage-air-condition-at-20dB.wav,ac_noise_minimal,Minimal AC noise
|
tags_labels.csv
CHANGED
|
@@ -1,2 +1,4 @@
|
|
| 1 |
-
|
| 2 |
-
|
|
|
|
|
|
|
|
|
| 1 |
+
ac_noise_loud;Loud AC noise
|
| 2 |
+
ac_noise_low;Low AC noise
|
| 3 |
+
ac_noise_medium;Medium AC noise
|
| 4 |
+
ac_noise_minimal;Minimal AC noise
|
test_dataset.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from datasets import load_dataset
|
| 2 |
+
import os
|
| 3 |
+
|
| 4 |
+
# Point to the parquet file generated
|
| 5 |
+
dataset_path = os.path.join(os.path.dirname(__file__), "data/train-00000-of-00001.parquet")
|
| 6 |
+
|
| 7 |
+
if not os.path.exists(dataset_path):
|
| 8 |
+
print(f"Dataset file not found at {dataset_path}")
|
| 9 |
+
print("Please run convert_to_parquet.py first.")
|
| 10 |
+
exit(1)
|
| 11 |
+
|
| 12 |
+
print(f"Loading foreground dataset from {dataset_path}...")
|
| 13 |
+
ds = load_dataset("parquet", data_files={"train": dataset_path}, split="train")
|
| 14 |
+
|
| 15 |
+
print("\nDataset Info:")
|
| 16 |
+
print(ds)
|
| 17 |
+
|
| 18 |
+
print("\nFeatures:")
|
| 19 |
+
print(ds.features)
|
| 20 |
+
|
| 21 |
+
print("\nFirst Example:")
|
| 22 |
+
item = ds[0]
|
| 23 |
+
print(item)
|
| 24 |
+
|
| 25 |
+
print("\nChecking file_path:")
|
| 26 |
+
print(f"File Path: {item['file_path']}")
|