Open paprikamario opened 4 years ago
@paprikamario さま
ご質問ありがとうございます。 皆のために、とても役立つので嬉しいです。
うまくデータローダーが作れていない気がします。 Google Colaboratoryですと、ファイルパスがうまく本書と合わずにこのエラーに遭遇している人が多いように感じます。
実行環境はAWSやクラウドのマシンでしょうか? Google Colaboratoryでしょうか?
Google Colaboratoryになります.ファイル添付します. 1-3_transfer_learning.zip
# 画像のラベルをファイル名から抜き出す
# google colabの時はfull path になるのでants, beesの場所の変更が必要
if self.phase == "train":
# label = img_path[30:34]
label = img_path[139:143]
elif self.phase == "val":
# label = img_path[28:32]
label = img_path[137:141]
ここの修正が必要のようでした.パスの位置からラベルをとっているようでした.
@paprikamario さま
解決策をありがとうございます。
これが、PyTorch1.6にバージョンが上がって(一緒に配布データセットもパスが変化した?)のか、 今後も皆が遭遇するエラーなのか、後日確認いたします。
重要なご投稿、および解決策を誠にありがとうございます。
1-3_transfer_learning.ipynbをgoogle colaboratoryで,試しに動作させたのですが, 学習の途中で止まってしまいます. 1-1_load_vgg.ipynbは,問題無く動作しました.
バーションは, PyTorch Version: 1.6.0+cu101 Torchvision Version: 0.7.0+cu101 と表示されています.
1-3_transfer_learning.ipynbの最後のセルになります. 画像もダウンロードできているようです.解決策をおしえていただけますと たすかります.よろしくお願いします.
ここからーー
学習・検証を実行する
num_epochs=2 train_model(net, dataloaders_dict, criterion, optimizer, num_epochs=num_epochs) を実行したら,下記のエラーがでてとまってしまいます.解決方法を教えてください.
エラー ===================================== 0%| | 0/5 [00:00<?, ?it/s]
Epoch 1/2
AttributeError Traceback (most recent call last)