Datasets:
metadata
dataset_info:
features:
- name: image
dtype: image
- name: text
dtype: string
splits:
- name: train
num_bytes: 356575908.28
num_examples: 6315
download_size: 333299098
dataset_size: 356575908.28
configs:
- config_name: default
data_files:
- split: train
path: data/train-*
license: cc-by-sa-3.0
task_categories:
- text-to-image
language:
- en
- ja
tags:
- kanji
pretty_name: Kanji images with textual descriptions
size_categories:
- 1K<n<10K
KanjiVG PNG images with textual descriptions
This dataset is an adaptation of KanjiVG by Ulrich Apel. The original SVG files have been converted to 1024x1024 PNG images and enriched with Kanji descriptions of their meaning.
Usage
>>> import datasets
>>> data = datasets.load_dataset("davidstap/kanji_definitions")
>>> data
DatasetDict({
train: Dataset({
features: ['image', 'text'],
num_rows: 6315
})
})
>>> data['train']
Dataset({
features: ['image', 'text'],
num_rows: 6315
})
>>> data['train']['text'][0]
'bamboo rice basket'
>>> data['train']['image'][0]
<PIL.PngImagePlugin.PngImageFile image mode=RGBA size=1024x1024 at 0x7F1B037E5600>
Note that some kanji characters have multiple meanings, which are separated by commas. You can expand entries to include the same image for each meaning by doing:
>>> new_data = (
... datasets.Dataset.from_dict(
... {
... 'image': [img for img, txt in zip(data['train']['image'], data['train']['text']) for _ in txt.split(',')],
... 'text': [desc.strip() for txt in data['train']['text'] for desc in txt.split(',')]
... }
... )
... )
>>> len(new_data)
16168
Modifications from Original
- Converted SVG files to 1024x1024 PNG format
- Added descriptive text for each Kanji character
- Removed numbering from SVG renders
- Original vector graphics available at: https://github.com/KanjiVG/kanjivg
Attribution
- Original work: KanjiVG by Ulrich Apel
- Original repository: https://github.com/KanjiVG/kanjivg
- Adaptation by: David Stap