注意:我们发布了统一的少数字体生成存储库(Clovaai/Lighshot-font Feneration)。如果您有兴趣使用我们的实施,请访问统一存储库。
多个头部的Pytorch实施比一个:与多个本地化专家的少数字体生成要好。 |纸
Song Park 1 ,Sanghyuk Chun 2,3 ,Junbum Cha 3 ,Bado Lee 3 ,Hyunjung Shim 1
1伊桑斯大学综合技术学院
2 NAVER AI实验室
3 Naver Clova
几个弹射字体生成(FFG)方法必须满足两个目标:生成的图像应保留目标特征的基本全局结构,并呈现各种本地参考样式。现有的FFG方法旨在通过提取通用表示样式或提取多个组件样式表示形式来解散内容和样式。但是,以前的方法要么无法捕获多种本地样式,要么不能推广到具有看不见的组件(例如,看不见的语言系统)的角色。为了减轻这些问题,我们提出了一种新颖的FFG方法,称为多个本地化专家,几乎没有字体生成网络(MX-FONT)。 MX-FONT提取多种样式功能,未在组件标签上明确条件,而是由多个专家自动代表不同的本地概念,例如,左侧子字形。由于多个专家,MX-Font可以捕获各种本地概念,并显示出对看不见语言的普遍性。在培训期间,我们利用组件标签作为薄弱的监督,指导每个专家专门针对不同的本地概念。我们将组件分配给每个专家作为图形匹配问题分配问题,并通过匈牙利算法解决。我们还利用独立性损失和内容式的对抗性损失来施加内容式的分离。在我们的实验中,MX-Font在中国一代和语法中的先前最先进的FFG方法,例如中文到韩语,一代。
您可以在以下链接上找到更多相关的项目:
Python> 3.6
建议使用conda:https://docs.anaconda.com/anaconda/install/linux/
pytorch> = 1.5
安装:https://pytorch.org/get-started/locally/
sconf,numpy,scipy,scikit-image,tqdm,jsonlib,fonttools
conda install numpy scipy scikit-image tqdm jsonlib-python3 fonttools
请注意,我们仅提供示例字体文件;不是用于培训的字体文件提供的权重(Generator.pth) 。示例字体文件将从此处下载。
get_chars_from_ttf.py自动生成可用字符文件 # Generating the available characters file
python get_chars_from_ttf.py --root_dir path/to/ttf/dir
- use_ddp: whether to use DataDistributedParallel, for multi-GPUs.
- port: the port for the DataDistributedParallel training.
- work_dir: the directory to save checkpoints, validation images, and the log.
- decomposition: path to the "decomposition rule" file.
- primals: path to the "primals" file.
- dset: (leave blank)
- train: (leave blank)
- data_dir : path to .ttf files for the training
- val: (leave blank)
- data_dir : path to .ttf files for the validation
- source_font : path to .ttf file used as the source font during the validation
python train.py cfgs/train.yaml
* data_dir
|-- font1
|-- char1.png
|-- char2.png
|-- char3.png
|-- font2
|-- char1.png
|-- char2.png
.
.
.
- dset: (leave blank)
- test: (leave blank)
- data_dir: path to reference images
- source_font: path to .ttf file used as the source font during the generation
- gen_chars_file: path to file of the characters to generate. Leave blank if you want to generate all the available characters in the source font.
python eval.py
cfgs/eval.yaml
--weight generator.pth
--result_dir path/to/save/images
该项目是根据MIT许可分发的,除了https://github.com/nvlabs/funit采用的模块。
MX-Font
Copyright (c) 2021-present NAVER Corp.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
该项目基于Clovaai/dmfont和Clovaai/lffont。
@inproceedings{park2021mxfont,
title={Multiple Heads are Better than One: Few-shot Font Generation with Multiple Localized Experts},
author={Park, Song and Chun, Sanghyuk and Cha, Junbum and Lee, Bado and Shim, Hyunjung},
year={2021},
booktitle={International Conference on Computer Vision (ICCV)},
}