simoninithomas / Deep_reinforcement_learning_Course

Implementations from the free course Deep Reinforcement Learning with Tensorflow and PyTorch
http://www.simoninithomas.com/deep-rl-course
3.74k stars 1.23k forks source link

[Deep Q Learning with Doom] ValueError: Cannot feed value of shape (64, 84, 84, 4, 260) for Tensor 'DQNetwork/inputs:0', which has shape '(?, 84, 84, 4)' #40

Open tyseng92 opened 5 years ago

tyseng92 commented 5 years ago

I have tried to run the script provided in the tutorial in terminal. After the doom windows pop out for a few seconds, the value error appeared. (ValueError: Cannot feed value of shape (64, 84, 84, 4, 260) for Tensor 'DQNetwork/inputs:0', which has shape '(?, 84, 84, 4)') Platform: Ubuntu 16.04 Tensorflow version: 1.12.0

Here is the output of the error in terminal after the program run failed:

Traceback (most recent call last):
  File "dqdoom.py", line 481, in <module>
    Qs_next_state = sess.run(DQNetwork.output, feed_dict = {DQNetwork.inputs_: next_states_mb})
  File "/home/work-tys/.local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 929, in run
    run_metadata_ptr)
  File "/home/work-tys/.local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1128, in _run
    str(subfeed_t.get_shape())))
ValueError: Cannot feed value of shape (64, 84, 84, 4, 260) for Tensor 'DQNetwork/inputs:0', which has shape '(?, 84, 84, 4)'

How to modify the dimension of next_states_mb in order to fit the array required by the DQNetwork.inputs?

mattguerrero commented 5 years ago

I'm having the same issue, were you able to figure out a solution?

tyseng92 commented 5 years ago

I'm having the same issue, were you able to figure out a solution?

No, haven't found a solution for this problem.

DrDumbenstein commented 5 years ago

The Screen format in vizdoom isn't grayscale. the default value is CRCGCB.. You have to import ScreenFormat from vizdoom and type this when creating the environment : game.set_screen_format(ScreenFormat.GRAY8)

mudassirej commented 4 years ago

game.set_screen_format(ScreenFormat.GRAY8)

can you please send the snippet of code of how to use this line in the code?

StruyfL commented 4 years ago

game.set_screen_format(ScreenFormat.GRAY8)

can you please send the snippet of code of how to use this line in the code?

You can add that line of code in the create_environment function, right before game.init()

Alternatively, you could change the basic.cfg file, and change the line screen_format = CRCGCB to screen_format = GRAY8 (Which is what I did first before I found the method above)