Datasets:
Dataset Viewer
The dataset viewer is not available for this dataset.
Unexpected token '<', "<html>
<h"... is not valid JSON
Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
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
- Downloads last month
- 16