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
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
Refactor detector threshold tests to config level
Replace FasterRCNN construction in detector tests with direct `DetectorModelConfig` checks for `box_score_thresh`. This keeps coverage of `None` fallback to `0.01`, preserves explicit value behavior, and adds a default-config assertion while making the test lighter and less coupled to a specific model initialization.
  • Loading branch information
C-Achard committed Aug 31, 2026
commit 21a0eb9a2d0c52c3ea98082fef65d81b7e54e8c5
34 changes: 20 additions & 14 deletions tests/pose_estimation_pytorch/models/test_detectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,23 @@

import pytest

from deeplabcut.pose_estimation_pytorch.models.detectors.base import DETECTORS


@pytest.mark.parametrize("box_score_thresh, expected", [(None, 0.01), (0.4, 0.4)])
def test_fasterrcnn_null_box_score_thresh_uses_default(box_score_thresh, expected):
detector = DETECTORS.build(
{
"type": "FasterRCNN",
"variant": "fasterrcnn_mobilenet_v3_large_fpn",
"pretrained": False,
"box_score_thresh": box_score_thresh,
}
)
assert detector.model.roi_heads.score_thresh == expected
from deeplabcut.pose_estimation_pytorch.config.pose import DetectorModelConfig


@pytest.mark.parametrize(
("value", "expected"),
[
(None, 0.01),
(0.4, 0.4),
],
)
def test_detector_box_score_thresh(value, expected):
config = DetectorModelConfig(box_score_thresh=value)

assert config.box_score_thresh == expected


def test_detector_box_score_thresh_default():
config = DetectorModelConfig()

assert config.box_score_thresh == 0.01
Loading