I created this repo to play around with the Deep Q-Network algorithm.
Make a virtual environment so that you
don't mess up the system installations and install the dependencies. These are
opencv-python
torch
and pygame
. Use python3.6.
virtualenv -p /usr/bin/python3.6 venv
source venv/bin/activate
pip install -r requirements.txt
I trained the model on 4 mil epochs. This took ~6h on my GTX-1070. If you wish to test my model simply type:
python dqn.py test current_model_4000000.pth
On the RHS the paddle changes position by tracking the y-position of the ball. Conversely, on the LHS the paddle changes it's position according to the action predicted by the DQN algorithm.
Should you want to train your own model, just type the command:
python dqn.py train
Every 25000 epochs a checkpoint is saved in the pretrained_model
directory.
python dqn.py continue <name_of_checkpoint>
For example:
python dqn.py continue current_model_4000000.pth