yenchenlin / DeepLearningFlappyBird

Flappy Bird hack using Deep Reinforcement Learning (Deep Q-learning).
MIT License
6.62k stars 2.04k forks source link

Confusion about the input #38

Closed bigtreeljc closed 7 years ago

bigtreeljc commented 7 years ago

Are the input really the last 4 frames or it's just one frame stacked into four? The code below seem to indicate it's one frame stacked into four as serve as the input.

do_nothing[0] = 1
x_t, r_0, terminal = game_state.frame_step(do_nothing)
x_t = cv2.cvtColor(cv2.resize(x_t, (80, 80)), cv2.COLOR_BGR2GRAY)
ret, x_t = cv2.threshold(x_t,1,255,cv2.THRESH_BINARY)
s_t = np.stack((x_t, x_t, x_t, x_t), axis=2)