Git Product home page Git Product logo

font_translator_gan's People

Contributors

ligoudaner377 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

Watchers

 avatar  avatar  avatar  avatar  avatar

font_translator_gan's Issues

error when I run evaluate.sh

Hello again,

I trained and tested with my own dataset and when I execute evaluate.sh I get the following error:

loading the model from evaluator/checkpoints/latest_content_resnet.pth
Traceback (most recent call last):
File "evaluate.py", line 17, in
evaluator = Evaluator(opt, num_classes=training_data.num_classes, text2label=training_data.text2label)
File "/home/manhvela/Desktop/greek_model/font_translator_gan/evaluator/evaluator.py", line 21, in init
self.criterionFID = FID(opt.evaluate_mode, num_classes, gpu_ids=opt.gpu_ids)
File "/home/manhvela/Desktop/greek_model/font_translator_gan/evaluator/fid.py", line 8, in init
self.classifier = Classifier(mode, num_classes, gpu_ids=gpu_ids, isTrain=False)
File "/home/manhvela/Desktop/greek_model/font_translator_gan/evaluator/classifier.py", line 31, in init
self.load_networks('latest')
File "/home/manhvela/Desktop/greek_model/font_translator_gan/evaluator/classifier.py", line 87, in load_networks
net.load_state_dict(state_dict)
File "/home/manhvela/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1482, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for ResNet:
size mismatch for fc.weight: copying a param with shape torch.Size([1074, 2048]) from checkpoint, the shape in current model is torch.Size([118, 2048]).
size mismatch for fc.bias: copying a param with shape torch.Size([1074]) from checkpoint, the shape in current model is torch.Size([118]).

How could I fix this?

Training for unknown contents

Hi Ligoudaner,
I want to transfer styles of unknown contents in japanese.
Could you please give me the guideline for training?
Thank you!

where can I get the font_file ?

Hey,
Great work!
I wanted to train your model for Japanese language. I would require a font_file as mentioned in your font2image.ipynb notebook.
Where can I find one?

Would really appreciate a quick response!
Thanks

Some problems encountered with font_file!

I want to make a large Japanese data set for training, but I encountered some problems while making it.

1、I got a lot of free ttf and otf files from two websites and successfully made them into png format images in windows.(https://www.freejapanesefont.com/ and https://fontmeme.com/ziti/gonta-kana-font/
When I put these successfully produced data sets into the Ubuntu system for training, I found that the names of these images were garbled. What is happening? How should I handle this?

2、So I took the collected ttf or otf files to the ubuntu system to make a data set, but it failed. Here are some tips for failure.
(ZenOldMincho-Medium.ttf failed!!!!!!!!!!!!!!!!!!
ZenOldMincho-Regular.ttf failed!!!!!!!!!!!!!!!!!!
ZenOldMincho-SemiBold.ttf failed!!!!!!!!!!!!!!!!!!
ZeroGothic.otf failed!!!!!!!!!!!!!!!!!!
偊傞杰乕.ttf failed!!!!!!!!!!!!!!!!!!
偊傞杰乕P.ttf failed!!!!!!!!!!!!!!!!!!
偼lateral偧唔僼only忞僩.ttf failed!!!!!!!!!!!!!!!!!!
剉偔偔杰偆偋勫偲.ttf failed!!!!!!!!!!!!!!!!!!
剉偔偔杰偆偋偲嵶.ttf failed!!!!!!!!!!!!!!!!!!
剉偔偔杰偆偋勁偲暍3.ttf failed!!!!!!!!!!!!!!!!!!
卒偐狠姧嫫-P.otf failed!!!!!!!!!!!!!!!!!!
PS.otf failed!!!!!!!!!!!!!!!!!!
卒偐狠姧嫫.otf failed!!!!!!!!!!!!!!!!!!
备偢 jun媞娤 N [M].ttf failed!!!!!!!!!!!!!!!!!!
)

How can I effectively solve these problems?Can the project be trained on Windows?

this performance is from L1loss ?

hi, thank your share the code. I have an question about loss

did you analysis loss importance for w & w/o L1 loss ?

the result is for blur , if w/o gan loss , the performance maybe the same ?

discriminator

Hello, can the discriminator use SNpatch? Is it as good as patch

Error Invalid device id

Hello, thanks for putting up this repo,

After following the instructions from the readme I'm getting this invalid device id error. But my torch with gpu does work

>>> import torch
>>> torch.cuda.current_device()
0
>>> 

I think there is some option for multiple GPUs which I'm not able to find

+ python train.py --dataroot ./datasets/font --model font_translator_gan --name test_new_dataset --no_dropout
----------------- Options ---------------
               batch_size: 256                           
                    beta1: 0.5                           
          checkpoints_dir: ./checkpoints                 
           continue_train: False                         
                 dataroot: ./datasets/font                      [default: None]
             dataset_mode: font                          
                direction: english2chinese               
                    dis_2: True                          
              display_env: main                          
             display_freq: 51200                         
               display_id: 1                             
            display_ncols: 10                            
             display_port: 8097                          
           display_server: http://localhost              
          display_winsize: 64                            
                    epoch: latest                        
              epoch_count: 1                             
                 gan_mode: hinge                         
                  gpu_ids: 0,1                           
                init_gain: 0.02                          
                init_type: normal                        
                  isTrain: True                                 [default: None]
                lambda_L1: 100.0                         
           lambda_content: 1.0                           
             lambda_style: 1.0                           
                load_iter: 0                                    [default: 0]
                load_size: 64                            
                       lr: 0.0002                        
           lr_decay_iters: 50                            
                lr_policy: linear                        
         max_dataset_size: inf                           
                    model: font_translator_gan           
                 n_epochs: 10                            
           n_epochs_decay: 10                            
               n_layers_D: 3                             
                     name: test_new_dataset                     [default: experiment_name]
                      ndf: 64                            
                     netD: basic_64                      
                     netG: FTGAN_MLAN                    
                      ngf: 64                            
               no_dropout: True                                 [default: False]
                  no_html: False                         
                     norm: batch                         
              num_threads: 4                             
                    phase: train                         
                pool_size: 0                             
               print_freq: 51200                         
             save_by_iter: False                         
          save_epoch_freq: 5                             
         save_latest_freq: 5000000                       
            style_channel: 6                             
                   suffix:                               
         update_html_freq: 51200                         
        use_spectral_norm: True                          
                  verbose: False                         
----------------- End -------------------
dataset [FontDataset] was created
The number of training images = 753637
gpuids [0, 1]
Traceback (most recent call last):
  File "train.py", line 14, in <module>
    model = create_model(opt)      # create a model given opt.model and other options
  File "/mnt/hdd2/Documents/font_translator_gan/models/__init__.py", line 65, in create_model
    instance = model(opt)
  File "/mnt/hdd2/Documents/font_translator_gan/models/font_translator_gan_model.py", line 43, in __init__
    not opt.no_dropout, opt.init_type, opt.init_gain, self.gpu_ids)
  File "/mnt/hdd2/Documents/font_translator_gan/models/networks.py", line 184, in define_G
    return init_net(net, init_type, init_gain, gpu_ids)
  File "/mnt/hdd2/Documents/font_translator_gan/models/networks.py", line 125, in init_net
    net = torch.nn.DataParallel(net, gpu_ids)  # multi-GPUs
  File "/home/bread/anaconda3/envs/p37/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 142, in __init__
    _check_balance(self.device_ids)
  File "/home/bread/anaconda3/envs/p37/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 23, in _check_balance
    dev_props = _get_devices_properties(device_ids)
  File "/home/bread/anaconda3/envs/p37/lib/python3.7/site-packages/torch/_utils.py", line 455, in _get_devices_properties
    return [_get_device_attr(lambda m: m.get_device_properties(i)) for i in device_ids]
  File "/home/bread/anaconda3/envs/p37/lib/python3.7/site-packages/torch/_utils.py", line 455, in <listcomp>
    return [_get_device_attr(lambda m: m.get_device_properties(i)) for i in device_ids]
  File "/home/bread/anaconda3/envs/p37/lib/python3.7/site-packages/torch/_utils.py", line 438, in _get_device_attr
    return get_member(torch.cuda)
  File "/home/bread/anaconda3/envs/p37/lib/python3.7/site-packages/torch/_utils.py", line 455, in <lambda>
    return [_get_device_attr(lambda m: m.get_device_properties(i)) for i in device_ids]
  File "/home/bread/anaconda3/envs/p37/lib/python3.7/site-packages/torch/cuda/__init__.py", line 312, in get_device_properties
    raise AssertionError("Invalid device id")
AssertionError: Invalid device id

Why is the image I generate an all-white image with no black font?

Hi, I've been trying to revive this project recently. I used the dataset provided by you and followed the parameters set in your paper
--epoch=20, λ1 = 100, λc = λs = 1, --max_dataset_size= 6, and the result generated an all-white image without black font. I have searched for a long time but have not found any problem, I would like to ask the reason.

AssertionError: invalid device id

Hello, amazing job there!

I'm kind of new in deep learning.
I tried to run your code but I get this error:

----------------- Options ---------------
batch_size: 256
beta1: 0.5
checkpoints_dir: ./checkpoints
continue_train: False
dataroot: ./datasets/font [default: None]
dataset_mode: font
direction: english2chinese
dis_2: True
display_env: main
display_freq: 51200
display_id: 1
display_ncols: 10
display_port: 8097
display_server: http://localhost
display_winsize: 64
epoch: latest
epoch_count: 1
gan_mode: hinge
gpu_ids: 0,1
init_gain: 0.02
init_type: normal
isTrain: True [default: None]
lambda_L1: 100.0
lambda_content: 1.0
lambda_style: 1.0
load_iter: 0 [default: 0]
load_size: 64
lr: 0.0002
lr_decay_iters: 50
lr_policy: linear
max_dataset_size: inf
model: font_translator_gan
n_epochs: 10
n_epochs_decay: 10
n_layers_D: 3
name: test_new_dataset [default: experiment_name]
ndf: 64
netD: basic_64
netG: FTGAN_MLAN
ngf: 64
no_dropout: True [default: False]
no_html: False
norm: batch
num_threads: 4
phase: train
pool_size: 0
print_freq: 51200
save_by_iter: False
save_epoch_freq: 5
save_latest_freq: 5000000
style_channel: 6
suffix:
update_html_freq: 51200
use_spectral_norm: True
verbose: False
----------------- End -------------------
dataset [FontDataset] was created
The number of training images = 753637
Traceback (most recent call last):
File "train.py", line 14, in
model = create_model(opt) # create a model given opt.model and other options
File "/home/dufra/Desktop/gan/font_translator_gan/models/init.py", line 65, in create_model
instance = model(opt)
File "/home/dufra/Desktop/gan/font_translator_gan/models/font_translator_gan_model.py", line 42, in init
self.netG = networks.define_G(self.style_channel+1, 1, opt.ngf, opt.netG, opt.norm,
File "/home/dufra/Desktop/gan/font_translator_gan/models/networks.py", line 183, in define_G
return init_net(net, init_type, init_gain, gpu_ids)
File "/home/dufra/Desktop/gan/font_translator_gan/models/networks.py", line 124, in init_net
net = torch.nn.DataParallel(net, gpu_ids) # multi-GPUs
File "/home/dufra/.local/lib/python3.8/site-packages/torch/nn/parallel/data_parallel.py", line 142, in init
_check_balance(self.device_ids)
File "/home/dufra/.local/lib/python3.8/site-packages/torch/nn/parallel/data_parallel.py", line 23, in _check_balance
dev_props = _get_devices_properties(device_ids)
File "/home/dufra/.local/lib/python3.8/site-packages/torch/_utils.py", line 464, in _get_devices_properties
return [_get_device_attr(lambda m: m.get_device_properties(i)) for i in device_ids]
File "/home/dufra/.local/lib/python3.8/site-packages/torch/_utils.py", line 464, in
return [_get_device_attr(lambda m: m.get_device_properties(i)) for i in device_ids]
File "/home/dufra/.local/lib/python3.8/site-packages/torch/_utils.py", line 447, in _get_device_attr
return get_member(torch.cuda)
File "/home/dufra/.local/lib/python3.8/site-packages/torch/_utils.py", line 464, in
return [_get_device_attr(lambda m: m.get_device_properties(i)) for i in device_ids]
File "/home/dufra/.local/lib/python3.8/site-packages/torch/cuda/init.py", line 359, in get_device_properties
raise AssertionError("Invalid device id")
AssertionError: Invalid device id

Could you help me?

Thanks

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.