C++ / Libtorch implementation of ImageNet Classification with Deep Convolutional Neural Networks. AlexNet is the winner of 2012 ImageNet Large Scale Visual Recognition Competition.
This project implements AlexNet using C++ / Libtorch and trains it on the CIFAR dataset.
- GCC / Clang
- CMake (3.10.2+)
- LibTorch (1.6.0)
If you are going to use GPU:
- CUDA (10.0.130)
- Nvidia Driver (450.80.02)
You can install LibTorch from PyTorch's official website.
Download CIFAR.
You can use ImageNet as well. AlexNet alreadys exists here, you would just need to write a dataloader for it.
$ git clone https://github.com/bhiziroglu/Image-Classification-with-Deep-Convolutional-Neural-Networks
$ cd Image-Classification-with-Deep-Convolutional-Neural-Networks
$ mkdir build
$ cd build
$ cmake -DCMAKE_PREFIX_PATH=your_libtorch_path ..
NOTE: If you want to use GPU, you should have CUDA installed before this step.
cmake should find your CUDA installation automatically.
For reference, mine is installed at : /usr/local/cuda
$ cmake --build . --config Release
After you make changes to the code and want to build again:
$ make
$ ./dnn
Feel free to create an issue if you face build problems.
My main goal was to use C++ and Libtorch. For that reason, I didn't try to get a high test accuracy.
Test set accuracy is around 70%.
Current SOTA is 99.37%.
You can try adding data augmentation and changing the hyperparameters to increase the test score.