AVISO: Lanzamos el repositorio de generación de fuentes de pocos disparos unificados (Generación de Clovaai/Pe Setshot-Font). Si está interesado en usar nuestra implementación, visite el repositorio unificado.
La implementación de Pytorch de múltiples cabezas es mejor que una: generación de fuentes de pocos disparos con múltiples expertos localizados . | papel
Song Park 1 , Sanghyuk Chun 2, 3 , Junbum Cha 3 , Bado Lee 3 , Hyunjung Shim 1
1 Escuela de Tecnología Integrada, Universidad de Yonsei
2 Laboratorio de AI de Naver
3 Naver Clova
Un método de generación de fuentes de pocos disparos (FFG) tiene que satisfacer dos objetivos: las imágenes generadas deben preservar la estructura global subyacente del carácter objetivo y presentar el estilo de referencia local diverso. Los métodos de FFG existentes tienen como objetivo desenredar el contenido y el estilo extrayendo un estilo de representación universal o extrayendo múltiples representaciones de estilo de componentes. Sin embargo, los métodos anteriores no logran capturar diversos estilos locales o no pueden generalizarse a un personaje con componentes invisibles, por ejemplo, sistemas de lenguaje invisibles. Para mitigar los problemas, proponemos un método FFG novedoso, llamado múltiples expertos localizados de la red de generación de fuentes de pocos disparos (MX-FONT). MX-FONT extrae múltiples características de estilo no acondicionadas explícitamente en las etiquetas de los componentes, pero automáticamente por múltiples expertos representa diferentes conceptos locales, por ejemplo, subglifo del lado izquierdo. Debido a los múltiples expertos, MX-Font puede capturar diversos conceptos locales y mostrar la generalización a los idiomas invisibles. Durante la capacitación, utilizamos etiquetas de componentes como supervisión débil para guiar a cada experto a ser especializado para diferentes conceptos locales. Formulamos el problema de asignación del componente a cada experto como problema de coincidencia de gráficos, y lo resolvemos mediante el algoritmo húngaro. También empleamos la pérdida de independencia y la pérdida adversa al estilo de contenido para imponer el desenredado al estilo de contenido. En nuestros experimentos, MX-font supera a los métodos de FFG de última generación en la generación china y en la generación interlingüística, por ejemplo, chino a coreano.
Puede encontrar más proyectos relacionados en la generación de fuentes de pocos disparos en los siguientes enlaces:
Python> 3.6
Se recomienda usar conda: https://docs.anaconda.com/anaconda/install/linux/
pytorch> = 1.5
Para instalar: https://pytorch.org/get-started/locally/
Sconf, Numpy, Scipy, Scikit-Image, TQDM, Jsonlib, FontTools
conda install numpy scipy scikit-image tqdm jsonlib-python3 fonttools
Tenga en cuenta que solo proporcionamos los archivos de fuentes de ejemplo; No los archivos de fuentes utilizados para la capacitación del peso proporcionado (generador.pth) . Los archivos de fuentes de ejemplo se descargan desde aquí.
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
Este proyecto se distribuye bajo la licencia MIT, excepto Modules.py que se adopta de 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.
Este proyecto se basa en Clovaai/DMFont y 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)},
}