๐ŸŒ AIๆœ็ดข & ไปฃ็† ไธป้กต
Skip to content

Training a vision-based agent with the Deep Q Learning Network (DQN) in Atari's Breakout environment, implementation in Tensorflow.

License

Notifications You must be signed in to change notification settings

andi611/DQN-Deep-Q-Network-Atari-Breakout-Tensorflow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

12 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Reinforcement Learning: Deeq Q Learning Network (DQN) Agent playing Atari Breakout

  • Training a vision-based agent with the Deep Q Learning Network (DQN) in Atari's Breakout environment, implementation in Tensorflow.

Environment

  • < Python 3.7 >
  • < OpenAI Gym >
    • Install the OpenAI Gym Atari environment: $ pip3 install opencv-python gym "gym[atari]"
    • Atari environment used: BreakoutNoFrameskip-v4
  • < Tensorflow r.1.12.0 >

Implementation

  • Deep Q Learning Network with the following improvements:
    • Experience Replay
    • Fixed Target Q-Network
    • TD error loss function with: Qtarget = reward + (1-terminal) * (gamma * Qmax(sโ€™)โ€จ)
  • DQN network Settings (in agent_dqn.py):

File Description

.
โ”œโ”€โ”€ ./
|   โ”œโ”€โ”€ agent_dqn.py โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ DQN model
|   โ”œโ”€โ”€ atari_wrapper.py โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Atari wrapper
|   โ”œโ”€โ”€ environment.py โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Gym wrapper
|   โ”œโ”€โ”€ runner.py โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Main program for training and testing
|   โ””โ”€โ”€ Readme.md โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ This file
โ””โ”€โ”€ model/
	โ”œโ”€โ”€ dqn_learning_curve_compare.png โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Figure 1  
	โ”œโ”€โ”€ dqn_best_setting.png โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Figure 2
	โ”œโ”€โ”€ dqn_learning_curve.png โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Figure 3
	โ”œโ”€โ”€ checkpoint โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Tensorflow model check point
	โ”œโ”€โ”€ model_dqn-25581.data-00000-of-00001 โ”€โ”€โ”€ Tensorflow model data
	โ”œโ”€โ”€ model_dqn-25581.meta โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Tensorflow model meta
	โ””โ”€โ”€ model_dqn-25581.index โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Tensorflow model index

Usage

  • Traing the DQN Agent: $ python3 runner.py --train_dqn
  • Testing the DQN Agent: $ python3 runner.py --test_dqn
  • Testing the DQN Agent with gameplay rendering: $ python3 runner.py --test_dqn --do_render

Learning Curve

  • Single learning curve:
  • With different plotting window: