Neural network racing cars around a track

Sdílet
Vložit
  • čas přidán 3. 01. 2019
  • Teaching a neural network to drive a car. It's a simple network with a fixed number of hidden nodes (no NEAT), and no bias. Yet it manages to drive the cars fast and safe after just a few generations. Population is 650. The network evolves through random mutation (no cross-breeding). Fitness evaluation is currently done manually as explained in the video.
    Car picture by Unlucky Studio:
    unluckystudio.com/game-art-giv...
    Track background created by Keely for Quickrally and modified a bit:
    / screenshot_saturday_26...
    Background music by Trevor Lentz:
    opengameart.org/users/trevor-...
    Coding by Johan Eliasson in 2019.

Komentáře • 2,5K

  • @harimichaelson5238
    @harimichaelson5238 Před 5 lety +5352

    Shoutout to that one car in first gen who went as far as it could in the other direction. You shall be remebered, rebel

    • @addityasinghal897
      @addityasinghal897 Před 5 lety +145

      yeah he should have been parented as well to get 2 sets of cars. Some that go left and some that go right. It would be a mix of the choices and eventually one would prevail. would be interesting

    • @Jonas_Aa
      @Jonas_Aa Před 5 lety +250

      Yeah he was smart enough to see that it would be a trafficjam going the same way as the others.

    • @ragnivus6020
      @ragnivus6020 Před 5 lety +7

      you are right!

    • @akshaydarekar1991
      @akshaydarekar1991 Před 5 lety +57

      Or it's an anti-vaxxer

    • @StuSiney
      @StuSiney Před 5 lety +5

      That one was probably my car

  • @Andy.o52
    @Andy.o52 Před 3 lety +675

    That one car that went backwords: "My goals are beyond your understanding"

    • @justus8675
      @justus8675 Před 3 lety +38

      That car has watched "Ready Player One"!

    • @altoclef4249
      @altoclef4249 Před 3 lety +3

      @@justus8675 lol

    • @AndreyTkachenko
      @AndreyTkachenko Před 3 lety +5

      that car had a goal to cross finish line - and it did that first :)

    • @sanyanders
      @sanyanders Před 3 lety +3

      It's speedrunner

  • @CRAZYMONYmc
    @CRAZYMONYmc Před 3 lety +915

    3:02 "looks like gen 4 will finish a full lap!"
    selected car: *rams into wall*

  • @thejesuschrist
    @thejesuschrist Před 5 lety +3855

    this blows my holy mind

  • @CraftyFoxe
    @CraftyFoxe Před 5 lety +1181

    ah the machines are learning!

    • @mg1462
      @mg1462 Před 3 lety +8

      Now imagine o e million learning one thousand generations per second

    • @caseyjr296
      @caseyjr296 Před 3 lety +2

      I tought you was fake for a second

    • @wlacsilbalazs
      @wlacsilbalazs Před 3 lety +2

      Yes. We arefz011jk011101001Fhkw/,,.dsd0 *ERROR* sdal+!'"glb.ú - system failure.
      Reboot...
      ...
      ...
      Yes. I agree with you my fellow human.

    • @RD-nz5gj
      @RD-nz5gj Před 3 lety

      Lowkey kinda thought u were fake

    • @djbabbotstown
      @djbabbotstown Před 3 lety

      With the help of a Conscious selector. Interesting.

  • @nexus1g
    @nexus1g Před 3 lety +230

    "Except for that top guy that figured out how to turn left..."
    Achievement Unlocked: Pro NASCAR Driver.

    • @francois487
      @francois487 Před 3 lety +5

      NASCAR announcer: "He's making a left turn!"

    • @theglockdub
      @theglockdub Před 3 lety +5

      Was laughing as fuck

  • @Lellistair
    @Lellistair Před 3 lety +1558

    Me: Alright, what's on the algorithm menu today?
    CZcams: Car breeding
    Me: Cool

    • @bagochips1208
      @bagochips1208 Před 3 lety +9

      @@googlexd7294 Sir this is a wendy's drive thru
      thats a lot of new stuff I learned today btw

    • @sontapaa11jokulainen94
      @sontapaa11jokulainen94 Před 3 lety +5

      @@googlexd7294 but this video is just neuroevolution. it does not actually do any backpropagation. it just randomly modifies the neural network here and there and then copies it and then rinse and repeat so this video and youtubes ai are different? (please correct me if i am wrong)

    • @sontapaa11jokulainen94
      @sontapaa11jokulainen94 Před 3 lety

      @@googlexd7294yes. I think that the forward propagation (goinc through the network in the forward direction) is the same, but in the video the best ones are picked and then randomly mutated and rinse and repeat, but in youtubes algorithm it back propagates the error using fancy mathematical tricks so this network is kinda dumb in comparison, but then again in backward propagation you need the error. For example to make the video ai smarter you could define the output you want from if the car is pointing too left or too right and then back propagate with the actual output of a poorly trained network so that would make the ai more sophisticated, because then it wouldnt need to go through artificial evolution, but instead training. But i am by no means an expert so takr this with a grain of salt.
      Edit: you sound like you are interested in ai. I highly advice you to look at 3blue1browns video series on neural networks, coding trains neural network videos and also check out www.neuralnetworksanddeeplearning.com .

    • @nicklawton4166
      @nicklawton4166 Před 3 lety

      ​@@googlexd7294 That was such an amazing description of the youtube algorithm; I had no idea it was so simple. I am however confused on whether the weighting is done using point differentials (and therefore uses the massey method) or whether the algorithm treats all variables equally (and therefore uses the colley method). I would assume that the variables: liking, commenting, time spent watching, and all the numerous data collection points are all weighted in using point differentials because I would believe that some actions are more pertinent than others. That's my hunch, but would love to find out if somebody knows the answer

    • @daylenhendricks7702
      @daylenhendricks7702 Před 3 lety

      I cannot express how much i am laughing at this and i have no clue why lmfao

  • @LoliLoveJuice
    @LoliLoveJuice Před 3 lety +1667

    moral of the story is:
    theres still gonna be alot of dumb people every generation even if their family head is a genius/successful

    • @IamR3D88
      @IamR3D88 Před 3 lety +128

      yea, but here they are only breeding the smart ones, real life is almost opposite.

    • @kaiserhhaie841
      @kaiserhhaie841 Před 3 lety +54

      @@IamR3D88 the dumb people fuck like rabbits yeah. Have you seen the movie idiocracy? its really a fun movie about this idea

    • @estantaya
      @estantaya Před 3 lety +2

      @@kaiserhhaie841 the plebs are a need

    • @RessG
      @RessG Před 3 lety

      The dumb is there to be taken advantage of.

    • @SecuR0M
      @SecuR0M Před 3 lety +22

      @@RessG Conscientiousness and agreeableness are stronger correlates of societal and economic success than IQ. And conscientiousness is correlated directly with lower IQ. (:
      IQ certainly matters to an extent that you can plan and foresee future outcomes I guess. But this only requires an IQ of "about average or a bit below" though. An IQ of 100 will be indistinguishable from an IQ of 120 or 140 if the latter is neurotic and schizoid or something. Past a certain point, IQ becomes detrimental to economic success, because once you control for IQ the only real effects to be seen are whether or not someone is able to compromise, make good arguments without being overly acerbic, and get along well with coworkers to not be passed up for promotion.
      Also since people like diligent workers, conscientious high intellects are in extremely high demand, but remember that conscientiousness is negatively correlated with IQ (a small negative correlate) and the rest of the Big Five are questionable as to which way they swing.
      People with higher-than-average (1 SD or more) IQs might make a bit more money but they're also more likely to fall for New Age cults like the Tesla Model S or Scientology, which reduces their effective lifetime earnings. This is natural and normal: there's no real reason to sit on money when it's being raked in unless you anticipate that changing in the future, and people with higher IQs tend to assume that present trends will continue (otoh saving back 6-8 months of pay is not hard for someone with a $70-150K USD job in Middle America).
      Only if you compare between populations rather than within populations does it seem like IQ matters for lifetime earnings.
      This is why the people who make the most money in their jobs (medical doctors, engineers, etc.) tend to be "around" a standard deviation or so of their population average. On one hand they're clearly clever enough to have a high-in-demand certification or license (medical board, professional engineer license) but they're also conscientious, and that will lower their IQ a wee bit (about 1/3rd a SD maybe? perhaps you need a certain level of conscientiousness to convert extra work hours to more money at a slightly less efficient rate) but because IQ is simply a coefficient of work by putting in another 3-4 hours on the job they don't actually lose money, they gain it.
      For high IQ earners, i.e. professional licensed workers, having a conscientiousness rating a full SD higher than standard high IQ population leads to nearly half a million dollars in total earning income. For people who are both extroverted and conscientious, this is about a million extra bucks. Or about 1/3rd more lifetime income. Counter-intuitively, agreeable employees earn a bit less (about 8%) than aggressive ones, but only because they're not willing to go in and fight for a pay increase or negotiate hard. Of course the Ternan study did show that higher IQ (1 SD) than already high IQ does lead to an actual increase in earning, this is entirely eclipsed by being agreeable: a paltry 5% higher earnings over the Ternan study population lifetime incomes. Boo. I'd trade a standard deviation in IQ at around 155 for a standard deviation in conscientiousness if I could min-max my rolls, but that would be cheating the system since it isn't even equivalent: conscientiousness just wins.
      Is being smart good? Yeah it's fine, depending on how much work the person is willing to do. I'd take someone with an IQ of 105 who actually does what I tell them to do over a guy with an IQ of 120 who puts in the minimum of effort; any day, any time.
      So yes, dumb people exist to be exploited. Specifically by giving them jobs that they're good at and perform well in, which can be anything from machinist to electrical engineer or medical doctor, if we assume that "dumb" is defined as "within a standard deviation of average" or so.

  • @AkiyamaKatsuko
    @AkiyamaKatsuko Před 5 lety +2053

    At least they drive better than most players in a Forza lobby.

  • @curiosamente
    @curiosamente Před 3 lety +1279

    Could you put the winner brain in a new, different track?

    • @criter96
      @criter96 Před 3 lety +66

      I would assume that yes. As long as the input remains the same and the output is enough to get through the course, then sure. Obviously it might couple of iterations to get used to new environment since as mentioned cars themselves know nothing other than input - output.

    • @TheVerandure
      @TheVerandure Před 3 lety +130

      This would be how you test for overtraining on a neural network. It's the difference between learning to drive and learning the line through a single, specific track.

    • @criter96
      @criter96 Před 3 lety +36

      Came up with interesting examples on how similar test could fail:
      - Widen the road. The goal is to make laps. Cars implemented here would just try to avoid death. If they could do the 360 in a width of the road, in few generations they would probably just start circling.

    • @WahGwaaan420
      @WahGwaaan420 Před 3 lety +8

      against some blue, yellow, green and purple cars? :3

    • @MichaelCrenshaw_TheXaldar
      @MichaelCrenshaw_TheXaldar Před 3 lety +21

      Kinda depends on what he's actually doing internally. If he is training actual neural networks that are being trained to navigate based on wall distance... sure. But if he is deviating from what the video implies and the nets are really just remembering a set of mildly successful actions then no. We can assume from some of the interactions of the cars that he is actually training the network to "predict" (wrong term but that's fine for now) where it should turn based on the variables he gave them.
      Evidence:
      Turns being made without a generational gap. (implies conditional actions instead of instructions)
      Cars continuing to make fairly obvious mistakes in each generation.
      Randomized evolution causing occasional large leaps in the success of a generation.
      There are some points against, but I suspect that the code runs almost exactly as he described. So the neural nets are trained to take the speed, direction, and nearest walls as data. And then run them through some basic (but i'm sure impressive) conditions that are randomized over time. Assuming the code runs in this way, then yes the cars would work along a different track.
      TL;DR
      Almost certainly, the cars would run but probably with a slight performance loss.

  • @Just_A_Guy_Here.
    @Just_A_Guy_Here. Před 3 lety +409

    Gen 200: The cars have have managed to enter the Industrial age.

    • @OceanCrasher
      @OceanCrasher Před 3 lety +26

      Gen 1000: The cars have now created their own simulation of neural network cars.

    • @RasmodeusQ
      @RasmodeusQ Před 3 lety +5

      Gen 12^100: ❄︎︎♒︎︎♏︎︎⍓︎︎🕯︎︎❖︎︎♏︎︎ ●︎︎♏︎︎♋︎︎❒︎︎■︎︎♏︎︎♎︎︎ ⧫︎♒︎♋︎⧫︎ ⬥︎♒︎♓︎♍︎♒︎ ⬧︎♒︎□︎◆︎●︎♎︎ ■︎♏︎❖︎♏︎❒︎ ♒︎♋︎❖︎♏︎ ♌︎♏︎♏︎■︎ ●︎♏︎♋︎❒︎■︎♏︎♎︎📬︎
      Tis encrypted my boy, I wish thee luck if you desire the knowledge; with a forgiving hint of Lingo~

    • @TheLegendary-ns3bi
      @TheLegendary-ns3bi Před 3 lety +7

      @@RasmodeusQ"They've learned that which *
      should never have been learned." but in Wingdings font *'should' was mistyped

    • @the_kombinator
      @the_kombinator Před 3 lety +4

      Still using carburettors, but managing to add forced induction ;)

    • @elionalejandroparedesborna2266
      @elionalejandroparedesborna2266 Před 3 lety +4

      The cars managed to create a racing line

  • @iamherenow7958
    @iamherenow7958 Před 3 lety +99

    Imagine using this to find perfect lines for actual races

    • @lasstunsspielen8279
      @lasstunsspielen8279 Před 3 lety +4

      That would end up like the car chase in Blues Brothers

    • @philrod1
      @philrod1 Před 3 lety +41

      You would need real-car physics such as traction, acceleration, deceleration, etc. I did something similar at Uni, optimising splines for the racing line. I never did get the physics right :(

    • @iamherenow7958
      @iamherenow7958 Před 3 lety +2

      @@philrod1 you could have a 3d physics engine and just use a template physics pack and just view it from above that would probably make the whole thing alot easier because its been done for 100s of games but i may be wrong I’ve only attempted to make basic games and never went anywhere because I didn’t enjoy it as much as I thought

    • @sunboy4224
      @sunboy4224 Před 3 lety +2

      @@philrod1 Is there any previous art on optimized splines for racing? I assume that's a solved problem (or at least we've figured out the system to optimize), right? Do you have any resources on that? It seems really interesting.

    • @philrod1
      @philrod1 Před 3 lety +2

      @@sunboy4224 - It was a while back I was working on this but I definitely remember reading a paper on a similar problem. I think they were using sections of spirals. But, yes. There's no reason this is not a solved problem, just that _I_ failed to solve it. It's only maths.

  • @suvidani
    @suvidani Před 5 lety +3973

    The track should have been re-generated for each generation to avoid overfitting. How the fittest cars perform on other tracks?

    • @patrickthepure
      @patrickthepure Před 5 lety +514

      Thanks to your comment, I just learned what overfitting actually is :)

    • @utkarshkharayat9533
      @utkarshkharayat9533 Před 5 lety +559

      Wow had my ML exam today and no book could explain over fitting , yet this guy's one sentence made it clear as a crystal .
      Thanks guy

    • @justimagine2403
      @justimagine2403 Před 5 lety +107

      Yes, it knows THIS track. It would be curious to see it on another. And ML means Machine Learning.

    • @pallingtontheshrike6374
      @pallingtontheshrike6374 Před 5 lety +141

      eh. overfitting wouldn't be a major issue in terms of tracks, rather the main overfitting problem here is can it perform with different acceleration/traction values.
      It's not given perfect spatial information, which means it doesn't actually make decisions based on coordinates/list, but rather it takes in 5 distances and outputs. 5 distance and output sets that work don't vary much track by track, but rather by specific car specs. This is of course assuming the procedure given in the video is fully correct.
      The neural network is merely taking in 5 distances to collision and computing what to do in the current situation. It is unlikely that it just makes a list, especially seen when cars don't complete laps in the same way each time.

    • @Submersed24
      @Submersed24 Před 5 lety +18

      I dont think it learns like that. I think it just saves the turns it took for the track and variates it slightly in time

  • @WillMiddlewick
    @WillMiddlewick Před 5 lety +1785

    Look at the bottom right. You can press K for a thanos snap!

    • @Onixstar
      @Onixstar Před 5 lety +60

      @@bubbles7608 It says 'Kill half' though
      Edit: This comment responds to a now deleted comment from 'Bubbles' who claimed pressing k would kill everything.

    • @RoxAS-RN
      @RoxAS-RN Před 5 lety +9

      @@bubbles7608 (K)ill Half

    • @Riskomul
      @Riskomul Před 5 lety +3

      @@bubbles7608 And why the F*ck would the snap only kill a half? Only because he wanted for it to be half... if he wanted to destroy everything it would be everything. thanos snap doesnt mean HALF

    • @markorezic3131
      @markorezic3131 Před 5 lety +29

      @@Riskomul wat

    • @UncleMerlin
      @UncleMerlin Před 5 lety +18

      @@Riskomul r/woooosh

  • @derk-306
    @derk-306 Před 3 lety +52

    "FOLLOW MY PATH MY CHILD"
    -the parents

    • @dgx-shorts
      @dgx-shorts Před 3 lety +2

      And child be like nahh!
      True also in real life.

  • @LiTAQ
    @LiTAQ Před 3 lety +52

    I just want to appreciate that this video came out in 2019 but looks like it's from 2009.

  • @saltynut2653
    @saltynut2653 Před 5 lety +1344

    CZcams recommendation is the randomest thing in the world
    but why on earth i click in..

    • @Pwnzistor
      @Pwnzistor Před 5 lety +37

      Because neural networks are fucking awesome, that's why.

    • @ChillingSpartan
      @ChillingSpartan Před 5 lety +28

      Because Google's neural net for recommendation calculated a high probability that you will click in.

    • @skop6321
      @skop6321 Před 5 lety +13

      am I influencing the neural networks or are the neural networks influencing me ? . . . .

    • @Mister.Weatherbee
      @Mister.Weatherbee Před 5 lety +2

      You clicking on this reinforces the algorithm making the right choice :D

    • @AgeofJP
      @AgeofJP Před 5 lety +2

      @@skop6321 yes

  • @Mintor94
    @Mintor94 Před 5 lety +540

    This is very interesting, but you should show also how well (or bad) they are doing when given a different track. By that you'll know if they learned how to ride that specific track, or they learned to drive any track.

    • @kevinosullivan6525
      @kevinosullivan6525 Před 5 lety +62

      the one in the begging that went backwards should have been another Parent representing that change and seeing if some ended up completing it backwards while some went forwards would be cool

    • @lyricallizard7817
      @lyricallizard7817 Před 5 lety +30

      Yes, always validate the network on new, unseen data

    • @MotesTV
      @MotesTV Před 5 lety +17

      @@lyricallizard7817
      The model thus far would be trash on a new track.
      A new track will take a new network.
      It will take thousands if not millions of novel tracks with subtle perturbations to complete a neural network capable of truly facing a novel track and succeeding.

    • @zamfent
      @zamfent Před 5 lety +45

      @@MotesTV That's not correct. The ANN model is simply a link between the yellow radar inputs and the wheels outputs. The model is essentially "when my front radar and right radars are blocked, turn left, and visa versa." These models are very standard and easy to evolve with ANNs. If anything is overfitted, it will simply be generic features like the width of the track--it may have trouble on a much narrower track, for instance. But it ought to do well on a different track with similar features (width of the track etc.).

    • @MotesTV
      @MotesTV Před 5 lety +3

      @@zamfent
      I agree with most of what you said but that I'm "not correct."
      For instance this track is very sinusoidal, what if the track were more angular, and the track narrower? What if such a concept as obstacles were introduced, causing networks which engaged in periodic swerving to facilitate "radar scanning" to become promoted?
      I'm simply pointing out that if this were to begin to become a "throw everything you got at it" test, the model would need loads of work.

  • @daaaah_whoosh
    @daaaah_whoosh Před 3 lety +115

    Huh, after only four generations they drive better than the AI in Halo.

    • @CranyUnknown
      @CranyUnknown Před 3 lety +7

      and better than the one's in this vid czcams.com/video/oHg5SJYRHA0/video.html
      (i don't own the video btw)

    • @gonzalofn95
      @gonzalofn95 Před 3 lety

      @@CranyUnknown reeee

    • @Rabijeel
      @Rabijeel Před 3 lety +4

      Funny, but that is exactly the amazement which is in this.
      HALO AI is old. The AIs have improved a lot since then.
      Back then you had to have around 100 Gens of AI until they manage the first round - and then you had to "teach" them go faster....

    • @SteffenHansen1973
      @SteffenHansen1973 Před 3 lety

      Better than a lot of people IRL....

    • @ImplyDoods
      @ImplyDoods Před 3 lety

      @@Rabijeel halo doesnt use this kind of stuff lol its not AI its pre programmed by people

  • @alice20001
    @alice20001 Před 3 lety +3

    This is the first time I've seen this 5-line-method be used and it actually work! The main difference I see here is that you MANUALLY selected the best network, so it could be an issue with the fitness, and that you used random mutation instead of cross-breeding. Which is very interesting!
    Congratulations, you did a great job!

  • @bavrarnasriksforbundsledam7557

    That's an accurate way of teaching how our neural system is working to connect experiences with learning.

  • @michaelbabb1087
    @michaelbabb1087 Před 3 lety +37

    "Victory cannot be achieved without sacrifice." - our boi Viktor Resnov straight outta Vorkuta.

  • @LittleMikeStarCraft
    @LittleMikeStarCraft Před 3 lety

    These videos always blow me away how quickly they learn with such little information.

  • @Spivonious
    @Spivonious Před 3 lety +1

    Fantastic visualization of neural nets. Awesome job!

  • @danburycollins
    @danburycollins Před 3 lety +73

    the real test would surely be deploying the evolved cars on a different race track

    • @raketman101
      @raketman101 Před 3 lety

      not very impressive idd

    • @radioactive.redwood
      @radioactive.redwood Před 3 lety +2

      They would still have to learn the track and do the same process like in the video. As OP said, the cars don’t know they’re in a racetrack.

    • @danburycollins
      @danburycollins Před 3 lety +9

      Except they are steering based on the inputs they receive - so it is not necessarily a case of them remembering the race track 'rote'. It's a question of whether they have 'learnt' or developed an algorithm which allows them to keep in the track as it twists and turns based on the set of inputs they are being given as they go round, and the way in which they respond to them. As you say, they don't know they are on a race track - just that they have a set of inputs.
      It all depends on what the algorithm in each car is actually doing with the inputs, and to what extent getting around the track is actually blind luck.

    • @rocksfire4390
      @rocksfire4390 Před 3 lety +3

      @@radioactive.redwood
      they wouldn't care what the track looked like. again the ai doesn't know it's driving something, it doesn't know it's on a track, it doesn't know anything but "does line 1-5 hit something?" if it does then adjust inputs.
      there are exceptions, like if it hit a big open room it might get messed up but with a bit more training it could figure even that out.

    • @TexMex421
      @TexMex421 Před 3 lety

      @@rocksfire4390 The AI has to know some things. Collisions are bad, laps are good for example.

  • @ImNotCheez
    @ImNotCheez Před 3 lety +39

    97% : I have to go faster!!
    2% : I just wanna go back
    1% : Paused.

  • @hear5am
    @hear5am Před 3 lety +1

    This is the best way to simply explain AI that I can use for anyone. Great stuff!!

  • @fireinabottle5502
    @fireinabottle5502 Před 3 lety

    those lines were near perfect by the end, stunning

  • @BlackFox0
    @BlackFox0 Před 3 lety +29

    Nice to see someone working on neural networks. I actually did a project exactly like this for my minor back in the day. I evaluated the genomes using 2 factors.
    1. Checkpoints: as you've stated. This is annoying to make at first but it is a must to automate evaluation. The more the better.. Hand-picking is just not going to work in the long run haha.
    2. Car damage: This one turned out to be very important as well to force the AI to drive acceptably. However i can see that your car just stops after crashing so this might not apply to you.
    Also something worth pointing out is that if you want cars to genuinely learn how to drive a track, you should have them learn on multiple tracks. I was so surprised to see my cars drive my first track like pro's only to get destroyed in a new track. What I did to avoid overfitting was to teach my genomes how to drive on 1 track until they're somewhat capable. Then gradually introduce new tracks and evaluate the fitness of all tracks combined. This way, only genomes that adapted to various situations will be selected.

    • @dcode1
      @dcode1 Před 2 lety

      I tried something similar and trained on multiple tracks and then tested on different tracks that were not part of the training data.
      There is a video on my channel ;)
      I also ran into some overfitting "issues", but I assume this will go away if I use even more tracks for training or reduce the size of the neural network.
      And I found a method to not have to do checkpoints, but generate a fitness value for each track pixel.

  • @flirose
    @flirose Před 5 lety +201

    It was killing me how he was clicking on them too early

    • @fortheloveofnoise9298
      @fortheloveofnoise9298 Před 5 lety +6

      Patience is a virtue. Thatbis whybhe makes for a bad god.

    • @thelevhart7980
      @thelevhart7980 Před 5 lety +1

      Because all the cars will mingle together after some time and itd be difficult to find that car from 300+ cars

    • @Jayheid98
      @Jayheid98 Před 5 lety +6

      @@thelevhart7980 not necessarily. You wait until the end where they all come to a rest or go as far as they're going to, and select them. If 300 cars get up front, then you want those 300.

    • @brekezek
      @brekezek Před 5 lety

      I did not get why having a selection algorithm was difficult. A simple time/distance would have been interesting to assess

  • @LeFreshmeat
    @LeFreshmeat Před 3 lety +2

    For those wondering, the music used is Hero Immortal, by Trevor Lentz.

  • @tjejojyj
    @tjejojyj Před 3 lety

    Excellent. We are in the process of seeing if this will scale and handle the complexity of real driving with the imperfection of real sensors.

  • @user-un9bu4ut8l
    @user-un9bu4ut8l Před 5 lety +4

    Great work! You can also determine breakpoints and select cars automatically, not manual.

  • @velzaresp8623
    @velzaresp8623 Před 5 lety +28

    0:37 MY heart. Because you know to much fastfood.

  • @_IvanMichael
    @_IvanMichael Před 5 lety +1

    *Wow, I'm really amazed! Great work bro!*

  • @Kram1032
    @Kram1032 Před 3 lety +2

    I actually like that you're selecting this manually. I think that may help you to significantly improve the conversion speed vs. regular fitness functions

    • @83vbond
      @83vbond Před 3 lety

      He's using his own brain's neural network to evaluate the fit of the machine net :)

  • @babarius1522
    @babarius1522 Před 5 lety +3

    CZcams recommendations at its best

  • @malax632
    @malax632 Před 5 lety +3

    honestly great video. But the music in the background was so perfect. Really nice choice props to you

    • @TrevorLentz
      @TrevorLentz Před 5 lety

      Glad you enjoyed the song. You can find my latest album "D-Pad Destruction" on Spotify. open.spotify.com/album/33NZN8PiYeEkW0w8V26rLP

    • @malax632
      @malax632 Před 3 lety

      @@TrevorLentz Oi cheers man, you make great music

  • @prathameshsundaram7509

    Great video man! Loved the presentation & visualization!

  • @Saddutchman
    @Saddutchman Před 3 lety

    Awesome stuff man. I did a project at university implementing AI in Robocode(Genetic algorithm for movement, neural network for aiming and shooting and a basean network for decision-making). That was a lot of fun and we found that nearly no matter the parameters, it always decided to not shoot but just avoid bullets.

  • @iyrnray
    @iyrnray Před 3 lety +5

    I absolutely love that in the first few generations they tried to go backwards and then cross the finish line, the little robot buddies are tryna cheese the game already

    • @zuzukyd
      @zuzukyd Před rokem +1

      well some of them were thrown into "existence" facin in the wrong direction lol

  • @stmaur0
    @stmaur0 Před 5 lety +806

    After that training, how do they perform on a different circuit?

    • @lucasbruel
      @lucasbruel Před 5 lety +80

      Very likely they don't perform any better than the first generations. It seems like the program is just given the 5 numbers for distance and spits out two other numbers that trace out a curve. What was selected was the algorithm that spits out a curve that fits the circuit.

    • @evil001987
      @evil001987 Před 5 lety +38

      @@lucasbruel It doesn't get any numbers for distance inside the curve or location inside the track. It recives distance to the edge of the track. So it could still work relatively well. It would likely manged to turn correctly, BUT, it might be unable to stay at an appropriate speed, because the correct speed might be highly dependent on the track.

    • @1080pixel
      @1080pixel Před 5 lety +20

      It will perform nearly the same. You can see this, when the first generation was driving into new areas... they behaved like in earlier places.

    • @tkdlvk27
      @tkdlvk27 Před 5 lety +7

      I don't think so. It is like genetic algorithm to overfit only this circuit not a general driving

    • @msq7041
      @msq7041 Před 5 lety +4

      @@lucasbruel the networks are familliar with gentle and sharp turns in both directions, so they will handle that, but something like a separation or crossing would be new to them

  • @jakobthekid
    @jakobthekid Před 3 lety

    Thanks for explaining whats going on in the process. Really cool stuff

  • @simplyclarified6948
    @simplyclarified6948 Před 3 lety

    Evolution of life on earth through selection works exactly that way. Fantastic demo!

  • @ender8850
    @ender8850 Před 5 lety +16

    "Kazunori Yamaguchi programing the AI for Gran Turismo 4 - circa 2003, colorized"

  • @alanwatts8239
    @alanwatts8239 Před 3 lety +13

    Skip 100 gens and you've got yourself a tiny Senna.

    • @marn200
      @marn200 Před 3 lety +1

      My brother has a tiny senna from Lego

  • @beepboopgpt1439
    @beepboopgpt1439 Před 4 lety +1

    You're like a god, creating your own universe of cars.

  • @unbekannternr.1353
    @unbekannternr.1353 Před 3 lety

    A wonderful example, very worthy to be taught to kids of any age!

  • @mateusz4r
    @mateusz4r Před 5 lety +14

    Now implement Reynold's boids on top of that so that the individual cars could see each other :)

  • @janbal2972
    @janbal2972 Před 3 lety +3

    Everybody gansta until the machines start learning

  • @Las505
    @Las505 Před 3 lety

    wow ! this totally inspires my confidence in self-driveing cars... specially those guys in the begining

  • @shengwubin4130
    @shengwubin4130 Před 5 lety

    Really great demo!

  • @ezradelsman6743
    @ezradelsman6743 Před 3 lety +18

    I wanna see this for DiRT Ralley. That would be so cool.

  • @albertomanchester2862
    @albertomanchester2862 Před 4 lety +17

    After that training, how do they perform on a different circuit?
    1 week later
    Skynet: ALL YOUR BASE ARE BELONG TO US !

  • @Aikisbest
    @Aikisbest Před 3 lety

    This is absolutely brilliant!

  • @Oxmond
    @Oxmond Před 4 lety +1

    Beautiful example! Well done! 👍🤓❤️

  • @Jongong_01
    @Jongong_01 Před 5 lety +27

    Wait! Why am I here? I’m suppose to watch meme videos.. but this is too interesting so imma stay

  • @jacksonzheng3103
    @jacksonzheng3103 Před 3 lety +16

    gigante: breeding cars
    me: struggles to get a cnn cat and dog image classifier to work

  • @JagofTroy
    @JagofTroy Před 3 lety

    Amazing. This video was incredible

  • @pumbaa667
    @pumbaa667 Před 3 lety

    Thanks, that was incredible !

  • @EmoryM
    @EmoryM Před 5 lety +18

    Getting around the track after 3 mutations seems crazy to me.

    • @goodby39
      @goodby39 Před 5 lety +1

      EmoryM it’s because he was manually deciding which cars get to move on each generation... kinda cheating

    • @vulpine3431
      @vulpine3431 Před 5 lety +3

      @@goodby39 Well, isn't normaly there a system to decide which ones go on anyway? He just hasn't implemented such a system, so he chose them instead.

    • @NotLegato
      @NotLegato Před 5 lety

      i mean you could've just done some kinda least squares fit to a path he himself would draw, but that'd be basically the same thing, and also develop WAY faster.

    • @evil001987
      @evil001987 Před 5 lety +1

      @@NotLegato Yeah, if he just measured distance travelled and choosed the best one, it would have same result. Still three generations is very fast.

  • @Runawaysage9
    @Runawaysage9 Před 5 lety +12

    Thanos: You should've gone for the head
    *Presses K on the keyboard
    Thor: Noooo

    • @ManuMitraan
      @ManuMitraan Před 5 lety

      I was about to type this.. Lmao 😂 😂 😂

  • @OrbGoblin
    @OrbGoblin Před 3 lety

    The music is incredible.

  • @TPfaffle
    @TPfaffle Před 3 lety

    They're even developing racing lines. Nice work.

  • @GudJobb
    @GudJobb Před 5 lety +4

    1969: There will be flying cars in the future
    2019:

    • @caringtonmathalephahlamohl7487
      @caringtonmathalephahlamohl7487 Před 5 lety

      lmao... Maybe they lost the tech like they did for the project to the moon... #lies
      I have another for 2050:
      Quantum computer will shatter out security model.
      2050:

  • @tylerc5311
    @tylerc5311 Před 5 lety +164

    *1 week later*
    Skynet: ALL YOUR BASE ARE BELONG TO US !

    • @chillappreciator885
      @chillappreciator885 Před 5 lety +2

      Not funny

    • @noietzpk5169
      @noietzpk5169 Před 5 lety +8

      @@chillappreciator885 You are on the way to destruction, you have no chance to survive make your time

    • @JaguarBST
      @JaguarBST Před 5 lety +7

      I hope gen 2 Skynet will have better grammar 🤣

    • @icekurimu1688
      @icekurimu1688 Před 5 lety +1

      Noietz PK 🤣that is funny

    • @petermaxx3669
      @petermaxx3669 Před 5 lety +11

      *1 week ago*
      Naked man: I need your clothes, your boots and your motorcycle

  • @jankostal2998
    @jankostal2998 Před 3 lety

    The Force is with YOU 🙌🙌

  • @stevewaclo167
    @stevewaclo167 Před 5 lety

    Well done John! Next challenge will be hitting apexes, late braking and situational awareness to minimize lap times!

  • @andrewglinski4722
    @andrewglinski4722 Před 5 lety +81

    Looks like a bunch of BMW drivers.

    • @LubomirPotocki
      @LubomirPotocki Před 3 lety +2

      @CF - 12ZZ 571370 Mayfield SS (2452) Indeed they are not using blinkers and overtake on the right.

    • @miguellopes6669
      @miguellopes6669 Před 3 lety +1

      Audi...

    • @pugnate666
      @pugnate666 Před 3 lety

      some things are just international, i guess ^^

    • @randyfleet9968
      @randyfleet9968 Před 3 lety

      Jealous!

    • @miguellopes6669
      @miguellopes6669 Před 3 lety

      @@randyfleet9968 Have a Tesla and a Mercedes, can´t be jeaulous of crap

  • @karius85
    @karius85 Před 5 lety +281

    Seems more like some sort of "manual" evolutionary algorithm than a neural network, there is no obvious place where backpropagation or any learning is done.

    • @karius85
      @karius85 Před 5 lety +30

      @@drkmtr Agreed. My reason for commenting is that I feel the title should have included Genetic Algorithm to some extent, as it is the only certain method I can see here for training. There may well be an ANN with connected nodes used, but there is hardly any signs for it, so it's hard to see that a NN is in fact the underlying framework in this case. Without a notion of generality, meaning the algorithm performs comparatively well on a random course, it is hard to see how using a NN framework improves on a straightforward GA approach.

    • @MuffinMan0521
      @MuffinMan0521 Před 5 lety +18

      @@karius85 it looks like to me some guy created a program that brute forces the solution and since it doesn't get a chance to keep trying after a car hits the wall he has to manually tell it which ones made the most progress. I hate the term AI. I don't see any intelligence in any of the "AI" examples anyone ever shows. It's just a stupid buzzword to me.

    • @HermanWillems
      @HermanWillems Před 5 lety +3

      I learn while i live. Can we create Cars that don't die but learn ON THE FLY?

    • @karius85
      @karius85 Před 5 lety +6

      @@MuffinMan0521 I wouldn't go as far as calling it "brute forcing", but I see your point. The results are made slightly less impressive by manual selection for training, instead of a fitness function. I agree that the term "AI" is currently used somewhat loosely, and I prefer more succinct terminology. I've seen simple linear regression being called an AI in the media, which is just ridiculous.

    • @noellelavenza494
      @noellelavenza494 Před 5 lety +2

      This feels more like a roundabout way of doing inverse reinforcement learning by hand, actually.

  • @asdfasdfasdf383
    @asdfasdfasdf383 Před 3 lety

    You are an inspiration. One day, I will code this.

  • @kalleidoskop2
    @kalleidoskop2 Před 3 lety

    Phenomenal, thanks for this!

  • @hemanthkumarar
    @hemanthkumarar Před 3 lety +33

    Those dislikes are from humans..

  • @derjansan9564
    @derjansan9564 Před 5 lety +21

    Would be interesting to see you manually trying to compete against the best car from your genetic algorithm.

    • @IKTeam
      @IKTeam Před 5 lety

      Hm,would that even be possible?

    • @Henrix1998
      @Henrix1998 Před 5 lety +1

      It would be easy win, the AI doesn't know about racing lines

    • @alexnuckolls8114
      @alexnuckolls8114 Před 5 lety

      Henrix98 Thats assuming the human has the reaction time and skill to gain any time with racing lines.

    • @Derpy-qg9hn
      @Derpy-qg9hn Před 5 lety

      @@alexnuckolls8114 It's not really that hard. It's less reaction time, more simple memorizing rules. It'd hard to get an Assetto Corsa world record; but it's not too hard to be a second off of it.

  • @fabdani2000
    @fabdani2000 Před 3 lety

    Great experiment!

  • @chrisd6736
    @chrisd6736 Před 5 lety +1

    F1 races of the future are gonna be really fun.

  • @Dubswitcher
    @Dubswitcher Před 5 lety +4

    Am I the only one who was taken back to biology class from the shape of the track

  • @salihkaragoz2322
    @salihkaragoz2322 Před 5 lety +157

    Great Work. A question, How did you implement that? which framework that you used. Pytorch etc, And also GUI - framework connection, data preparation

    • @ezanchi5422
      @ezanchi5422 Před 5 lety +10

      Would like to know.

    • @princeofexcess
      @princeofexcess Před 5 lety +41

      This is not using deep neural networks that learn through back-propagation but instead it is using an evolving neural network. (Although this is not neat it acts in very similar way)
      You dont actually need GPU nor a neural network library like pytorch or tensorflow to write code like this. (You can implement your own algorithm in python. Or just use neat algorithm since it has the same effect )
      If you know how neural networks work simply create one with random weights then alter the weights of the best networks slightly and see if it gets better.

    • @marekpiirikivi9877
      @marekpiirikivi9877 Před 5 lety +28

      @@princeofexcess Yep. People often see neural networks as something complicated. In fact, one can program it within 20 minutes from scratch. It's really easy to implement.

    • @GaryMcKinnonUFO
      @GaryMcKinnonUFO Před 5 lety +4

      @@princeofexcess It has similarities to a genetic algorithm.

    • @yaroslavpanych2067
      @yaroslavpanych2067 Před 5 lety +31

      @@GaryMcKinnonUFO IT IS genetic algorithm. By definition.

  • @inibapakbudi
    @inibapakbudi Před 5 lety

    Hey, Great job. Thanks for sharing this video. I learnt alot.

  • @Noel_Medina
    @Noel_Medina Před 5 lety

    Cool af, mad props!
    I have no idea what's goin on but I respect it😎

  •  Před 5 lety +9

    That's cool.
    Now make another AI for some tower defense fun!

  • @DanielNehemiahJ
    @DanielNehemiahJ Před 3 lety +4

    This shows that most of the tasks we humans do, like playing games can all be represented in complex mathematical equations!!

    • @Zekromus
      @Zekromus Před 3 lety +1

      I would say that this is not a very good representation for everyday tasks - how about the task of creating this? :)

    • @PickyPaige
      @PickyPaige Před 3 lety

      So we are living in a simulation.

  • @jdearr1
    @jdearr1 Před 5 lety

    The fastest car out of the gate was frequently left by the wayside it appeared on first viewing. Awesome video

  • @MIH1230
    @MIH1230 Před 5 lety

    I dont know why CZcams recommended this for me... but THANKS CZcams, love the vid

  • @user-xn5ky9uj3j
    @user-xn5ky9uj3j Před 5 lety +63

    Shouldn't it be called Genetic algorithm rather than Neural Network?

    • @matthewhall2318
      @matthewhall2318 Před 4 lety +41

      It's both. Using a genetic learning algorithm to train a neural network driving model

    • @seeker4430
      @seeker4430 Před 3 lety +4

      Where is the code for this? Has he shared it?

  • @tianjin8208
    @tianjin8208 Před 5 lety +11

    This is awesome!! Did u plan to opensource this???

    • @erix777
      @erix777 Před 5 lety

      Yeah, opensource it dude!

    • @RyanWebDev
      @RyanWebDev Před 5 lety +6

      I made something very similar in response to this asshat not making his open source. github.com/RyanCopley/self-driving-car-game

    • @tianjin8208
      @tianjin8208 Před 5 lety

      @@erix777 Someone mention me pls once it opensourced.

  • @sunso1991
    @sunso1991 Před 3 lety +1

    this is AWESOME!!!!!!!!!!!!!!!!!!!!!
    thank you for making it!

  • @twistiv
    @twistiv Před 5 lety

    I like how on the third generation they started doing better than you expected and you had to unselect a few of them

  • @MiottoGuilherme
    @MiottoGuilherme Před 5 lety +32

    Really cool project, congrats!
    My only concern is about generalization: if you get the best performing generation and run it on a different course, will it still perform well? We have to remember that neural networks are models with very high capacity, they can easily overfit. In that case, the "brain" wouldn't really be "intelligent", it would just memorize what to do on each position of this specific course.
    Therefore we usually never test the model (the neural network) on the same dataset (the course) used for training.
    That could be an interesting next step for your project.
    But again, good job!

    • @thestopper5165
      @thestopper5165 Před 5 lety +3

      That was my immediate conclusion - what was being evolved was a machine optimised to find a path around that *specific* racetrack.
      That's only a minor criticism though; even an overfit would give a starting 'stock' that had some 'wall avoidance', 'brake/accelerate' and 'turn' behaviours - which could them be used in increasingly-difficult tracks.
      Building a general-purpose self-steering mechanism from that stock would be much quicker than starting from scratch.

    • @yaroslavpanych2067
      @yaroslavpanych2067 Před 5 lety +5

      No, this one will perform well (enough) on most other tracks. As you can judge yourself, inputs are not track specific at all. Worst case will be probably very narrow tracks. Also as you can expect, it will fail on tracks with self intersection. But it will perform well on tracks of the same class.

    • @EmoryM
      @EmoryM Před 5 lety

      The car is getting around the track in generation 4, that's 3 mutations - I really doubt it could overfit.

    • @ab8jeh
      @ab8jeh Před 5 lety

      It's really evolving the network to deal with corners, not tracks, so overfitting is unlikely as there is quite a variety of corners on this particular track.

    • @zealiskander
      @zealiskander Před 5 lety

      @@thestopper5165 "what was being evolved was a machine optimised to find a path around that specific racetrack." => completely false. What was being evolved is a machine capable of not hitting a wall given 5 inputs representing its distance to said walls. It's completely de-correlated from the track itself.
      A recursive NN could be optimized for that specific track. Most likely, this one is a very simple NN with 5 inputs, 2-3 layers, and 2 outputs.

  • @ivansidorov6391
    @ivansidorov6391 Před 5 lety +4

    I see now, how you created your driving technique, Takahashi Ryosuke.

  • @EpicFox
    @EpicFox Před 3 lety

    You are the GOD to those cars

  • @mj6463
    @mj6463 Před 5 lety

    I clicked this thinking it was a code bullet vid but your video was good man nice job

  • @MrCmon113
    @MrCmon113 Před 5 lety +16

    That's a Genetic Algorithm. The idea behind Neural Networks is to use stochastic gradient descend to adjust the parameters.

    • @prettymatt3494
      @prettymatt3494 Před 5 lety +1

      Yes, i would think that something like reinforcement learning would be used here. I wonder if he randomly changed the parameters prior to the "generation", and then did this shit. Kinda a interesting approach, but i dont think its as efficient as reinforcement learning

    • @zealiskander
      @zealiskander Před 5 lety

      This is simply untrue. If it has neurons and weights, it is a neural network. You're confusing training and neural networks here.

  • @SwopCovers
    @SwopCovers Před 5 lety +35

    since you didn’t change the environment every iteration, it possibly didn’t learn to drive and it might have just memorised the current environment. Still, this is very impressive though!

    • @shadiester
      @shadiester Před 5 lety +26

      While it may be better suited to this particular track, I doubt it's the case that it's solely suited to and 'memorised' this track because a) it has no memory per se, it drives as though it has never seen the track before and bases how it should drive purely on the information that it has at that particular moment. Additionally, you can see that multiple times a new generation would automatically succeed in manoeuvring multiple new corners that it had never encountered before, suggesting it would be able to do the same where it to encounter such a corner (or any other corner for that matter) in an entirely different track.

    • @pg5353
      @pg5353 Před 5 lety +4

      @@shadiester I think you are right... Everytime it fails, it makes changes to some parameters in its function for the desired output.. so it basically learns what parameters would work best with the given inputs. So as long as its given 7 inputs as he/she has mentioned in the video, cars will learn to drive on any track. Thats how I see it.. i dont know if i am 100% correct because i have just the basic understanding of ML.

    • @thisnicklldo
      @thisnicklldo Před 5 lety +1

      @Shadiester. Yes, clearly it can't be memorising. But it might be more tuned to this particular track than you are allowing for. Not so much different bends, but I wonder how it would do with a pronounced narrowing (chicane) or a very wide section (perhaps beyond sensor range, if the sensors have a range), or distinctly polygonal corners, both convex and concave. Because it is using a very small number of nodes and consolidating 5 or so sensors - I can see situations where this brain could be fooled into going backwards if the track perimeter was wrong for it.

    • @MadBunnyRabbit
      @MadBunnyRabbit Před 5 lety

      @Shadiester @Flutter with Butter @thisnicklldo do you even read? The guy wrote it. The ai has no concept of what will happen if they hit the wall it just takes distances to each wall and randomly outputs numbers that controll speed and direction, while he has to manualy pick the best ai from each iteration. This thing can in theory manouver on any track, but it will freak the fuck out since:
      - it doesn't know that it needs to avoide walls
      - it outputs random stuff based on input
      You wanna see an AI that will understand how to manouver any track? Here:
      czcams.com/video/r428O_CMcpI/video.html

    • @eliancordoba1199
      @eliancordoba1199 Před 5 lety +1

      @Andy agree with you, in order to see if it really learns he should test a trained "AI" in a new track.

  • @ausika
    @ausika Před 3 lety

    this dude just coded evolution

  • @johanlarsson9805
    @johanlarsson9805 Před 5 lety

    This is how I started my own learning in this field 10 years ago, I've been a sucker for genetic algorithms since, but with the advent of physical cores on graphics card designed for matrix calculations i'm using back propegation more and more

  • @newrez
    @newrez Před 5 lety +4

    Very impressive, maybe improve by having them try to learn a correct racing line. Will make them faster. eg, taking the corners to correctly hit the apex and minimize the amount of turning and loss of speed.

  • @nikolaychechulin3494
    @nikolaychechulin3494 Před 5 lety +3

    Nice video
    Could you please explain how you store the genome of each car?

  • @luqmanhafeez55
    @luqmanhafeez55 Před 3 lety

    I believe this the best video on how to explain to everyone about how AI works... thanks for the video

  • @henmich
    @henmich Před 3 lety

    I LOVE this!! This makes me want to go get a degree in computer science, with AI as a focus...