MCPcopy Index your code
hub / github.com/ecnuycxie/DG-Font

github.com/ecnuycxie/DG-Font @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
158 symbols 365 edges 30 files 20 documented · 13%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

DG-Font: Deformable Generative Networks for Unsupervised Font Generation

The source code for 'DG-Font: Deformable Generative Networks for Unsupervised Font Generation', by Yangchen Xie, Xinyuan Chen, Li sun and Yue lu. The paper was accepted by CVPR2021.

Arvix version

Note

Note that the current repo only works with 80x80 resolution images. An improved version of DGFont, DGFont++, is coming soon, which will also fit 128x128 and 256x256 resolution images.

Gallery

image image

Dependencies

Libarary

pytorch (>=1.0)
tqdm  
numpy
opencv-python  
scipy  
sklearn
matplotlib  
pillow  
tensorboardX

DCN

please refer to https://github.com/chengdazhi/Deformable-Convolution-V2-PyTorch/tree/pytorch_1.0.0 to install the dependencies of deformable convolution.

Dataset

方正字库 provides free font download for non-commercial users.

Example directory hierarchy

Project
|--- DG-Font
|          |--- font2img.py    
|          |--- main.py
|          |--- train
|                 |--- train.py
|
|--- data
       |--- font1
       |--- font2
             |--- 0000.png
             |--- 0001.png
             |--- ...
       |--- ...

How to run

prepare dataset

python font2img.py --ttf_path ttf_folder --chara character.txt --save_path save_folder --img_size 80 --chara_size CHARACTERSIZE

train

python main.py --gpu GPU_ID --img_size 80 --data_path /path/to --output_k CLASS_NUM --batch_size BATCHSIZE --val_num TEST_IMGS_NUM_FOR_EACH_CLASS

test

python main.py --gpu GPU_ID --img_size 80 --data_path /path/to --output_k CLASS_NUM --batch_size BATCHSIZE --validation --load_model $DIR_TO_LOAD

Acknowledgements

We would like to thank Johnson yue and 上海驿创信息技术有限公司 for their advices in code. Our code is based on TUNIT.

Bibtex

@inproceedings{DG-Font,
    title={DG-Font: Deformable Generative Networks for Unsupervised Font Generation},
    author={Yangchen Xie, Xinyuan Chen, Li sun, Yue lu},
    booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition},
    year={2021}
}

Core symbols most depended-on inside this repo

update
called by 9
tools/utils.py
add_logs
called by 8
tools/utils.py
makedirs
called by 6
tools/utils.py
decode
called by 6
models/generator.py
calc_adv_loss
called by 4
tools/ops.py
backward
called by 4
functions/modulated_deform_conv_func.py
moco
called by 4
models/guidingNet.py
average_gradients
called by 3
tools/ops.py

Shape

Method 73
Function 58
Class 27

Languages

Python92%
C++8%

Modules by API surface

models/blocks.py24 symbols
datasets/custom_dataset.py21 symbols
models/generator.py18 symbols
models/inception.py16 symbols
tools/ops.py13 symbols
tools/utils.py12 symbols
modules/modulated_deform_conv.py8 symbols
main.py8 symbols
models/guidingNet.py7 symbols
models/discriminator.py6 symbols
datasets/datasetgetter.py4 symbols
functions/modulated_deform_conv_func.py3 symbols

For agents

$ claude mcp add DG-Font \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact