GithubHelp home page GithubHelp logo

cnn_lstm_bot's Introduction

A CNN + LSTM bot for full game mode in FIFA 18

Introduction

This work is based on ChintanTrivedi/DeepGamingAI_FIFA, re-implemented using BigDL and Analytics-Zoo from Intel-analytics group.

It uses a MobileNet to extract visual features from screen-shots of FIFA game. Then the feature is stacked with previous features (to enable time series prediction) and fed into two LSTM networks. One LSTM network predicts where to move the human, another predicts which action to take. Then the signal is converted to keyboard signal and send to the game.

CNN_LSTM_bot

Development state

Code has been tested with the following specifications:

  • Windows 10 Enterprise
  • CUDA V9.1.85
  • Python 3.6.6 from Anaconda
  • Analytics-zoo 0.3.0 (Nightly 20180802.173847-26), pre-built with bigdl 0.6.0, and spark 2.2.0

TODO:

  • Training code for LSTM models
  • Training code for MobilNet
  • Inference speed test
  • More training samples for different situations

Run demo

Preparation

  1. Change the path to spark-submit executable in run_zoo.bat.

  2. Open an Anaconda prompt, direct to this project root.

  3. Find the Kick Off full game mode in FIFA 18: Play -> Kick Off

  4. Choose your team and start the game. You may skip all animations by pressing space.

Testing

  1. Run run_zoo.bat.

  2. When the game is ready, enter 'p' in the prompt and click the game again (to move the focus point back to the game).

  3. Your player should be controlled by the bot now.

Training

The code used to collect training data can be found in create_lstm_training_data.py. Start the game and run this script (it doesn't depend on BigDL or Zoo so just with python is fine), the training data will be stored in rnn folder.

Uncomment the following lines in zoo_main.py:

# train_LSTM = 1

# if train_LSTM:
    # lstm_predictor = LSTMPredictor()
    # lstm_predictor.train()

Then the training will be started.

Project structure

The main access point for BigDL/Zoo adaption is zoo_main.py.

CNN feature extractor

Find more of this part in zoo_cnn.py. The CNN used in this project is a MobileNet-SSD detection framework, originally provided by Tensorflow object detection model. The original author of DeepGaming_FIFA finetunes the MobileNet-SSD model with some FIFA training samples, see ssd_mobilenet_training folder in backup_files.

To use the network in BigDL/Zoo, it is wraped into TFNet model, reference here. Since TFNet doesn't feature model training, the reader will have to fine-tune the original Tensorflow model using their API and then convert to TFNet in order to fit this project. See DetectionNet > convert_from_tf for model conversion.

LSTM model

Find more of this part in zoo_lstm.py. The LSTM model is written with BigDL Keras API, and trained with self-collected data. To train the model, you'll need more data for supervised learning. You'll need to run create_lstm_training_data.py as you play, and the logged data is stored in rnn folder. See LSTMPredictor > train for training code.

cnn_lstm_bot's People

Contributors

shanyu-sys avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.