Visitar URL original
Fix Faster R-CNN detector inference crashing on box_score_thresh: null by rysk-t · Pull Request #3470 · DeepLabCut/DeepLabCut · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix detector box_score_thresh handling
Make `DetectorModelConfig.box_score_thresh` non-optional with an explicit default so detector configs always carry a numeric threshold. Tests were updated to compare threshold values (not object identity) and to cover `0.0`, ensuring falsy-but-valid thresholds are preserved.
  • Loading branch information
C-Achard committed Sep 1, 2026
commit 7893a352550c48c29fec8831b9f0954bc0052f4a
2 changes: 1 addition & 1 deletion deeplabcut/pose_estimation_pytorch/config/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class DetectorModelConfig(DLCBaseConfig):
freeze_bn_stats: bool = False
freeze_bn_weights: bool = False
variant: str | None = None
box_score_thresh: Fraction | None = DEFAULT_BOX_SCORE_THRESH
box_score_thresh: Fraction = DEFAULT_BOX_SCORE_THRESH

@field_validator("box_score_thresh", mode="before")
@classmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def test_pose_config_creation(case: PoseConfigCase, tmp_path: Path) -> None:
assert detector is not None
assert detector["model"]["type"] == case.detector_type
assert detector["device"] == "auto"
assert detector["model"].get("box_score_thresh") is DEFAULT_BOX_SCORE_THRESH
assert detector["model"].get("box_score_thresh") == DEFAULT_BOX_SCORE_THRESH
assert cfg["data"]["train"].get("top_down_crop") is not None
else:
assert cfg.get("detector") is None
Expand Down
1 change: 1 addition & 0 deletions tests/pose_estimation_pytorch/models/test_detectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
("value", "expected"),
[
(None, 0.01),
(0.0, 0.0),
(0.4, 0.4),
],
)
Expand Down