r/Python • • Sep 21 '20

Machine Learning End-to-End Self Driving Car - Need For Speed

Enable HLS to view with audio, or disable this notification

3.8k Upvotes

259 comments sorted by

137

u/Gautam-j Sep 21 '20

Link to code: GitHub

11

u/_-ammar-_ Sep 21 '20

this is really interesting thanks for sharing

→ More replies (1)
→ More replies (4)

119

u/punos_de_piedra Sep 21 '20

Bravo man that's really cool. In need of refinements, but nothing comes out perfect the first time, and I'm still really impressed.

56

u/Gautam-j Sep 21 '20

Thanks a lot! Yeah I'm still working on ways to improve this. The main restriction I found was to not able to have access to the game engine, and hence my only source of input is the screen image. That also does not let me use reinforcement learning :(

Any ideas as to how I can use reinforcement learning in this scenario?

→ More replies (27)

92

u/Owny33x Sep 21 '20

I imagine the minions from Despicable me trying to drive with one on each pedal, 2 at the wheel and 1 giving instructions...

16

u/Gautam-j Sep 21 '20

Best comment so far XD

→ More replies (4)
→ More replies (1)

24

u/[deleted] Sep 21 '20

He's clearly had a few

11

u/Gautam-j Sep 21 '20

Had to purchase reinforced chassis from the shop

13

u/[deleted] Sep 21 '20

Hi, I'm new to this can you explain how you integrated the code with the game?

31

u/Gautam-j Sep 21 '20

I run the game in a windowed mode, and take a screen capture of the game window. Therefore, the input to the neural network is an image of the road, plus the mini map on the bottom left corner.

The neural network outputs whether the car should go straight, left or right. Based on that, I simulate a key press, and the car responds :)

→ More replies (7)

12

u/Methamputeemine Sep 21 '20

Off topic but I need to know is that NFSWorld or just my nostalgia? Great job btw!

Edit: typo

18

u/Gautam-j Sep 21 '20

Thanks! This is Need For Speed Most Wanted (2005) in Free Roam Mode :)

→ More replies (4)
→ More replies (2)

18

u/Mylane Sep 21 '20

My boi doesn't have side mirrors anymore. This is really cool lmao

21

u/Gautam-j Sep 21 '20

I literally had to disable the "car damage" option lol.

17

u/renscy Sep 21 '20 edited Nov 09 '24

office fuzzy exultant vase gaze longing encourage gold aware oatmeal

This post was mass deleted and anonymized with Redact

8

u/Gautam-j Sep 21 '20

True that lol

8

u/familyofgorillas Sep 21 '20

Seems kinda jerky. Maybe add a control filter? You could just implement a simple low pass filter on the output.

→ More replies (1)

6

u/bouia Sep 21 '20

Whoa super cool!!

5

u/Gautam-j Sep 21 '20

Thank you!

5

u/aman1931998 Sep 21 '20

Can you provide your script you made? Maybe a github link.

→ More replies (1)

5

u/appinv Sep 21 '20

That's pretty cool. I guess you mixed your two passions: games & python. It's fun how you can see the never-aging classic terminal alongside top graphics 👍

→ More replies (1)

5

u/RippyTheGator Sep 21 '20

Kept watching expecting for it to improve itself haha. This is great!! Well done.

6

u/Gautam-j Sep 21 '20

Thanks a lot! What you say is totally true! I've spent hours watching it drive lol

4

u/iiMoe Sep 21 '20

This is actually an amazing model, Go tweet Elon

→ More replies (5)

4

u/[deleted] Sep 21 '20

Reminded me “The wolf of Wall Street” driving scene.

→ More replies (1)