Skip to content

Improve unit-test parameterization for models #3891

@datumbox

Description

@datumbox

🚀 Feature

We are currently doing hacks like the following to parameterize the tests:

vision/test/test_models.py

Lines 149 to 157 in 43d7720

kwargs = {}
if "retinanet" in name:
# Reduce the default threshold to ensure the returned boxes are not empty.
kwargs["score_thresh"] = 0.01
elif "fasterrcnn_mobilenet_v3_large" in name:
kwargs["box_score_thresh"] = 0.02076
if "fasterrcnn_mobilenet_v3_large_320_fpn" in name:
kwargs["rpn_pre_nms_top_n_test"] = 1000
kwargs["rpn_post_nms_top_n_test"] = 1000

Instead we should use parameterize to pass (model, params) combinations:

vision/test/test_models.py

Lines 449 to 452 in 43d7720

@pytest.mark.parametrize('model_name', get_available_detection_models())
@pytest.mark.parametrize('dev', _devs)
def test_detection_model(model_name, dev):
ModelTester()._test_detection_model(model_name, dev)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions