A pytorch implementations for AlexNet.
The introduction to AlexNet can be found in link.
Construction of anaconda and pytorch deep learning environment can be found in link
Using these steps to prepare.
All dependencies can be installed into a conda environment with the provided environment.yaml file.
git clone https://github.com/EightBarren7/AlexNet-Pytorch.git
cd AlexNet-Pytorch
conda env create -f environment.yaml
conda activate AlexNet
You can change the batch_size according to your GPUs.
Howrver,you should set num_workers to 0 if you are using Windows.
If all preparations have been completed,run train.py
python train.py
Run test.pyto eval on FashionMNIST dataset.
python test.py
Classifying raw images has not been provided yet, it may be updated after a while.
Firstly,you should remove the comments in the following lines
# from torch.utils.tensorboard import SummaryWriter
# writer = SummaryWriter("../summarywriter") # 将训练过程保存到tensorboard展示
# writer.add_scalar('train loss', loss.item(), num_iter)
# writer.add_scalar('test acc', test_acc, num_iter)
# writer.close()
Then run train.py
Type in terminal tensorboard --logdir='../summarywriter' --port=6006and open the browser
The results can be found in web address:http://localhost:6006
1.Zhongxin.,"AlexNet网络模型的PyTorch实现",zhihu.com,2021.