Skip to content

rishiyama/kanjivg-ML

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kanjivg-ML

Note

These tools are based on the KanjiVG project.

This is an unofficial implementation to generate datasets for Machine learning experiments from the Kanjivg project.

Overview

  • Source Data: KanjiVG (Kanji Vector Graphics)
  • Status: Unofficial, for research/personal use.

Setup

  • python 3.10>=
  • ubuntu

1. Clone the KanjiVG-ML repository:

git clone https://github.com/rishiyama/kanjivg-ML
cd kanjivg-ML

2. Clone the KanjiVG repository and initialize it:

git clone https://github.com/KanjiVG/kanjivg.git
# fix kanjivg/__init__.py to import kanjivg
bash scripts/init.sh 

3. Install any required dependencies:

cairo:

pip install CairoSVG 
apt install libcairo2

Optional:

if you can get the output like this, then you are ready to use the kanjivg and kanjivg-ML package.

$ python example.py 
Is 0x4E00 a kanji? True

Usage

Generate a dataset:

python run.py

and also, you can customize the parameters of png-images, such as width, height, and save directory by using the following command:

# same as default
python run.py --path ./kanjivg/kanji --width 256 --height 256 --save_dir ./output

result

output
|-- kanji
|   |-- png
|   |-- png_white
|   `-- svg
`-- other
    |-- png
    |-- png_white
    `-- svg
  • kanji: contains the kanji images by filtering.
  • other: contains the non-kanji images by filtering.
  • png: contains the kanji images in PNG format with a transparent background.
  • png_white: contains the kanji images in PNG format with a white background.
  • svg: contains the kanji images in SVG format, using simplified SVG paths.

Acknowledgments

This project is heavily reliant on the fantastic work done by the KanjiVG project.

About

scripts for generating machine learning dataset of kanjivg

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors