]> git.djapps.eu Git - pkg/ggml/sources/ggml/commit
Add MNIST inference example with CNN
authorRadoslav Gerganov <redacted>
Sun, 27 Aug 2023 17:46:51 +0000 (20:46 +0300)
committerRadoslav Gerganov <redacted>
Mon, 28 Aug 2023 13:24:54 +0000 (16:24 +0300)
commit9a287f7a1b6c24c9e090dc782a9eca5757105f71
tree56810447c7106ffa757a0e800e5f3f135a9358f5
parent69bf842b39e6a53218eda35852a91d395d357e18
Add MNIST inference example with CNN

Add one more implementation for MNIST which uses Conv2D layers, ref:
https://keras.io/examples/vision/mnist_convnet/. It achieves ~99%
accuracy on the MNIST test set and also performs better for user inputs.
This implementation expects a model in GGUF format. You can get one with
the 'mnist-cnn.py' script. Example usage:

$ ./mnist-cnn.py train mnist-cnn-model
...
Keras model saved to 'mnist-cnn-model'

$ ./mnist-cnn.py convert mnist-cnn-model
...
Model converted and saved to 'mnist-cnn-model.gguf'

$ ./mnist-cnn mnist-cnn-model.gguf models/mnist/t10k-images.idx3-ubyte
examples/mnist/CMakeLists.txt
examples/mnist/main-cnn.cpp [new file with mode: 0644]
examples/mnist/mnist-cnn.py [new file with mode: 0755]