Coder Social home page Coder Social logo

weiqiao / imitation-learning Goto Github PK

View Code? Open in Web Editor NEW

This project forked from merantix/imitation-learning

0.0 1.0 0.0 30.56 MB

Autonomous driving: Tensorflow implementation of the paper "End-to-end Driving via Conditional Imitation Learning"

Home Page: https://medium.com/merantix/journey-from-academic-paper-to-industry-usage-cf57fe598f31

License: MIT License

Dockerfile 1.17% Python 98.83%

imitation-learning's Introduction

Imitation learning Build Status Tweet

This repository provides a Tensorflow implementation of the paper End-to-end Driving via Conditional Imitation Learning.

You can find a pre-trained network here. The repository at hand adds Tensorflow training code.

There are only a few changes to the setup in the paper:

  • We train less steps (we do 190k steps, the paper does 450k steps), but this is configurable.
  • The branches for the controller follow the order of the training data.
  • We take different weight hyperparameters for the outputs (steer, gas, brake, speed), since the hyperparameters suggested in the paper did not work for us.

Setup

This repository uses docker images. In order to use it, install docker. To build the image, use:

docker build --build-arg base_image=tensorflow/tensorflow:1.12.0-gpu -t imit-learn .

If you only need a CPU image, leave out base_image=tensorflow/tensorflow:1.12.0-gpu. So far, we only tested the setup with Python2, which tensorflow:1.12.0 is based on.

To run a container, use:

cd <root of this repository>
DOCKER_BASH_HISTORY="$(pwd)/data/docker.bash_history"
touch $DOCKER_BASH_HISTORY

docker run -it --rm --name imit_learn \
    -v "$(pwd)/imitation:/imitation" \
    -v "$(pwd)/data:/data" \
    -v "$DOCKER_BASH_HISTORY:/root/.bash_history" \
    imit-learn bash

Download dataset (24GB). Unpack! Put them into data/imitation_learning/h5_files/AgentHuman.

If you don't wanna download all the data right away, you can try on a very small subset that is contained in this repository. To set it up, run:

cd <root of this repository>
mkdir data/imitation_learning/h5_files/
cp -r imitation/test/mock_data_181018/imitation_learning/h5_files/ data/imitation_learning/h5_files/

Preprocessing

The preprocessing converts the downloaded h5 files into tfrecord files so we can easier use them for training with Tensorflow.

During preprocessing, the data is shuffled to a certain degree. More specifically speaking, it is shuffled the h5 files, but it is not shuffling the frames inside an h5 file.
Shuffling across files is achieved by using a big shuffle buffer during training.

Run preprocessing using:

mkdir -p /data/imitation_learning/preprocessed/
python /imitation/preprocessor.py --preproc_config_paths=config-preprocess-production.yaml

This might run for a while and slow consume a lot of CPU power. To simply check that the preprocessing code can run, set --preproc_config_paths=config-preprocess-debug.yaml.

Train

In order for the training to run, training and validation data need to be in the right place as described above. To run training with best hyperparameters on the entire dataset, run:

python trainer.py --config_paths=config-train-production.yaml

To debug training, use:

python trainer.py --config_paths=config-train-debug.yaml

Tests

pytest

imitation-learning's People

Contributors

markus-hinsche avatar

Watchers

James Cloos 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.