Training a Neural Network to operate drones using Genetic Algorithm

Поделиться
HTML-код
  • Опубликовано: 1 дек 2020
  • After my first try with flappy I wanted to see how would a genetic algorithm handle more complex situations.
    Github github.com/johnBuffer/AutoDrone
    Music used
    freepd.com/music/Limit%2070.mp3
    freepd.com/music/Rulers%20of%...
    freepd.com/music/Lurking%20Sl...
  • НаукаНаука

Комментарии • 384

  • @Alayric
    @Alayric 3 года назад +299

    Good idea, and I like your smoke!

    • @PezzzasWork
      @PezzzasWork  3 года назад +116

      Thanks! I think smoke is where I spent the most time :D

    • @mendelovitch
      @mendelovitch 3 года назад +42

      @@PezzzasWork Why do we get hung up on those small sidequests?

    • @I_SEE_RED
      @I_SEE_RED 2 года назад +17

      @@mendelovitch it’s an easy way to procrastinate the main problem

    • @anujanshu2917
      @anujanshu2917 10 месяцев назад

      How or where you stimulate this in unity or special software

  • @katzen3314
    @katzen3314 3 года назад +383

    I love how they seem to move so organically even though it seems like a relatively simple model. I bet there's some really interesting optimisation problems and extra restrictions you could throw at this.

    • @katzen3314
      @katzen3314 3 года назад +27

      Also thanks for uploading the demo and source code, very fun to play around with!

  • @NetHacker100
    @NetHacker100 3 года назад +512

    I think that the need to center themselves perfectly with the sphere is what makes them not become speed machines. Because when they reach the target they always gotta somehow "dock". And that requires their inertia to be 0 when they reach that point so they have to slow down. If somehow this was changed by making the drones to just need to touch the point at any part and maybe making the orb bigger I would certainly expect that there would be more speedy manoeuvres to just arrive at the target and pass through it. Perhaps even in an elliptical patrolling. Would be certainly interesting to see.

    • @00swinter21
      @00swinter21 3 года назад +8

      im currently working on the same thing but with more inputs;
      I will try ours too;

    • @eliaswenner7847
      @eliaswenner7847 3 года назад +4

      @@00swinter21 Don't forget to post the result on your RUclips channel !

    • @feffy380
      @feffy380 3 года назад +19

      Exactly my thoughts. It looks like the target requires pixel perfect precision to count as a success. Careful approach is the only way when the targeting criteria are so unnecessarily strict.

    • @christopheroldfield1066
      @christopheroldfield1066 3 года назад +6

      ​@@Wock__ I believe you are right. On one of their videos, there is an actual clock face that counts down on top of the target, like a circular loading bar.

    • @UnitSe7en
      @UnitSe7en 3 года назад +12

      The goal is to dock, not to touch the target. Changing the goals to achieve a better outcome does not mean that your model improved. Making them just have to touch the target so they could go really fast does not mean that they are suddenly better. Your thinking is flawed.

  • @blmppes9876
    @blmppes9876 3 года назад +161

    5:28, gen 900: Ok, you guys are too good and I'm tired now. Bye!!!

    • @NanoCubeOG
      @NanoCubeOG 3 года назад

      true

    • @tuna3977
      @tuna3977 2 года назад +1

      "I have to go now, my planet needs me"

  • @WwZa7
    @WwZa7 3 года назад +210

    I'd love to see a game where your enemies are all neural network trained AI, and the higher the difficulty, the more trained AI variant you will have to face

    • @ChunkyWaterisReal
      @ChunkyWaterisReal 3 года назад +13

      Give it 10 years

    • @kirtil5177
      @kirtil5177 2 года назад +42

      imagine if the AI is being trained while you play. The better you play the less hard the ai is, but if you slow down the difficulty increases

    • @marfitrblx
      @marfitrblx 2 года назад +15

      @@ChunkyWaterisReal it's already possible now lol

    • @ChunkyWaterisReal
      @ChunkyWaterisReal 2 года назад +1

      @@marfitrblx AI has been shit since the 64 hush yourself.

    • @keyboardegg931
      @keyboardegg931 2 года назад +4

      Or even the player being an AI - I can totally see a 2D game with your cursor being the target point, and the more you play/the more enemies you defeat/etc. the smarter your character gets

  • @dan_obie
    @dan_obie 3 года назад +85

    Would be really interesting to add fuel consumption to the mix and watch them optimize their fuel economy

    • @dazcarrr
      @dazcarrr 2 года назад +11

      and give them more fuel for every target they reach as more reward for doing that

  • @markoftheland3115
    @markoftheland3115 3 года назад +96

    Very cool stuff, well done!
    Now make them go through an obstacle course 😁

    • @PezzzasWork
      @PezzzasWork  3 года назад +53

      I am working on it ;)

    • @marc_frank
      @marc_frank 3 года назад +6

      a combination of the ants finding the optimal path and then the drones following that? :)

    • @Vofr
      @Vofr 2 года назад +4

      @@PezzzasWork where's the video 🗿

  • @phantuananh2163
    @phantuananh2163 3 года назад +24

    This channel is a gem

  • @osman4172
    @osman4172 3 года назад +2

    Great work. I think many people would appreciate seeing background of the work.

  • @raffimolero64
    @raffimolero64 2 года назад +2

    love this channel. what separates this guy from others is his consistent ability to make his sims look cool.

  • @the0neskater
    @the0neskater 2 года назад +1

    This is one of the coolest projects I've ever seen. Would be awesome to extend to add walls and an environment! Great work.

  • @reaperbs7105
    @reaperbs7105 2 года назад +4

    Props to Gen 300 and 400 for beings underdogs and yet surviving for so long

  • @youssefelshahawy8080
    @youssefelshahawy8080 3 года назад +3

    This is one of the coolest implementations i've seen. Nj!

  • @YellingSilently
    @YellingSilently 2 года назад

    The end of play lineup was a cute touch. Nice work!

  • @SongStudios
    @SongStudios 3 года назад +1

    Dude I love it when they get sooo roofless! So fun to watch!

  • @Lengthy_Lemon
    @Lengthy_Lemon Год назад

    You are amazing. Thank you for sharing your fascinating work.

  • @darkfrei2
    @darkfrei2 3 года назад +1

    Very nice! Please make more such content, with neural network and drones! :)

  • @dromeosaur1031
    @dromeosaur1031 3 года назад +1

    Thanks for the video! It's really inspiring.

  • @thorbenpultke1350
    @thorbenpultke1350 3 года назад +2

    Impressive Stuff! Had my hands on GAs too for my Bachelor Thesis but with a 6 DOF 3D acting robotic arm. Kinda addicting when you dive deep down in ML :)!

  • @noiky6164
    @noiky6164 2 года назад

    OMG This is so cool, your video actually change my attitude toward neural network from hate to love.

  • @s.m8766
    @s.m8766 Год назад +2

    very nice! I'd love to see the same tests, but with added random disturbances like wind gusts from the side, to see how well they can adapt to that!

  • @GG64du02
    @GG64du02 3 года назад +27

    I wrote my autopilot cargo drone for space engineers and still i am impressed by the work

  • @Algok17
    @Algok17 3 года назад

    Very nice result!

  • @Phiwipuss
    @Phiwipuss 3 года назад

    5:56 The drone in the left down corner synchronized with the beat in the music. Perfection.

  • @quinn840
    @quinn840 2 года назад

    Pls make more vids like this I love them

  • @xDeltaF1x
    @xDeltaF1x 3 года назад +46

    That end result with the live-tracking is so good! I wonder how viable it is to train simple neural networks like this for game enemy AI

    • @originalbillyspeed1
      @originalbillyspeed1 3 года назад +2

      Depends on the game, but on games with a clear goal, it is fairly trivial and will quickly surpass humans.

    • @AB-bp9fi
      @AB-bp9fi 3 года назад +4

      @@originalbillyspeed1 i guess for different difficulty levels game designer can use agents (enemies) from different generations, for example "easy" = generation 400, medium = generation 500, hard=generation 1000.

    • @commenturthegreat2915
      @commenturthegreat2915 2 года назад +6

      ​@@AB-bp9fi I don't think that would work for most applications. When you want to make enemy AI easier or harder, you always have to think of it in relation to the player - for instance, in a stealth game, harder AI could mean it detects you faster - which pushes the player to improve and be more careful. That won't happen if you just made the enemies drunk (which is basically what would happen if you pick bad neural networks) - it just adds randomness which can be annoying to deal with. Maybe it could work better in things like racing games though.

    • @williambarnes5023
      @williambarnes5023 2 года назад

      I'm now imagining a game cloud coordinating through the internet. The AI uses background CPU while the game is running to simulate and evolve against itself, spits its best results against the player to see how they fare, and takes those results as more data to go back to the cloud with to keep working. The bots will start laughably bad at first, but they'll learn how players act, and make players devise new tactics... You might even get good teammate and wingman AI out of it if you put those AIs on the player's side.

    • @MrStealthWarrior
      @MrStealthWarrior 2 года назад

      @@commenturthegreat2915 What about training AI to match the certain level of intelligence? Like if AI detects a player too fast, then it failed the test.

  • @memento9979
    @memento9979 3 года назад

    I like these projects !

  • @darkfrei2
    @darkfrei2 3 года назад +5

    Which parameters give the drone positive or negative feedback?
    Is flying time a positive or a negative parameter? An acceleration to the target?

  • @Reverend-dd2lq
    @Reverend-dd2lq 2 года назад +1

    Getting some strong Factorio vibes at 4:57

  • @skoll6007
    @skoll6007 2 года назад

    1:58 that faint Vader "noooooo" put me on the floor for some reason

  • @jeremybertoncini6935
    @jeremybertoncini6935 Год назад +3

    Hello,
    very interesting work !
    Did you think about testing scenarios with obstacles ?
    It would be also interesting to compare the last trajectories and controls with optimal control algorithms solutions.
    Cheers.

  • @mytechpractice8924
    @mytechpractice8924 2 года назад

    Totally amazing!!!

  • @chinmayghule8272
    @chinmayghule8272 2 года назад

    That was really cool.

  • @mawa5702
    @mawa5702 3 года назад

    Love that video

  • @creativecodingwithmaxim
    @creativecodingwithmaxim 3 года назад

    So good! :o very impressive ✨✨✨

  • @JuanPabloLorenzo.
    @JuanPabloLorenzo. 3 года назад +2

    Great video! How long have you been training them? Greetings from Uruguay!

  • @frodobolson213
    @frodobolson213 2 года назад

    Wonderful!

  • @xandon24
    @xandon24 3 года назад

    7:25 the music moves to your left and right ear as the drone in the top right moves it's power to it's left and right thruster.

  • @guillearnautamarit9102
    @guillearnautamarit9102 2 года назад +1

    Wow that's amazing and looks amazing, how did you cross the two neural networks?

  • @eyalsegal6730
    @eyalsegal6730 2 года назад +1

    Nice work!
    What mutation/crossover did you use?

  • @abeltoth1878
    @abeltoth1878 Год назад

    Really cool project!!!
    I was wondering what fitness function you used?

  • @flight_risk
    @flight_risk Год назад

    somewhat smaller models and policy gradient following might have increased convergence speed. MLPs are differentiable, so you could just backpropagate through them, sampling distance to the target at every frame and accumulating rewards over the trajectory for an unbiased estimate of a policy’s optimality. you could even use a decay term to incentivize the robots to move faster by downweighting rewards acquired later in the trajectory: distance to the target is ideally the same in the end, but according to the gradient of this reward function, faster would be better.
    the only thing left would be running the simulations in parallel or faster than real-time by simply not fully rendering the state of the environment at every training step

  • @crristox
    @crristox 3 года назад +1

    What about creating new variables? Like saving fuel or energy consumption, or giving priorities like speed over energy/fuel consumption

  • @motbus3
    @motbus3 Год назад +1

    It would be great to have a remake of this one

    • @PezzzasWork
      @PezzzasWork  Год назад

      I am actually working on a follow up :)

    • @motbus3
      @motbus3 Год назад

      @@PezzzasWork noice! I will certainly watch it

  • @EsbenEugen
    @EsbenEugen 2 года назад

    The target tracking would be cool for a background

  • @J3R3MI6
    @J3R3MI6 2 года назад

    Amazing 😮😮😮

  • @ThePizzaGoblin
    @ThePizzaGoblin 2 года назад

    I like how it learned to turn off its thrusters to arrest upward motion and to speed up descent.

  • @pcy113
    @pcy113 3 года назад

    It's really nice 👍

  • @artherius535
    @artherius535 2 года назад

    400 was such a trooper

  • @jenvetcar5319
    @jenvetcar5319 3 года назад +1

    great Awesome!!👌👌😀. where did you learn to do this?

  • @bobingstern4448
    @bobingstern4448 3 года назад +2

    im more impressed by the smoke, great project though!

  • @jayshukla6724
    @jayshukla6724 2 года назад +13

    7:24 Loved how the Gen-400's legs synced with the music...
    Btw, How do we decide the size of the hidden layers? Is there some rule or formula for the best size approximation?

  • @manuelpena3988
    @manuelpena3988 3 года назад +6

    xDDD the "ok..." almost kills me

    • @Zygorg
      @Zygorg 2 года назад

      The memes are fun on this vid

  • @estebansanchezkanaan2567
    @estebansanchezkanaan2567 3 года назад

    Amazing

  • @sammyboy1112
    @sammyboy1112 3 года назад

    Very cool

  • @KiemPlant
    @KiemPlant 2 года назад +1

    Other than giving us almost 20 seconds to read 6 words at 4:39 this was very enjoyable to watch :p

  • @alejandromartinez-vp4sx
    @alejandromartinez-vp4sx 3 года назад

    Fantastic. Did you published it? Why did you choose GA for learning instead of traditional NN methods, e.g. stochastic gradient descent?

  •  3 года назад

    Achei muito interessante o seu canal, obrigado mano

  • @kovacsattila8993
    @kovacsattila8993 3 года назад +1

    I tryed the mouse controlled vesion what you uploaded on github. And i saw that it's easy to confuse the A.I. in that way to lose controll and fall off the map. I think if you crate a small Trainer A.I. for the target control what best interest to confuse the drone and make it fall off the map, it can train the drone to not fall off no matter how the target moves.

    • @PezzzasWork
      @PezzzasWork  3 года назад +3

      Yes I did a more robust version that I can upload as well

  • @dromedda6810
    @dromedda6810 Год назад

    gen 400 is like that one kid in your class that cant stand still when waiting in a queue

  • @Fallout3131
    @Fallout3131 Год назад

    That drone that got yeeted at 5:30 had me dieing 😂

  • @rishiniranjan1746
    @rishiniranjan1746 2 года назад

    its really beautiful.... can you please suggest how do I learn all this. What I learn in what seuqence ??

  • @jakobheiter355
    @jakobheiter355 2 года назад

    You should make a game out of this, it looks very funny!!

  • @av3stube480
    @av3stube480 3 года назад

    It would be interesting to see which learning algorithm would produce better results, this genetic algorithm or back propagation or something similar.

    • @GhostStyle007
      @GhostStyle007 Год назад

      you can't achieve that comparison unless you use super humains to play that game and train the models... since it's not the case, the genetic algorithm will always reach far more better results at some point, it's about time.

  • @lightandsmoothcoffee
    @lightandsmoothcoffee 3 года назад

    Wowwww I'm amazed

  • @joepeters8746
    @joepeters8746 3 года назад

    With what enforcement do you achieved it (what is input/output), which rewards?

  • @aycoded7840
    @aycoded7840 2 года назад

    This is cool.

  • @sulaimantriarjo8097
    @sulaimantriarjo8097 2 года назад

    how do you tune the weight and bias using GA,? do you intercept the backward process with GA?

  • @argmentum22
    @argmentum22 2 года назад

    Adding a fuel allowance would probably add a more varied result, possibly get those burn hard drones quicker. Also maybe increase your destination bubble a fraction ? This increase the prize rate and hopefully the drones would tighten up the homecoming naturally like the ants do for food routes

  • @pradyumnagupta3989
    @pradyumnagupta3989 3 года назад

    I have been working in ML for quite some time now but haven't learned anything about GA and simulation yet .Can you please point to any resource or tutorial that can help me learn to build something like this?

  • @rishikumarsoni
    @rishikumarsoni 2 года назад +2

    Hi Pezzza, I really liked the video and the way you trained it. Can you tell me how can I learn to code to train a model like this ?? I really want to learn how to do this level of coding. pls reply

    • @00swinter21
      @00swinter21 6 месяцев назад

      ask chat gpt.
      it knows a lot about it
      i used unity for the physics and did my recreation there and it was even better then the original

  • @JavierAlbinarrate
    @JavierAlbinarrate 2 года назад

    Beginning of the video: LOL!! those squeaks as they fall are really funny
    End of the video: let's run to buy some food cans before they come for me!!!

  • @toseneda2012
    @toseneda2012 3 года назад

    good job :)

  • @ziggyzoggin
    @ziggyzoggin Год назад

    I'm kind of upset that you didn't publish the thing at the end on itch. Its so satisfying to see the drone follow your mouse and I want to play around with it. Great video!

    • @PezzzasWork
      @PezzzasWork  Год назад +1

      You can download the control demo here github.com/johnBuffer/AutoDrone/releases/tag/v1

    • @ziggyzoggin
      @ziggyzoggin Год назад +1

      @@PezzzasWork thank you! :)

  • @prakharsethi4910
    @prakharsethi4910 7 месяцев назад

    Hi! i am new, in 3rd year of undergraduation. can u guide me how have you got this far? and what tools and softwares are u using?

  • @markvarden3802
    @markvarden3802 3 года назад

    I would love for you to make an eco system like the bibites using those drones

  • @241lolololol
    @241lolololol 3 года назад +1

    man this is so cool. a bit off topic but how are you rendering the thruster particles and smoke?

    • @PezzzasWork
      @PezzzasWork  3 года назад

      The smoke is just made out of static sprites and the thruster particles are baked into the flame's texture

  • @aiksi5605
    @aiksi5605 2 года назад

    This video felt like it's 30 minutes because I somehow kept falling asleep every ten seconds or so.
    And it's not boring and no I am not high, idk I guess I just got tired or something

  • @aesvarash3256
    @aesvarash3256 Год назад

    Can u make a tutorial how to choose the best inputs depend on sample ?

  • @keltskiy
    @keltskiy 2 года назад

    This would be a great premise for a game where the character tracks the mouse so instead of controlling the character you're directing it and it gets better as you play through AI learning

  • @cirogarcia8958
    @cirogarcia8958 3 года назад +2

    I love this! I'm gonna implement it right now in Python. What genetic algorithm were you using? I'm planning on using Neat

    • @CE-ov7of
      @CE-ov7of 3 года назад +1

      how did you get this environment in Python? I want to test policy gradient RL algorithms

    • @j_owatson
      @j_owatson Год назад +1

      @@CE-ov7of not sure if you still need this question answering however i'll give it my shot. My guess is hes implementing the basic algorithm of the envirment in python using pygame and and numpy. Then for the AI my second guess is he'll be using NEAT Python library or custom AI/NN algorithm for the agent and training. That's my guess however if you want any question just reply and i'll do my best to help. Python isn't my strongest language however but i'll try my best.

    • @CE-ov7of
      @CE-ov7of Год назад +1

      Hey @@j_owatson , unfortunately this is not something I have time/interest for anymore.
      But I really appreciate your willingness to help! This is what makes the software/tech community great!

  • @raphulali8937
    @raphulali8937 3 года назад +3

    i have no idea about how you did it ..but it seems like something fun to learn

    • @PezzzasWork
      @PezzzasWork  3 года назад +1

      Machine learning is extremely fun and addictive :)

    • @00swinter21
      @00swinter21 3 года назад

      @@PezzzasWork can confirm

  • @leesweets4110
    @leesweets4110 Год назад

    How are you training the NN and what does your genome represent?

  • @veggiet2009
    @veggiet2009 3 года назад

    oooh idea. Space Invaders: Drones Addition. Different levels use different generations of drones as enemies.

  • @bluecrystal_7843
    @bluecrystal_7843 2 года назад

    if you had an body orientation/angle input they would have been able to recover from a spin out or even fly upsidedown

  • @itzoryx
    @itzoryx 3 года назад

    Is there a windows version for this dwonload? or am i being dumb lmaooo. but anyway, this is *E P I C*, i loveee the design and everythingggg ahhh ahaha, keep this up :) great work :D

  • @shanewalsch
    @shanewalsch 2 года назад

    Wooow drone is very cool

  • @triplezgames3882
    @triplezgames3882 Год назад

    Am I right, that the final code controlling the drone is really slim and efficient code? It's just some products and sums, and an activation curve, right? Seems pretty amazing for how organic the movement appears

    • @00swinter21
      @00swinter21 6 месяцев назад

      yes exactly. thats the good part about this.

  • @Wolfoxy1904
    @Wolfoxy1904 2 года назад

    thats epic

  • @benjaminojeda5681
    @benjaminojeda5681 2 года назад

    How i can use this or download it? Because is EPIC

  • @908animates
    @908animates 2 года назад

    Imagine spending hours and hours trying to get to something and then when you finally get there you just have to go to another one

  • @alessandrodamato5059
    @alessandrodamato5059 2 года назад

    give a consolation prize to generation 300!
    It deserves it all
    Have you ever tried using a neural network on a hardware platform?

  • @angelodeus8423
    @angelodeus8423 3 года назад

    it's cool to see your using dropout, so it learns better

  • @adolfocabarcas5795
    @adolfocabarcas5795 3 года назад +1

    where do i star to do games and machine learning like this?

  • @kovacsattila8993
    @kovacsattila8993 3 года назад +1

    Why don't you upload a Gen 5500 drone to github? I tryed it but i only founded the Gen 3100 one. I really want to try that one. :D

  • @quietsamurai1998
    @quietsamurai1998 3 года назад +2

    Would it be possible to have the drones compete? For example, by simulating the entire population of drones at once, and only rewarding the first drone to reach a target.

    • @00swinter21
      @00swinter21 3 года назад +1

      That's exactly what genetic algorithms (GA) means

  • @SoulZeroTwo
    @SoulZeroTwo 2 года назад

    After a few tweaks, I have a feeling this could have real-world use.

  • @Andrecio64
    @Andrecio64 2 года назад +1

    1:05: this one looks like Los Angeles Battle drones

  • @petersmythe6462
    @petersmythe6462 3 года назад

    Would be interesting to have a drone sumo where they can collide and try to shove each other out of a ring.

  • @aczander11
    @aczander11 2 года назад

    What activation functions did you use for the hidden and output layers of the neural network?

    • @bobingstern4448
      @bobingstern4448 2 года назад

      Looking at his code I think he used sigmoid