用Tensorflow训练的AI玩flappy bird小游戏
2017-08-16 21:46
471 查看
原作者的理论介绍文章:
程序员带你一步步分析AI如何玩Flappy Bird
http://www.jianshu.com/p/0a04426ee3ad
本文只介绍如何配置系统玩起来,基于ubuntu 16.04.
https://www.continuum.io/downloads#linux
cd 下载
sudo chmod +x Anaconda3-4.4.0-Linux-x86_64.sh
./Anaconda3-4.4.0-Linux-x86_64.sh
这个是for python3.6的,因为现在的tensorflow版本是for python 3.5的,改成3.5免得有问题:
conda install python=3.5
cd DeepLearningFlappyBird
python deep_q_network.py
运行报错:
pygame.image.load('assets/sprites/0.png').convert_alpha(),
pygame.error: File is not a Windows BMP file
不知道什么问题,干脆把png全部另存为bmp,在报错的py文件中也做相应修改。
再运行还是报错:找不到sdl_mixer。
不知道什么问题,直接把程序中的mixer相关语句注释掉即可,鸟死的时候你自己“啊”一声吧。
再运行,就可以看到小鸟自动飞啊飞了:
程序员带你一步步分析AI如何玩Flappy Bird
http://www.jianshu.com/p/0a04426ee3ad
本文只介绍如何配置系统玩起来,基于ubuntu 16.04.
1.安装anaconda
下载地址:https://www.continuum.io/downloads#linux
cd 下载
sudo chmod +x Anaconda3-4.4.0-Linux-x86_64.sh
./Anaconda3-4.4.0-Linux-x86_64.sh
这个是for python3.6的,因为现在的tensorflow版本是for python 3.5的,改成3.5免得有问题:
conda install python=3.5
2.安装opencv
conda install --channel https://conda.anaconda.org/menpo opencv33.安装tensorflow
conda install tensorflow4.安装pygame
conda install --channel https://conda.anaconda.org/kne pygame5.安装sdl
conda install --channel https://conda.anaconda.org/ufechner sdl6.运行小鸟游戏
git clone https://github.com/yenchenlin1994/DeepLearningFlappyBird.gitcd DeepLearningFlappyBird
python deep_q_network.py
运行报错:
pygame.image.load('assets/sprites/0.png').convert_alpha(),
pygame.error: File is not a Windows BMP file
不知道什么问题,干脆把png全部另存为bmp,在报错的py文件中也做相应修改。
再运行还是报错:找不到sdl_mixer。
不知道什么问题,直接把程序中的mixer相关语句注释掉即可,鸟死的时候你自己“啊”一声吧。
再运行,就可以看到小鸟自动飞啊飞了:
相关文章推荐
- tensorflow训练ai玩flappybird
- 百度AI攻城狮,用TensorFlow API训练目标检测模型(浣熊超可爱)
- TensorFlow全流程样板代码:以ai challenger 场景分类和slim预训练模型为例
- 用tensorflow训练模型来玩微信小游戏“跳一跳”。
- tensorflow训练打游戏ai
- 基于tensorflow的躲避障碍物的ai训练
- TensorFlow训练线性回归
- [TensorFlow学习笔记2]构建训练softmax分类器
- 学习TensorFlow,调用预训练好的网络(Alex, VGG, ResNet etc)
- 用tensorflow实现VGG网络,训练mnist数据集
- 摩尔定律搅局者:这家公司用光训练 AI,而不是GPU
- 伯克利AI分布式框架Ray,兼容TensorFlow、PyTorch与MXNet
- Facebook开源Caffe2深度学习框架:开发者可快速训练和迭代AI模型
- tensorflow的基本用法(九)——定义卷积神经网络训练MNIST
- Tensorflow中mnist数据使用CNN训练
- Qt小游戏开发:五子棋(带AI功能)
- Tensorflow 训练自己的cnn模型 行人识别
- 手把手教你制作那个风靡的flappy bird小游戏(一)
- tensorflow 生成pb文件(训练结束后用官方提供的脚本手动生成)
- 现代英特尔® 架构上的 TensorFlow* 优化——正如去年参加Intel AI会议一样,Intel自己提供了对接自己AI CPU优化版本的Tensorflow,下载链接见后,同时可以基于谷歌官方的tf版本直接编译生成安装包