Giter VIP home page Giter VIP logo

mc-gan's People

Contributors

azadis 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mc-gan's Issues

How the dataset is generated

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?

Error:Train Glyph Network:

When I run ./scripts/train_cGAN.sh Capitals64.
There are a problem.
111

This is my current environment configuration (Ubuntu 16.04 + torch 1.0.0+ torchvision 0.2.1 others using pip install)

What is your operating environment and the version of the software?

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

invalid index of a 0-dim tensor

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)

Quick fix - setup error on 1 GPU machine

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)

datasets

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

Usecase question

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?

  1. Produce the letters that don't exist based on the letters that do.

  2. 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!

Test OrnaNet

How can I test the OrnaNet with pretrained weights on new images, one image (One source and one style image) at a time?

Error training with pretrained models.

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

Dataset

Sorry, I can't get the dataset.
Could you please help me? Thank you very much.

RuntimeError: DataLoader worker (pid(s) 18360) exited unexpectedly

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

RuntimeError: The size of tensor a (3) must match the size of tensor b (7) at non-singleton dimension 0

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

when sh train_cGAN.sh, it comes a mistake

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.

AssertionError: not a valid directory

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

#=====================================

MC-GAN

Train and Test conditional GAN Glyph network

By Samaneh Azadi

#=====================================

#=====================================

Set Parameters

#=====================================

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")

=======================================

Train Glyph Network on font dataset

=======================================

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 ' '

=======================================

Train on RGB inputs to generate RGB outputs; Image Translation in the paper

=======================================

CUDA_VISIBLE_DEVICES=2 python ~/AdobeFontDropper/train.py --dataroot ../datasets/Capitals_colorGrad64/ --name "${experiment_dir}"\

					 # --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

=======================================

Consider input as tiling of input glyphs rather than a stack

=======================================

CUDA_VISIBLE_DEVICES=2 python ~/AdobeFontDropper/train.py --dataroot ../datasets/Capitals64/ --name "${experiment_dir}" \

			# --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

`
screen shot 2019-03-06 at 11 46 51 pm

KeyError: 'anie_i.0.0.png' When use my test picture

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 .

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.