This is an implementation of a classifier very similar to LeNet, the groundbraking classifier for digits designed by LeCun and others. It starts from the code in https://github.com/tbennun/cudnn-training and implements several improvements:
- the original version runs on CUDNN 6 and does not compile on recent (8+) CUDNN versions; this one does (tested with CUDNN 8.2)
- modular code design, with layers and functionalities clearly split into different files
- polished code, using C++ features and algorithms and several convenience classes to abstract functionalities
- compilation infrastructure that build, download the MNIST database for you and runs a tets version
You can read here for a list of LeNet versions with their architectures and the proceedings paper for the full descrition of LeNet 5 from the authors.
Relevant make targets are
build/lenet_example.exeto build the executablemnistto download the MNIST datasetrunto run the executable (also builds and downloads mnist)helpto see the help from the executable with command line options and their default parameterscleanto remove the built binariesdistcleanto remove the built binaries and the mnist files
To build this code, you need a recent enough (8+) version of CUDA and the nvcc compiler.
Makefile variables of interest
CXXis currentlynvccCUDA_DIR, currently/usr/local/cudais the location of CUDA you are using
A slightly modified version of argparse is included, with fixes to compile with nvcc version 11; this compiler is known to have a bug in inferring std::tuple template parameters leading to sudden crashes.