Skip to content

kamui 0.3.0

Latest

Choose a tag to compare

@yoyolicoris yoyolicoris released this 09 Oct 16:46
· 3 commits to dev since this release
ce56e6f

Fixes wrong results on 3-D data and point clouds, and is over 100× faster on large grids. Check the breaking changes if you use weights or the grid builders' cycles.

pip install -U kamui

Fixed

  • Wrong results on 3-D data and point clouds with simplices. The final integration step summed differences along edges that don't exist (#22). This is the likely cause of #9. 2-D grids were not affected.

Faster

  • 2-D grids and planar meshes are solved as min-cost flows with LEMON, through pylmcf (#30).
  • Program build: the problem is now built without Python loops (#31).
  • Other inputs go to HiGHS, which now solves a linear program first and falls back to the integer program only when needed (#20).

Time and peak memory for unwrap_dimensional on a noisy grid (M1 Pro):

Grid 0.2.1 0.3.0
600×600 69.5 s, 3.0 GB 0.52 s, 0.2 GB
1000×1000 279 s, 8.2 GB 1.7 s, 0.6 GB
4628×2562 (#11, #12) — 49 s, 9.6 GB

New

  • solver="auto" | "highs" | "lemon" chooses the backend.
  • return_info=True also returns a scipy.optimize.OptimizeResult, which includes the cost and the solver used.

Breaking changes

  • pylmcf>=1.3 is now required.
  • unwrap_dimensional uses weights as given. It no longer rescales them to $[0.1, 1]$. Each edge gets the sum of its two pixels by default (merging_method is "sum", "min" or "max"). LEMON needs integer weights, e.g. np.round(coherence * 100). For the old behaviour, pass prepare_weights(coherence, edges) to unwrap_arbitrary.
  • calculate_k(adaptive_weighting=) is removed. Pass weights=np.ones(len(edges)) for uniform weights.
  • The grid builders return cycles as an (S, 4) array instead of a list of lists, so cycles + more now adds element-wise.
  • Vertex indices must be non-negative integers.
  • Invalid input raises ValueError or TypeError instead of failing an assertion.
  • A non-optimal solver result returns None.

Requires Python ≥ 3.10, NumPy ≥ 2, SciPy ≥ 1.13 and pylmcf ≥ 1.3.

What's Changed

  • Solve the unwrapping programs as LP first, with ILP fallback by @hctah in #20
  • Fix integrate: accumulate along a spanning tree, not the visit order by @yoyolicoris in #22
  • Refresh the README, validate inputs with exceptions, add an optional solver report by @yoyolicoris in #29
  • Solve 2-D and planar programs as min-cost flows with LEMON by @yoyolicoris in #30
  • Build the cycle matrix vectorized; unwrap a 4628×2562 scene in 49 s and 9.6 GB by @yoyolicoris in #31

Full Changelog: v0.2.1...v0.3.0