Skip to content

Commit f6cddd2

Browse files
authored
Update Obj Det iou thresholds to [0.1, 0.5, 0.75] (#832)
1 parent 4110014 commit f6cddd2

File tree

4 files changed

+20
-11
lines changed

4 files changed

+20
-11
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: install pre-commit tests clean help
1+
.PHONY: install pre-commit test help
22

33
install:
44
@echo "Installing from source..."

benchmarks/benchmark_objdet.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,10 @@ def run_benchmarking_analysis(
323323
)
324324

325325
# evaluate - base metrics only
326-
eval_time, metrics = time_it(evaluator.compute_precision_recall)()
326+
eval_time, metrics = time_it(evaluator.compute_precision_recall)(
327+
score_thresholds=[0.5, 0.75, 0.9],
328+
iou_thresholds=[0.1, 0.5, 0.75],
329+
)
327330
if eval_time > evaluation_timeout and evaluation_timeout != -1:
328331
raise TimeoutError(
329332
f"Base evaluation timed out with {evaluator.n_datums} datums."
@@ -333,6 +336,8 @@ def run_benchmarking_analysis(
333336
detailed_counts_time_no_samples, metrics = time_it(
334337
evaluator.compute_confusion_matrix
335338
)(
339+
score_thresholds=[0.5, 0.75, 0.9],
340+
iou_thresholds=[0.1, 0.5, 0.75],
336341
number_of_examples=0,
337342
)
338343
if (
@@ -347,6 +352,8 @@ def run_benchmarking_analysis(
347352
detailed_counts_time_three_samples, metrics = time_it(
348353
evaluator.compute_confusion_matrix
349354
)(
355+
score_thresholds=[0.5, 0.75, 0.9],
356+
iou_thresholds=[0.1, 0.5, 0.75],
350357
number_of_examples=3,
351358
)
352359
if (

src/valor_lite/object_detection/manager.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ def create_filter(
195195

196196
def compute_precision_recall(
197197
self,
198-
iou_thresholds: list[float] = [0.5, 0.75, 0.9],
199-
score_thresholds: list[float] = [0.5],
198+
iou_thresholds: list[float],
199+
score_thresholds: list[float],
200200
filter_: Filter | None = None,
201201
) -> dict[MetricType, list[Metric]]:
202202
"""
@@ -240,9 +240,9 @@ def compute_precision_recall(
240240

241241
def compute_confusion_matrix(
242242
self,
243-
iou_thresholds: list[float] = [0.5, 0.75, 0.9],
244-
score_thresholds: list[float] = [0.5],
245-
number_of_examples: int = 0,
243+
iou_thresholds: list[float],
244+
score_thresholds: list[float],
245+
number_of_examples: int,
246246
filter_: Filter | None = None,
247247
) -> list[Metric]:
248248
"""
@@ -254,7 +254,7 @@ def compute_confusion_matrix(
254254
A list of IOU thresholds to compute metrics over.
255255
score_thresholds : list[float]
256256
A list of score thresholds to compute metrics over.
257-
number_of_examples : int, default=0
257+
number_of_examples : int
258258
Maximum number of annotation examples to return in ConfusionMatrix.
259259
filter_ : Filter, optional
260260
An optional filter object.
@@ -295,7 +295,7 @@ def compute_confusion_matrix(
295295

296296
def evaluate(
297297
self,
298-
iou_thresholds: list[float] = [0.5, 0.75, 0.9],
298+
iou_thresholds: list[float] = [0.1, 0.5, 0.75],
299299
score_thresholds: list[float] = [0.5],
300300
number_of_examples: int = 0,
301301
filter_: Filter | None = None,
@@ -305,9 +305,9 @@ def evaluate(
305305
306306
Parameters
307307
----------
308-
iou_thresholds : list[float]
308+
iou_thresholds : list[float], default=[0.1, 0.5, 0.75]
309309
A list of IOU thresholds to compute metrics over.
310-
score_thresholds : list[float]
310+
score_thresholds : list[float], default=[0.5]
311311
A list of score thresholds to compute metrics over.
312312
number_of_examples : int, default=0
313313
Maximum number of annotation examples to return in ConfusionMatrix.

tests/object_detection/test_filtering.py

+2
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,8 @@ def test_filtering_all_detections(four_detections: list[Detection]):
572572
)
573573
evaluator.compute_confusion_matrix(
574574
iou_thresholds=[0.5],
575+
score_thresholds=[0.5],
576+
number_of_examples=0,
575577
filter_=filter_,
576578
)
577579

0 commit comments

Comments
 (0)