Skip to content

philiWeitz/reinforcement-learning

Repository files navigation

Unity - Python Reinforcement Learning

Example

Install dependencies

  1. navigate to cd ./python-reinforcement-learning
  2. start a new virtualenv pipenv shell
  3. install all dependencies pipenv install

Start python

  1. navigate to cd ./python-reinforcement-learning
  2. start the virtualenv pipenv shell
  3. run script python3.7 ./src/unity-connector.py

Start unity

  1. open unity project
  2. load RaceTrack scene
  3. run scene

Testing your model against real data

If your agent made it through the whole track, a ppo_actor.h5 and a ppo_critic.h5 file will be created. The test script will generate a video visualizing how your agent would reacted given real "markku" images (https://markku.ai/).

  1. check that a valid model.h5 file is available
  2. navigate to cd ./python-reinforcement-learning
  3. start the virtualenv pipenv shell
  4. run script python3.7 ./src/test.py

Run the game headless

  1. build the game using unity (name of the app in my case is "game-build")
  2. open comand line and navigate to cd <path-to-build>/game-build.app/Contents/MacOS
  3. run the game in batch mode ./game-build -batchmode

Create a frame by frame recording

  1. navigate to cd ./python-reinforcement-learning
  2. start the virtualenv pipenv shell
  3. run the recording script python ./src/recording.py
  4. open the unity project and start the game
  5. the recoding will be saved as soon as the goal is reached or you are off track

Next Up

  1. give higher rewards to agents which complete the track with the least steps
  2. add additional exploraton strategies such as RND or self-supervised prediction

Analyse the model using tensorboard (Not Implemented Yet)

  1. navigate to cd ./python-reinforcement-learning
  2. start the virtualenv pipenv shell
  3. run tensorboard --logdir ./logs
  4. start agent training
  5. open web interface http://localhost:6006/

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published