Skip to main content


Reading @neauoire's posts about character input, got me wondering if it is possible to do character recognition with neural networks inside UXN.

After a few hours of work, the answer is: Yeah, kind of (?)

As a proof of concept I implemented a 3 layer neural network trained on MNIST.
Since UXN has limited memory and no floating point operations, I decided to use a binary neural network: Each weight & activation is quantized to a single bit.

#uxn

in reply to Devine Lu Linvega

Note that this is the first version of this code that worked at all, there are still lots of improvements (the first of which would be using an argmax(...) function to find the correct output, training longer than a few minutes might also help). The example above is slightly cherry picked 😄

https://gist.github.com/can-lehmann/6a6fd92fc54f7416de6ffbca29774187

in reply to Can Lehmann

Training is done externally using a neural network framework I built some time ago. Though it should be possible to achieve the same results with other software. The resulting network is quantized according in multiple phases: First the weights are quantized, then the network is retrained, finally the biases are quantized. The result is exported to UXNTAL.
in reply to Devine Lu Linvega

Oh, its just a C++ module for training feed forward networks, not currently publically available though.
in reply to Can Lehmann

super cool project, so what other things can we feed this. you've train it on recognizing the ascii characters?
in reply to Devine Lu Linvega

Theoretically you could train it on ascii charaters, though I am still a bit confused why the performance of the network inside UXN is considerably below what the theoretical accuracy should be. Either there is still some bug in the UXN code, or I don't do the conversion from C++ to UXN correctly. I should probably figure that out before training larger networks 😀 This is very much a proof of concept right now (i.e. it is possible to fit a NN inside UXN)
in reply to Can Lehmann

super interesting project tho, never seen anything like this attempted on such a tiny stack machine.

Lo, thar be cookies on this site to keep track of your login. By clicking 'okay', you are CONSENTING to this.