Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问下有关cartpole使用图像输入的问题 #6

Open
Rulen9987 opened this issue Mar 21, 2022 · 2 comments
Open

请问下有关cartpole使用图像输入的问题 #6

Rulen9987 opened this issue Mar 21, 2022 · 2 comments

Comments

@Rulen9987
Copy link

你好,我尝试在训练cartpole游戏的时候,将DQN的输入改为84x84的图像,action始终都会趋向只有一个方向的问题,请教下有这方面的建议吗?
网络设计:conv2d + conv2d + conv2d + fc
reward:使用默认的1结束时为0 和 theta / (1 - thetaThreshold)两种计算方式都尝试过
Q值:dqn和ddqn都试过

@zhaoyingjun
Copy link
Owner

你在每个卷积层后面加上一个pooling层做特征提取,你现在只是做了卷积了。

@Rulen9987
Copy link
Author

没有详细描述我的网络结构,用的是slim工具,卷积后是有作maxpool
以尝试过如下方法:
1.模仿darknet不使用pooling而直接使用卷积也尝试过。
2.增加网络深度。
3.参考darknet加入resnet层,层数一般为2

同样的问题也请教其他人,结果也是一样,达不到gym返回的state作为输入的效果。

我的结构如下,改过很多次,这是最近的一次:
with slim.arg_scope([slim.conv2d,slim.batch_norm], reuse=False):
with slim.arg_scope([slim.conv2d],
normalizer_fn = slim.batch_norm,
normalizer_params = batch_norm_params,
biases_initializer=tf.constant_initializer(0.1),
weights_initializer=tf.random_normal_initializer(0., 0.1),
activation_fn=lambda x: tf.nn.relu(x),
):
net = self.conv2d(inputs, 16, 5,strides=2,cname=self.mmodel_name + "-c1")
net = slim.max_pool2d(net,[2,2],padding="SAME",scope=self.mmodel_name+"-mp1")

            net = self.conv2d(net, 32, 5, strides=2,cname=self.mmodel_name +"-c2")  
            net = slim.max_pool2d(net, [2, 2], padding="SAME", scope=self.mmodel_name + "-mp2")

            net = self.conv2d(net, 64, 3, strides=2,cname=self.mmodel_name +"-c3")  
           #这里接了2个fc,不过差别不大
            net = slim.flatten(net, scope='flatten')
            net = slim.fully_connected(net, 1024, scope=self.mmodel_name + "-fc2")
            fc_out = slim.fully_connected(net, output_count, activation_fn=None,scope=self.mmodel_name +"-fc3")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants