/trex-keras-cnn

Play T-Rex game with Keras using convolutional neural network

Primary LanguagePythonMIT LicenseMIT

T-Rex Keras CNN

T-rex game

http://www.trex-game.skipser.com

Install Requirement

pip install -r requirements.txt

Recommended to use Tensorflow-GPU as backend

Instruction

1. Collect Data

This game use 3 keys on keyboard to record screen capture, the screen capture image will store in ./img/ folder. The image capture resolution is 650x130 pixel

Key Description
Up Arrow (↑) T-Rex Jump
Down Arrow (↓) T-Rex Crouch
Right Arrow (→) T-Rex ran normal

if you want to exit collect_data.py press esc key.

Please check your screen capture correction in the folder ./img/ before go to next step

Example image captured

2. Training

Just run train.py

python train.py

train until 98%+ accuracy. the weight file trex_weight.h5 will create.

3. Play your model

run player.py as root (require root by keybaord package)

python player.py

It possible T-Rex will jump before barrier, you can modify delay in player.py

Dataset & Pretrained Model

Available soon

Contributing

Feel free to contribute on this project, I will be happy to work with you.

License

The MIT License (MIT)