Giter Site home page Giter Site logo

stackgan's People

Contributors

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

stackgan's Issues

how to test the pretrained model on the dataset?

you have released codes about how to train and how to make a demo..
but how we evaluate the pretrained model?I have found ./demo/birds-eval.yml and downloaded the pre-trained model birds_model_164000.ckpt in ./model
meanwhile, the test CUB dataset have produced by the prepocess_birds.py, such as char-CNN-RNN-embedding.pickle, filenames.pickle, but the file *.txt and *.t7 are needed in birds_demo.sh..

so how to test the pretrained stackedGAN?

Stage-I Training Problem

GeForce GTX 1070
ubuntu 16.04
python 2.7
tensorflow 0.12.0
cuda 8.0
cudnn 5.1

I'm currently trying to train the StackGAN network.
After download the birds caption data and image data, I pre-process images using python misc/preprocess_birds.py".
It works and produces 38images.pickle and 304images.pickle.
But when I'm training Stage-I using python stageI/run_exp.py --cfg stageI/cfg/birds.yml --gpu 0,some problems happened.
The console output :
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcublas.so.8.0 locally I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcudnn.so.5 locally I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcufft.so.8.0 locally I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcuda.so.1 locally I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcurand.so.8.0 locally Using config: {'CONFIG_NAME': 'stageI', 'DATASET_NAME': 'birds', 'EMBEDDING_TYPE': 'cnn-rnn', 'GAN': {'DF_DIM': 64, 'EMBEDDING_DIM': 128, 'GF_DIM': 128, 'NETWORK_TYPE': 'default'}, 'GPU_ID': 0, 'TEST': {'BATCH_SIZE': 64, 'CAPTION_PATH': '', 'HR_IMSIZE': 256, 'LR_IMSIZE': 64, 'NUM_COPY': 16, 'PRETRAINED_MODEL': ''}, 'TRAIN': {'BATCH_SIZE': 64, 'B_WRONG': True, 'COEFF': {'KL': 2.0}, 'COND_AUGMENTATION': True, 'DISCRIMINATOR_LR': 0.0002, 'FINETUNE_LR': False, 'FLAG': True, 'FT_LR_RETIO': 0.1, 'GENERATOR_LR': 0.0002, 'LR_DECAY_EPOCH': 50, 'MAX_EPOCH': 600, 'NUM_COPY': 4, 'NUM_EMBEDDING': 4, 'PRETRAINED_EPOCH': 600, 'PRETRAINED_MODEL': '', 'SNAPSHOT_INTERVAL': 2000}, 'Z_DIM': 100} images: (2933, 76, 76, 3) embeddings: (2933, 10, 1024) list_filenames: 2933 001.Black_footed_Albatross/Black_Footed_Albatross_0046_18 images: (8855, 76, 76, 3) embeddings: (8855, 10, 1024) list_filenames: 8855 002.Laysan_Albatross/Laysan_Albatross_0002_1027 train(self): <stageI.trainer.CondGANTrainer object at 0x7fc3bad2a610> W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE3 instructions, but these are available on your machine and could speed up CPU computations. W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations. W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations. W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations. W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations. W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations. I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:910] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero I tensorflow/core/common_runtime/gpu/gpu_device.cc:885] Found device 0 with properties: name: GeForce GTX 1070 major: 6 minor: 1 memoryClockRate (GHz) 1.7845 pciBusID 0000:03:00.0 Total memory: 7.92GiB Free memory: 7.56GiB I tensorflow/core/common_runtime/gpu/gpu_device.cc:906] DMA: 0 I tensorflow/core/common_runtime/gpu/gpu_device.cc:916] 0: Y I tensorflow/core/common_runtime/gpu/gpu_device.cc:975] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX 1070, pci bus id: 0000:03:00.0) success Created model with fresh parameters. epoch #0| 0%| |ETA: --:--:--

Then my computer will auto reboot when the progress bar is still 0%.
I don't know if this is a problem with computer equipment.
What should I do now? Can someone help me?
Or show your computer equipment.
Thank you!!!

Where to find example_captions.t7

Hi I've followed the install instructions in the README, but I can't for the life of me figure out where to find Data/flowers/example_captions.t7? Same with birds. Are they simply the files like lm_sje_nc4_cub_hybrid_gru18_a1_c512_ ... 70_1_10_trainvalids.txt_iter30000.t7 files that have been renamed?

How to train with skip-thought text encoder

Is there an example yml? Do I need to change EMBEDDING_TYPE in it?
The char-cnn-rnn features are M x 10 x 1024, but the skip-thought features are M x 4800,
do I need to change the xml or the scripts accordingly?
Thanks.

StageI Training Failure

I'm currently trying to train the network using pre-trained word embedding of bird and flowers. I'm using TensorFlow 1.3 so I did some necessary adaptions. But the result is frustrating:
train
It seems the generator is a completely mess. Also I checked some loss values and it's really weird that some of them are never changed:

default

I'm not sure what could be the cause of the problem, is it possible that some TensorFlow core function behave differently in r1.3 (as opposed to r0.12)?

Is there anyone who successfully reproduced the result with new version of TensorFlow? Can you send me a message to [email protected] so I can check some implementation issue with you? Much appreciated guys!

PIL required for misc/preprocess_*.py

Without PIL (which I was able to install through pip install pillow as pip install PIL failed for me on Ubuntu 16.04) scipy.misc.imread() fails in misc/utils.py. This might be worth noting in the README so that users attempting to use these scripts to pre-process their images aren't faced with an error.

Stage II ValueError: slice index 0 of dimension 0 out of bounds.

Hello, I'm trying to run Stage II, but get a Value Error.

Below I've copied and pasted which tf version I'm using (which ran stage I successfully) and the terminal output when I try to run "python stageII/run_exp.py --cfg stageII/cfg/birds.yml --gpu 1".

ubuntu@ip-172-31-26-237:~/pynb/StackGAN-master$ pip show tensorflow
Name: tensorflow
Version: 0.11.0rc0
Summary: TensorFlow helps the tensors flow
Home-page: http://tensorflow.org/
Author: Google Inc.
Author-email: [email protected]
License: Apache 2.0
Location: /usr/local/lib/python2.7/dist-packages
Requires: mock, protobuf, numpy, wheel, six

ubuntu@ip-172-31-26-237:~/pynb/StackGAN-master$ pip show tensorflow-gpu
Name: tensorflow-gpu
Version: 0.12.0
Summary: TensorFlow helps the tensors flow
Home-page: http://tensorflow.org/
Author: Google Inc.
Author-email: [email protected]
License: Apache 2.0
Location: /usr/local/lib/python2.7/dist-packages
Requires: mock, numpy, protobuf, wheel, six
|tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcurand.so locally
Using config:
{'CONFIG_NAME': 'stageII',
 'DATASET_NAME': 'birds',
 'EMBEDDING_TYPE': 'cnn-rnn',
 'GAN': {'DF_DIM': 64,
         'EMBEDDING_DIM': 128,
         'GF_DIM': 128,
         'NETWORK_TYPE': 'default'},
 'GPU_ID': 1,
 'TEST': {'BATCH_SIZE': 64,
          'CAPTION_PATH': '',
          'HR_IMSIZE': 256,
          'LR_IMSIZE': 64,
          'NUM_COPY': 16,
          'PRETRAINED_MODEL': ''},
 'TRAIN': {'BATCH_SIZE': 16,
           'B_WRONG': True,
           'COEFF': {'KL': 2.0},
           'COND_AUGMENTATION': True,
           'DISCRIMINATOR_LR': 0.0002,
           'FINETUNE_LR': False,
           'FLAG': True,
           'FT_LR_RETIO': 0.1,
           'GENERATOR_LR': 0.0002,
           'LR_DECAY_EPOCH': 100,
           'MAX_EPOCH': 50,
           'NUM_COPY': 4,
           'NUM_EMBEDDING': 4,
           'PRETRAINED_EPOCH': 20,
           'PRETRAINED_MODEL': '/home/ubuntu/pynb/StackGAN-master/ckt_logs/birds/stageI_2017_06_20_02_48_33/model_2000.ckpt',
           'SNAPSHOT_INTERVAL': 2000},
 'Z_DIM': 100}
images:  (2933, 304, 304, 3)
embeddings:  (2933, 10, 1024)
list_filenames:  2933 001.Black_footed_Albatross/Black_Footed_Albatross_0046_18
images:  (8855, 304, 304, 3)
embeddings:  (8855, 10, 1024)
list_filenames:  8855 002.Laysan_Albatross/Laysan_Albatross_0002_1027
lr_imsize:  64
hr_image_shape [256, 256, 3]
lr_image_shape [64, 64, 3]
I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:925] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
I tensorflow/core/common_runtime/gpu/gpu_device.cc:951] Found device 0 with properties: 
name: Tesla K80
major: 3 minor: 7 memoryClockRate (GHz) 0.8235
pciBusID 0000:00:1e.0
Total memory: 11.25GiB
Free memory: 11.13GiB
I tensorflow/core/common_runtime/gpu/gpu_device.cc:972] DMA: 0 
I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] 0:   Y 
I tensorflow/core/common_runtime/gpu/gpu_device.cc:1041] Creating TensorFlow device (/gpu:0) -> (device: 0, name: Tesla K80, pci bus id: 0000:00:1e.0)
Traceback (most recent call last):
  File "stageII/run_exp.py", line 71, in <module>
    algo.train()
  File "/home/ubuntu/pynb/StackGAN-master/stageII/trainer.py", line 463, in train
    counter = self.build_model(sess)
  File "/home/ubuntu/pynb/StackGAN-master/stageII/trainer.py", line 380, in build_model
    self.init_opt()
  File "/home/ubuntu/pynb/StackGAN-master/stageII/trainer.py", line 154, in init_opt
    self.visualization(cfg.TRAIN.NUM_COPY)
  File "/home/ubuntu/pynb/StackGAN-master/stageII/trainer.py", line 303, in visualization
    n, "test")
  File "/home/ubuntu/pynb/StackGAN-master/stageII/trainer.py", line 285, in visualize_one_superimage
    img = images[row * rows, :, :, :]
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py", line 383, in _SliceHelper
    name=name)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py", line 537, in strided_slice
    shrink_axis_mask=shrink_axis_mask)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_array_ops.py", line 2750, in strided_slice
    shrink_axis_mask=shrink_axis_mask, name=name)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 749, in apply_op
    op_def=op_def)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2382, in create_op
    set_shapes_for_outputs(ret)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 1783, in set_shapes_for_outputs
    shapes = shape_func(op)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py", line 1645, in _DelegateStridedSliceShape
    return common_shapes.call_cpp_shape_fn(op, input_tensors_needed=[1, 2, 3])
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/common_shapes.py", line 596, in call_cpp_shape_fn
    raise ValueError(err.message)
ValueError: slice index 0 of dimension 0 out of bounds.

error: run error

I use "pip install prettytensor" but prettytensor aways make mistakes ๏ผš

$ sh demo/flowers_demo.sh
{
doc_length : 201
filenames : "Data/flowers/example_captions.t7"
queries : "Data/flowers/example_captions.txt"
net_txt : "models/text_encoder/lm_sje_flowers_c10_hybrid_0.00070_1_10_trainvalids.txt_iter16400.t7"
}
Successfully load sentences from: Data/flowers/example_captions.t7
Total number of sentences: 5
num_embeddings: 5 (5, 1024)
2017-03-29 09:47:14.610481: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2017-03-29 09:47:14.610495: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2017-03-29 09:47:14.610500: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2017-03-29 09:47:14.610505: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
2017-03-29 09:47:14.610509: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
lr_imsize: 64
Traceback (most recent call last):
File "demo/demo.py", line 192, in
build_model(sess, embeddings.shape[-1], batch_size)
File "demo/demo.py", line 64, in build_model
fake_images = model.get_generator(tf.concat(1, [c, z]))
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py", line 1029, in concat
dtype=dtypes.int32).get_shape(
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 639, in convert_to_tensor
as_ref=False)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 704, in internal_convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/constant_op.py", line 113, in _constant_tensor_conversion_function
return constant(v, dtype=dtype, name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/constant_op.py", line 102, in constant
tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape, verify_shape=verify_shape))
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/tensor_util.py", line 370, in make_tensor_proto
_AssertCompatible(values, dtype)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/tensor_util.py", line 302, in _AssertCompatible
(dtype.name, repr(mismatch), type(mismatch).name))
TypeError: Expected int32, got <prettytensor.pretty_tensor_class.Layer object at 0x7f74d41abd90> of type 'Layer' instead.

Having issues while reproducing

Hello everyone,

I am trying to reproduce the code implemented in this repository. However i am getting stuck at the following error. I have followed the steps in the readme file. Could you guys please guide me what i am missing or tell where i am making mistakes? .

Traceback (most recent call last): |ETA: --:--:-- File "stageI/run_exp.py", line 68, in <module> algo.train() File "/home/ubuntu/gans/gans/stacked-gans/StackGAN/stageI/trainer.py", line 346, in train num_embedding) File "/home/ubuntu/gans/gans/stacked-gans/StackGAN/misc/datasets.py", line 144, in next_batch sampled_images = self.transform(sampled_images) File "/home/ubuntu/gans/gans/stacked-gans/StackGAN/misc/datasets.py", line 78, in transform images[i][w1: w1 + self._imsize, h1: h1 + self._imsize, :] TypeError: slice indices must be integers or None or have an __index__ method

This is the error I am getting.

UnicodeDecodeError while stage - 1 training

This is the code I am trying to run on anaconda IDE :-

#Training Step 1: train Stage-I GAN
#python stageI/run_exp.py --cfg stageI/cfg/birds.yml --gpu 0
from future import division
from future import print_function

import dateutil
import dateutil.tz
import datetime
import argparse
import pprint

from Project.misc.datasets import TextDataset
from Project.stageI.model import CondGAN
from Project.stageI.trainer import CondGANTrainer
from Project.misc.utils import mkdir_p
from Project.misc.config import cfg, cfg_from_file

import codecs #module and function addition by shubham kale : start
def replace_line(file_name, line_num, text):
f = codecs.open(file_name, 'r', encoding='utf-8')
lines = f.readlines()
lines[line_num] = text
f.close()
w = codecs.open(file_name, 'w', encoding='utf-8')
w.writelines(lines)
w.close()
#End of additions
import sys #change by shubham kale line -1
from importlib import reload #line - 2
reload(sys) #line - 3
#sys.setdefaultencoding('utf8') #meaningless in python 3

print('Using config:')
pprint.pprint(cfg)

now = datetime.datetime.now(dateutil.tz.tzlocal())
timestamp = now.strftime('%Y_%m_%d_%H_%M_%S')

#datadir = 'Data/%s' % cfg.DATASET_NAME
datadir = 'Data/flowers'
dataset = TextDataset(datadir, cfg.EMBEDDING_TYPE, 1)
filename_test = '%s/test' % (datadir)
dataset.test = dataset.get_data(filename_test)
if cfg.TRAIN.FLAG:
filename_train = '%s/train' % (datadir)
dataset.train = dataset.get_data(filename_train)
ckt_logs_dir = "ckt_logs/%s/%s_%s" %(cfg.DATASET_NAME, cfg.CONFIG_NAME, timestamp)
mkdir_p(ckt_logs_dir)
else:
s_tmp = cfg.TRAIN.PRETRAINED_MODEL
ckt_logs_dir = s_tmp[:s_tmp.find('.ckpt')]

model = CondGAN(
image_shape=dataset.image_shape
)

algo = CondGANTrainer(
model=model,
dataset=dataset,
ckt_logs_dir=ckt_logs_dir
)
if cfg.TRAIN.FLAG:
algo.train()
else:
''' For every input text embedding/sentence in the
training and test datasets, generate cfg.TRAIN.NUM_COPY
images with randomness from noise z and conditioning augmentation.'''
algo.evaluate()

The Output error log is :-

Using config:
{'CONFIG_NAME': '',
'DATASET_NAME': 'birds',
'EMBEDDING_TYPE': 'cnn-rnn',
'GAN': {'DF_DIM': 64,
'EMBEDDING_DIM': 128,
'GF_DIM': 128,
'NETWORK_TYPE': 'default'},
'GPU_ID': 0,
'TEST': {'BATCH_SIZE': 64,
'CAPTION_PATH': '',
'HR_IMSIZE': 256,
'LR_IMSIZE': 64,
'NUM_COPY': 16,
'PRETRAINED_MODEL': ''},
'TRAIN': {'BATCH_SIZE': 64,
'B_WRONG': True,
'COEFF': {'KL': 2.0},
'COND_AUGMENTATION': True,
'DISCRIMINATOR_LR': 0.0002,
'FINETUNE_LR': False,
'FLAG': True,
'FT_LR_RETIO': 0.1,
'GENERATOR_LR': 0.0002,
'LR_DECAY_EPOCH': 50,
'MAX_EPOCH': 600,
'NUM_COPY': 4,
'NUM_EMBEDDING': 4,
'PRETRAINED_EPOCH': 600,
'PRETRAINED_MODEL': '',
'SNAPSHOT_INTERVAL': 2000},
'Z_DIM': 100}
images: (1155, 76, 76, 3)

UnicodeDecodeError Traceback (most recent call last)
in ()
42 dataset = TextDataset(datadir, cfg.EMBEDDING_TYPE, 1)
43 filename_test = '%s/test' % (datadir)
---> 44 dataset.test = dataset.get_data(filename_test)
45 if cfg.TRAIN.FLAG:
46 filename_train = '%s/train' % (datadir)

~/Project/misc/datasets.py in get_data(self, pickle_path, aug_flag)
227 images = pickle.load(f)
228 images = np.array(images)
--> 229 print('images: ', images.shape)
230
231 with open(pickle_path + self.embedding_filename, 'rb') as f:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc4 in position 0: ordinal not in range(128)

module 'cunn' not found:No LuaRocks module found for cunn

(tensorflow) oslab how_to_convert_text_to_images-master
$ sh demo/flowers_demo.sh

/home/oslab/torch-cl/install/bin/luajit: /home/oslab/torch-cl/install/share/lua/5.1/trepl/init.lua:384: module 'cunn' not found:No LuaRocks module found for cunn
no field package.preload['cunn']
no file '/home/oslab/.luarocks/share/lua/5.1/cunn.lua'
no file '/home/oslab/.luarocks/share/lua/5.1/cunn/init.lua'
no file '/home/oslab/torch-cl/install/share/lua/5.1/cunn.lua'
no file '/home/oslab/torch-cl/install/share/lua/5.1/cunn/init.lua'
no file '/home/oslab/torch/install/share/lua/5.1/cunn.lua'
no file '/home/oslab/torch/install/share/lua/5.1/cunn/init.lua'
no file './cunn.lua'
no file '/home/oslab/torch/install/share/luajit-2.1.0-beta1/cunn.lua'
no file '/usr/local/share/lua/5.1/cunn.lua'
no file '/usr/local/share/lua/5.1/cunn/init.lua'
no file '/home/oslab/.luarocks/lib/lua/5.1/cunn.so'
no file '/home/oslab/torch-cl/install/lib/lua/5.1/cunn.so'
no file '/home/oslab/torch-cl/install/lib/cunn.so'
no file '/home/oslab/torch/install/lib/cunn.so'
no file '/home/oslab/torch/install/lib/lua/5.1/cunn.so'
no file './cunn.so'
no file '/usr/local/lib/lua/5.1/cunn.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
[C]: in function 'error'
/home/oslab/torch-cl/install/share/lua/5.1/trepl/init.lua:384: in function 'require'
demo/get_embedding.lua:7: in main chunk
[C]: in function 'dofile'
...b/torch-cl/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
[C]: at 0x00405e90

error on StageI _VARSCOPE_KEY

 python stageI/run_exp.py --cfg stageI/cfg/birds.yml --gpu 0
Using config:
{'CONFIG_NAME': 'stageI',
 'DATASET_NAME': 'birds',
 'EMBEDDING_TYPE': 'cnn-rnn',
 'GAN': {'DF_DIM': 64,
         'EMBEDDING_DIM': 128,
         'GF_DIM': 128,
         'NETWORK_TYPE': 'default'},
 'GPU_ID': 0,
 'TEST': {'BATCH_SIZE': 64,
          'CAPTION_PATH': '',
          'HR_IMSIZE': 256,
          'LR_IMSIZE': 64,
          'NUM_COPY': 16,
          'PRETRAINED_MODEL': ''},
 'TRAIN': {'BATCH_SIZE': 64,
           'B_WRONG': True,
           'COEFF': {'KL': 2.0},
           'COND_AUGMENTATION': True,
           'DISCRIMINATOR_LR': 0.0002,
           'FINETUNE_LR': False,
           'FLAG': True,
           'FT_LR_RETIO': 0.1,
           'GENERATOR_LR': 0.0002,
           'LR_DECAY_EPOCH': 50,
           'MAX_EPOCH': 600,
           'NUM_COPY': 4,
           'NUM_EMBEDDING': 4,
           'PRETRAINED_EPOCH': 600,
           'PRETRAINED_MODEL': '',
           'SNAPSHOT_INTERVAL': 2000},
 'Z_DIM': 100}
images:  (2933, 76, 76, 3)
embeddings:  (2933, 10, 1024)
list_filenames:  2933 001.Black_footed_Albatross/Black_Footed_Albatross_0046_18
images:  (8855, 76, 76, 3)
embeddings:  (8855, 10, 1024)
list_filenames:  8855 002.Laysan_Albatross/Laysan_Albatross_0002_1027
Traceback (most recent call last):
  File "stageI/run_exp.py", line 61, in <module>
    image_shape=dataset.image_shape
  File "/home/adminis/StackGAN/stageI/model.py", line 31, in __init__
    self.d_encode_img_template = self.d_encode_image()
  File "/home/adminis/StackGAN/stageI/model.py", line 161, in d_encode_image
    custom_conv2d(self.df_dim, k_h=4, k_w=4).
  File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1965, in method
    with _method_scope(input_layer, scope_name) as (scope, _):
  File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1776, in _method_scope
    scopes.var_and_name_scope((name, None)) as (scope, var_scope):
  File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/usr/local/lib/python2.7/dist-packages/prettytensor/scopes.py", line 55, in var_and_name_scope
    vs_key = tf.get_collection_ref(variable_scope._VARSCOPE_KEY)
AttributeError: 'module' object has no attribute '_VARSCOPE_KEY'

Anyone who know how to fix this issue?

Training on COCO dataset

Hello everyone,

I am trying to train StackGAN on COCO dataset. However, I do not know how to generate following files:
image
Or, have anyone trained on COCO before, Could you please share it to us?
Thank you very much!

Best Regards๏ผ

Prettytensor library doesn't include customs_fully_connected/custom_conv2d

the part of the code in StageI/model.py as followed:
node1_0 =
(pt.wrap(z_var).
flatten().
custom_fully_connected(self.s16 * self.s16 * self.gf_dim * 8).
fc_batch_norm().
reshape([-1, self.s16, self.s16, self.gf_dim * 8]))
node1_1 =
(node1_0.
custom_conv2d(self.gf_dim * 2, k_h=1, k_w=1, d_h=1, d_w=1).
conv_batch_norm().
apply(tf.nn.relu).
custom_conv2d(self.gf_dim * 2, k_h=3, k_w=3, d_h=1, d_w=1).
conv_batch_norm().
apply(tf.nn.relu).
custom_conv2d(self.gf_dim * 8, k_h=3, k_w=3, d_h=1, d_w=1).
conv_batch_norm())

I'm trying to running the experiments with the data.However, it gives me the error:
NO module "custom_fully_connected"
It might be caused by the fact that I use recent version of Tensorflow or PrettyTensor master branch . I wonder which modification make running this code on current settings.
่ฐข่ฐขไฝ ็š„่งฃ็ญ”๏ผŒๅœจ็บฟๆ€ฅใ€‚

What do I do with this "ipdb>" screen or error that running the demo causes?

So I installed StackGAN using this guide, but I am unsure of what do with the screen/error that ipdb creates?

ubuntu@ip-Address:~/StackGAN$ sh demo/birds_demo.sh
{
  doc_length : 201
  filenames : "Data/birds/example_captions.t7"
  queries : "Data/birds/example_captions.txt"
  net_txt : "models/text_encoder/lm_sje_nc4_cub_hybrid_gru18_a1_c512_0.00070_1_10_trainvalids.txt_iter30000.t7"
}
Successfully load sentences from:  Data/birds/example_captions.t7
Total number of sentences: 6
num_embeddings: 6 (6, 1024)
lr_imsize:  64
--Return--
None
> /home/ubuntu/StackGAN/misc/custom_ops.py(136)__call__()
    132                                        init=tf.random_normal_initializer(stddev=stddev))
    133                 bias = self.variable("bias", [output_size], init=tf.constant_initializer(bias_start))
    134                 return input_layer.with_tensor(tf.matmul(input_, matrix) + bias, parameters=self.vars)
    135         except Exception:
--> 136             import ipdb; ipdb.set_trace()

ipdb>

what is the meaning of TRAINING???

what is the meaning of the stage 1 and stage 2 training?

i know that GAN is not needed to train.

is there anybody know the meaning of stage1 and stage2 training?

can you explain that to me?

help me guyz :)

T7ReaderException: unknown object type / typeidx: 1936287828

The error log I am getting is :-
T7ReaderException Traceback (most recent call last)
in ()
6 cap_path ="/home/oslab/Data/flowers/example_captions"
7 #torch.save(cap_path,'ascii')# ///// 'output.t7',
----> 8 t_file = torchfile.load(cap_path)
9
10 captions_list = t_file.raw_txt

~/anaconda3/envs/tensorflow/lib/python3.6/site-packages/torchfile.py in load(filename, **kwargs)
422 with open(filename, 'rb') as f:
423 reader = T7Reader(f, **kwargs)
--> 424 return reader.read_obj()

~/anaconda3/envs/tensorflow/lib/python3.6/site-packages/torchfile.py in read_obj(self)
412 else:
413 raise T7ReaderException(
--> 414 "unknown object type / typeidx: {}".format(typeidx))
415
416

T7ReaderException: unknown object type / typeidx: 1936287828

AttributeError: 'module' object has no attribute '_VARSCOPE_KEY'

When I run the stageI/run_exp.py. I meet the problem as follows:
Traceback (most recent call last):
File "/home/shizhenbo/PycharmProjects/StackGAN-master/stageI/run_exp.py", line 62, in
image_shape=dataset.image_shape
File "/home/shizhenbo/PycharmProjects/StackGAN-master/stageI/model.py", line 34, in init
self.d_encode_img_template = self.d_encode_image()
File "/home/shizhenbo/PycharmProjects/StackGAN-master/stageI/model.py", line 164, in d_encode_image
custom_conv2d(self.df_dim, k_h=4, k_w=4).
File "/home/shizhenbo/.conda/envs/py27/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1965, in method
with _method_scope(input_layer, scope_name) as (scope, _):
File "/home/shizhenbo/.conda/envs/py27/lib/python2.7/contextlib.py", line 17, in enter
return self.gen.next()
File "/home/shizhenbo/.conda/envs/py27/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1776, in _method_scope
scopes.var_and_name_scope((name, None)) as (scope, var_scope):
File "/home/shizhenbo/.conda/envs/py27/lib/python2.7/contextlib.py", line 17, in enter
return self.gen.next()
File "/home/shizhenbo/.conda/envs/py27/lib/python2.7/site-packages/prettytensor/scopes.py", line 55, in var_and_name_scope
vs_key = tf.get_collection_ref(variable_scope._VARSCOPE_KEY)
AttributeError: 'module' object has no attribute '_VARSCOPE_KEY'
Why ?
Maybe the number of lines are different to yours. Someone can help me? Thank you

please add requirements.txt

Please add a requirements.txt which specifies dependencies and their version. There are too many issues caused by compatibility problem.

Does anyone success run this model?

I'm running at StageII ,but it doesn't work
I think that it out of memeory
Can someone show you success image and show your computer equipment
Thank you ~~!

ValueError: too many values to unpack when using tensorflow R1.2

I am using version R 1.2 of tensorflow to run the training process, that is python stageI/run_exp.py --cfg stageI/cfg/flowers.yml --gpu 0
but bug has happened like this:
x_code = self.d_encode_img_template.construct(input= pt.wrap(x_var))
File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1248, in construct
return self._construct(context)
File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct
method_args = self._replace_deferred(self._method_args, context)
File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred
return [self._replace_deferred(x, context) for x in arg]
File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred
return arg._construct(context)
File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct
method_args = self._replace_deferred(self._method_args, context)
File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred
return [self._replace_deferred(x, context) for x in arg]
File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred
return arg._construct(context)
File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct
method_args = self._replace_deferred(self._method_args, context)
File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred
return [self._replace_deferred(x, context) for x in arg]
File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred
return arg._construct(context)
File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct
method_args = self._replace_deferred(self._method_args, context)
File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred
return [self._replace_deferred(x, context) for x in arg]
File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred
return arg._construct(context)
File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct
method_args = self._replace_deferred(self._method_args, context)
File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred
return [self._replace_deferred(x, context) for x in arg]
File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred
return arg._construct(context)
File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct
method_args = self._replace_deferred(self._method_args, context)
File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred
return [self._replace_deferred(x, context) for x in arg]
File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred
return arg._construct(context)
File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct
method_args = self._replace_deferred(self._method_args, context)
File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred
return [self._replace_deferred(x, context) for x in arg]
File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred
return arg._construct(context)
File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct
method_args = self._replace_deferred(self._method_args, context)
File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred
return [self._replace_deferred(x, context) for x in arg]
File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred
return arg._construct(context)
File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct
method_args = self._replace_deferred(self._method_args, context)
File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred
return [self._replace_deferred(x, context) for x in arg]
File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred
return arg._construct(context)
File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct
method_args = self._replace_deferred(self._method_args, context)
File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred
return [self._replace_deferred(x, context) for x in arg]
File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred
return arg._construct(context)
File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct
method_args = self._replace_deferred(self._method_args, context)
File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred
return [self._replace_deferred(x, context) for x in arg]
File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred
return arg._construct(context)
File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1176, in _construct
_strip_unnecessary_contents_from_stack(result, set())
File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1335, in _strip_unnecessary_contents_from_stack
for f, line_no, method, _ in result._traceback:
ValueError: too many values to unpack

it is because the line: x_code = self.d_encode_img_template.construct(input= pt.wrap(x_var)) in script model.py, How to use 'construct' in tensorflow R 1.2.

the original code are based on tensorflow R0.12 , so how to transfer the construct between R0.12 and R 1.2?
or did someone meet this kind issue?

Any response will be appreciated, thanks in advanced!

missing 1 required positional argument : 'shape' error

How i need to fix it?

Traceback (most recent call last):
File "demo/demo.py", line 4, in
import prettytensor as pt
File "/home/sb/tensorflow/lib/python3.5/site-packages/prettytensor/init.py", line 25, in
from prettytensor import funcs
File "/home/sb/tensorflow/lib/python3.5/site-packages/prettytensor/funcs.py", line 25, in
from prettytensor.pretty_tensor_image_methods import *
File "/home/sb/tensorflow/lib/python3.5/site-packages/prettytensor/pretty_tensor_image_methods.py", line 135, in
class conv2d(prettytensor.VarStoreMethod):
File "/home/sb/tensorflow/lib/python3.5/site-packages/prettytensor/pretty_tensor_image_methods.py", line 145, in conv2d
bias=tf.zeros_initializer(),
TypeError: zeros_initializer() missing 1 required positional argument: 'shape'

What to do after finish training StageII.

After I had finish training StageII, how can I use the model. What to do and what is the command? I copied model_164000.ckpt.index and model_164000.ckpt.meta to /models. I'm not sure how to run the model itself for testing my own descriptions.

Data preprocess on MSCOCO dataset

Hello, I'm trying to reproduce the experiment result on COCO dataset by failed to find any matching files to preprocess COCO images in the repository.
Since for birds and flowers dataset there are ways to generate satisfying bounding boxes, I'm not sure whether it is good to simply crop the COCO images or resize it before feeding to generator.

Stage-I GAN train error

ubuntu 14.04
python 2.7
tensorflow 0.12.1
cuda 8.0
cudnn 5.1
when i run this
python stageI/run_exp.py --cfg stageI/cfg/flowers.yml --gpu 0
The error is this
`/home/cwt/StackGAN/misc/datasets.py:78: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
images[i][w1: w1 + self._imsize, h1: h1 + self._imsize, :]
W tensorflow/core/framework/op_kernel.cc:975] Internal: Failed launching ResizeNearestNeighbor
[[Node: g_net/apply_5/ResizeNearestNeighbor = ResizeNearestNeighbor[T=DT_FLOAT, align_corners=false, _device="/job:localhost/replica:0/task:0/gpu:0"](g_net/apply_4/Relu, g_net/apply_5/ResizeNearestNeighbor/size)]]
W tensorflow/core/framework/op_kernel.cc:975] Internal: Failed launching ResizeNearestNeighbor
[[Node: g_net/apply_5/ResizeNearestNeighbor = ResizeNearestNeighbor[T=DT_FLOAT, align_corners=false, _device="/job:localhost/replica:0/task:0/gpu:0"](g_net/apply_4/Relu, g_net/apply_5/ResizeNearestNeighbor/size)]]
Traceback (most recent call last):
File "stageI/run_exp.py", line 68, in
algo.train()
File "/home/cwt/StackGAN/stageI/trainer.py", line 359, in train
feed_dict)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 766, in run
run_metadata_ptr)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 964, in _run
feed_dict_string, options, run_metadata)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1014, in _do_run
target_list, options, run_metadata)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1034, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InternalError: Failed launching ResizeNearestNeighbor
[[Node: g_net/apply_5/ResizeNearestNeighbor = ResizeNearestNeighbor[T=DT_FLOAT, align_corners=false, _device="/job:localhost/replica:0/task:0/gpu:0"](g_net/apply_4/Relu, g_net/apply_5/ResizeNearestNeighbor/size)]]
[[Node: add_1/_71 = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/cpu:0", send_device="/job:localhost/replica:0/task:0/gpu:0", send_device_incarnation=1, tensor_name="edge_6500_add_1", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"]]

Caused by op u'g_net/apply_5/ResizeNearestNeighbor', defined at:
File "stageI/run_exp.py", line 68, in
algo.train()
File "/home/cwt/StackGAN/stageI/trainer.py", line 306, in train
counter = self.build_model(sess)
File "/home/cwt/StackGAN/stageI/trainer.py", line 280, in build_model
self.init_opt()
File "/home/cwt/StackGAN/stageI/trainer.py", line 101, in init_opt
fake_images = self.model.get_generator(tf.concat(1, [c, z]))
File "/home/cwt/StackGAN/stageI/model.py", line 145, in get_generator
return self.generator(z_var)
File "/home/cwt/StackGAN/stageI/model.py", line 78, in generator
apply(tf.image.resize_nearest_neighbor, [self.s8, self.s8]).
File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1972, in method
result = func(non_seq_layer, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_methods.py", line 425, in apply_op
operation(input_layer.tensor, *op_args, **op_kwargs))
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_image_ops.py", line 818, in resize_nearest_neighbor
name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 759, in apply_op
op_def=op_def)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2240, in create_op
original_op=self._default_original_op, op_def=op_def)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 1128, in init
self._traceback = _extract_stack()

InternalError (see above for traceback): Failed launching ResizeNearestNeighbor
[[Node: g_net/apply_5/ResizeNearestNeighbor = ResizeNearestNeighbor[T=DT_FLOAT, align_corners=false, _device="/job:localhost/replica:0/task:0/gpu:0"](g_net/apply_4/Relu, g_net/apply_5/ResizeNearestNeighbor/size)]]
[[Node: add_1/_71 = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/cpu:0", send_device="/job:localhost/replica:0/task:0/gpu:0", send_device_incarnation=1, tensor_name="edge_6500_add_1", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"]]
`
Dear friends,can you help me ? Thanks a lot!

TypeError: zeros_initializer() takes at least 1 argument (0 given)

i wrote

$ python run_exp.py --cfg stageI/cfg/birds.yml --gpu 0

and it prints out

Traceback (most recent call last):
File "run_exp.py", line 11, in
from stageI.model import CondGAN
File "/home/han/StackGAN/stageI/model.py", line 4, in
import prettytensor as pt
File "/home/han/anaconda2/lib/python2.7/site-packages/prettytensor/init.py", line 25, in
from prettytensor import funcs
File "/home/han/anaconda2/lib/python2.7/site-packages/prettytensor/funcs.py", line 25, in
from prettytensor.pretty_tensor_image_methods import *
File "/home/han/anaconda2/lib/python2.7/site-packages/prettytensor/pretty_tensor_image_methods.py", line 135, in
class conv2d(prettytensor.VarStoreMethod):
File "/home/han/anaconda2/lib/python2.7/site-packages/prettytensor/pretty_tensor_image_methods.py", line 145, in conv2d
bias=tf.zeros_initializer(),
TypeError: zeros_initializer() takes at least 1 argument (0 given)

what should i do?
please help me.

I'm running on Ubuntu 16.04, tensorflow r0.11 with cuda8.0 and cudnn5.1

CUDA driver version is insufficient for CUDA runtime version

The Error Log :-

$ sh demo/birds_demo.sh
/home/oslab/torch-cl/install/bin/luajit: /home/oslab/torch-cl/install/share/lua/5.1/trepl/init.lua:384: /home/oslab/torch-cl/install/share/lua/5.1/trepl/init.lua:384: cuda runtime error (35) : CUDA driver version is insufficient for CUDA runtime version at /tmp/luarocks_cutorch-scm-1-5883/cutorch/lib/THC/THCGeneral.c:16
stack traceback:
[C]: in function 'error'
/home/oslab/torch-cl/install/share/lua/5.1/trepl/init.lua:384: in function 'require'
demo/get_embedding.lua:7: in main chunk
[C]: in function 'dofile'
...b/torch-cl/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
[C]: at 0x00405e90

How long does stageII training take?

I'm training the stageII model with the command
python stageII/run_exp.py --cfg stageII/cfg/birds.yml --gpu 1
But each epoch take 10min on Titan X. Is it natural?

Thanks!

I have an ERROR with STAGE II training.

I wrote
$ python run_exp_stage1.py --cfg stageI/cfg/birds.yml --gpu 1

and prints out

.............................
I tensorflow/core/common_runtime/bfc_allocator.cc:696] 1 Chunks of size 117254912 totalling 111.82MiB
I tensorflow/core/common_runtime/bfc_allocator.cc:696] 10 Chunks of size 134217728 totalling 1.25GiB
I tensorflow/core/common_runtime/bfc_allocator.cc:696] 1 Chunks of size 214433792 totalling 204.50MiB
I tensorflow/core/common_runtime/bfc_allocator.cc:696] 3 Chunks of size 268435456 totalling 768.00MiB
I tensorflow/core/common_runtime/bfc_allocator.cc:696] 1 Chunks of size 276824064 totalling 264.00MiB
I tensorflow/core/common_runtime/bfc_allocator.cc:696] 1 Chunks of size 318767104 totalling 304.00MiB
I tensorflow/core/common_runtime/bfc_allocator.cc:700] Sum Total of in-use chunks: 5.20GiB
I tensorflow/core/common_runtime/bfc_allocator.cc:702] Stats:
Limit: 5632950272
InUse: 5579675904
MaxInUse: 5631752192
NumAllocs: 3795
MaxAllocSize: 1478306560

W tensorflow/core/common_runtime/bfc_allocator.cc:274] ****************************************************************************************************
W tensorflow/core/common_runtime/bfc_allocator.cc:275] Ran out of memory trying to allocate 32.00MiB. See logs for memory state.
W tensorflow/core/framework/op_kernel.cc:993] Resource exhausted: OOM when allocating tensor with shape[64,32,32,128]
Traceback (most recent call last):
File "run_exp_stage2.py", line 71, in
algo.train()
File "/home/han/StackGAN/stageII/trainer.py", line 506, in train
log_vars, sess)
File "/home/han/StackGAN/stageII/trainer.py", line 447, in train_one_step
ret_list = sess.run(feed_out_d, feed_dict)
File "/home/han/anaconda2/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 767, in run
run_metadata_ptr)
File "/home/han/anaconda2/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 965, in _run
feed_dict_string, options, run_metadata)
File "/home/han/anaconda2/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1015, in _do_run
target_list, options, run_metadata)
File "/home/han/anaconda2/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1035, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.ResourceExhaustedError: OOM when allocating tensor with shape[2048,1024,4,4]
[[Node: custom_conv2d_5_3/custom_conv2d/custom_conv2d_5/Conv2D = Conv2D[T=DT_FLOAT, data_format="NHWC", padding="SAME", strides=[1, 2, 2, 1], use_cudnn_on_gpu=true, _device="/job:localhost/replica:0/task:0/gpu:0"](apply_5_3/apply/Maximum, hr_d_net/custom_conv2d_5/custom_conv2d_5/w/read)]]
[[Node: Adam_2/update/_184 = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/cpu:0", send_device="/job:localhost/replica:0/task:0/gpu:0", send_device_incarnation=1, tensor_name="edge_19689_Adam_2/update", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"]]

Caused by op u'custom_conv2d_5_3/custom_conv2d/custom_conv2d_5/Conv2D', defined at:
File "run_exp_stage2.py", line 71, in
algo.train()
File "/home/han/StackGAN/stageII/trainer.py", line 463, in train
counter = self.build_model(sess)
File "/home/han/StackGAN/stageII/trainer.py", line 380, in build_model
self.init_opt()
File "/home/han/StackGAN/stageII/trainer.py", line 142, in init_opt
flag='hr')
File "/home/han/StackGAN/stageII/trainer.py", line 178, in compute_losses
self.model.hr_get_discriminator(images, embeddings)
File "/home/han/StackGAN/stageII/model.py", line 314, in hr_get_discriminator
x_code = self.hr_d_image_template.construct(input=x_var) # s16 * s16 * df_dim*8
File "/home/han/anaconda2/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1248, in construct
return self._construct(context)
File "/home/han/anaconda2/lib/python2.7/site-packages/prettytensor/scopes.py", line 158, in call
return self._call_func(args, kwargs)
File "/home/han/anaconda2/lib/python2.7/site-packages/prettytensor/scopes.py", line 131, in _call_func
return self._func(*args, **kwargs)
File "/home/han/anaconda2/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1924, in _with_method_complete
return input_layer._method_complete(func(*args, **kwargs))
File "/home/han/StackGAN/misc/custom_ops.py", line 82, in call
conv = tf.nn.conv2d(input_layer.tensor, w, strides=[1, d_h, d_w, 1], padding=padding)
File "/home/han/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/gen_nn_ops.py", line 396, in conv2d
data_format=data_format, name=name)
File "/home/han/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 763, in apply_op
op_def=op_def)
File "/home/han/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2327, in create_op
original_op=self._default_original_op, op_def=op_def)
File "/home/han/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1226, in init
self._traceback = _extract_stack()

ResourceExhaustedError (see above for traceback): OOM when allocating tensor with shape[2048,1024,4,4]
[[Node: custom_conv2d_5_3/custom_conv2d/custom_conv2d_5/Conv2D = Conv2D[T=DT_FLOAT, data_format="NHWC", padding="SAME", strides=[1, 2, 2, 1], use_cudnn_on_gpu=true, _device="/job:localhost/replica:0/task:0/gpu:0"](apply_5_3/apply/Maximum, hr_d_net/custom_conv2d_5/custom_conv2d_5/w/read)]]
[[Node: Adam_2/update/_184 = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/cpu:0", send_device="/job:localhost/replica:0/task:0/gpu:0", send_device_incarnation=1, tensor_name="edge_19689_Adam_2/update", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"]]

I have never seen like this error before. please help me :(

this code is implemented on Ubuntu 16.04, Tensorflow r1.0.1, CUDA 8.0, cuDNN 5.1

ImportError: No module named misc.utils

after i wrote

$ python ./misc/preprocess_birds.py

then it prints out

Traceback (most recent call last):
File "./misc/preprocess_birds.py", line 10, in
from misc.utils import get_image
ImportError: No module named misc.utils

please help me guyz :)

I'm implementing this code on
Ubuntu 16.04 LTS
Tensorflow 0.11 with cuda8.0, cudnn5.1

"Too many values to unpack" (stageI training)

Ubuntu 16.04
Python 2.7
Tensorflow 0.12.0
Two GE Force GTX 1080 TI
Core I7
64 GB RAM

When running stageI training with GPU enabled:

python stageI/run_exp.py --cfg stageI/cfg/birds.yml --gpu 1

Stack Trace

Free memory: 10.75GiB
2017-10-17 21:02:08.926351: I tensorflow/core/common_runtime/gpu/gpu_device.cc:961] DMA: 0 1
2017-10-17 21:02:08.926360: I tensorflow/core/common_runtime/gpu/gpu_device.cc:971] 0: Y Y
2017-10-17 21:02:08.926363: I tensorflow/core/common_runtime/gpu/gpu_device.cc:971] 1: Y Y
2017-10-17 21:02:08.926374: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1030] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX 1080 Ti, pci bus id: 0000:01:00.0)
2017-10-17 21:02:08.926379: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1030] Creating TensorFlow device (/gpu:1) -> (device: 1, name: GeForce GTX 1080 Ti, pci bus id: 0000:02:00.0)
Traceback (most recent call last):
File "stageI/run_exp.py", line 68, in
algo.train()
File "/home/kyle/git/StackGAN/stageI/trainer.py", line 306, in train
counter = self.build_model(sess)
File "/home/kyle/git/StackGAN/stageI/trainer.py", line 280, in build_model
self.init_opt()
File "/home/kyle/git/StackGAN/stageI/trainer.py", line 108, in init_opt
self.embeddings)
File "/home/kyle/git/StackGAN/stageI/trainer.py", line 134, in compute_losses
real_logit = self.model.get_discriminator(images, embeddings)
File "/home/kyle/git/StackGAN/stageI/model.py", line 217, in get_discriminator
x_code = self.d_encode_img_template.construct(input=x_var)
File "/home/kyle/git/StackGAN/.env/local/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1248, in construct
return self._construct(context)
File "/home/kyle/git/StackGAN/.env/local/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct
method_args = self._replace_deferred(self._method_args, context)
File "/home/kyle/git/StackGAN/.env/local/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred
return [self._replace_deferred(x, context) for x in arg]
File "/home/kyle/git/StackGAN/.env/local/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred
return arg._construct(context)
File "/home/kyle/git/StackGAN/.env/local/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct
method_args = self._replace_deferred(self._method_args, context)
File "/home/kyle/git/StackGAN/.env/local/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred
return [self._replace_deferred(x, context) for x in arg]
File "/home/kyle/git/StackGAN/.env/local/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred
return arg._construct(context)
File "/home/kyle/git/StackGAN/.env/local/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct
method_args = self._replace_deferred(self._method_args, context)
File "/home/kyle/git/StackGAN/.env/local/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred
return [self._replace_deferred(x, context) for x in arg]
File "/home/kyle/git/StackGAN/.env/local/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred
return arg._construct(context)
File "/home/kyle/git/StackGAN/.env/local/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct
method_args = self._replace_deferred(self._method_args, context)
File "/home/kyle/git/StackGAN/.env/local/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred
return [self._replace_deferred(x, context) for x in arg]
File "/home/kyle/git/StackGAN/.env/local/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred
return arg._construct(context)
File "/home/kyle/git/StackGAN/.env/local/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct
method_args = self._replace_deferred(self._method_args, context)
File "/home/kyle/git/StackGAN/.env/local/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred
return [self._replace_deferred(x, context) for x in arg]
File "/home/kyle/git/StackGAN/.env/local/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred
return arg._construct(context)
File "/home/kyle/git/StackGAN/.env/local/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct
method_args = self._replace_deferred(self._method_args, context)
File "/home/kyle/git/StackGAN/.env/local/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred
return [self._replace_deferred(x, context) for x in arg]
File "/home/kyle/git/StackGAN/.env/local/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred
return arg._construct(context)
File "/home/kyle/git/StackGAN/.env/local/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct
method_args = self._replace_deferred(self._method_args, context)
File "/home/kyle/git/StackGAN/.env/local/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred
return [self._replace_deferred(x, context) for x in arg]
File "/home/kyle/git/StackGAN/.env/local/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred
return arg._construct(context)
File "/home/kyle/git/StackGAN/.env/local/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct
method_args = self._replace_deferred(self._method_args, context)
File "/home/kyle/git/StackGAN/.env/local/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred
return [self._replace_deferred(x, context) for x in arg]
File "/home/kyle/git/StackGAN/.env/local/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred
return arg._construct(context)
File "/home/kyle/git/StackGAN/.env/local/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct
method_args = self._replace_deferred(self._method_args, context)
File "/home/kyle/git/StackGAN/.env/local/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred
return [self._replace_deferred(x, context) for x in arg]
File "/home/kyle/git/StackGAN/.env/local/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred
return arg._construct(context)
File "/home/kyle/git/StackGAN/.env/local/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct
method_args = self._replace_deferred(self._method_args, context)
File "/home/kyle/git/StackGAN/.env/local/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred
return [self._replace_deferred(x, context) for x in arg]
File "/home/kyle/git/StackGAN/.env/local/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred
return arg._construct(context)
File "/home/kyle/git/StackGAN/.env/local/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct
method_args = self._replace_deferred(self._method_args, context)
File "/home/kyle/git/StackGAN/.env/local/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred
return [self._replace_deferred(x, context) for x in arg]
File "/home/kyle/git/StackGAN/.env/local/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred
return arg._construct(context)
File "/home/kyle/git/StackGAN/.env/local/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1176, in _construct
_strip_unnecessary_contents_from_stack(result, set())
File "/home/kyle/git/StackGAN/.env/local/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1335, in _strip_unnecessary_contents_from_stack
for f, line_no, method, _ in result._traceback:
ValueError: too many values to unpack

==========================
Contents of my Requirements.txt

The following requirements were added by pip freeze:

backports.weakref==1.0.post1
bleach==1.5.0
easydict==1.7
enum34==1.1.6
funcsigs==1.0.2
html5lib==0.9999999
Markdown==2.6.9
mock==2.0.0
numpy==1.13.3
pandas==0.20.3
pbr==3.1.1
pkg-resources==0.0.0
prettytensor==0.7.4
progressbar==2.3
protobuf==3.4.0
python-dateutil==2.6.1
pytz==2017.2
six==1.11.0
tensorflow-gpu==1.3.0
tensorflow-tensorboard==0.1.8
torchfile==0.1.0
Werkzeug==0.12.2

The following requirements were added by pip freeze:

backports.weakref==1.0.post1
bleach==1.5.0
easydict==1.7
enum34==1.1.6
funcsigs==1.0.2
html5lib==0.9999999
Markdown==2.6.9
mock==2.0.0
numpy==1.13.3
pandas==0.20.3
pbr==3.1.1
pkg-resources==0.0.0
prettytensor==0.7.4
progressbar==2.3
protobuf==3.4.0
python-dateutil==2.6.1
pytz==2017.2
six==1.11.0
tensorflow-gpu==1.3.0
tensorflow-tensorboard==0.1.8
torchfile==0.1.0
Werkzeug==0.12.2

The following requirements were added by pip freeze:

scikit-learn==0.19.0

The following requirements were added by pip freeze:

backports.weakref==1.0rc1
bleach==1.5.0
easydict==1.7
enum34==1.1.6
funcsigs==1.0.2
html5lib==0.9999999
Markdown==2.2.0
mock==2.0.0
numpy==1.13.3
pandas==0.20.3
pbr==3.1.1
pkg-resources==0.0.0
prettytensor==0.7.4
progressbar==2.3
protobuf==3.4.0
python-dateutil==2.6.1
pytz==2017.2
six==1.11.0
tensorflow-gpu==1.2.0
tensorflow-tensorboard==0.1.8
torchfile==0.1.0
Werkzeug==0.12.2
scikit-learn==0.19.0

The following requirements were added by pip freeze:

backports.functools-lru-cache==1.4
cycler==0.10.0
decorator==4.1.2
matplotlib==2.1.0
networkx==2.0
olefile==0.44
Pillow==4.3.0
pyparsing==2.2.0
PyWavelets==0.5.2
PyYAML==3.12
scikit-image==0.13.1
scipy==0.19.1
subprocess32==3.2.7

Having issues while reproducing

When I am trying to training a GAN model by myself. I met the following issue:

Total filenames: 11788 001.Black_footed_Albatross/Black_Footed_Albatross_0046_18.jpg
Traceback (most recent call last):
File "misc/preprocess_birds.py", line 101, in
convert_birds_dataset_pickle(BIRD_DIR)
File "misc/preprocess_birds.py", line 91, in convert_birds_dataset_pickle
train_filenames = load_filenames(train_dir)
File "misc/preprocess_birds.py", line 27, in load_filenames
with open(filepath, 'rb') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'Data/birds/train/filenames.pickle'

Where Can I find or generate the file 'Data/birds/train/filenames.pickle'?

IOError during StageI training

Here's the traceback for python run_exp.py --cfg cfg/birds.yml --gpu 0

Using config:
{'CONFIG_NAME': 'stageI',
'DATASET_NAME': 'birds',
'EMBEDDING_TYPE': 'cnn-rnn',
'GAN': {'DF_DIM': 64,
'EMBEDDING_DIM': 128,
'GF_DIM': 128,
'NETWORK_TYPE': 'default'},
'GPU_ID': 0,
'TEST': {'BATCH_SIZE': 64,
'CAPTION_PATH': '',
'HR_IMSIZE': 256,
'LR_IMSIZE': 64,
'NUM_COPY': 16,
'PRETRAINED_MODEL': ''},
'TRAIN': {'BATCH_SIZE': 64,
'B_WRONG': True,
'COEFF': {'KL': 2.0},
'COND_AUGMENTATION': True,
'DISCRIMINATOR_LR': 0.0002,
'FINETUNE_LR': False,
'FLAG': True,
'FT_LR_RETIO': 0.1,
'GENERATOR_LR': 0.0002,
'LR_DECAY_EPOCH': 50,
'MAX_EPOCH': 600,
'NUM_COPY': 4,
'NUM_EMBEDDING': 4,
'PRETRAINED_EPOCH': 600,
'PRETRAINED_MODEL': '',
'SNAPSHOT_INTERVAL': 2000},
'Z_DIM': 100}
Traceback (most recent call last):
File "run_exp.py", line 47, in
dataset.test = dataset.get_data(filename_test)
File "/home/rahul/StackGAN_Rahul/misc/datasets.py", line 223, in get_data
with open(pickle_path + self.image_filename, 'rb') as f:
IOError: [Errno 2] No such file or directory: 'Data/birds/test/76images.pickle'

Any idea about a step I may have missed?

pretrained model

Thanks your repo. I am trying to run your program.

Is the provided pretrained model for StackI or StackII.

How about the results if i don't use the text-image function?

Hi, guys. I'm really curious about whether this network can be applied to generate images merely based on image dataset.

And i have deleted the text-encoding module from the code, train the model intimately.The result of stageII is not so satisfactory.

Can anyone give me some advices? Thanks

Using StackGAN demo without Nvidia CUDA

I tried to get StackGAN to work on my cluster by it does not have an NVIDIA GPU. Is it possible to run StackGAN without CUDA, i.e. use the CPU instead? If possible what are the steps?

[Solution] How to run this project with Python 3.x and TensorFlow 1.x

I spent 5 hours getting the program running, which is a great waste of time. I hereby summarize all the necessary changes for this project to run in Python 3.x and TensorFlow r1.x environment.

I assume your working directory is ~/StackGAN/StageI.

1. Python 3.x compatibility issues

In addition to minor changes mentioned in #2, there are still a major issue:

Pickle Issue: The original pickle files are created in Python 2.7, and open it with Python 3 could lead to the following error:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 1: ordinal not in range(128)
The solution can be found here: Unpickle Python 2 object in Python 3

2. TensorFlow r1.x compatibility issues

tf.concat() Issue #11: If you encounter error message like this:
TypeError: Expected int32, got <prettytensor.pretty_tensor_class.Layer object at 0x7f74d41abd90> of type 'Layer' instead.
In TensorFlow r0.12, the function is like
tf.concat(axis, value)
while in TensorFlow r1.x version the argument order has been changed:
tf.concat(value, axis)

PrettyTensor Issue #27: This issue is cause in PrettyTensor module with error message like this:
File ".../site-packages/prettytensor/pretty_tensor_class.py", line 1335, in _strip_unnecessary_contents_from_stack for f, line_no, method, _ in result._traceback: ValueError: too many values to unpack (expected 4)

This issue has nothing to do with PrettyTensor package version, I use the latest 0.7.4 but 0.6.2 should also work.

The main cause of this problem is in _traceback format, in TensorFlow r1.3 the _traceback object is a list with each entry a 6-tuple like this:
('D:\\Anaconda3\\envs\\tensorflow\\lib\\site-packages\\spyder\\utils\\ipython\\start_kernel.py', 241, '<module>', {'__name__': '__main__', '__doc__': '\nFile used to start kernels for the IPython Console\n', '__package__': None, '__loader__': <_frozen_importlib_external.SourceFileLoader object at 0x0000021474E75CF8>, '__spec__': None, '__annotations__': {}, '__builtins__': <module 'builtins' (built-in)>, '__file__': 'D:\\Anaconda3\\envs\\tensorflow\\lib\\site-packages\\spyder\\utils\\ipython\\start_kernel.py', '__cached__': None, 'os': <module 'os' from 'D:\\Anaconda3\\envs\\tensorflow\\lib\\os.py'>, 'osp': <module 'ntpath' from 'D:\\Anaconda3\\envs\\tensorflow\\lib\\ntpath.py'>, 'sys': <module 'sys' (built-in)>, 'IS_EXT_INTERPRETER': True, 'sympy_config': <function sympy_config at 0x00000214799891E0>, 'kernel_config': <function kernel_config at 0x0000021479989268>, 'varexp': <function varexp at 0x00000214799892F0>, 'main': <function main at 0x0000021479989378>}, 9, None)

I guess in TensorFlow r0.12 the entry only contains 4 elements. But anyway here's a quick workaround:

Change
for f, line_no, method, _ in result._traceback:
to
for f, line_no, method, *_ in result._traceback:
*_ takes any number of arguments and resolve whatever left in the unpacked tuple.

3. Summary Issue:
TensorFlow r1.3 has a new summary class so many code should be adapted like this:

tf.merge_all_summaries() -> tf.summary.merge_all()
tf.scalar_summary(k,v) -> tf.summary.scalar(k,v)
summary_writer = tf.train.SummaryWriter(self.log_dir, sess.graph) ->
summary_writer = tf.summary.FileWriter(self.log_dir, sess.graph)

4. Slicing Index Issue:
The index must be integer, so in dataset.py line 80 something should be changed:
# cropped_image =\ # images[i][w1: w1 + self._imsize, h1: h1 + self._imsize, :] original_image = images[i] cropped_image = original_image[int(w1): int(w1 + imsize),\ int(h1): int(h1 + imsize), :]

That's all the major compatibility issues that are necessary for training. Enjoy :)
image

how to run the demo like the flowers_demo.sh to get the train sample ?

I had download all the file required, and want to see the generated samples from the example_captions; but when I run it on the environment:
linux Ubuntu 14.04.5 LTS (GNU/Linux 3.19.0-25-generic x86_64)
tensorflow 1.3.0
python 2.7

and run using the instruction like sh demo/flowers_demo.sh
and got output and error like:
{
doc_length : 201
filenames : "Data/flowers/example_captions.t7"
queries : "Data/flowers/example_captions.txt"
net_txt : "models/text_encoder/lm_sje_flowers_c10_hybrid_0.00070_1_10_trainvalids.txt_iter16400.t7"
}
Successfully load sentences from: Data/flowers/example_captions.t7
Total number of sentences: 8
num_embeddings: 8 (8, 1024)
2018-05-01 13:06:33.652722: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2018-05-01 13:06:33.652751: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2018-05-01 13:06:33.652760: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2018-05-01 13:06:33.652767: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
2018-05-01 13:06:33.652774: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
lr_imsize: 64
Traceback (most recent call last):
File "demo/demo.py", line 193, in
build_model(sess, embeddings.shape[-1], batch_size)
File "demo/demo.py", line 68, in build_model
hr_fake_images = model.hr_get_generator(fake_images, hr_c)
File "/home1/y/StackGAN-master/stageII/model.py", line 195, in hr_get_generator
x_c_code = tf.concat(3, [x_code, c_code])
File "/home/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/array_ops.py", line 1061, in concat
dtype=dtypes.int32).get_shape(
File "/home/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 611, in convert_to_tensor
as_ref=False)
File "/home/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 676, in internal_convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "/home/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/constant_op.py", line 121, in _constant_tensor_conversion_function
return constant(v, dtype=dtype, name=name)
File "/home/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/constant_op.py", line 102, in constant
tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape, verify_shape=verify_shape))
File "/home/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/tensor_util.py", line 376, in make_tensor_proto
_AssertCompatible(values, dtype)
File "/home/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/tensor_util.py", line 302, in _AssertCompatible
(dtype.name, repr(mismatch), type(mismatch).name))
TypeError: Expected int32, got <prettytensor.pretty_tensor_class.Layer object at 0x7f580cfdba90> of type 'Layer' instead.

could anyone help me? Thanks!

Difference between "generator" and "generator_simple"

I have some questions about the functions "generator" and "generator_simple" in model.py, stage-1. It is controlled by __C.GAN.NETWORK_TYPE = 'default' in config.py and the default setting is to use function "generator" for g-net. I can understand the chain generation process shown in the code. But I can't understand the details. Why the ''generator'' just uses the sub-function conv2d instead of conv2d_transpose? What is the difference between the "generator" and "generator_simple" ?

Process bewteen char-CNN-RNN and StackGAN

I would like to know how does the output of text embeddings become the input of the StackGAN. I saw the output of the embedding is with a matrix of [1,1024] for 1 text description. Can anyone explain to me how does the matrix work? and what does is the meaning. Even I put the text description 'abc' it will also have 1024.

Compatibility issue for python3

I notice there is no requirement about python version in readme. But actually besides common import of print and absolute import from future, there are still some issues need to be resolved when I try to run the demo in python3. Including:

  1. I find relative path doesn't work wherever the directory I'm in. Is this alright in python2, or just because I use it in wrong way?

  2. Some string format problem, like caption in drawCaption and the pattern in save_super_images.

  3. dict.iteritem, dict.haskey method has been deprecated in python3, instead dict.items and in are used. So some code in config.py need to be modified.

  4. the result torchfile.load returns doesn't support access values through fetching attribute, like easydict. So I use [] ( e.g. t_file[b'raw_txt'] ) to access values, for a workaround.

  5. in drawCaption, fnt = ImageFont.truetype('Pillow/Tests/fonts/FreeMono.ttf', 50) is used, but I have no clue where the font is, and it doesn't work with any luck. So I use a font in /usr/share/fonts/(Linux).

  6. xrange, in preprocess_birds.py.

At last I run the demo successfully, with a lot of temporary workaround, but I would prefer a indication about python version in the README.

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.