통지 : 우리는 통합 소수의 글꼴 생성 저장소 (Clovaai/Fewshot-Font-Generation)를 출시합니다. 구현 사용에 관심이 있으시면 Unified Repository를 방문하십시오.
여러 헤드의 Pytorch 구현은 하나보다 낫습니다 : 여러 지역 전문가와 함께 소수의 글꼴 생성 . | 종이
Song Park 1 , Sanghyuk Chun 2, 3 , Junbum Cha 3 , Bado Lee 3 , Hyunjung Shim 1
1 연성 대학 통합 기술 학교
2 Naver AI Lab
3 Naver Clova
FFG (Foust Font Generation) 방법은 두 가지 목표를 충족시켜야합니다. 생성 된 이미지는 대상 문자의 기본 글로벌 구조를 유지하고 다양한 로컬 참조 스타일을 제시해야합니다. 기존 FFG 방법은 보편적 인 표현 스타일을 추출하거나 여러 구성 요소 별 스타일 표현을 추출하여 컨텐츠와 스타일을 분해하는 것을 목표로합니다. 그러나 이전 방법은 다양한 로컬 스타일을 캡처하지 못하거나 보이지 않는 구성 요소가있는 캐릭터로 일반화 될 수 없습니다. 문제를 완화하기 위해, 우리는 여러 지역화 된 전문가 소수의 글꼴 생성 네트워크 (MX-FONT)라는 새로운 FFG 방법을 제안합니다. MX-Font는 구성 요소 라벨에 명시 적으로 조절되지 않고 여러 전문가가 자동으로 다른 로컬 개념을 나타내는 여러 스타일의 기능을 추출합니다 (예 : 왼쪽 서브 글리프). 여러 전문가로 인해 MX-Font는 다양한 지역 개념을 포착하고 보이지 않는 언어에 대한 일반화 가능성을 보여줄 수 있습니다. 훈련 중에, 우리는 구성 요소 라벨을 약한 감독으로 사용하여 각 전문가가 다른 지역 개념에 대해 전문화되도록 안내합니다. 우리는 구성 요소가 그래프 매칭 문제로 각 전문가에게 문제를 할당하고 헝가리 알고리즘에 의해 문제를 해결합니다. 우리는 또한 내용 스타일의 분리를 부과하기 위해 독립성 손실과 콘텐츠 스타일의 대적 손실을 사용합니다. 우리의 실험에서, MX-FONT는 중국 세대와 교차 언어 (예 : 중국어에서 한국에서 한국의 세대)에서 이전의 최신 FFG 방법을 능가합니다.
다음 링크에서 소수의 글꼴 생성에 대한 더 많은 관련 프로젝트를 찾을 수 있습니다.
파이썬> 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
이 프로젝트는 https://github.com/nvlabs/funit에서 채택 된 Modules.py를 제외하고 MIT 라이센스에 따라 배포됩니다.
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)},
}