第8章現代の畳み込みニューラルネットワーク
8.1.3. Training8.1.3 訓練
Although AlexNet was trained on ImageNet in Krizhevsky et al. (2012), we use Fashion-MNIST here since training an ImageNet model to convergence could take hours or days even on a modern GPU. One of the problems with applying AlexNet directly on Fashion-MNIST is that its images have lower resolution ( pixels) than ImageNet images. To make things work, we upsample them to . This is generally not a smart practice, as it simply increases the computational complexity without adding information. Nonetheless, we do it here to be faithful to the AlexNet architecture. We perform this resizing with the
resize argument in the d2l.FashionMNIST constructor.英語のヒント
Krizhevsky et al. (2012)ではAlexNetはImageNetで訓練されたが、ここではFashion-MNISTを使う。ImageNetのモデルを収束するまで訓練するには、現代のGPUでも何時間も何日もかかりうるからである。AlexNetをFashion-MNISTに直接当てはめるときの問題の一つは、その画像の解像度(画素)がImageNetの画像より低いことである。うまくいかせるため、画像をにアップサンプリングする。これは一般には賢いやり方ではない。情報を加えずに計算の複雑さを増やすだけだからである。それでも、AlexNetの構造に忠実であるために、ここではそうする。この大きさの変更は、
d2l.FashionMNISTのコンストラクタの引数resizeで行う。Now, we can start training AlexNet. Compared to LeNet in Section 7.6, the main change here is the use of a smaller learning rate and much slower training due to the deeper and wider network, the higher image resolution, and the more costly convolutions.
英語のヒント
これで、AlexNetの訓練を始められる。7.6節のLeNetと比べると、ここでの主な変化は、もっと小さな学習率を使うことと、ネットワークがより深く広いこと、画像の解像度が高いこと、畳み込みの費用が高いことのせいで、訓練がずっと遅くなることである。
model = AlexNet(lr=0.01)
data = d2l.FashionMNIST(batch_size=128, resize=(224, 224))
trainer = d2l.Trainer(max_epochs=10, num_gpus=1)
trainer.fit(model, data)