PEMBERITAHUAN: Kami merilis repositori generasi font beberapa-shot terpadu (clovaai/sewshot-font-generation). Jika Anda tertarik untuk menggunakan implementasi kami, silakan kunjungi repositori terpadu.
Implementasi PyTorch dari banyak kepala lebih baik dari satu: beberapa generasi font-shot dengan beberapa ahli lokal . | kertas
Song Park 1 , Sanghyuk Chun 2, 3 , Junbum Cha 3 , Bado Lee 3 , Hyunjung Shim 1
1 Sekolah Teknologi Terpadu, Universitas Yonsei
2 Naver AI Lab
3 Naver Clova
Metode beberapa shot font generasi (FFG) harus memenuhi dua tujuan: gambar yang dihasilkan harus menjaga struktur global yang mendasari karakter target dan menyajikan gaya referensi lokal yang beragam. Metode FFG yang ada bertujuan untuk memisahkan konten dan gaya baik dengan mengekstraksi gaya representasi universal atau mengekstraksi beberapa representasi gaya komponen-bijaksana. Namun, metode sebelumnya gagal menangkap beragam gaya lokal atau tidak dapat digeneralisasi ke karakter dengan komponen yang tidak terlihat, misalnya, sistem bahasa yang tidak terlihat. Untuk mengurangi masalah, kami mengusulkan metode FFG baru, bernama beberapa ahli lokal beberapa ahli font generasi (MX-Font). MX-Font mengekstrak beberapa fitur gaya tidak secara eksplisit dikondisikan pada label komponen, tetapi secara otomatis oleh beberapa ahli untuk mewakili konsep lokal yang berbeda, misalnya, sub-glish sisi kiri. Karena banyak ahli, MX-Font dapat menangkap beragam konsep lokal dan menunjukkan generalisasi pada bahasa yang tidak terlihat. Selama pelatihan, kami menggunakan label komponen sebagai pengawasan yang lemah untuk memandu setiap ahli untuk berspesialisasi untuk berbagai konsep lokal. Kami merumuskan komponen menetapkan masalah untuk setiap ahli sebagai masalah pencocokan grafik, dan menyelesaikannya dengan algoritma Hongaria. Kami juga menggunakan kerugian independensi dan kerugian permusuhan gaya konten untuk memaksakan pemasukan gaya konten. Dalam eksperimen kami, MX-Font mengungguli metode FFG canggih sebelumnya dalam generasi Cina dan lintas-bahasa, misalnya, Cina ke Korea, generasi.
Anda dapat menemukan lebih banyak proyek terkait pada generasi font beberapa-shot di tautan berikut:
Python> 3.6
Menggunakan conda direkomendasikan: https://docs.anaconda.com/anaconda/install/linux/
pytorch> = 1.5
Untuk menginstal: https://pytorch.org/get-started/locally/
sconf, numpy, scipy, scikit-image, tqdm, jsonlib, fonttools
conda install numpy scipy scikit-image tqdm jsonlib-python3 fonttools
Perhatikan bahwa, kami hanya memberikan contoh file font; bukan file font yang digunakan untuk pelatihan yang disediakan berat (generator.pth) . Contoh file font diunduh dari sini.
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
Proyek ini didistribusikan di bawah lisensi MIT, kecuali modules.py yang diadopsi dari 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.
Proyek ini didasarkan pada Clovaai/Dmfont dan 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)},
}