azadis / mc-gan Goto Github PK
View Code? Open in Web Editor NEWMulti-Content GAN for Few-Shot Font Style Transfer at CVPR 2018
Home Page: http://bair.berkeley.edu/blog/2018/03/13/mcgan/
License: Other
Multi-Content GAN for Few-Shot Font Style Transfer at CVPR 2018
Home Page: http://bair.berkeley.edu/blog/2018/03/13/mcgan/
License: Other
Hi, I want to train the network on my own dataset, I'd like to know how the dataset is generated. Can you share some data preparation scripts?
I want to reproduce your experiment. But there have been some problems in the debugging process. There are even code errors. I think this will definitely not be your problem. So I want to ask the specific environment running version (Ps. My environment is configured according to Readme)
Such as: tensor_gt[batch,0,:,:] = tensor_all.data[batch,self.out_id[batch],:,:]
IndexError: list index out of range
When I run the model with CUP, and got this error:
Traceback (most recent call last):
File "train.py", line 38, in
errors = model.get_current_errors()
File "/Users/XXX/Desktop/XXX/MC-GAN/models/cGAN_model.py", line 250, in get_current_errors
return OrderedDict([('G_GAN', self.loss_G_GAN.data[0]),
IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number`
Please change the code return OrderedDict([('G_GAN', self.loss_G_GAN.data[0])
in line 250 of cGAN_model.py into return OrderedDict([('G_GAN', self.loss_G_GAN.data)
If you only have one GPU, the setup steps give the following error:
cuda runtime error (38) : no CUDA-capable device is detected
Please change CUDA_ID=1
to CUDA_ID=0
in scripts/train_cGAN.sh
(I can make a pull request for this if the author prefers)
I followed the README steps, downloaded all of the data,but I don't know how to deal with this problem.
Hi, i am using COLAB to train the model.i couldn't get the result only one time.
How to use checkpoints to let the model continue training after the break in the middle of training?
Hello, I just want to know how to add more complex color gradients and textures to text if I want to create a dataset using fonts,thank you
Hi. I don't have a deep understanding of all this, so please bear with me.
I am working hobby project with the ornate handwriting of a medieval manuscript. The manuscript is in Latin. There are no letter "j"s (i is used), no "k"s (didn't exist), no "v"s (u is used), no "w"s (didn't exist), and very few "y"s.
Would MC-GAN be capable of doing either of the following tasks?
Produce the letters that don't exist based on the letters that do.
Produce multiple, unique instances of letters that are few in number. (The letters that exist in abundance slightly vary from one to the next, because this is handwriting. So an "e", for example, looks slightly different every time. I'm asking if MC-GAN could create more "y"s, for example, with each one slightly varying from the others, yet plausibly the product of the original scribe.)
Thank you!
How can I test the OrnaNet with pretrained weights on new images, one image (One source and one style image) at a time?
How much memory do I need for Capitals64? I have 11 GB.
After running
./scripts/train_StackGAN.sh ft37_1
RuntimeError: The size of tensor a (26) must match the size of tensor b (64) at non-singleton dimension 0
... I hackily fixed that changing train.staqckGAN.sh
FINESIZE=64
LOADSIZE=64
to
FINESIZE=26
LOADSIZE=26
...
Then the next error was it couldn't find the files in /A/train/ and /b/train/
(it was looking for .ft6_14.png when they were all named ft6_14.png etc (without the ' . ' prepended.
So I uploaded them because I couldn't find how that path was being set.
Now I get a similar error to the start..
RuntimeError: The size of tensor a (3) must match the size of tensor b (26) at non-singleton dimension 0
I've given up trying to do this. As it's taken my whole day with no results :(
Here's where I've stopped
https://colab.research.google.com/gist/Abul22/cf9a67e393118a1c30add68c38ac65c9/untitled0.ipynb
If anyone else more capable than I could make a working colab (or help me find where I've gone wrong) -- That would be so amazingly great.
Cheers
Sorry, I can't get the dataset.
Could you please help me? Thank you very much.
While running train_Stack.py I am getting below error:
Traceback (most recent call last):
File "D:\Innovation day 2019\python\lib\site-packages\torch\utils\data\dataloader.py", line 724, in _try_get_data
data = self._data_queue.get(timeout=timeout)
File "D:\Innovation day 2019\python\lib\multiprocessing\queues.py", line 105, in get
raise Empty
_queue.Empty
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/kiku/FontTransfer/MC-GAN/train_Stack.py", line 44, in
for i, data in enumerate(dataset):
File "C:\Users\kiku\FontTransfer\MC-GAN\data\data_loader.py", line 211, in next
A, A_paths = next(self.data_loader_iter_A)
File "D:\Innovation day 2019\python\lib\site-packages\torch\utils\data\dataloader.py", line 804, in next
idx, data = self._get_data()
File "D:\Innovation day 2019\python\lib\site-packages\torch\utils\data\dataloader.py", line 771, in _get_data
success, data = self._try_get_data()
File "D:\Innovation day 2019\python\lib\site-packages\torch\utils\data\dataloader.py", line 737, in _try_get_data
raise RuntimeError('DataLoader worker (pid(s) {}) exited unexpectedly'.format(pids_str))
RuntimeError: DataLoader worker (pid(s) 18360) exited unexpectedly
Process finished with exit code 1
I get this error when running ./scripts/train_StackGAN.sh ${DATA}
model [StackGANModel] was created
create web directory ./checkpoints/BRAVE_MCGAN_train/web...
saving the model at the end of epoch 0, iters 0
Traceback (most recent call last):
File "train_Stack.py", line 49, in <module>
model.optimize_parameters_Stacked(epoch)
File "/home/abc/FontTransfer/MC-GAN/models/StackGAN_model.py", line 538, in optimize_parameters_Stacked
self.backward_G(fake_B0_grad, iter)
File "/home/abc/FontTransfer/MC-GAN/models/StackGAN_model.py", line 408, in backward_G
self.loss_G_L1 = self.criterionL1(weights * self.fake_B0, weights * self.fake_B0_init.detach()) * self.opt.lambda_C
RuntimeError: The size of tensor a (3) must match the size of tensor b (7) at non-singleton dimension 0
Which version of pytorch and torchvision that this repo based on? My torch is 0.3.1 and torchvision 0.2.0
Hi, Thank you for sharing the code, and when sh train_cGAN.sh, it comes a mistake,
RuntimeError: cuda runtime error (38) : no CUDA-capable device is detected at /pytorch/torch/lib/THC/THCGeneral.c:70
my system is ubuntu16.04, CUDA8.0, pytorch0.3.0,torchvision0.2.0,python2.7.12.Thanks.
Hi, so I only mod'd the cGan file to run on a CPU rather than a GPU and I'm consistently running into this assertionError. I have followed the path manually to ensure it directs to the right location (it does) but somehow this error consistently throws even though the directory does exist. Could you take a peek at my code and ref. error code, I could use the help because I have been unable to correct this on my own using web references.
`#!/bin/bash -f
#=====================================
#=====================================
#=====================================
#=====================================
DATA=$1
DATASET="../datasets/${DATA}/"
experiment_dir="GlyphNet_pretrain"
MODEL=cGAN
MODEL_G=resnet_6blocks
MODEL_D=n_layers
n_layers_D=1
NORM=batch
IN_NC=26
O_NC=26
GRP=26
PRENET=2_layers
FINESIZE=64
LOADSIZE=64
LAM_A=100
NITER=500
NITERD=100
BATCHSIZE=150
CUDA_ID=-1
if [ ! -d "./checkpoints/${experiment_dir}" ]; then
mkdir "./checkpoints/${experiment_dir}"
fi
LOG="./checkpoints/${experiment_dir}/output.txt"
if [ -f $LOG ]; then
rm $LOG
fi
exec &> >(tee -a "$LOG")
python train.py --dataroot ../datasets --name "${experiment_dir}"
--model ${MODEL} --which_model_netG ${MODEL_G} --which_model_netD ${MODEL_D} --n_layers_D ${n_layers_D} --which_model_preNet ${PRENET}
--norm ${NORM} --input_nc ${IN_NC} --output_nc ${O_NC} --grps ${GRP} --fineSize ${FINESIZE} --loadSize ${LOADSIZE} --lambda_A ${LAM_A} --align_data --use_dropout
--display_id 0 --niter ${NITER} --niter_decay ${NITERD} --batchSize ${BATCHSIZE} --conditional --save_epoch_freq 100 --print_freq 100 --conv3d --gpu_ids ' '
# --model cGAN --which_model_netG resnet_6blocks --which_model_netD n_layers --n_layers_D 1 --which_model_preNet 2_layers \
# --norm batch --input_nc 78 --output_nc 78 --fineSize 64 --loadSize 64 --lambda_A 100 --align_data --use_dropout \
# --display_id 0 --niter 500 --niter_decay 1000 --batchSize 100 --conditional --save_epoch_freq 20 --display_freq 2 --rgb
# --model cGAN --which_model_netG resnet_6blocks --which_model_netD n_layers --n_layers_D 1 --which_model_preNet 2_layers\
# --norm batch --input_nc 1 --output_nc 1 --fineSize 64 --loadSize 64 --lambda_A 100 --align_data --use_dropout\
# --display_id 0 --niter 500 --niter_decay 2000 --batchSize 5 --conditional --save_epoch_freq 10 --display_freq 5 --print_freq 100 --flat
Is it possible to train the network in multi GPUs?
When click the link : https://github.com/azadis/AdobeFontDropper#mc-gan-traintest
it turns out to be 404.
When I use my test picture,RUN ERROR:
Traceback (most recent call last):
File "test.py", line 34, in
for i, data in enumerate(dataset):
File "/home/zhaojing/.conda/envs/py2.7/lib/python2.7/site-packages/future/types/newobject.py", line 53, in next
return type(self).next(self)
File "/home/zhaojing/ZT/MC-GAN-master1/data/data_loader.py", line 164, in next
blank_ind = self.random_dict[file_name][0:int(self.blanks*A.size(1)/n_rgb)]
KeyError: 'anie_i.0.0.png'
BUT when i change the name the same as yours ,it runs .
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.