Giter Site home page Giter Site logo

clovaai / lffont Goto Github PK

View Code? Open in Web Editor NEW
147.0 8.0 22.0 56.59 MB

Official PyTorch implementation of LF-Font (Few-shot Font Generation with Localized Style Representations and Factorization) AAAI 2021

License: Other

Python 100.00%
machine-learning deep-learning generative-models font font-generation pytorch lf-font aaai2021

lffont's Introduction

Few-shot Font Generation with Localized Style Representations and Factorization (AAAI 2021)

NOTICE: We release the unified few-shot font generation repository (clovaai/fewshot-font-generation). If you are interested in using our implementation, please visit the unified repository.

Official PyTorch implementation of LF-Font | paper | paper (PAMI extension)

Song Park1*, Sanghyuk Chun2*, Junbum Cha2, Bado Lee2, Hyunjung Shim1
* Equal contribution

1 School of Integrated Technology, Yonsei University
2 Clova AI Research, NAVER Corp.

Automatic few-shot font generation is in high demand because manual designs are expensive and sensitive to the expertise of designers. Existing methods of few-shot font generation aims to learn to disentangle the style and content element from a few reference glyphs and mainly focus on a universal style representation for each font style. However, such approach limits the model in representing diverse local styles, and thus make it unsuitable to the most complicated letter system, e.g., Chinese, whose characters consist of a varying number of components (often called "radical") with a highly complex structure. In this paper, we propose a novel font generation method by learning localized styles, namely component-wise style representations, instead of universal styles. The proposed style representations enable us to synthesize complex local details in text designs. However, learning component-wise styles solely from reference glyphs is infeasible in the few-shot font generation scenario, when a target script has a large number of components, e.g., over 200 for Chinese. To reduce the number of reference glyphs, we simplify component-wise styles by a product of component factor and style factor, inspired by low-rank matrix factorization. Thanks to the combination of strong representation and a compact factorization strategy, our method shows remarkably better few-shot font generation results (with only 8 reference glyph images) than other state-of-the-arts, without utilizing strong locality supervision, e.g., location of each component, skeleton, or strokes.

You can find more related projects on the few-shot font generation at the following links:

Introduction

Pytorch implementation of Few-shot Font Generation with Localized Style Representations and Factorization.


Prerequisites

conda install numpy tqdm lmdb ruamel.yaml jsonlib-python3 msgpack

Usage

Prepare datasets

Build meta file to dump lmdb environment

  • To build a dataset with your own truetype font files (.ttf), a json-format meta file is needed:
    • structure: dict
    • format: {fontname: {"path": path/to/.ttf", "charlist": [chars to dump.]}}
    • example: {"font1": {"path": "./fonts/font1.ttf", "charlist": ["春", "夏", "秋", "冬"]}}

The font file we used as the content font can be accessed here.

Run script

python build_dataset.py \
    --lmdb_path path/to/dump/lmdb \
    --meta_path path/to/meta/file \
    --json_path path/to/save/dict
  • arguments
    • --lmdb_path: path to save lmdb environment.
    • --meta_path: path to meta file of built meta file.
    • --json_path: path to save json file, which contains information of available fonts and characters.
      • saved json file has format like this: {fontname: [saved character list in unicode format]}

Build meta file to train and test

  • train meta (dict, json format)

    • should have keys; "train", "valid", "avail"
    • "train": {font: list of characters} pairs for training, dict
      • key: font name / value: list of chars in the key font.
      • example: {"font1": ["4E00", "4E01"...], "font2": ["4E00", "4E01"...]}
    • "avail": {font: list of characters} pairs which are accessible in lmdb, dict
      • same format with "train"
    • "valid": list of font and list characters for validation, dict
      • should have keys: "seen_fonts", "unseen_fonts", "seen_unis", "unseen_unis"
      • seen fonts(unis) : list of fonts(chars in unicode) in training set.
      • unseen fonts(unis): list of fonts(chars in unicode) not in training set, for validation.
    • An example of train meta file is in meta/train.json.
  • test meta (dict, json format)

    • should have keys; "gen_fonts", "gen_unis", "ref_unis"
    • "gen_fonts": list of fonts to generate.
    • "gen_unis": list of chars to generate, in unicode
    • "ref_unis": list of chars to use as reference chars, in unicode
    • An example of test meta file is in meta/test.json.

Modify the configuration file

We recommend to modify cfgs/custom.yaml rather than cfgs/default.yaml, cfgs/combined.yaml, or cfgs/factorize.yaml.

keys

  • use_half
    • whether to use half tensor. (apex is needed)
  • use_ddp
    • whether to use DataDistributedParallel, for multi-gpus.
  • work_dir
    • the root directory for saved results.
  • data_path
    • path to data lmdb environment.
  • data_meta
    • path to train meta file.
  • content_font
    • the name of font you want to use as source font.
  • other values are hyperparameters for training.

Train

# 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
  • arguments
    • NAME (first argument): name for the experiment.
      • the (checkpoints, validation images, logs) are saved in ./results/(checkpoints, images, logs)/NAME
    • path/to/config (second argument): path to configration file.
      • multiple values are allowed, but their keys should not be repeated.
      • cfgs/combined.yaml : for phase 1 training.
      • cfgs/factorize.yaml: for phase 2 training.
    • --resume (optional) : path to checkpoint to resume.

Test

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
  • arguments
    • path/to/config (first argument): path to configration file.
    • --weight : path to saved weight to test.
    • --img_dir: path to save generated images.
    • --test_meta: path to test meta file.
    • --data_path: path to lmdb dataset which contatins the reference images.

Code license

This project is distributed under MIT license, except modules.py which is adopted from 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.

Acknowledgement

This project is based on clovaai/dmfont.

How to cite

@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}
}

lffont's People

Contributors

8uos avatar beanmilk avatar clovaaiadmin avatar johnson-yue avatar sanghyukchun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lffont's Issues

question about your dataset number?

Hi, good job and thank your sharing, but I have some question about your dataset number?
image

482 chinese fonts, a total of 19,514 characters? avg should be = 19514/482 ~ 40 characters/fonts but why you said is 6654?

Style transfer for a single font

Hi, thanks for this great work! I have implemented this code into a single font style transferring task. That means I only use one content font (6000+ chars) and a style font (500+ chars), and try to generate the rest chars of that style. When I trained the model for phase1, the output is really strange and the generator accuracy is really low (no more than 40%). Could you give some hints? I am looking forward to your reply and further discussions.

Again, it is a fantastic work! Thank you very much!

Frank

KeyError : "XXXX" when valid phase

when I train phase 1 , this error occur in here

I debug it and the local variables self.availds.keys() is ["seen_fonts", "unseen_fonts", "seen_unis", "unseen_unis"]
maybe this is a bug ?

Question about p1dataset.py

CombTestDataset class

def __getitem__(self, index):
        font_name, trg_uni = self.fus[index]
        font_idx = self.fonts.index(font_name)

        style_unis, trg_comp_ids = self.sample_char(font_name, trg_uni)
        style_imgs = torch.stack([self.env_get(self.env, font_name, uni, self.transform) for uni in style_unis])

        font_idx = torch.LongTensor([font_idx])
        trg_dec_uni = torch.LongTensor([self.to_int(trg_uni)])

        content_img = self.env_get(self.env, self.content_font, trg_uni, self.transform)

        ret = (
            font_idx.repeat(len(trg_comp_ids)),
            torch.LongTensor(trg_comp_ids),
            style_imgs,
            font_idx,
            trg_comp_ids,
            trg_dec_uni,
            content_img
        )

I think return value doesn't contain the information of style_comp_ids, only trg_comp_ids
Can I get an explanation about this?

Thank you.

Question about training

Hi, Thank you for your fantastic work! But when training with my dataset, I met a problem.
When training for phase 1, generator doesn't have a emb_block, but in phase 2, generator has a emb_block, so how to load the weight of the phase 1 in the phase 2?

How to use the data produced by the build_dataset.py file during training

Hi, I am very interested in your work, so I would really like to train my own dataset using your network. But I'm having some problems with your network, I made the dataset according to the build_dataset.py file, but the format of the dataset you use in training is not quite the same as this, and I'd like to ask about the exact way to make the training data. Thank you for reading and I look forward to your reply!

about phase 1 training

when i ran train.py(phase 1),i got problem is "env_get = lambda env, x, y, transform: transform(read_data_from_lmdb(env, f'{x}_{y}')['img']) TypeError: 'NoneType' object is not subscriptable" .then i found that the return vaule “data” is None in function "read_data_from"
Looking forward to your help!
error

function

Can not Evaluate!

Hi, I do some test and using my dataset training with some unicodes, and I find if there are some characters that can not be divided into radicals, the evaluate will be failed.

The label number of the chn_decomposed

Would you please tell me whether the chn_decomposed.json is created by yourself? And how can I know the number of the each component of the character? Thanks

How to use pre-trained model

Hi,

Thank you for your fantastic work! It's very helpful.

But when I execute the 'evaluator.py', there are some problems.

  1. I use the command directly:

python evaluator.py
cfgs/factorize.yaml
--weight weight/generator.pth
--img_dir path/to/save/images
--test_meta meta/test.json

error output: lmdb.Error: /path/to/lmdb: No such file or directory

Best regards
GMT

data set

I need you to explain to see fonts, unseen fonts, see characters, unseen characters

KeyError: '71FC'

(base) D:\lffont>python train.py stkb2jingji1 ./cfgs/custom.yaml ./cfgs/combined.yaml
failed to import apex
INFO::08/25 18:03:41 | Run Argv:
> train.py stkb2jingji1 ./cfgs/custom.yaml ./cfgs/combined.yaml
INFO::08/25 18:03:41 | Args:
name            = stkb2jingji1
config_paths    = ['./cfgs/custom.yaml', './cfgs/combined.yaml']
resume          = None
use_unique_name = False
INFO::08/25 18:03:41 | Configs:
use_half: False
half_type: O2
use_ddp: False
port: 7890
phase: comb
overwrite: False
work_dir: result
batch_size: 8
comb_iter: 800000
fact_iter: 50000
seed: 2
g_lr: 0.0002
d_lr: 0.0008
ac_lr: 0.0002
n_workers: 0
adam_betas:
  - 0.0
  - 0.9
init: kaiming
n_comps: 371
n_in_chars: 3
n_each_chars: 3
n_targets: 9
n_shots: 8
content_font: font1
language: chn
data_path: ./data/stkb2jingji
data_meta: ./data/stkb2jingji_train.json
dec_dict: meta/chn_decompose.json
dset_args:
  n_sample_min: 3
  n_sample_max: 5
dset_aug:
  normalize: True
  random_affine: False
cv_n_unis: 30
cv_n_fonts: 10
C: 32
g_args:
  comp_enc:
    norm: in
    activ: relu
    pad_type: zero
    skip_scale_var: False
    sigmoid: True
  emb_block:
    emb_dim: None
  dec:
    norm: IN
    activ: relu
    pad_type: zero
    out: sigmoid
  content_enc:
    C_out: 256
    content_sigmoid: False
    norm: in
d_args:
  w_norm: spectral
  activ: relu
  gap_activ: relu
  pad_type: zero
  res_scale_var: False
ac_args:
  norm: IN
  activ: relu
  pad_type: zero
  conv_dropout: 0.3
  clf_dropout: 0.2
pixel_loss_type: l1
pixel_w: 0.1
gan_w: 1.0
fm_layers: all
fm_w: 1.0
ac_w: 0.1
ac_gen_w: 0.1
dec_const_w: 0.0
save: all-last
print_freq: 1000
val_freq: 10000
save_freq: 10000
tb_freq: 100
unique_name: stkb2jingji1
name: stkb2jingji1
gpu: -1
INFO::08/25 18:03:41 | Unique name: stkb2jingji1
INFO::08/25 18:03:41 | Get dataset ...
INFO::08/25 18:03:41 | Build model ...
INFO::08/25 18:03:42 | Start training ...
Traceback (most recent call last):
  File "D:\lffont\train.py", line 253, in <module>
    main()
  File "D:\lffont\train.py", line 249, in main
    train(args, cfg)
  File "D:\lffont\train.py", line 235, in train
    trainer.train(trn_loader, st_step, cfg[f"{cfg.phase}_iter"])
  File "D:\lffont\trainer\combined_trainer.py", line 54, in train
    for (in_style_ids, in_comp_ids, in_imgs,
  File "D:\lffont\datasets\datautils.py", line 12, in cyclize
    for x in loader:
  File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 652, in __next__
    data = self._next_data()
  File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 692, in _next_data
    data = self._dataset_fetcher.fetch(index)  # may raise StopIteration
  File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data\_utils\fetch.py", line 49, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data\_utils\fetch.py", line 49, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "D:\lffont\datasets\p1dataset.py", line 93, in __getitem__
    trg_unis, trg_comp_ids = self.get_available_combinations(avail_unis, style_comp_ids)
  File "D:\lffont\datasets\p1dataset.py", line 66, in get_available_combinations
    comps = self.decompose_dict[uni]
KeyError: '71FC'

KeyError:'test'

I build the train.json as ReadMe said.
train.json has no "test" in keywords , only have ("train", "valid", "avail")

this error occur in uniform_sample function

Maybe this is "valid" keyword ??

IndexError: list index out of range

INFO::08/25 20:17:59 | Validation at Epoch = 0.323
Traceback (most recent call last):
  File "D:\lffont\train.py", line 253, in <module>
    main()
  File "D:\lffont\train.py", line 249, in main
    train(args, cfg)
  File "D:\lffont\train.py", line 235, in train
    trainer.train(trn_loader, st_step, cfg[f"{cfg.phase}_iter"])
  File "D:\lffont\trainer\combined_trainer.py", line 173, in train
    self.evaluator.cp_validation(self.gen_ema, self.cv_loaders, self.step, phase="comb",
  File "D:\lffont\evaluator.py", line 44, in cp_validation
    self.comparable_val_saveimg(gen, loader, step, tag=f"comparable_{tag}_{ext_tag}",
  File "C:\ProgramData\Anaconda3\lib\site-packages\torch\autograd\grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "D:\lffont\evaluator.py", line 19, in decorated
    ret = val_fn(self, gen, *args, **kwargs)
  File "D:\lffont\evaluator.py", line 50, in comparable_val_saveimg
    compare_batches = self.infer_loader(gen, loader, phase=phase, reduction=reduction)
  File "C:\ProgramData\Anaconda3\lib\site-packages\torch\autograd\grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "D:\lffont\evaluator.py", line 19, in decorated
    ret = val_fn(self, gen, *args, **kwargs)
  File "D:\lffont\evaluator.py", line 60, in infer_loader
    for i, (in_style_ids, in_comp_ids, in_imgs, trg_style_ids, trg_comp_ids,
  File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 652, in __next__
    data = self._next_data()
  File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 692, in _next_data
    data = self._dataset_fetcher.fetch(index)  # may raise StopIteration
  File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data\_utils\fetch.py", line 49, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data\_utils\fetch.py", line 49, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "D:\lffont\datasets\p1dataset.py", line 197, in __getitem__
    style_unis, trg_comp_ids = self.sample_char(font_name, trg_uni)
  File "D:\lffont\datasets\p1dataset.py", line 186, in sample_char
    style_uni = random.choice(avail_style_uni)
  File "C:\ProgramData\Anaconda3\lib\random.py", line 346, in choice
    return seq[self._randbelow(len(seq))]
IndexError: list index out of range

Is it right to get such result with two fonts input?

Hi , I using two font for testing the pretrained weight there are 8 characters every font, you can download and test it。
C2232_攀_256
C2366_晴_256
C3639_癜_256
C3844_碱_256
C4775_荷_256
C5810_郗_256
C6265_霄_256
C2088_捐_256
and other font is
C3844_碱_256
C4775_荷_256
C5810_郗_256
C6265_霄_256
C2088_捐_256
C2232_攀_256
C2366_晴_256
C3639_癜_256

I got the result for font1 is:
font1_gen

Would you plz try with two font testing ???
I want to know whether I make some problem or not about phase test ?

Question about korean generator

In the paper, there are no details about korean generator; the number of sample fonts, and the number of seen/unseen characters.
I'm just curious about training details of korean.

During training, the model stops at "Start training..."

gpu: -1
INFO::07/07 13:42:05 | Unique name: NAME_phase1
INFO::07/07 13:42:05 | Get dataset ...
INFO::07/07 13:42:05 | Build model ...
INFO::07/07 13:42:14 | Start training ...

During training, the model stops at "Start training..."

how to test model with pretrained weight

Hi, I see there is pertrained weight in weight/, and I run the code like the ReadMe
image

But has error:

lmdb.Error: /path/to/lmdb : No such file or directory

because it find lmdb by defaults.yaml , and I did not modify it.

If I want to test pretrained weight, :

  1. I should write test.json first
  2. then make the lmdb file for test.json
  3. modify the data_path and data_meta in cfgs/defaults.yaml

?? Am I right?

As my opinion, if I want to test the generator it must be need content_font, so the it must be in test_lmdb file when Step2 (make it).

Pre-trained model for Korean fonts generation

I wonder whether you used another pre-trained model to produce Korean fonts for Figure 11 or you just used the uploaded pre-trained for the Korean fonts as well.

If you have a Korean-specific trained model, may I ask you to share it?

Question about the classfiers for calculating FID ACC(S) and ACC(C)

Hi, thanks for the nice work! I have few questions about the evaluation classifiers while reading the paper. In your paper, you trained “style-aware (S) and content-aware (C) classifiers”. I'm curious about how they have been trained.

Are they trained on both the seen and unseen fonts? If so, what are the training samples? Are all samples from training and testing datasets used to train the classifiers? And what architecture you were using for these classifiers?

Again, LFFont is a great work. Thanks a lot for your time.

James

Did you consider using edge information?

Hi, I test the model, it is good。 And I have some question about the framework:

  1. some generated image is blur and stroke is break, why did you not trying edge information for better performance?
  2. the generated image is smaller then input image, why?

I have a question about phase2

Hi, in phase2, there is a function named check_and_sample, the trg_fonts is random choiced, and it's stype don't match to the in_fonts. Isn't it a bug?Thank you.
for example:
/media/chengls/Elements/lffont/images/in_img_3.jpg
/media/chengls/Elements/lffont/images/content_img_7.jpg
/media/chengls/Elements/lffont/images/trg_img_7.jpg
they are in_img、content_img and trg_img, but the style of trg_img is different from in_img.

data set

Hello, I have the following questions:

  1. Does your model train multiple fonts at one time?
  2. Is the dataset.json file in the example to generate train.json and test.json
  3. Does the valid field in train.json represent the validation set? Why are there seen_fonts, seen_units, unseen_fonts, unseen_units? Among them, is unseen_fonts a type of font that has not been seen during training? If so, how does the model generate characters in font classes it has not seen before at evaluation time?
  4. https://github.com/clovaai/fewshot-font-generation This preparation data set is much simpler than LF-font, is there any difference

It failed when train phase2

ret_targets=False,

Hi, when I trained phase1 , I am so happy to look this performance. and then I will train phase2, it have same bug during evaluate....

the bug is :

lffont/evaluator.py

Lines 56 to 73 in 2e45e91

def infer_loader(self, gen, loader, phase, reduction="mean"):
outs = []
trgs = []
for i, (in_style_ids, in_comp_ids, in_imgs, trg_style_ids, trg_comp_ids,
trg_unis, content_imgs, trg_imgs) in enumerate(loader):
if self.use_half:
in_imgs = in_imgs.half()
content_imgs = content_imgs.half()
out = gen.infer(in_style_ids, in_comp_ids, in_imgs, trg_style_ids, trg_comp_ids,
content_imgs, phase, reduction=reduction)
outs.append(out.detach().cpu())
trgs.append(trg_imgs.detach().cpu())
return torch.cat(outs).float(), torch.cat(trgs).float()
this function always parser the loader into 8 elements. like
(in_style_ids, in_comp_ids, in_imgs, trg_style_ids, trg_comp_ids, trg_unis, content_imgs, trg_imgs)

But, when phase2 evaluate, the FactTestDataset() function only return 7 elements ,like :

ret = (torch.LongTensor(in_style_ids),
               [*map(torch.LongTensor, in_comp_ids)],
               torch.cat(in_imgs),
               torch.LongTensor(trg_style_id),
               torch.LongTensor(trg_comp_ids),
               torch.LongTensor(trg_dec_uni),
               content_img
        )

the ret_targets is False it was be set here , so it only return 7 elements and the program is crashed!!! at infer_loader() function

数据集

您好,我大致看了一下您的论文,对于数据集部分有些疑问,需要您对seen fonts,unseen fonts,seen characters,unseen characters进行一下解释。尤其是unseen fonts,训练中没有出现的字体种类,测试时可以生成该种类字体吗

I have three questions about the training details

Hi, I'm so appreciate of your work. And I have three questions about the training details.
question one: when train the phase1 model, how choose training fonts to benefit to the convergence of the model ?
question two: first train the phase1 model, then initialize phase1, train the phase2 model, the technological process is right?
question three: almost training fonts don't include 371 components,whether need to update components json?
thank you .

lmdb_path

您好!请教您一些问题:
1.lmdb_path文件下保存的.mdb文件是包括训练集和测试集的所有数据吗?
2.readme里面叙述的train meta下的"avail"数据应该是什么?我没有理解"avail",您可以解释一下吗。
3.您是如何拆分部件的,依据的标准是什么?
期待您的回复,谢谢!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.