Skip to content

Thb1t/AI_driving_DQN_version

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš— Driving AI with Deep Q-learning

This project showcases an AI that learns to drive a car in a 2D environment using the deep Q-learning algorithm. No hardcoded pathfinding โ€” the agent improves by trial, error, and reward-based learning. ๐Ÿง ๐Ÿ“ˆ

๐Ÿง  What It Does

๐ŸŽฎ The AI controls a car in a Pygame environment with basic physics and obstacles.

๐Ÿง  It uses a Deep Q-Network to estimate the best action to take from any given state.

๐Ÿงพ Inputs include distance to next checkpoint, velocity, distance to obstacles, and relative angles to next checkpoint.

๐ŸŽฏ Rewards are given based on life time, distance to the next checkpoint, avoiding collisions, velocity to encourage speed and reaching checkpoints.

๐Ÿš€ Features

๐Ÿค– Uses Deep Q-Learning with experience replay and epsilon-greedy exploration

๐Ÿงฑ Neural network approximates Q-values for discrete actions (e.g., accelerate, turn left/right)

Here is an image of what it looks like :

Image_cars

๐Ÿ“ฆ Dependencies

  • Python 3.x ๐Ÿ
  • pytorch for neurons ๐Ÿง 
  • numpy for tracking and plotting results ๐Ÿ“Š
  • pygame for visualization ๐ŸŽฎ

๐Ÿ“ Notes & Observations

โณ Training is unstable at first โ€” the car often spins out or crashes quickly โ€” but over time, it learns to stabilize, turn properly, and sometimes follow simple roads or avoid walls.

๐ŸŽ›๏ธ Hyperparameters (learning rate, epsilon decay, reward shaping) have a huge impact on learning performance.

Here, we can see that over 100 steps, the best path have been found (in just more than 5 min).

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages