Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
manushreegangwar committed Dec 11, 2024
1 parent 42c01bc commit d5ca574
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions fiftyone/utils/eval/regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,16 +312,19 @@ def evaluate_samples(
# Metric operators.
agg_metric_ops = []
if eval_metrics:
for metric_op, metric_kwargs in eval_metrics:
import fiftyone.operators as foo

for metric_uri, metric_kwargs in eval_metrics:
metric_op = foo.get_operator(metric_uri)
if not metric_op.is_aggregate: # check if per-sample/frame
try:
metric_op(
samples, ytrue, ypred, eval_key, **metric_kwargs
)
metric_kwargs["ytrue"] = ytrue
metric_kwargs["ypred"] = ypred
metric_op(samples, **metric_kwargs)
except Exception as e:
print(e)
else:
agg_metric_ops.append((metric_op, metric_kwargs))
agg_metric_ops.append((metric_uri, metric_kwargs))

results = RegressionResults(
samples,
Expand Down Expand Up @@ -474,9 +477,12 @@ def metrics(self, weights=None):
}

if self.agg_metrics_ops:
for metric_op, metric_kwargs in self.agg_metrics_ops:
import fiftyone.operators as foo

for metric_uri, metric_kwargs in self.agg_metrics_ops:
metric_op = foo.get_operator(metric_uri)
metric_val = metric_op(self.samples, **metric_kwargs)
sample_eval_key = metric_kwargs.get("sample_eval_key", None)
sample_eval_key = metric_kwargs.get("sample_eval_key")
metric_name = (
f"{metric_op.name}_{sample_eval_key}"
if sample_eval_key
Expand Down

0 comments on commit d5ca574

Please sign in to comment.