• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

vdutor/TF-rex: Play Google Chrome's T-rex game with TensorFlow

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

vdutor/TF-rex

开源软件地址:

https://github.com/vdutor/TF-rex

开源编程语言:

JavaScript 60.3%

开源软件介绍:

TF-rex

In this project we play Google's T-rex game using Reinforcement Learning. The RL algorithm is based on the Deep Q-Learning algorithm [1] and is implemented from scratch in TensorFlow.

===========================================================================

CHECK OUT THE ACCOMPAGNYING BLOGPOST - it contains a lot more useful information.

===========================================================================

Dependencies

  • Python 3.5 or higher
  • Pillow 4.3.0
  • scipy 0.19.1
  • tensorflow 1.7.0 or higher
  • optional: tensorflow tensorboard

Installation

Tested on MacOs, Debian, Ubuntu, and Ubuntu-based distros.

Start by cloning the repository

$ git clone https://github.com/vdutor/TF-rex

We recommend creating a virtualenv before installing the required packages. See virtualenv or virtualenv-wrapper on how to do so.

The dependencies can be easly installed using pip.

$ optional: open the virtualenv
$ pip install -r requirements.txt

Getting started

Webserver for running the javascript T-rex game

A simple webserver is required to run the T-rex javascript game. The easiest way to achieve this is by using python's Simple HTTP Server module. Open a new terminal and navigate to TF-Rex/game, then run the following command

$ cd /path/to/project/TF-Rex/game
$ python2 -m SimpleHTTPServer 8000

The game is now accessable on your localhost 127.0.0.1:8000. This approach was tested for Chrome and Mozilla Firefox.

Tf-Rex

First, all the commandline arguments can be retrieved with

$ cd /path/to/project/TF-Rex/tf-rex
$ python main.py --help

Quickly check if the installation was successful by playing with a pretrained Q-learner.

$ python main.py --notraining --logdir ../trained-model

This command will restore the pretrained model, stored in ../trained-model and play the T-rex game.

IMPORTANT: The browser needs to connect with the python side. Therefore, refresh the browser after firing python main.py --notraining --logdir ../trained-model.

TF-REX

Training a new model can be done as follows

$ python main.py --logdir logs

Again, the browser needs to be refreshed to start the process. The directory passed as logdir argument will be used to store intermediate tensorflow checkpoints and tensorboard information.

While training, a different terminal can be opened to launch the tensorboard

$ tensorboard --logdir logs

The tensorboards will be visible on http://127.0.0.1:6006/.

References

[1] Playing Atari with Deep Reinforcement Learning




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
DaramG/Chrome发布时间:2022-04-18
下一篇:
gregnb/react-to-print: Print React components in the browser. Supports Chrome, S ...发布时间:2022-04-18
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap