imagry / Gym-Torcs-DQN

Torcs-DQN implementaion
http://www.imagry.co/?p=49609
Other
13 stars 5 forks source link

Video

Blog post with details and description.

Installation:

  1. Install Caffe with opencv2 (opencv is also neeeded for this version of gym-torcs) https://github.com/BVLC/caffe

  2. install Torcs dependencies 1.0 remove old gym-torc if necessary:

    • make distclean

    1.1 xautomation (http://linux.die.net/man/7/xautomation)

    • apt-get install xautomation

    1.2 OpenAI-Gym (https://github.com/openai/gym)

    • apt-get install -y python-numpy python-dev cmake zlib1g-dev libjpeg-dev xvfb libav-tools xorg-dev python-opengl libboost-all-dev libsdl2-dev swig
    • pip install gym
  3. Install gym-torcs 2.1 install vtorcs-RL-color dependencies

    • sudo apt-get install libglib2.0-dev libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev libplib-dev libopenal-dev libalut-dev libxi-dev libxmu-dev libxrender-dev libxrandr-dev libpng12-dev

    2.2 install gym-torcs

    • cd /gym-torcs/ command:
    • SRC_DIR=proto DST_DIR=. CPP_DST_DIR=vtorcs-RL-color/src/drivers/scr_server/; protoc -I=$SRC_DIR --cpp_out=$CPP_DST_DIR --python_out=$DST_DIR $SRC_DIR/car_state.proto

    2.2.1 install vtorcs-RL-color

    • cd /gym-torcs/vtorcs-RL-color
    • ./configure
    • make -j8
    • if "no ossspec.h" or "no tgfclien.h" errors just restart make
    • make install
    • make datainstall

    2.3 Initialize race

    • sudo torcs Configure driver: Race --> Quick Race --> Configure Race-->(Select track)Accept -->On the left column Deselect "Damned" driver

      Quit all menues

      To temporary increase resolution if font is too small before configuring driver Option-->Display-->choose resolution and affter configuring driver Option-->Display-->choose Screen resolution 256x192

  4. export Caffe and CUDA paths

    • export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-8.0/lib64:/usr/local/lib
    • export PYTHONPATH=/home/sergey/repo/caffe/python:$PYTHONPATH
  5. Download models from this link and put them into working directory specified in current_dir in dqn.py

    • r18nb.caffemodel is original resnet-18 model trained on the imagenet. Batch normalization layers merged into convolutions
    • q_solver.caffemodel is dqn current training model
    • qq_target.caffemodel is dqn taret model, running avergae of training model

Model archiecture:

Protofiles for models are in the directory resnet_torcs

Training:

For general description check this blog post How to start:

Acknowledgement: Caffe is developed by Berkeley AI Research (BAIR)/The Berkeley Vision and Learning Center (BVLC) and community contributors Naoto Yoshida is the author of the gym torcs. Implementation of replay buffer is based on Ben Lau work.