fix(patchworkpp): clear ringwise_flatness every ring (#69)#91
Merged
Conversation
ringwise_flatness was only cleared inside `if (!candidates.empty())`, so when a ring finished with no revert candidates the accumulated flatnesses leaked into the next ring's `temporal_ground_revert` call, polluting its mean/stdev statistics (and therefore the revert decision threshold) with flatnesses from a coarser/finer ring. Move the clear outside the if-block so it runs unconditionally per ring iteration. Reported by @KennethBlomqvist in #69. Closes #69.
Merged
LimHyungTae
added a commit
that referenced
this pull request
May 21, 2026
Patch release with one bug fix (#69 -> #91): - ringwise_flatness is now cleared every ring (not only on rings with revert candidates), so stale flatnesses no longer leak into the next ring's TGR mean/stdev. Numerical impact on KITTI 00-10: +0.003 F1 (within run-to-run noise). Bumps: - python/pyproject.toml 1.3.0 -> 1.3.1 - cpp/CMakeLists.txt 1.3.0 -> 1.3.1
This was referenced May 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Move
ringwise_flatness.clear()outside theif (!candidates.empty())block incpp/patchworkpp/src/patchworkpp.cppso it runs unconditionally at the end of every ring iteration.if (!candidates.empty()) { if (params_.enable_TGR) { temporal_ground_revert(ringwise_flatness, candidates, concentric_idx); } else { for (auto candidate : candidates) { addCloud(cloud_nonground_, candidate.regionwise_ground); } } candidates.clear(); - ringwise_flatness.clear(); } + ringwise_flatness.clear();Why
Reported by @KennethBlomqvist in #69. The previous placement only cleared
ringwise_flatnesswhen the current ring produced at least one revert candidate. If a ring finished withcandidatesempty, the accumulated flatnesses leaked into the next ring'stemporal_ground_revertcall and polluted itsmean ± stdevstatistics. Since flatness statistics differ across CZM rings (closer rings are flatter by construction), this biased the revert decision threshold (mu_flatness = mean + 1.5 * stdev, line 435).Impact in practice is small because most rings DO produce candidates, so TGR fires every ring on KITTI. But the bug is real and the fix is one line.
Numerical impact — KITTI 00–10, full 23,201 frames, Patchwork++ paper protocol
ΔF1 = +0.003 (within run-to-run noise). Confirms no regression.
Test plan
temporal_ground_revert).pip install -v ./python/from a clean conda env succeeds.--method patchworkpp --eval_protocol patchworkpp→ table above.Closes #69.