零基础10分钟运行DQN图文教程 Playing Flappy Bird Using Deep Reinforcement Learning (Based on Deep Q Learning DQN


文件下载

链接:http://pan.baidu.com/s/1jH9ItTW  密码:0pmq

文件列表

Anaconda3-4.2.0-Windows-x86_64.exe    (python3.5.2)

pycharm-community-2017.2.4.exe

tensorflow_gpu-1.1.0-cp35-cp35m-win_amd64.whl  或 (tensorflow_cpu-1.1.0-cp35-cp35m-win_amd64.whl),1.1.0以上版本

pygame-1.9.3-cp35-cp35m-win_amd64.whl


安装顺序:

联想笔记本电脑T430、64位机

1. win7旗舰sp1

2.Anaconda3-4.2.0-Windows-x86_64.exe 

3.   pycharm-community-2017.2.4.exe

4.  tensorflow_gpu-1.1.0-cp35-cp35m-win_amd64.whl 

5.  pip install pygame  

系统会自动匹配和python对应的版本

或者  pip  install c:\pygame-1.9.3-cp35-cp35m-win_amd64.whl


完整项目下载

https://github.com/songrotek/DRL-FlappyBird

说明:python2.x版本,在python3.x环境需要修改部分函数命名和使用方法。


运行

python C:\DRL-FlappyBird-master\FlappyBirdDQN.py



效果




运行说明

随着训练,小鸟飞行距离越来越远。

训练需要时长比较长。


问题和解决方法总结

问题1:

  File "C:\DRL-FlappyBird-master\BrainDQN_Nature.py", line 155
    print "TIMESTEP", self.timeStep, "/ STATE", state, \
                   ^
SyntaxError: Missing parentheses in call to 'print'


print在python3.x里面 加(),这样print()


问题2:

AttributeError: 'itertools.cycle' object has no attribute 'next'

https://stackoverflow.com/questions/5237611/itertools-cycle-next

iter.next() was removed in python 3. Use next(iter) instead. So in your example change itertools.cycle().next() to next(itertools.cycle())

There is a good example here along with various other porting to python 3 tips. It also compares various other next() idioms in python 2.x vs python 3.x

wrapped_flappy_bird.py

#self.playerIndex = PLAYER_INDEX_GEN.next()
self.playerIndex = next(PLAYER_INDEX_GEN)

问题3:

  File "C:\DRL-FlappyBird-master\game\wrapped_flappy_bird.py", line 222, in pixelCollision
    for x in xrange(rect.width):
NameError: name 'xrange' is not defined

xrange  修改wierange

问题4:

WARNING:tensorflow:From C:\DRL-FlappyBird-master\BrainDQN_Nature.py:45: initialize_all_variables (from tensorflow.python.ops.variables) is deprecated and will be removed after 2017-03-02.
Instructions for updating:
Use `tf.global_variables_initializer` instead.

#self.session.run(tf.initialize_all_variables())
self.session.run(tf.global_variables_initializer)

问题5:

ImportError: No module named 'pygame'

pip install pygame   会自动匹配和python对应的版本

或者  pip  install c:\pygame-1.9.3-cp35-cp35m-win_amd64.whl


遇到问题、分享经验欢迎加入QQ群:452205574


  • 3
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值