Training convolutional neural network for self-driving - Python plays GTA p.11

Поділитися
Вставка
  • Опубліковано 18 гру 2024

КОМЕНТАРІ • 99

  • @Damaged7
    @Damaged7 7 років тому +79

    Epoch video series!

  • @linkilehl
    @linkilehl 6 років тому +21

    Training a neural network. With GTA open in the background. "Why is it so slow?"

  • @marcgenou9024
    @marcgenou9024 6 років тому +2

    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

    • @MrMagicarpe
      @MrMagicarpe 5 років тому

      Same issue here.. If you ever figured it out let me know please

    • @constantincolac1993
      @constantincolac1993 5 років тому

      Did you figure it out? I also have a different shape for Y.

    • @Video-Notes
      @Video-Notes 4 роки тому

      did you figured it out

  • @fuba44
    @fuba44 7 років тому +12

    love your video on this subject!!! so you eventually found the mistake "rights = rights[:len(rights)]"... right ? (should be len(forwards) .... )

    • @doylerudolph7965
      @doylerudolph7965 7 років тому +3

      fuba44 that is killing me, I wish I could teleport and go back in time to tell him

  • @easter.bunny.6
    @easter.bunny.6 7 років тому

    GENIUS! this model uses MaxPooling in firsst few layers then without MaxPooling do the rest

  • @akirarenbokoji4464
    @akirarenbokoji4464 7 років тому +2

    Question: What is hm_data?
    I'm trying to figure out what the for loop is doing. Is it an epoch within an epoch?

  • @andrewjones54
    @andrewjones54 6 років тому +1

    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?

  • @prateeksoni4890
    @prateeksoni4890 6 років тому +4

    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

  • @7c7c7
    @7c7c7 4 роки тому +1

    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

    • @zaid7166
      @zaid7166 3 роки тому +1

      np.load('training_data.npy', allow_pickle=True), in the later versions you have to specify allow_pickle=True through an argument

  • @mohammedminhajfalakipm9943
    @mohammedminhajfalakipm9943 7 років тому +4

    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

  • @ilanaizelman3993
    @ilanaizelman3993 5 років тому

    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.

  • @oliverli9630
    @oliverli9630 7 років тому +1

    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?

    • @sentdex
      @sentdex  7 років тому +3

      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

    • @oliverli9630
      @oliverli9630 7 років тому

      thanks ;)

  • @MyAndrey98
    @MyAndrey98 4 роки тому

    What versions of software do you use?
    I assume that tensorflow==1.14, but what about numpy, pandas, opencv-python, pypiwin32 and tflearn?

  • @daviddemmers130
    @daviddemmers130 6 років тому +1

    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?

  • @HeRoXLeGenD1
    @HeRoXLeGenD1 6 років тому

    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

  • @kaushiksathvara8051
    @kaushiksathvara8051 4 роки тому

    How does output /input layer shape is matched ? I didn't see any tweaks to network last layer or first layer.

  • @marcelburkhard
    @marcelburkhard 7 років тому

    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

  • @thinkandlearn7258
    @thinkandlearn7258 7 років тому +1

    I have a 940MX GPU. DO you think it would be wise to train this on my PC?

    • @manfred1234e
      @manfred1234e 7 років тому

      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

  • @alykh96
    @alykh96 5 років тому

    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

  • @SamoSkywalker
    @SamoSkywalker 6 років тому

    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.

  • @16rongon
    @16rongon 4 роки тому

    Which version of Tensorflow are you using?

  • @etopowertwon
    @etopowertwon 6 років тому +2

    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.

  • @jithinkgeorge9232
    @jithinkgeorge9232 4 роки тому

    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

  • @datarachit
    @datarachit 4 роки тому

    Where have you Posted the training data

  • @ShravanKumar147
    @ShravanKumar147 7 років тому

    Hey, I appreciate your work. Thanks for all. Tell me why do you do all in windows?

    • @sentdex
      @sentdex  7 років тому +6

      I typically use windows because its what handles recording software best. In the case of these videos, GTA also runs best on Windows.

    • @allmightqs1679
      @allmightqs1679 5 років тому +1

      You need to be really really shrewd to run GTA 5 on Ubuntu.

  • @shubhampaul6559
    @shubhampaul6559 6 років тому

    Using tflearn only, shows index error. Like, Index is out of bounds. Any suggestions? Thanks.

  • @IMSezer
    @IMSezer 4 роки тому

    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?

    • @7c7c7
      @7c7c7 4 роки тому

      Hi, I installed tensorflow 1.14 with python 3.7.9 with pip install tensorflow==1.14. It doesn't work for you?

    • @jithinkgeorge9232
      @jithinkgeorge9232 4 роки тому

      Did you fix the problem I am having the same trouble

    • @IMSezer
      @IMSezer 4 роки тому +1

      @@jithinkgeorge9232 no, i found tutorials for tf2

    • @zaid7166
      @zaid7166 3 роки тому

      @@IMSezer if pip install tensorflow doesn't work, you may try pip install tensorflow --user

  • @akirarenbokoji4464
    @akirarenbokoji4464 7 років тому

    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.

    • @sentdex
      @sentdex  7 років тому +1

      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.

    • @ageklopstra6153
      @ageklopstra6153 6 років тому

      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)

    • @Video-Notes
      @Video-Notes 4 роки тому

      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 ??

  • @turanyasar3375
    @turanyasar3375 4 роки тому

    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.

  • @drink__more__water
    @drink__more__water 6 років тому +1

    Oooh Titan X. Nice.

  • @emretatbak
    @emretatbak 5 років тому

    Is it posible to train dataset on Google Colab? @sentdex

  • @deknas1407
    @deknas1407 4 роки тому

    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

  • @chrisdahms9682
    @chrisdahms9682 7 років тому

    Interested as to your choice of AlexNet over GoogLeNet ??

    • @sentdex
      @sentdex  7 років тому

      +Chris Dahms well, continue along and boom we use a modified inception instead.

    • @chrisdahms9682
      @chrisdahms9682 7 років тому

      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.

  • @manfred1234e
    @manfred1234e 7 років тому

    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

    • @daviddemmers130
      @daviddemmers130 6 років тому +1

      Have you propperly installed cuddn and cuda?

  • @adityashubham1997
    @adityashubham1997 6 років тому

    Can anyone tell me the no. of epochs that the program will run for?

  • @JITHINKGEORGEMEA-
    @JITHINKGEORGEMEA- 4 роки тому

    why am i not able to train im gettting depreciation warnings

  • @vikaskumar-ww6sh
    @vikaskumar-ww6sh 6 років тому

    can we use Yolo in place of CNN?

  • @cerpokas
    @cerpokas 7 років тому

    Shouldn't image be square before going into neural network?

    • @sentdex
      @sentdex  7 років тому

      There's no rule that the image should be a square that I've ever heard.

    • @cerpokas
      @cerpokas 7 років тому

      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.

    • @sentdex
      @sentdex  7 років тому

      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.

    • @cerpokas
      @cerpokas 7 років тому

      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.

  • @YumekuiNeru
    @YumekuiNeru 7 років тому

    are not extensions just a part of the filename
    why are they hidden like that

  • @Liam-e6q
    @Liam-e6q 6 років тому

    Following error:
    InvalidArgumentError: Duplicate tag Momentum/Conv2D/W found in summary inputs

  • @themanwhosings-v3n
    @themanwhosings-v3n 7 років тому

    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?

    • @sidharthtalia
      @sidharthtalia 7 років тому

      i have the same error in 1), for 2, maybe you should go to 11:29 and notice the last parameter in regression function

    • @sidharthtalia
      @sidharthtalia 7 років тому

      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

    • @themanwhosings-v3n
      @themanwhosings-v3n 7 років тому

      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.

  • @crustog11
    @crustog11 5 років тому

    were you running it on GPU?

  • @rephlexions
    @rephlexions 7 років тому

    can this be done in GTA 4?

    • @xro7117
      @xro7117 7 років тому +4

      of course! You can do it on tetris too

    • @sentdex
      @sentdex  7 років тому +2

      Yes, you can do this in GTA 4, or tetris as XRO7 says. These methods can be used with whatever game you want.

  • @nxxxxzn
    @nxxxxzn 7 років тому

    look up 'clipcube' for global windows clipboard history

    • @Phoen1x883
      @Phoen1x883 7 років тому

      For anyone preferring something a bit more minimalistic, try Ditto.

  • @ahmetfurkanyldrm7386
    @ahmetfurkanyldrm7386 7 років тому +18

    mah, copy and paste

    • @sentdex
      @sentdex  7 років тому +5

      +Ahmet Furkan Yıldırım :D

    • @morpheus88r
      @morpheus88r 7 років тому

      The envious said...

  • @herp_derpingson
    @herp_derpingson 7 років тому

    The training is slow because you are running GTA 5 in the background. Also recording software.

    • @England91
      @England91 7 років тому +1

      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

  • @Random-pz1nl
    @Random-pz1nl 7 років тому

    This is so awesome, but gta 5 on a mac :'(

    • @amirs5512
      @amirs5512 7 років тому

      Masnad Nehith you can use this on any game really

    • @England91
      @England91 7 років тому

      Masnad Nehith if you watch the the videos he says you can but I'm guessing you didn't

  • @MohitPratapSingh95
    @MohitPratapSingh95 6 років тому

    yeeet!! GTX titan *_*

  • @easter.bunny.6
    @easter.bunny.6 7 років тому

    loss > 1 is BAD

    • @sentdex
      @sentdex  7 років тому

      Loss is fairly relative, you really can't make a sweeping statement like that.

    • @easter.bunny.6
      @easter.bunny.6 7 років тому

      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