Deep Reinforcement Learning for Atari Games Python Tutorial | AI Plays Space Invaders

preview_player
Показать описание
Suck at playing games?

Need to start smashing your friends at retro Atari?

Want to use AI to help you level up and start beating em?

You need to start with a little Reinforcement Learning. In this video you'll learn how to use Python to build AI models to play Space Invaders. You'll learn how to use an OpenAI gym environment and Tensorflow to train a model which can play autonomously! With a little training you can build a model that starts to beat your mates!

In this video you'll learn how to:
1. Create an Atari Environment from OpenAI
2. Build a deep learning model with Tensorflow for RL
3. Train and test a live Reinforcement Learning model using Keras-RL and Python

Links Mentioned

Chapters
00:00 - Start
00:18 - Introduction
01:21 - Installing Dependencies for Keras-RL and OpenAI Gym for Python
03:59 - Creating an OpenAI Gym Environment for Atari Space Invaders
07:11 - Applying Random Actions to RL OpenAI Environments
11:03 - Importing Tensorflow Deep Learning Dependencies
12:38 - Creating a Deep Learning Model Build Function
19:03 - Setting up a Deep Learning Model and Viewing the Architecture
21:11 - Importing Keras-RL Dependencies
22:54 - Setting up a Reinforcement Learning Agent with Keras-RL
25:54 - Training Reinforcement Learning Models to Play Space Invaders
31:55 - Testing the Model

Oh, and don't forget to connect with me!

Happy coding!
Nick

P.s. Let me know how you go and drop a comment if you need a hand!
Рекомендации по теме
Комментарии
Автор

Happy New Years y’all, wishing you all a super amazing 💯 2021!! Thanks for checkin’ in, see ya in the new year 😉

NicholasRenotte
Автор

Never comment on YouTube, but can't even begin to express how well you taught this and how grateful I am. So hard to find someone who can teach this in a straight way, and you did it!

ddrha
Автор

This video is way too high quality for how few likes it has, excellent video man you explain everything very clearly, much appreciated!

vertyco
Автор

I am getting error at building a agent, kernel crashes when i call build_agent method

govthamreddy
Автор

One question,
Shouldn't the no. Of warm-up timesteps be equal to the max limit of sequential memory ? In the example shown, the model will warm-up for 10000 timesteps but it can only remember the experience of last 1000 timesteps since that's the max limit of memory. Which is used for experience replay right ?

susmitvengurlekar
Автор

does the build_agent still work because i have this error why i call the build_agent
RecursionError: maximum recursion depth exceeded while getting the repr of an object
i tried to increase the maximum recursion depth but i get segmentation error.
also the del model doesnt work beaucse is undefined at the point that you used it so i removed it

giorgosmodz
Автор

Hi Nicholas. I'm trying to run your code in Colab, but I'm having a problem building the model! Are weeks that I'm trying to solve, without solution :( When i run the line "model = build_model(height, width, channels, actions)", i got this Error "ValueError: Kernel shape must have the same length as input, but received kernel of shape (8, 8, 3, 32) and input of shape (None, 3, 210, 160, 3)." Can you please help me? Thank you very much.

simoneabbate
Автор

I've discovered your channel just a couple days ago and watched only a few videos so far, but I want to say one thing:
I really enjoy your content! Your videos are structured extremely well, which I find very helpful! I learned a lot already and I am looking forward to watching more of your videos! :)
Thank you so much for making them! Much appreciated :)

NoMercy
Автор

can you make a project on Chess AI ? using reinforcement learning

creative-commons-videos
Автор

This is a good lecture. While studying reinforcement learning, while thinking about how to implement it, I saw this lecture and implemented it.

pa-su
Автор

Hey! I'm getting this error: KeyError: 'SpaceInvaders-v0'. Do you know how I can solve it? Great video btw!

vascopearson
Автор

Again, very resourceful video with great line by line explanation, which resolves almost all doubts.

modernfusions
Автор

when I try to do the den.fit() I get the error: 'int' object has no attribute shape, any way I can solve this?

sixtocorralescastle
Автор

👏👏👏 Thank you for the interesting topic and happy new year!

gustavojuantorena
Автор

Hey Nick, I got a question. Is it normal for the training to get significantly slower after each step? (Like one episode lasts 500+ seconds) I'm running this on an i5 cpu.

aiden
Автор

Great and innovative way in explanation rather difficult, abstracted and required some extra effort part of machine learning. Reinforcement learning together with deep learning are now extremely popular in different branches of our life. Probably great part of our life will be more and more affected by these technologies. It is amazing what you are doing Nicholas for the community. Your performance and consistent information are outstanding. Very impressive. Sooner or later (for sure in 2021) your channel will explode in number of new awesome subscribers. Reading the comment I can see it can be very reasonable to run jupyter in Google Colab so the community will avoid  problem related with installation of packages and other dependencies. They will have more time to enjoy your content and perform other experiments. Wish you good luck!

markusbuchholz
Автор

thank you for the tutorial! Will watch more your AI/ML videos

jeremyheng
Автор

Hi! Thank you for explaining the code line by line! It was very helpful to go through it and actually understand the code! But just wanted to ask if we can use the same code to create different versions of Atari games like Breakout-v0 or is this code specifically for SpaceInvaders?

namithashaji
Автор

can you make an updated version? with ALE, importing DQNAgent also doesn't work like that any more, you need tf-agents, though I can't get it to work (wheels + windows issue), so have to make your own in that case

rakly
Автор

hello, I have tried your code and I got an error message at dqn.test(env, nb_episodes=100, visualize=True)

it says :

Exception has occurred: Error
render(mode='human') is deprecated. Please supply `render_mode` when constructing your environment, e.g., gym.make(ID, render_mode='human'). The new `render_mode` keyword argument supports DPI scaling, audio, and native framerates.

stephwu
visit shbcf.ru