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