Your vids are awesome. I have some doubts. I am trying to get a little different implementation with a 7D [0,0,0,0,0,0,0] list for Y but keeps receiving an error of shape (?,3) expected. I dont know where change that. Also, is it possible to add a third array of input data? and one last question, a self driving road race car should I use CNN or RNN neural network? Thank you for your incredible work and effort
I've noticed the input shape for your models is [None, width, height, 1] (i.e. you're using width before height, the same as cv2), but the tflearn documentation (tflearn.org/layers/conv/#convolution-2d) seems to specify that the inputs are [batch, height, width, in_channels] (height before width). I've built my models in Keras and this is the same there... Could you possibly be squishing your input images into a portrait shape rather than landscape?
Loving the tutorials! I am having an error : ValueError: Cannot feed value of shape (64, 80, 60, 1) for Tensor 'input/X:0', which has shape '(?, 160, 120, 1)'. Someone help me on this? I can't move ahead, the error seems to be coming from the model.fit part
Does this code requires any changes if you run the training on a CPU instead of a GPU? I have to always load data from numpy and specifiy allow_pickle. Idk if it is a numpy version issue
Hi, i am using same alexnet.py to train image dataset (obtained from camera) to get steering and throttle values. my accuracy is getting near 50% only. what can i do to get a higher accuracy? i am using 100000 images with labels
Should I train for like 80-120 epochs? Because in part 12 (next video) in your tensor board it shows on the x-axis of accuracy like 12k, which means it's 120 epochs you did.
When im reshaping the image data i get 'cannot reshape array of size 4117 into shape (80,60,1)', the data is the same size 80*60 so i am really confused. Could it be because i am using python 3.6?
You might want to pick shorter video titles, on this part eleven the title was truncated in the "Up next" section when watching part 10 and It wasn't clear part 11 is linked. Hope that makes sense
Hello,I have collected datasets about Asphalt8.When I use Alexnet to train this dataset, my training accuracy does not change.The validation accuracy is always 0.5812.I'm very confused about this problem.
Hmm. Either TF changed a lot in a year, or balancing threw baby with the water: I almost instantly got 0.9999 accuracy and 0.0001 loss. Also TF-GPU is a surprising PITA. Apparently stable TF12 doesn't support CUDA 10 (or even python3.7 fwiw) but it seems someone already compiled a whl which support CUDA10 so no need to compile TF from scratch.
hi, im following your tutorials in 2020 and i get tensorflow.contrib error because of tensorflow 2 has no .contrib. on internet people say install tensorflow 1.14 but as i learned python 3.8 and 3.7 can not install tf 1.14. and i couldnt download tf 1.4 with pip (it gave version error) i tried to install tf 1.8 from git but it gave absolutely nothing. andd i can not open alexnet i searched for alexnet for tf 2.0 but i can not find anything. im completely confused. what should i do?
Question: I increased the inputs from 3 [w, a, d] to 5 and now I get a ValueError: cannot reshape array of size 393600 into shape (160, 120, 1) so I changed my WIDTH and HEIGHT to 960, 410. Is this an acceptable thing to do? The exception error I get now in threading.py: IndexError: list index out of range. I'm not sure if this error is related to the input changes. I'm just trying to figure out what to do if I want to increase inputs from 3 to 5+ etc.
Are you recording an initial 800 x 600 frame like we are here? Are you then resizing to 160 x 120 before passing to the neural network like we are here? Like I said in the other comment, the only change you make (to train) if you have a one hot array for 5 values instead of 3 is you change the output layer on the network to be 5 rather than 3. That's really the only change to make for the training part, aside from of course making sure you have unique one-hot inputs for the unique keys, but I am assuming you did that too. The error you're seeing has to do with the input data most likely.
I know this is a little late but I had the same problem and I managed to fix it, if you want to change the number of outputs (in your case to 5), you have to go to alexnet.py and change the 3 in line network = fully_connected(network, 3, activation='softmax') to 5, the index out of range error is most likely because you didn't grayscale your input data (at least that's how I got that error)
i have a question please help me guys! i already have the steering angle data extracted from the image. i also have corresponding keyboard inputs like [1 0 0] or [0 1 0]etc.. what neural network should i use? i dont want to use image data cuz of some library conflicts. im using raspberry pi with ros so i cant export image.
i get these errors... nothing works C:\Users\ganda\PycharmProjects\Python_Plays_GTAV\venv\Scripts\python.exe C:/Users/ganda/PycharmProjects/Python_Plays_GTAV/train_model.py 2020-02-28 16:42:34.811467: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found 2020-02-28 16:42:34.811699: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine. Traceback (most recent call last): File "C:/Users/ganda/PycharmProjects/Python_Plays_GTAV/train_model.py", line 2, in from alexnet import alexnet File "C:\Users\ganda\PycharmProjects\Python_Plays_GTAV\alexnet.py", line 7, in import tflearn File "C:\Users\ganda\PycharmProjects\Python_Plays_GTAV\venv\lib\site-packages\tflearn\__init__.py", line 4, in from . import config File "C:\Users\ganda\PycharmProjects\Python_Plays_GTAV\venv\lib\site-packages\tflearn\config.py", line 5, in from .variables import variable File "C:\Users\ganda\PycharmProjects\Python_Plays_GTAV\venv\lib\site-packages\tflearn\variables.py", line 7, in from tensorflow.contrib.framework.python.ops import add_arg_scope as contrib_add_arg_scope ModuleNotFoundError: No module named 'tensorflow.contrib' Process finished with exit code 1
I noticed that after I posted this as I continued along in the series. I find Inception gets great results for most classification tasks. I'm looking forward to getting into your TensorFlow object detection series next, thx for the great vids.
Are you doing math correctly on alexnet fully connected layer? Copying some random stuff from stackoverflow: The problem is not with convolutional layers, it's the fully connected layers of the network ,which require fix number of neurons.For example, take a small 3 layer network + softmax layer. If first 2 layers are convolutional + max pooling, assuming the dimensions are same before and after convolution, and pooling reduces dim/2 ,which is usually the case. For an image of 3*32*32(C,W,H)with 4 filters in the first layer and 6 filters in the second layer ,the output after convolutional + max pooling at the end of 2nd layer, will be 6*8*8 ,whereas for an image with 3*64*64, at the end of 2nd layer output will be 6*16*16. Before doing fully connected,we stretch this as a single vector( 6*8*8=384 neurons)and do a fully connected operation. So, you cannot have different dimension fully connected layers for different size images. One way to tackle this is using spatial pyramid pooling, where you force the output of last convolutional layer to pool it to a fixed number of bins(I.e neurons) such that fully connected layer has same number of neurons. You can also check fully convolutional networks, which can take non-square images.
You would probably want something different for non-straight edges, like if your image was a circle, but any rectangular image should be fine. Also, why do you ask about the math here? I am not totally certain what red flag you're seeing here. This model trained...pretty well for the very low amount of data that I passed. I considered this to be a great success.
Just throwing random ideas.. Great series, binged on your episodes. Started from 13th and I was completely hooked. Hoped it is possible to make autonomous driver a bit better so started looking for possible improvements/mistakes along the series. Anyway love your project. I hope there will be another episode.
Hi While Trying This Code, i have 2 issues- 1)The Reshape Part Does not work for me. 2)While Running the Script,I get this error-Exception: Feed dict asks for variable named 'targets' but no such variable is known to exist Could Anyone Help me in Resolving These Issues?
i figured out the reason for 1) , pythonprogramming.net/training-self-driving-car-neural-network-python-plays-gta-v/ look at his code where he does X = np.array(whatever ) very carefully, you are probably missing the square bracket outside i[0] for i in train just like i did
I will try this and let you know.BTW,Do you have any other profile so that i could contact you.I am interested in this field and it would be helpful if i knew some other like minded people.
Herp Derpingson well that's obvious, that's why if you was doing this in the real world you would just be running the training on a dedicated machine for this kind of job
ya i rly hope time can run faster so training will be faster, it's a pain in the *** since if you set the wrong parameter and trained for days and then you find your model is not correct then time was lost :( but NICE VIDEO MAN I LIKE IT
Epoch video series!
A+
Training a neural network. With GTA open in the background. "Why is it so slow?"
Your vids are awesome. I have some doubts.
I am trying to get a little different implementation with a 7D [0,0,0,0,0,0,0] list for Y but keeps receiving an error of shape (?,3) expected. I dont know where change that.
Also, is it possible to add a third array of input data?
and one last question, a self driving road race car should I use CNN or RNN neural network?
Thank you for your incredible work and effort
Same issue here.. If you ever figured it out let me know please
Did you figure it out? I also have a different shape for Y.
did you figured it out
love your video on this subject!!! so you eventually found the mistake "rights = rights[:len(rights)]"... right ? (should be len(forwards) .... )
fuba44 that is killing me, I wish I could teleport and go back in time to tell him
GENIUS! this model uses MaxPooling in firsst few layers then without MaxPooling do the rest
Question: What is hm_data?
I'm trying to figure out what the for loop is doing. Is it an epoch within an epoch?
I've noticed the input shape for your models is [None, width, height, 1] (i.e. you're using width before height, the same as cv2), but the tflearn documentation (tflearn.org/layers/conv/#convolution-2d) seems to specify that the inputs are [batch, height, width, in_channels] (height before width). I've built my models in Keras and this is the same there... Could you possibly be squishing your input images into a portrait shape rather than landscape?
Loving the tutorials! I am having an error : ValueError: Cannot feed value of shape (64, 80, 60, 1) for Tensor 'input/X:0', which has shape '(?, 160, 120, 1)'. Someone help me on this? I can't move ahead, the error seems to be coming from the model.fit part
I'm facing this problem too.
same problem
@@hamidfazli6936 did u find the solution?
never mind got it.but different error now
@@running_machine anyone with the solution got the same error
Does this code requires any changes if you run the training on a CPU instead of a GPU? I have to always load data from numpy and specifiy allow_pickle. Idk if it is a numpy version issue
np.load('training_data.npy', allow_pickle=True), in the later versions you have to specify allow_pickle=True through an argument
Hi, i am using same alexnet.py to train image dataset (obtained from camera) to get steering and throttle values. my accuracy is getting near 50% only. what can i do to get a higher accuracy? i am using 100000 images with labels
Should I train for like 80-120 epochs? Because in part 12 (next video) in your tensor board it shows on the x-axis of accuracy like 12k, which means it's 120 epochs you did.
I just noticed that you're using tensorflow on windows without the cumbersome Docker. Do you have a tutorial series teaching how to install it?
Yep, no need for docker with TensorFlow on Windows anymore, here's a tutorial on it: ua-cam.com/video/r7-WPbx8VuY/v-deo.html
thanks ;)
What versions of software do you use?
I assume that tensorflow==1.14, but what about numpy, pandas, opencv-python, pypiwin32 and tflearn?
When im reshaping the image data i get 'cannot reshape array of size 4117 into shape (80,60,1)', the data is the same size 80*60 so i am really confused.
Could it be because i am using python 3.6?
Same. Im still trying to figure it out
So do I. I am using python 3.7
For people who are having problem with index out of bounds in the train_model. Make sure that the height and width is the same as your training data
How does output /input layer shape is matched ? I didn't see any tweaks to network last layer or first layer.
You might want to pick shorter video titles, on this part eleven the title was truncated in the "Up next" section when watching part 10 and It wasn't clear part 11 is linked.
Hope that makes sense
I have a 940MX GPU. DO you think it would be wise to train this on my PC?
Depends on how much data you want to precess. But i don´t think you will have the time to let it run until it is really good. Can take weeks
Hey @sentdex .... sorry for my noob question, my training model doesn't seem to start training. GPU is 0% and the console just doesn't print anything
you need configurate your training.You can look CUDA
Hello,I have collected datasets about Asphalt8.When I use Alexnet to train this dataset, my training accuracy does not change.The validation accuracy is always 0.5812.I'm very confused about this problem.
Which version of Tensorflow are you using?
Hmm. Either TF changed a lot in a year, or balancing threw baby with the water: I almost instantly got 0.9999 accuracy and 0.0001 loss.
Also TF-GPU is a surprising PITA. Apparently stable TF12 doesn't support CUDA 10 (or even python3.7 fwiw) but it seems someone already compiled a whl which support CUDA10 so no need to compile TF from scratch.
I don't have GPU can I use Collab to tain the neutral network
If I could do I have to upload the whole training data into Google drive
Where have you Posted the training data
Hey, I appreciate your work. Thanks for all. Tell me why do you do all in windows?
I typically use windows because its what handles recording software best. In the case of these videos, GTA also runs best on Windows.
You need to be really really shrewd to run GTA 5 on Ubuntu.
Using tflearn only, shows index error. Like, Index is out of bounds. Any suggestions? Thanks.
hi, im following your tutorials in 2020 and i get tensorflow.contrib error because of tensorflow 2 has no .contrib. on internet people say install tensorflow 1.14 but as i learned python 3.8 and 3.7 can not install tf 1.14. and i couldnt download tf 1.4 with pip (it gave version error)
i tried to install tf 1.8 from git but it gave absolutely nothing.
andd i can not open alexnet
i searched for alexnet for tf 2.0 but i can not find anything.
im completely confused. what should i do?
Hi, I installed tensorflow 1.14 with python 3.7.9 with pip install tensorflow==1.14. It doesn't work for you?
Did you fix the problem I am having the same trouble
@@jithinkgeorge9232 no, i found tutorials for tf2
@@IMSezer if pip install tensorflow doesn't work, you may try pip install tensorflow --user
Question: I increased the inputs from 3 [w, a, d] to 5 and now I get a ValueError: cannot reshape array of size 393600 into shape (160, 120, 1) so I changed my WIDTH and HEIGHT to 960, 410. Is this an acceptable thing to do?
The exception error I get now in threading.py: IndexError: list index out of range. I'm not sure if this error is related to the input changes. I'm just trying to figure out what to do if I want to increase inputs from 3 to 5+ etc.
Are you recording an initial 800 x 600 frame like we are here? Are you then resizing to 160 x 120 before passing to the neural network like we are here? Like I said in the other comment, the only change you make (to train) if you have a one hot array for 5 values instead of 3 is you change the output layer on the network to be 5 rather than 3. That's really the only change to make for the training part, aside from of course making sure you have unique one-hot inputs for the unique keys, but I am assuming you did that too.
The error you're seeing has to do with the input data most likely.
I know this is a little late but I had the same problem and I managed to fix it, if you want to change the number of outputs (in your case to 5), you have to go to alexnet.py and change the 3 in line network = fully_connected(network, 3, activation='softmax') to 5, the index out of range error is most likely because you didn't grayscale your input data (at least that's how I got that error)
while playing a game we do press multiple keys at a time will the neural network be able to give two 1 1 in a single output ??
i have a question please help me guys! i already have the steering angle data extracted from the image. i also have corresponding keyboard inputs like [1 0 0] or [0 1 0]etc.. what neural network should i use? i dont want to use image data cuz of some library conflicts. im using raspberry pi with ros so i cant export image.
Oooh Titan X. Nice.
Is it posible to train dataset on Google Colab? @sentdex
i get these errors... nothing works
C:\Users\ganda\PycharmProjects\Python_Plays_GTAV\venv\Scripts\python.exe C:/Users/ganda/PycharmProjects/Python_Plays_GTAV/train_model.py
2020-02-28 16:42:34.811467: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found
2020-02-28 16:42:34.811699: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
Traceback (most recent call last):
File "C:/Users/ganda/PycharmProjects/Python_Plays_GTAV/train_model.py", line 2, in
from alexnet import alexnet
File "C:\Users\ganda\PycharmProjects\Python_Plays_GTAV\alexnet.py", line 7, in
import tflearn
File "C:\Users\ganda\PycharmProjects\Python_Plays_GTAV\venv\lib\site-packages\tflearn\__init__.py", line 4, in
from . import config
File "C:\Users\ganda\PycharmProjects\Python_Plays_GTAV\venv\lib\site-packages\tflearn\config.py", line 5, in
from .variables import variable
File "C:\Users\ganda\PycharmProjects\Python_Plays_GTAV\venv\lib\site-packages\tflearn\variables.py", line 7, in
from tensorflow.contrib.framework.python.ops import add_arg_scope as contrib_add_arg_scope
ModuleNotFoundError: No module named 'tensorflow.contrib'
Process finished with exit code 1
You need TensorFlow 1.15.0
Interested as to your choice of AlexNet over GoogLeNet ??
+Chris Dahms well, continue along and boom we use a modified inception instead.
I noticed that after I posted this as I continued along in the series. I find Inception gets great results for most classification tasks. I'm looking forward to getting into your TensorFlow object detection series next, thx for the great vids.
i have installed tensorflow-gpu but when training it use the CPU.
Have googled it but no success changing to GPU.
Any help is appreciated.
Thanks
Have you propperly installed cuddn and cuda?
Can anyone tell me the no. of epochs that the program will run for?
why am i not able to train im gettting depreciation warnings
can we use Yolo in place of CNN?
Shouldn't image be square before going into neural network?
There's no rule that the image should be a square that I've ever heard.
Are you doing math correctly on alexnet fully connected layer?
Copying some random stuff from stackoverflow:
The problem is not with convolutional layers, it's the fully connected layers of the network ,which require fix number of neurons.For example, take a small 3 layer network + softmax layer. If first 2 layers are convolutional + max pooling, assuming the dimensions are same before and after convolution, and pooling reduces dim/2 ,which is usually the case. For an image of 3*32*32(C,W,H)with 4 filters in the first layer and 6 filters in the second layer ,the output after convolutional + max pooling at the end of 2nd layer, will be 6*8*8 ,whereas for an image with 3*64*64, at the end of 2nd layer output will be 6*16*16. Before doing fully connected,we stretch this as a single vector( 6*8*8=384 neurons)and do a fully connected operation. So, you cannot have different dimension fully connected layers for different size images. One way to tackle this is using spatial pyramid pooling, where you force the output of last convolutional layer to pool it to a fixed number of bins(I.e neurons) such that fully connected layer has same number of neurons. You can also check fully convolutional networks, which can take non-square images.
You would probably want something different for non-straight edges, like if your image was a circle, but any rectangular image should be fine.
Also, why do you ask about the math here? I am not totally certain what red flag you're seeing here. This model trained...pretty well for the very low amount of data that I passed. I considered this to be a great success.
Just throwing random ideas.. Great series, binged on your episodes. Started from 13th and I was completely hooked. Hoped it is possible to make autonomous driver a bit better so started looking for possible improvements/mistakes along the series. Anyway love your project. I hope there will be another episode.
are not extensions just a part of the filename
why are they hidden like that
Following error:
InvalidArgumentError: Duplicate tag Momentum/Conv2D/W found in summary inputs
Hi
While Trying This Code, i have 2 issues-
1)The Reshape Part Does not work for me.
2)While Running the Script,I get this error-Exception: Feed dict asks for variable named 'targets' but no such variable is known to exist
Could Anyone Help me in Resolving These Issues?
i have the same error in 1), for 2, maybe you should go to 11:29 and notice the last parameter in regression function
i figured out the reason for 1) , pythonprogramming.net/training-self-driving-car-neural-network-python-plays-gta-v/ look at his code where he does X = np.array(whatever ) very carefully, you are probably missing the square bracket outside i[0] for i in train just like i did
I will try this and let you know.BTW,Do you have any other profile so that i could contact you.I am interested in this field and it would be helpful if i knew some other like minded people.
were you running it on GPU?
Yes
can this be done in GTA 4?
of course! You can do it on tetris too
Yes, you can do this in GTA 4, or tetris as XRO7 says. These methods can be used with whatever game you want.
look up 'clipcube' for global windows clipboard history
For anyone preferring something a bit more minimalistic, try Ditto.
mah, copy and paste
+Ahmet Furkan Yıldırım :D
The envious said...
The training is slow because you are running GTA 5 in the background. Also recording software.
Herp Derpingson well that's obvious, that's why if you was doing this in the real world you would just be running the training on a dedicated machine for this kind of job
This is so awesome, but gta 5 on a mac :'(
Masnad Nehith you can use this on any game really
Masnad Nehith if you watch the the videos he says you can but I'm guessing you didn't
yeeet!! GTX titan *_*
loss > 1 is BAD
Loss is fairly relative, you really can't make a sweeping statement like that.
ya i rly hope time can run faster so training will be faster, it's a pain in the *** since if you set the wrong parameter and trained for days and then you find your model is not correct then time was lost :( but NICE VIDEO MAN I LIKE IT