Closed ouyangzhuzhu closed 6 years ago
here is my command: ./train_dqn.py -s settings/examples/defend_the_center_dqn.yml
and the full context of my yml is: config_file: defend_the_center.cfg scenario_tag: defend_cent
resolution: [40, 30] conv_filters_num: [ 32, 32 ] conv_filters_sizes: [ 4, 3 ] conv_strides: [ 2, 1 ]
epsilon_decay_steps: 2e05
train_steps_per_epoch: 5000 frozen_steps: 2000
run_tag: dqn_defend_the_center use_misc: false
Did you modify the resolution and/or filter sizes/strides? Convolutions do not work with all kinds of combinations of these, and in this case (I think) you try to convolve over smaller image than the size of filter. If these were default settings, then something must have changed internally in Tensorflow that broke the code.
3ks Miffyli, this problem slovede like this , modifying the yml from : conv_filters_num: [ 32, 32 ] conv_filters_sizes: [ 4, 3 ] conv_strides: [ 2, 1 ]
to: conv_filters_num: [ 32 ] conv_filters_sizes: [ 4 ] conv_strides: [ 2 ]
because in the code there is only one conv-level for dqn , i guss there is some special method when in a3c.
In common.py:
def get_input_layers(self, img_input=None, misc_input=None, name_scope=None): ..... conv_layers = create_conv_layers(img_input, name_scope, self.conv_filters_num, self.conv_filters_sizes, self.conv_strides) if self.use_misc: if misc_input is None: misc_input = self.vars.state_misc fc_input = tf.concat(values=[conv_layers, misc_input], axis=1) else: (the misc is none in my defent_the_center_dqn.yml) fc_input = conv_layers
here I have quesion below when I run dqn for defend the center senario: How can I solve it.... Traceback (most recent call last): File "/home/d3alg/.local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1567, in _create_c_op c_op = c_api.TF_FinishOperation(op_desc) tensorflow.python.framework.errors_impl.InvalidArgumentError: Negative dimension size caused by subtracting 3 from 1 for 'dueling_dqn/conv1/Conv2D' (op: 'Conv2D') with input shapes: [?,1,14,32], [3,3,32,32].
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "./train_dqn.py", line 6, in
train_dqn()
File "/home/lab/wsy/deep_rl_vizdoom/_train_test.py", line 74, in train_dqn
dqn = DQN(model_savefile=model_savefile, settings)
File "/home/lab/wsy/deep_rl_vizdoom/_dqn_algo.py", line 80, in init
settings)
File "/home/lab/wsy/deep_rl_vizdoom/networks/dqn.py", line 122, in init
super(DuelingDQNNet, self).init(*args, kwargs)
File "/home/lab/wsy/deep_rl_vizdoom/networks/dqn.py", line 44, in init
self._prepare_ops()
File "/home/lab/wsy/deep_rl_vizdoom/networks/dqn.py", line 55, in _prepare_ops
name_scope=self._name_scope)
File "/home/lab/wsy/deep_rl_vizdoom/networks/dqn.py", line 130, in create_architecture
fc_input = self.get_input_layers(img_input, misc_input, name_scope)
File "/home/lab/wsy/deep_rl_vizdoom/networks/common.py", line 72, in get_input_layers
self.conv_strides)
File "/home/lab/wsy/deep_rl_vizdoom/networks/common.py", line 20, in create_conv_layers
padding="VALID", scope=name_scope + "/conv" + str(i))
File "/home/d3alg/.local/lib/python3.6/site-packages/tensorflow/contrib/framework/python/ops/arg_scope.py", line 183, in func_with_args
return func(*args, *current_args)
File "/home/d3alg/.local/lib/python3.6/site-packages/tensorflow/contrib/layers/python/layers/layers.py", line 1049, in convolution
outputs = layer.apply(inputs)
File "/home/d3alg/.local/lib/python3.6/site-packages/tensorflow/python/layers/base.py", line 828, in apply
return self.call(inputs, args, kwargs)
File "/home/d3alg/.local/lib/python3.6/site-packages/tensorflow/python/layers/base.py", line 717, in call
outputs = self.call(inputs, *args, **kwargs)
File "/home/d3alg/.local/lib/python3.6/site-packages/tensorflow/python/layers/convolutional.py", line 168, in call
outputs = self._convolution_op(inputs, self.kernel)
File "/home/d3alg/.local/lib/python3.6/site-packages/tensorflow/python/ops/nn_ops.py", line 868, in call
return self.conv_op(inp, filter)
File "/home/d3alg/.local/lib/python3.6/site-packages/tensorflow/python/ops/nn_ops.py", line 520, in call
return self.call(inp, filter)
File "/home/d3alg/.local/lib/python3.6/site-packages/tensorflow/python/ops/nn_ops.py", line 204, in call
name=self.name)
File "/home/d3alg/.local/lib/python3.6/site-packages/tensorflow/python/ops/gen_nn_ops.py", line 956, in conv2d
data_format=data_format, dilations=dilations, name=name)
File "/home/d3alg/.local/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/home/d3alg/.local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3392, in create_op
op_def=op_def)
File "/home/d3alg/.local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1734, in init
control_input_ops)
File "/home/d3alg/.local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1570, in _create_c_op
raise ValueError(str(e))
ValueError: Negative dimension size caused by subtracting 3 from 1 for 'dueling_dqn/conv1/Conv2D' (op: 'Conv2D') with input shapes: [?,1,14,32], [3,3,32,32].