AverageMeter and Metric Reduction Clarification
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- jupyter-notebook, python, pytorch
調査の方向性
3d_segmentation/swin_unetr_brats21_segmentation_3d.ipynb から始め、AverageMeter の実装、acc_func の集約、run_acc.update の呼び出しを確認します。ノートブックまたは記載された再現手順を実行し、NaN と非 NaN の予測値/ground truth の組み合わせが報告される平均値にどのような影響を与えるかを検証します。false-positive と欠落クラスについて意図された動作が明確になり、一貫して反映されていれば完了です。
索引モデルが issue の本文から書いたものです。
説明
I am seeking clarification on the AverageMeter and metric reduction implementations in 3d_segmentation/swin_unetr_brats21_segmentation_3d.ipynb.
For instance, here is the AverageMeter implementation provided in the brats swinunetr tutorial:
class AverageMeter(object):
def __init__(self):
self.reset()
def reset(self):
self.val = 0
self.avg = 0
self.sum = 0
self.count = 0
def update(self, val, n=1):
self.val = val
self.sum += val * n
self.count += n
self.avg = np.where(self.count > 0, self.sum / self.count, self.sum)
It's similar to the ImageNet implementation apart from the last line.
ImageNet's last line: self.avg = self.sum / self.count
The reason why I think this could be problematic is because the tutorial does the following:
acc_func(y_pred=val_output_convert, y=val_labels_list)
acc, not_nans = acc_func.aggregate()
run_acc.update(acc.cpu().numpy(), n=not_nans.cpu().numpy())
This implies that anytime the model has a nan prediction and the ground truth is NOT NAN (or vice versa), the resulting dice coefficient is NOT penalized as though the prediction has a dice coefficient of zero.
For instance, let's assume the ground truth is has pixels in it, but the model predicts nothing for one class, resulting in these dice values: [0.0000, 0.8775, 0.1213]
The way that AverageMeter is currently used might simply ignore the 0 dice value in the first class if DiceMetric returned nan for the corresponding class.
However, NaNs are caused by the ground truth being NaN. What happens when the ground truth is NaN AND the predicted is not NaN, because that is also not desirable (i.e. false positive)?
Edit: please see my next comment for further clarification.
To Reproduce
Just run the notebook or use the AverageMeter implementation within your own code.
Expected behavior
Would it be possible to refactor the aggregation/average meter to yield zero if the ground truth is NaN and the predicted is NOT NaN?
- 主要言語
- Jupyter Notebook
- スター
- 2.6k
- フォーク
- 805
- 平均マージ
- 6日 17時間
- マージ済み PR(30日)
- 4
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Project-MONAI/tutorials のほかの issue
-
難易度 1/5 1〜3時間 初心者へのやさしさ 76/100
Project-MONAI/tutorials#2069 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
Project-MONAI/tutorials#1704 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
Project-MONAI/tutorials#2080 ·
-
Rehost CONSep対応中かも @vikashg が 10 日前に担当しました。 オープン
Project-MONAI/tutorials#2079 · コメント 1 件 · 担当者 2 名 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 62/100
Project-MONAI/tutorials#2071 ·
Project-MONAI/tutorials の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
EleutherAI/lm-evaluation-harness#4305 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
kyutai-labs/moshi#427 ·