Skip to content

Commit

Permalink
Updating saved attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
prernadh committed Dec 31, 2024
1 parent 3cee74a commit c9af0d4
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions fiftyone/utils/eval/segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from copy import deepcopy
import logging
import inspect
import itertools
import warnings

import numpy as np
Expand Down Expand Up @@ -487,9 +488,6 @@ def __init__(

self.pixel_confusion_matrix = pixel_confusion_matrix

def attributes(self):
return ["cls", "pixel_confusion_matrix", "classes", "missing"]

def dice_score(self):
"""Computes the Dice score across all samples in the evaluation.
Expand All @@ -500,12 +498,27 @@ def dice_score(self):

@classmethod
def _from_dict(cls, d, samples, config, eval_key, **kwargs):
ytrue = d["ytrue"]
ypred = d["ypred"]
weights = d["weights"]

ytrue_ids = d.get("ytrue_ids", None)
if ytrue_ids is None:
ytrue_ids = itertools.repeat(None)

ypred_ids = d.get("ypred_ids", None)
if ypred_ids is None:
ypred_ids = itertools.repeat(None)

matches = list(zip(ytrue, ypred, weights, ytrue_ids, ypred_ids))

return cls(
samples,
config,
eval_key,
d["pixel_confusion_matrix"],
d["classes"],
matches=matches,
missing=d.get("missing", None),
**kwargs,
)
Expand Down

0 comments on commit c9af0d4

Please sign in to comment.