Lornatang AlexNet PyTorch Save

An PyTorch implementation AlexNet.Simple, easy to use and efficient

Project README

AlexNet-PyTorch

Overview

This repository contains an op-for-op PyTorch reimplementation of ImageNet Classification with Deep Convolutional Neural Networks.

Table of contents

Download weights

Download datasets

Contains MNIST, CIFAR10&CIFAR100, TinyImageNet_200, MiniImageNet_1K, ImageNet_1K, Caltech101&Caltech256 and more etc.

Please refer to README.md in the data directory for the method of making a dataset.

How Test and Train

Both training and testing only need to modify the config.py file.

Test

  • line 29: model_num_classes change to 1000.
  • line 31: mode change to test.
  • line 79: model_path change to ./results/pretrained_models/AlexNet-ImageNet_1K-9df8cd0f.pth.tar.
python3 test.py

Train model

  • line 29: model_num_classes change to 1000.
  • line 31: mode change to train.
  • line 33: exp_name change to AlexNet-ImageNet_1K.
  • line 45: pretrained_model_path change to ./results/pretrained_models/AlexNet-ImageNet_1K-9df8cd0f.pth.tar.
python3 train.py

Resume train model

  • line 29: model_num_classes change to 1000.
  • line 31: mode change to train.
  • line 33: exp_name change to AlexNet-ImageNet_1K.
  • line 48: resume change to ./samples/AlexNet-ImageNet_1K/epoch_xxx.pth.tar.
python3 train.py

Result

Source of original paper results: https://proceedings.neurips.cc/paper/2012/file/c399862d3b9d6b76c8436e924a68c45b-Paper.pdf

In the following table, the top-x error value in () indicates the result of the project, and - indicates no test.

Model Dataset Top-1 error (val) Top-5 error (val)
AlexNet ImageNet_1K 36.7%(43.8%) 15.4%(21.3%)
# Download `AlexNet-ImageNet_1K-9df8cd0f.pth.tar` weights to `./results/pretrained_models`
# More detail see `README.md<Download weights>`
python3 ./inference.py 

Input:

Output:

Build AlexNet model successfully.
Load AlexNet model weights `/AlexNet-PyTorch/results/pretrained_models/AlexNet-ImageNet_1K-9df8cd0f.pth.tar` successfully.
tench, Tinca tinca                                                          (95.73%)
bolete                                                                      (1.20%)
triceratops                                                                 (0.43%)
platypus, duckbill, duckbilled platypus, duck-billed platypus, Ornithorhynchus anatinus (0.36%)
croquet ball                                                                (0.28%)

Contributing

If you find a bug, create a GitHub issue, or even better, submit a pull request. Similarly, if you have questions, simply post them as GitHub issues.

I look forward to seeing what the community does with these models!

Credit

ImageNet Classification with Deep Convolutional Neural Networks

Alex Krizhevsky,Ilya Sutskever,Geoffrey E. Hinton

Abstract

We trained a large, deep convolutional neural network to classify the 1.2 million high-resolution images in the ImageNet LSVRC-2010 contest into the 1000 different classes. On the test data, we achieved top-1 and top-5 error rates of 37.5% and 17.0% which is considerably better than the previous state-of-the-art. The neural network, which has 60 million parameters and 650,000 neurons, consists of five convolutional layers, some of which are followed by max-pooling layers, and three fully-connected layers with a final 1000-way softmax. To make training faster, we used non-saturating neurons and a very efficient GPU implementation of the convolution operation. To reduce overfitting in the fully-connected layers we employed a recently-developed regularization method called “dropout” that proved to be very effective. We also entered a variant of this model in the ILSVRC-2012 competition and achieved a winning top-5 test error rate of 15.3%, compared to 26.2% achieved by the second-best entry.

[Paper]

@article{AlexNet,
    title = {ImageNet Classification with Deep Convolutional Neural Networks},
    author = {Alex Krizhevsky,Ilya Sutskever,Geoffrey E. Hinton},
    journal = {nips},
    year = {2012}
}
Open Source Agenda is not affiliated with "Lornatang AlexNet PyTorch" Project. README Source: Lornatang/AlexNet-PyTorch

Open Source Agenda Badge

Open Source Agenda Rating