| import os
|
| import numpy as np
|
| import datasets
|
|
|
|
|
| _DESCRIPTION = """
|
| VOYA Vietnamese Sign Language (VSL) dataset.
|
| Dataset gồm các chuỗi keypoints đã trích xuất bằng MediaPipe cho nhận dạng ngôn ngữ ký hiệu.
|
| Mỗi sample có shape (60, 1605), lưu trong 'sequences', với nhãn tương ứng trong 'labels'.
|
| """
|
|
|
| _HOMEPAGE = "https://huggingface.co/datasets/Kateht/VOYA_VSL"
|
| _LICENSE = "MIT"
|
| _CITATION = """
|
| @misc{voya_vsl_2025,
|
| author = {Kateht et al.},
|
| title = {VOYA Vietnamese Sign Language Dataset},
|
| year = {2025},
|
| publisher = {Hugging Face},
|
| howpublished = {\\url{https://huggingface.co/datasets/Kateht/VOYA_VSL}}
|
| }
|
| """
|
|
|
|
|
| class VOYAVSLConfig(datasets.BuilderConfig):
|
| def __init__(self, **kwargs):
|
| super().__init__(**kwargs)
|
|
|
|
|
| class VOYAVSL(datasets.GeneratorBasedBuilder):
|
| BUILDER_CONFIGS = [
|
| VOYAVSLConfig(
|
| name="default",
|
| version=datasets.Version("1.0.0"),
|
| description="VOYA Vietnamese Sign Language dataset",
|
| )
|
| ]
|
|
|
| def _info(self):
|
| return datasets.DatasetInfo(
|
| description=_DESCRIPTION,
|
| features=datasets.Features(
|
| {
|
| "sequences": datasets.Array2D(
|
| shape=(60, 1605), dtype="float32"
|
| ),
|
| "labels": datasets.Value("int32"),
|
| }
|
| ),
|
| supervised_keys=("sequences", "labels"),
|
| homepage=_HOMEPAGE,
|
| license=_LICENSE,
|
| citation=_CITATION,
|
| )
|
|
|
| def _split_generators(self, dl_manager):
|
|
|
| data_dir = dl_manager.download_and_extract(
|
| "https://huggingface.co/datasets/Kateht/VOYA_VSL/resolve/main/Merged"
|
| )
|
| return [
|
| datasets.SplitGenerator(
|
| name=datasets.Split.TRAIN,
|
| gen_kwargs={"data_dir": data_dir},
|
| ),
|
| ]
|
|
|
| def _generate_examples(self, data_dir):
|
| idx = 0
|
| for fname in sorted(os.listdir(data_dir)):
|
| if not fname.endswith(".npz"):
|
| continue
|
| fpath = os.path.join(data_dir, fname)
|
| data = np.load(fpath)
|
|
|
| sequences, labels = data["sequences"], data["labels"]
|
| for seq, label in zip(sequences, labels):
|
| yield idx, {
|
| "sequences": seq.astype("float32"),
|
| "labels": int(label),
|
| }
|
| idx += 1
|
|
|