TensorflowでCPUでCIFAR-10トレーニングを行っていました。最初の数回のラウンドでは、損失は大丈夫だったようだ。しかし、ステップ10210の後、損失は変化し、NaNになる。Tensorflow:損失が「NaN」になる
私のネットワークは、ウェブサイトのCIFAR-10 CNNモデルをモデル化しています。ここに私の設定は、
image_size = 32
num_channels = 3
num_classes = 10
num_batches_to_run = 50000
batch_size = 128
eval_batch_size = 64
initial_learning_rate = 0.1
learning_rate_decay_factor = 0.1
num_epochs_per_decay = 350.0
moving_average_decay = 0.9999
であり、結果は以下の通りです。
2017-05-12 21:53:05.125242: step 10210, loss = 4.99 (124.9 examples/sec; 1.025 sec/batch)
2017-05-12 21:53:13.960001: step 10220, loss = 7.55 (139.5 examples/sec; 0.918 sec/batch)
2017-05-12 21:53:23.491228: step 10230, loss = 6.63 (149.5 examples/sec; 0.856 sec/batch)
2017-05-12 21:53:33.355805: step 10240, loss = 8.08 (113.3 examples/sec; 1.129 sec/batch)
2017-05-12 21:53:43.007007: step 10250, loss = 7.18 (126.7 examples/sec; 1.010 sec/batch)
2017-05-12 21:53:52.650118: step 10260, loss = 16.61 (138.0 examples/sec; 0.928 sec/batch)
2017-05-12 21:54:02.537279: step 10270, loss = 9.60 (137.6 examples/sec; 0.930 sec/batch)
2017-05-12 21:54:12.390117: step 10280, loss = 46526.25 (145.5 examples/sec; 0.880 sec/batch)
2017-05-12 21:54:22.060741: step 10290, loss = 133479743509972411931057146822656.00 (130.4 examples/sec; 0.982 sec/batch)
2017-05-12 21:54:31.691058: step 10300, loss = nan (115.8 examples/sec; 1.105 sec/batch)
NaNの損失に関する考えはありますか?
学習率を0.01または0.001に下げることができますか。 – hars
あなたの練習は非常に大きいです、それを減らしてください。 –
この質問はここでかなりロバストに答えています:https://stackoverflow.com/questions/40050397/tensorflow-nan-loss-reasons/45339569#45339569 – Zroach