Why my deep learning network is producing NaN outputs?

51 ビュー (過去 30 日間)
BIPIN SAMUEL
BIPIN SAMUEL 2024 年 6 月 28 日
コメント済み: BIPIN SAMUEL 2024 年 7 月 1 日
I have a deep CNN network with 39 layers. While training the network is producing NaN output so the loss function is also producing NaN values. My network also has some custom layers which uses 'dlconv' where the weights are intialized using 'initializeGlorot' function. Why the network is producing 'NaN' outputs? Is there any way to solve this? Kindly request to provide suggestions.
Thanking,
Bipin

回答 (1 件)

Prasanna
Prasanna 2024 年 6 月 28 日
Hi Bipin,
When a deep CNN network produces NaN outputs during training, it typically indicates that there is an issue with the numerical stability of the network. Some reasons for NaN outputs can be:
  • Improper weight initializations
  • High Learning Rate
  • Batch normalizations.
To debug and solve the issue, you can try lowering the learning rate, gradient clipping and check and debug custom layers and their corresponding weight initializations and loss functions. Temporarily, you can use a smaller version of your network to see if the issue persists. This can help isolate whether the problem is due to the network size or specific layers.
For more help on network producing NaN outputs, refer the following links:
Hope this helps.
  1 件のコメント
BIPIN SAMUEL
BIPIN SAMUEL 2024 年 7 月 1 日
Thank you @Prasanna, the initial layer that I was using the network was custom layer and it was generating NaN while initializing the weight values, but it was working properly for the inner layers. When I replace the initial layer with the in-built matlab layers the network is working. So, I will check with that initial layers.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDeep Learning Toolbox についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by