--- dataset_info: features: - name: qid dtype: uint32 - name: image dtype: image - name: question dtype: string - name: answer dtype: string - name: q_lang dtype: class_label: names: '0': en '1': zh - name: img_id dtype: uint32 - name: location dtype: class_label: names: '0': Abdomen '1': Lung '2': Chest_heart '3': Chest_lung '4': Brain_Tissue '5': Brain_Face '6': Brain '7': Neck '8': Chest_mediastinal '9': Pelvic Cavity - name: modality dtype: class_label: names: '0': MRI '1': CT '2': X-Ray - name: base_type dtype: class_label: names: '0': vqa '1': kvqa - name: answer_type dtype: class_label: names: '0': OPEN '1': CLOSED - name: content_type dtype: class_label: names: '0': Modality '1': Position '2': Organ '3': Size '4': Abnormality '5': Quantity '6': Plane '7': Shape '8': Color '9': KG - name: triple list: string splits: - name: test num_bytes: 215442470 num_examples: 2094 - name: train num_bytes: 1331237033 num_examples: 9835 - name: validation num_bytes: 195808761 num_examples: 2099 download_size: 1324949790 dataset_size: 1742488264 configs: - config_name: default data_files: - split: test path: data/test-* - split: train path: data/train-* - split: validation path: data/validation-* license: cc-by-4.0 task_categories: - visual-question-answering language: - en - zh tags: - medical --- Fork of [BoKelvin/SLAKE](https://huggingface.co/datasets/BoKelvin/SLAKE) converted to: 1. Wrap images as binary object 2. Classify categorical information into class labels ## Metadata | Name | #train | #val | #test | img#train | img#val | img#test | | :---: | :----: | :---: | :---: | :-------: | :-----: | :------: | | SLAKE | 9,835 | 2,099 | 2,094 | 586 | 174 | 180 | ### Conversion script ```py from pathlib import Path from datasets import ClassLabel, Dataset, Features, Image, Sequence, Value SLAKE_FEAT = { "qid": Value("uint32"), "image": Image(decode=True), "question": Value("string"), "answer": Value("string"), "q_lang": ClassLabel(names=["en", "zh"]), "img_id": Value("uint32"), "location": ClassLabel( names=[ "Abdomen", "Lung", "Chest_heart", "Chest_lung", "Brain_Tissue", "Brain_Face", "Brain", "Neck", "Chest_mediastinal", "Pelvic Cavity", ] ), "modality": ClassLabel(names=["MRI", "CT", "X-Ray"]), "base_type": ClassLabel(names=["vqa", "kvqa"]), "answer_type": ClassLabel(names=["OPEN", "CLOSED"]), "content_type": ClassLabel( names=[ "Modality", "Position", "Organ", "Size", "Abnormality", "Quantity", "Plane", "Shape", "Color", "KG", ] ), "triple": Sequence(Value("string")), } def reformat( jsonl_path: Path, upload_to: str | None = None, image_dir: str = "images", ): split = jsonl_path.stem d = Dataset.from_json(jsonl_path.as_posix()) d = d.map( lambda e: { "image": {"path": f"{image_dir}/{e['img_name']}"}, }, num_proc=16, features=Features(SLAKE_FEAT), remove_columns=["img_name"] ) if upload_to: d.push_to_hub(upload_to, split=split) else: print(d) print(d[0]) print(f"Would upload to split={split} on the hub.") ```