プリンキピア

第8章現代の畳み込みニューラルネットワーク

8.6.4. Training8.6.4 訓練

We train ResNet on the Fashion-MNIST dataset, just like before. ResNet is quite a powerful and flexible architecture. The plot capturing training and validation loss illustrates a significant gap between both graphs, with the training loss being considerably lower. For a network of this flexibility, more training data would offer distinct benefit in closing the gap and improving accuracy.
英語のヒント
前と同じように、Fashion-MNISTのデータセットでResNetを訓練する。ResNetはかなり強力で柔軟な構造である。訓練損失と検証損失を描いたグラフでは、二つのグラフのあいだに大きな隔たりがあり、訓練損失のほうがかなり低い。これほど柔軟なネットワークでは、訓練データを増やせば、隔たりを埋めて正解率を上げるうえではっきりした利点がある。
model = ResNet18(lr=0.01)
trainer = d2l.Trainer(max_epochs=10, num_gpus=1)
data = d2l.FashionMNIST(batch_size=128, resize=(96, 96))
model.apply_init([next(iter(data.get_dataloader(True)))[0]], d2l.init_cnn)
trainer.fit(model, data)