注意:我们发布了统一的少数字体生成存储库(Clovaai/Lighshot-font Feneration)。如果您有兴趣使用我们的实施,请访问统一存储库。
LF-FONT的官方Pytorch实施|纸|纸(PAMI扩展)
Song Park 1* ,Sanghyuk Chun 2* ,Junbum Cha 2 ,Bado Lee 2 ,Hyunjung Shim 1
*同等的贡献
1伊桑斯大学综合技术学院
2 Clova AI研究,Naver Corp.
自动发射字体生成的需求很高,因为手动设计对设计师的专业知识昂贵且敏感。现有的少量字体生成的方法旨在学习将样式和内容元素从几个参考字形中解散,并主要关注每种字体样式的通用样式表示。但是,这种方法限制了模型代表多种本地样式,因此使其不适合最复杂的字母系统,例如中文,其字符由具有高度复杂结构的各种组件(通常称为“激进”)组成。在本文中,我们通过学习局部样式(即组件样式表示)而不是通用样式提出了一种新颖的字体生成方法。提出的样式表示使我们能够在文本设计中综合复杂的本地细节。但是,仅从参考字形的学习组件样式就在几种字体生成的情况下是不可行的,当目标脚本具有大量的组件,例如,中文超过200个。为了减少参考字形的数量,我们以低级别矩阵分数的启发来简化组件因子和样式因子的乘积来简化组件样式。由于强大的表示和紧凑的分解策略的结合,我们的方法比其他最先进的方法显示出比其他最先进的局部先进的字体生成结果(仅具有8个参考文字图像),而无需使用强大的局部性监督,例如,每个组件的位置,骨架或笔触。
您可以在以下链接上找到更多相关的项目:
Pytorch实现了具有本地化样式表示和分解的几击字体生成。
Python> 3.6
建议使用conda:https://docs.anaconda.com/anaconda/install/linux/
pytorch> = 1.1 (建议:1.1)
安装:https://pytorch.org/get-started/locally/
斯科夫
安装:https://github.com/khanrc/sconf
Numpy,TQDM,LMDB,YAML,JSONLIB,MSGPACK
conda install numpy tqdm lmdb ruamel.yaml jsonlib-python3 msgpack
我们用作内容字体的字体文件可以在此处访问。
python build_dataset.py
--lmdb_path path/to/dump/lmdb
--meta_path path/to/meta/file
--json_path path/to/save/dict
火车元( dict,json格式)
meta/train.json中。测试元( dict,json格式)
meta/test.json中。我们建议修改cfgs/custom.yaml而不是cfgs/default.yaml , cfgs/combined.yaml或cfgs/factorize.yaml 。
钥匙
# Phase 1 training
python train.py
NAME_phase1
cfgs/custom.yaml cfgs/combined.yaml
# Phase 2 training
python train.py
NAME_phase2
cfgs/custom.yaml cfgs/factorize.yaml
--resume ./result/checkpoints/NAME_phase1/800000-NAME_phase1.pth
python evaluator.py
cfgs/factorize.yaml
--weight weight/generator.pth
--img_dir path/to/save/images
--test_meta meta/test.json
--data_path path/to/data
该项目是根据MIT许可分发的,除了https://github.com/nvlabs/funit采用的模块。
LF-Font
Copyright (c) 2020-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。
@inproceedings{park2021lffont,
title={Few-shot Font Generation with Localized Style Representations and Factorization},
author={Park, Song and Chun, Sanghyuk and Cha, Junbum and Lee, Bado and Shim, Hyunjung},
year={2021},
booktitle={AAAI Conference on Artificial Intelligence},
}
@article{park2022lffont_extension,
author={Park, Song and Chun, Sanghyuk and Cha, Junbum and Lee, Bado and Shim, Hyunjung},
journal = {IEEE Transactions on Pattern Analysis & Machine Intelligence},
title = {Few-shot Font Generation with Weakly Supervised Localized Representations},
year = {5555},
volume = {},
number = {01},
issn = {1939-3539},
pages = {1-17},
keywords = {},
doi = {10.1109/TPAMI.2022.3196675},
publisher = {IEEE Computer Society},
address = {Los Alamitos, CA, USA},
month = {aug}
}