/pytorch_imagenet

PyTorch implementation of AlexNet

Primary LanguagePython

The implementation of AlexNet in PyTorch Vision is not actually the ordinary version. In this case, this repository reimplements some of the networks for the author's usage.

Pre-requirements

Data Preparation

The original data loader (link) is slow. Therefore, I build a new data loader with Caffe utils.

Genearte LMDB

The preprocessed datasets can be found here. Please download it and uncompress it into the directory of ./networks/data/.
To generate the dataset from raw images, please follow the instructions for Caffe to build the LMDB dataset of ImageNet. However, the key used in the LMDB dataset is not suitable for accessing. Therefore, please use the script ./tools/fix_key.sh to convert the keys. Preprocessed data will be available soon.

Load LMDB

Please change the variable lmdb_dir in ./datasets/folder.py to the directory which includes the training and validating LMDB datasets.

AlexNet

The implementation is in ./networks/model_list/alexnet.py. Since PyTorch does not support local response normalization (LRN) layer, I implements it also. The trained model will be available soon.

Training from scratch

$ cd networks
$ python main.py --arch alexnet

Evaluate pretained model

Pretrained model is available here. The pretained model achieves an accuracy of 57.494% (Top-1) and 80.588% (Top-5). Please download it and put it under the directory of ./networks/model_list/. Run the evaluation by:

$ python main.py --arch alexnet --pretrained --evaluate