research icon indicating copy to clipboard operation
research copied to clipboard

view_generative_model.py fail to generate animation

Open longjie opened this issue 8 years ago • 5 comments

Hi,

I have successfully trained the transition model. Now I'm going to generate the gif of the predicted image. I followed instructions:

$ ./server.py --time 60 --batch 64
$ ./view_generative_model.py transition --name transition

I got an error:

loading weights...
Traceback (most recent call last):
  File "./view_generative_model.py", line 71, in <module>
    x = X.reshape((sh[0], args.time, 80, 160, 3))
ValueError: cannot reshape array of size 147456000 into shape (64,1,80,160,3)

I thought I may need to make the input size matched, I add time and batch options as:

$ ./view_generative_model.py transition --name transition --batch 64 --time 60

I got another error:

loading weights...
Sampling...
  0%|                                                   | 0/128 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "./view_generative_model.py", line 83, in <module>
    code = sess.run([E_out[0]], feed_dict={I: x, K.learning_phase(): 1})[0]
  File "/home/tajima/.local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 766, in run
    run_metadata_ptr)
  File "/home/tajima/.local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 943, in _run
    % (np_val.shape, subfeed_t.name, str(subfeed_t.get_shape())))
ValueError: Cannot feed value of shape (3840, 80, 160, 3) for Tensor u'transition/input_1:0', which has shape '(960, 80, 160, 3)'

How can I make it work?

longjie avatar Jan 23 '17 08:01 longjie

hi.i meet the same problem,have you solve it ?thanks

zhaobaozi avatar Mar 22 '17 05:03 zhaobaozi

Hello.I have the same question with you.Do you solve it?Thank you very much.It will be better if you could help me to solve it.

yangyuekai avatar Jan 08 '18 02:01 yangyuekai

Hi, I have solved this problem by using the following instructions: $ ./server.py --time 15 --batch 7 $ ./view_generative_model.py --name transition --time 15 --batch 7 You can have a try.

Ling-wei avatar Mar 23 '18 08:03 Ling-wei

oh.I have tried it.But,there is a warning: ValueError:Cannot feed value of shape(35,512)for Tensor u'transition/dense_input_1:0',which has shape '(98,512)'.So,did you have changed code ? It is hepld me very much.Thanks!

yangyuekai avatar Mar 23 '18 11:03 yangyuekai

@yangyuekai Hi, I didn't change the code from github. I guess your problem from this command( line 87 ) imgs = sess.run([G_out], feed_dict={O: outs.reshape((-1, z_dim)), K.learning_phase(): 1})[0] The shape of G_out is (98,512) and the feed_dict which is the output of transition model should also be like this. You can check if something wrong when training the transition model because when I ran the command ./view_generative_model.py transition --time 15 --batch 7 the screen output T.shape: (7, 14, 512), maybe your model made some mistake and had a wrong output just like T.shape: (7, 5, 512)

Ling-wei avatar Mar 24 '18 02:03 Ling-wei