Attacking car racing in OpenAI Gym using adversarial attacks on environment. The fully trained agent and its associated environment wrappers, networks are taken from pytorch_car_caring.
Clone the repo and cd into directory.
$ git clone https://github.com/DesignInformaticsLab/adversarial-environment.git
$ cd adversarial-environment
Here are some of the dependencies that are required. For complete dependencies check requirements.txt file
- pytorch 1.4.0
- gym 0.15.4
- Box2D 2.3.2
- visdom 0.1.8
- numpy 1.18.1
- matplotlib 3.1.3
- torchvision 0.5.0
- tensorboard 1.14.0
Note: If you are facing errors related to Box2D while running, try installing Box2D-kengz v2.3.3. Also, some versions of libraries are upgraded to support tensorboard.
To train the attack, run python adv_attack_train.py --attack_type=general. To test the attack and render the environment, run python adv_attack_test.py --render --attack_type=general
To train the attack, run python adv_attack_train.py --attack_type=patch --patch_type=circle. To test the attack and render the environment, run python adv_attack_test.py --render --attack_type=patch --patch_type=circle. Currently supports only two types of patches box and circle.
This work is highly based on the following repo: