The goal of this assignment is to experiment with imitation learning - direct behavior cloning and the DAgger algorithm, on OpenAI Gym's CarRacing-v0 environment.
Follow the general instructions to clone the repository.
Specific instructions may be found in the comments in each script.
- Required Libraries
pip3 install -r requirements.txt
- Installing resources for the environment.
git clone https://github.com/openai/gym.git cd gym pip install -e . pip3 install -e '.[box2d]'
Note : This will work only on a local machine
A small dataset of expert behaviour is already present in data/data.pkl.gzip. You are, however encouraged to create your own dataset by running manual.py.
Edit model.py to add data processing, if required and define your agent model.
Train your agent by defining the training pipelines in train.py for -
- Naive Behavioral Cloning
- DAgger
Run the training script :
usage: train.py [-h] [--mode {naive,dagger}]
optional arguments:
-h, --help show this help message and exit
--mode {naive,dagger}, -m {naive,dagger}
Sets the training mode. Default : naive
Add the commands for loading and getting predictions from your trained model in eval.py and run the script.
Note : rendering in colab can only be achieved by plotting the state returned with env.render(mode='rgb_array')
.
usage: eval.py [-h] [--render] [--num_episodes NUM_EPISODES]
optional arguments:
-h, --help show this help message and exit
--render, -r To visualise the agent's performance
--num_episodes NUM_EPISODES, -n NUM_EPISODES
Number of episodes to run.