AverageMeter and Metric Reduction Clarification
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 35/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- jupyter-notebook, python, pytorch
- Bereich
- machine-learning
Rechercherichtung
Beginne mit 3d_segmentation/swin_unetr_brats21_segmentation_3d.ipynb und überprüfe die Implementierung von AverageMeter, die Aggregation von acc_func sowie den Aufruf von run_acc.update. Führe das Notebook oder die angegebene Reproduktion aus und verifiziere, wie sich Kombinationen aus NaN- und Nicht-NaN-Vorhersagen bzw. Ground-Truth-Werten auf den berichteten Durchschnitt auswirken; als erledigt gilt die Aufgabe, wenn das beabsichtigte Verhalten bei False Positives und fehlenden Klassen geklärt ist und konsistent widergespiegelt wird.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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?
- Vorherrschende Sprache
- Jupyter Notebook
- Sterne
- 2.6k
- Forks
- 805
- Ø Merge
- 3 T. 7 Std.
- Gemergte PRs (30 T.)
- 3
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus Project-MONAI/tutorials
-
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Project-MONAI/tutorials#2069 ·
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 85/100
Project-MONAI/tutorials#1704 ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 45/100
Project-MONAI/tutorials#2080 ·
-
Rehost CONSepEvtl. vergeben @vikashg hat das vor 14 Tagen übernommen. Offen
Project-MONAI/tutorials#2079 · 1 Kommentar · 2 zugewiesene Personen ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 62/100
Project-MONAI/tutorials#2071 ·
Alle Issues in Project-MONAI/tutorials
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 95/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
google-research/flood-forecasting#353 ·
Maintainer antworten meist innerhalb von 5 Tagen
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
PriorLabs/TabPFN#1362 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
bot-triaged module: error checking module: optimizer triaged
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
pytorch/pytorch#200158 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag