Snake Neural Net

I used threejs to train this model.
https://satellitevisualization.pythonanywhere.com/snakeneuralnet

What I like

  • I use raycasters to help alert the neural net. With the AI snake games I have seen, you can hardcode it’s environment. I used raycasters instead since I think it could extend past the grided 2D example. Maybe one day I’ll try to make more complicated models that travel 3D.
  • The neural net visual. I think threejs could easily plug into large python neural net models and make cool visuals.

Thanks!

4 Likes

This is suuper cool. How did you train the network in python? Any resources? Love this stuff…

1 Like

Premiers pas avec TensorFlow.js is pretty solid. It’s what I used to make my image Denoiser and has tons of examples.

If you have pretrained models already ONNX is also an option: Web | onnxruntime

Eventually we’ll be able to do this in the browser with WebNN but it’s even farther back than WebGPU

1 Like

thanks!

I have two versions. A local site where I I trained it using a python backend connected to threejs via websocket.
I used this repo for a basis of the python model. There is also a very good youtube video where he breaks it down.

Then this second (published) site where I transferred over the numpy matrices as JS arrays and perform the dot products and activation functions inside the javascript loop.

1 Like