This project showcases Deep Q-Network (DQN) capabilities to teach agent how to steer a car based on detected distance from a car to the edge of a track. DQN is a type of reinforcement learning algorithm, where agent is placed in certain environment, and is capable of performing specified actions. Based on reward and punishment system, agent tries to maximize rewards, while avoiding punishments. In this example reward is given for every frame the car is driving, while punishment is given when car touches edge of a track.
- procedurally generated track on every episode
- raycasting for detecting edges of a track
- DQN model
- Pygame
- PyTorch
At the beggining agent is exploring new environment, a lot of crashes are expected.
After some episodes agent adapts his driving skill to stay on track for longer period of time.