美文网首页
Cifar-10 with PyTorch

Cifar-10 with PyTorch

作者: zhe_lin | 来源:发表于2017-05-22 10:46 被阅读0次

    PyTorch is a convenient framwork which allows us to build deep learning network faster.

    However, its tutorial does not provide example of loading datasets from raw data e.g. images. This tutorial uses cifar-10 datasets as an example to show how to load data without torchvision. SourceCode

    First, we download train.7z and trainLabels.csv from kaggle. train.7z contains images from different classes and trainLabels.csv gives out the related labels. Unzip train.7z and put it into 'data' fold. Then we can use data_prepare.py to process data. Specially, function data_preprocessing normalize images to [-1, 1]. Please be aware that shape of training sample is [3,32,32] or PyTorch will report error.

    Then we can use cifar-10.py to train the network. Network structure is 

    3*1->1*3->RELU->BN ->3*1->1*3->RELU->maxpool->BN ->3*1->1*3->RELU->BN ->3*1->1*3->RELU->avgpool->BN->3*1->1*3->RELU ->BN->3*1->1*3->RELU->BN->3*1->1*3->RELU->avgpool->BN->fc(256,256)->fc(256,10)

    With 200 epochs the best validation error is 83%.

    相关文章

      网友评论

          本文标题:Cifar-10 with PyTorch

          本文链接:https://www.haomeiwen.com/subject/ocyyxxtx.html