Skip to content

Commit

Permalink
Added comment
Browse files Browse the repository at this point in the history
  • Loading branch information
minhtuevo committed Jan 24, 2025
1 parent 637e7fe commit 8d58b84
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions fiftyone/utils/eval/detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,13 @@ def spin():


def _evaluate_detections_bulk(
_samples, gt_field, pred_field, eval_method, eval_key, progress=True
_samples,
gt_field,
pred_field,
eval_method,
eval_key,
progress=True,
save=True,
):
matches = []
id_field = "id"
Expand All @@ -75,6 +81,7 @@ def _evaluate_detections_bulk(

decorated_func = spinner_decorator(enabled=True)(_samples.values)

# might want to fetch batches of data instead of the whole collection
ids, ground_truths, predictions = decorated_func(
[id_field, gt_field, pred_field]
)
Expand All @@ -97,9 +104,10 @@ def _evaluate_detections_bulk(
matches.extend(doc_matches)
tp, fp, fn = _tally_matches(doc_matches)

sample_updates["sample_tp"][id] = tp
sample_updates["sample_fp"][id] = fp
sample_updates["sample_fn"][id] = fn
if save:
sample_updates["sample_tp"][id] = tp
sample_updates["sample_fp"][id] = fp
sample_updates["sample_fn"][id] = fn
pb.update()

docs = (ids, ground_truths, predictions)
Expand Down Expand Up @@ -284,6 +292,7 @@ def evaluate_detections(
eval_method,
eval_key,
progress=progress,
save=save,
)
end_time = time.time()
logger.info(
Expand Down

0 comments on commit 8d58b84

Please sign in to comment.