This project implements the code to create a hybrid model which combines a basic CNN with handcrafted SIFT features. The CNN is based on the ALL-CNN-A network from https://github.com/wtsyang/dl-reproducibility-project/blob/master/Report.ipynb. The dataset used is CIFAR-10. The SIFT features are created using OpenCV's Dense SIFT feature generator, which creates a set amount of features which are then flattened and combined with the flattened feature maps created by the CNN. The combined feature vector is then fed to a series of fully connected layers which output the results. By default the training batch size is 256, the learning rate 0.05 and the network is trained for 350 epochs. Preprocessing includes random horizontal flipping, random cropping and normalization.
In summary, the hybrid model outperforms the CNN by about 1.6%. Which makes it hard to justify the 2-3 times increase in learning time.
The results can be recreated by simply running main.py, which will automatically download all relevant data. It then starts the training of the hybrid model with listed parameters. The CNN results can either be viewed over at the listed github link or recreated using this code by altering it slightly. One needs to switch out the classifier with the CNN, change the input data in trainer.py from cuda to regular data and finally uncomment the last Conv2d, ReLU and AdaptiveAvgPool2D layers in cnn.py.
To test out the code on other datasets such as the FASHION-MNIST, one needs to simply alter the torch.datasets code located in the loader.py.
-
Notifications
You must be signed in to change notification settings - Fork 0
dVoorhout/SIFT-CNN-hybrid
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published