manicman1999 / StyleGAN2-Tensorflow-2.0

StyleGAN 2 in Tensorflow 2.0
MIT License
486 stars 111 forks source link

load LandscapesBig mode error #5

Open alphabeta10 opened 4 years ago

alphabeta10 commented 4 years ago

model.load(28)

n1 = noiseList(64)
n2 = nImage(64)
for i in range(50):
    print(i, end = '\r')
    model.generateTruncated(n1, noi = n2, trunc = i / 50, outImage = True, num = i)

error 2020-01-27 14:14:23.735268: W tensorflow/core/common_runtime/base_collective_executor.cc:216] BaseCollectiveExecutor::StartAbort Invalid argument: input and filter must have the same depth: 1536 vs 96 [[{{node conv2d_mod_23/Conv2D}}]] Traceback (most recent call last): File "/Users/pig/PycharmProjects/StyleGAN2-Tensorflow-2.0/stylegan_two.py", line 646, in model.generateTruncated(n1, noi = n2, trunc = i / 50, outImage = True, num = i) File "/Users/pig/PycharmProjects/StyleGAN2-Tensorflow-2.0/stylegan_two.py", line 567, in generateTruncated generated_images = self.GAN.GE.predict(w_space + [noi], batch_size = BATCH_SIZE) File "/Users/pig/anaconda3/envs/tf2/lib/python3.6/site-packages/tensorflow_core/python/keras/engine/training.py", line 909, in predict use_multiprocessing=use_multiprocessing) File "/Users/pig/anaconda3/envs/tf2/lib/python3.6/site-packages/tensorflow_core/python/keras/engine/training_arrays.py", line 722, in predict callbacks=callbacks) File "/Users/pig/anaconda3/envs/tf2/lib/python3.6/site-packages/tensorflow_core/python/keras/engine/training_arrays.py", line 393, in model_iteration batch_outs = f(ins_batch) File "/Users/pig/anaconda3/envs/tf2/lib/python3.6/site-packages/tensorflow_core/python/keras/backend.py", line 3740, in call outputs = self._graph_fn(*converted_inputs) File "/Users/pig/anaconda3/envs/tf2/lib/python3.6/site-packages/tensorflow_core/python/eager/function.py", line 1081, in call return self._call_impl(args, kwargs) File "/Users/pig/anaconda3/envs/tf2/lib/python3.6/site-packages/tensorflow_core/python/eager/function.py", line 1121, in _call_impl return self._call_flat(args, self.captured_inputs, cancellation_manager) File "/Users/pig/anaconda3/envs/tf2/lib/python3.6/site-packages/tensorflow_core/python/eager/function.py", line 1224, in _call_flat ctx, args, cancellation_manager=cancellation_manager) File "/Users/pig/anaconda3/envs/tf2/lib/python3.6/site-packages/tensorflow_core/python/eager/function.py", line 511, in call ctx=ctx) File "/Users/pig/anaconda3/envs/tf2/lib/python3.6/site-packages/tensorflow_core/python/eager/execute.py", line 67, in quick_execute six.raise_from(core._status_to_exception(e.code, message), None) File "", line 3, in raise_from tensorflow.python.framework.errors_impl.InvalidArgumentError: input and filter must have the same depth: 1536 vs 96 [[node conv2d_mod_23/Conv2D (defined at /anaconda3/envs/tf2/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py:1751) ]] [Op:__inference_keras_scratch_graph_20999]

Function call stack: keras_scratch_graph

pyrator commented 4 years ago

I have this issue too. Note that 1536 is 16 * 96. Could this be an issue with BATCH_SIZE? So changing BATCH_SIZE to 1 generates images in the Results folder.

vii33 commented 4 years ago

tensorflow.python.framework.errors_impl.InvalidArgumentError: input and filter must have the same depth: 1536 vs 96

Same problem here. Changing the batch size to 1 helped solving this issue.

pyrator commented 4 years ago

I ran the section of code to generateTruncated using one of preexisting models, LandscapeBig.zip. This is model 28. I commented out the section to evaluate and train and then amended the model.load parameter to 28. I'm not sure how necessary it is to have your own data in place in the data subfolder as these are for training I believe, but I had used 256 by 256 images. The problem was when I tried to train the code crashes eventually with a GPU (unfortunately it;s only a 1050 Ti) - possibly some sort of GPU memory issue, and it would take an extremely long time with a CPU, which I tried but it looked like it was going to take many days.

so here's my snippet of code if name == "main":

model = StyleGAN(lr = 0.0001, silent = False)
#model.evaluate(0)

#while model.GAN.steps < 1000001:
#    model.train()

model.load(28)

n1 = noiseList(64)
n2 = nImage(64)
for i in range(50):
    print(i, end = '\r')
    model.generateTruncated(n1, noi = n2, trunc = i / 50, outImage =

True, num = i)

On Sat, 8 Feb 2020 at 14:03, derveit notifications@github.com wrote:

tensorflow.python.framework.errors_impl.InvalidArgumentError: input and filter must have the same depth: 1536 vs 96 Same problem here. Changing the batch size to 1 helped solving this issue.

Unfortunately there is no output image created. @pyrator https://github.com/pyrator : What dimensions and format do your images have? Thanks.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/manicman1999/StyleGAN2-Tensorflow-2.0/issues/5?email_source=notifications&email_token=AAUZPLGD32NE5KOHEEJWKBLRB23R3A5CNFSM4KL4GW3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELFSPPA#issuecomment-583739324, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAUZPLFXGWCNUINBN7MYMB3RB23R3ANCNFSM4KL4GW3A .

gaborvecsei commented 4 years ago

Same problem. If you set the batch size to 1 then it works. But a fix is needed.