Narrow lattice search from strong spacing hints
This commit is contained in:
parent
a2cf44b3ba
commit
a7c55663a7
4 changed files with 104 additions and 6 deletions
|
|
@ -5,6 +5,7 @@ from repixelizer.inference import (
|
|||
_candidate_dims,
|
||||
_combine_axis_priors,
|
||||
_hint_target_sizes_from_spacing,
|
||||
_resolve_candidate_dims_from_spacing,
|
||||
_top_candidates_by_size,
|
||||
infer_fixed_lattice,
|
||||
infer_lattice,
|
||||
|
|
@ -37,6 +38,35 @@ def test_spacing_hints_can_add_dense_candidates_around_true_size() -> None:
|
|||
assert 128 in sizes
|
||||
|
||||
|
||||
def test_strong_spacing_signal_can_collapse_candidate_search_to_single_size() -> None:
|
||||
dims = _resolve_candidate_dims_from_spacing(
|
||||
1024,
|
||||
1024,
|
||||
None,
|
||||
hinted_sizes=[128],
|
||||
spacing_x=(8.0, 0.82),
|
||||
spacing_y=(8.02, 0.78),
|
||||
prior_reliability=0.74,
|
||||
)
|
||||
sizes = {width for width, _ in dims}
|
||||
assert sizes == {128}
|
||||
|
||||
|
||||
def test_weak_spacing_signal_keeps_broad_candidate_search() -> None:
|
||||
dims = _resolve_candidate_dims_from_spacing(
|
||||
1024,
|
||||
1024,
|
||||
None,
|
||||
hinted_sizes=[128],
|
||||
spacing_x=(8.0, 0.18),
|
||||
spacing_y=(8.1, 0.12),
|
||||
prior_reliability=0.24,
|
||||
)
|
||||
sizes = {width for width, _ in dims}
|
||||
assert 128 in sizes
|
||||
assert len(sizes) > 10
|
||||
|
||||
|
||||
def test_top_candidates_are_diversified_by_size() -> None:
|
||||
candidates = [
|
||||
InferenceCandidate(target_width=113, target_height=113, phase_x=0.0, phase_y=0.0, score=0.90, breakdown={}),
|
||||
|
|
|
|||
Loading…
Reference in a new issue