import datasets from datasets.tasks import ImageClassification import os _CITATION = """\ @misc{https://doi.org/10.48550/arxiv.2301.11932, doi = {10.48550/ARXIV.2301.11932}, url = {https://arxiv.org/abs/2301.11932}, author = {Al-Barham, Muhammad and Alsharkawi, Adham and Al-Yaman, Musa and Al-Fetyani, Mohammad and Elnagar, Ashraf and SaAleek, Ahmad Abu and Al-Odat, Mohammad}, keywords = {Computer Vision and Pattern Recognition (cs.CV), FOS: Computer and information sciences, FOS: Computer and information sciences}, title = {RGB Arabic Alphabets Sign Language Dataset}, publisher = {arXiv}, year = {2023}, copyright = {Creative Commons Attribution 4.0 International} } """ _DESCRIPTION = "RGB Arabic Alphabet Sign Language (AASL) dataset comprises 7,857 raw and fully labelled RGB images of the Arabic sign language alphabets, which to our best knowledge is the first publicly available RGB dataset. The dataset is aimed to help those interested in developing real-life Arabic sign language classification models. AASL was collected from more than 200 participants and with different settings such as lighting, background, image orientation, image size, and image resolution. Experts in the field supervised, validated and filtered the collected images to ensure a high-quality dataset." _URL = "https://huggingface.co/datasets/pain/AASL/resolve/main/images.zip" _HOMEPAGE = "https://www.kaggle.com/datasets/muhammadalbrham/rgb-arabic-alphabets-sign-language-dataset" _LICENSE = "CC BY-SA 4.0" class AASL(datasets.GeneratorBasedBuilder): def _info(self): return datasets.DatasetInfo( description=_DESCRIPTION, features=datasets.Features( { "image": datasets.Image(), "label": datasets.features.ClassLabel(names=['Ain','Al','Alef','Beh','Dad','Dal','Feh','Ghain','Hah','Heh','Jeem','Kaf','Khah','Laa','Lam','Meem','Noon','Qaf','Reh','Sad','Seen','Sheen','Tah','Teh','Teh_Marbuta','Theh','Waw','Yeh','Zah','Zain']) } ), supervised_keys=("image", "label"), homepage=_HOMEPAGE, citation=_CITATION, task_templates=[ ImageClassification( image_column="image", label_column="label" ) ], license=_LICENSE ) def _split_generators(self, dl_manager): images_path = dl_manager.download_and_extract(_URL) print("print(images_path)") print(images_path) return [datasets.SplitGenerator( name=datasets.Split.TRAIN, gen_kwargs={"images":dl_manager.iter_files([images_path])} )] def _generate_examples(self, images): x = len(list(images)) print("Length") print(x) print(images) for file_path, file_obj in images: if file_path.startswith("images/"): yield file_path, { "image": {"path": file_path, "bytes": file_obj.read()}, "label": 'x', }