注意:我們發布了統一的少數字體生成存儲庫(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}
}