Skip to content

Releases: rkr14/reImage

v2.0.0: High-Performance Engine with AVX2 SIMD Math and BK Solver

Choose a tag to compare

@rkr14 rkr14 released this 24 Jun 12:42

Release v2.0.0: High-Performance BK Solver, GMM Color Models, and AVX2 Vectorization

This major release introduces significant architectural upgrades to the reImage image segmentation engine, integrating high-performance computer vision algorithms, multivariate color modeling, and low-level memory/mathematical vectorizations. These enhancements deliver up to a 25x speedup on standard inputs and enable real-time Full HD (1920x1080) segmentations.

Technical Enhancements

1. Boykov-Kolmogorov (BK) Solver

  • Replaced the standard Dinic flow algorithm with a custom, dedicated Boykov-Kolmogorov max-flow/min-cut solver optimized for grid-based computer vision graphs.
  • Delivers a 25.8x speedup on standard resolutions (640x480), reducing execution time from 4.50s to 0.17s.
  • Enables Full HD (1080p) segmentations in 0.95s (where the Dinic solver failed to terminate in a reasonable timeframe).

2. Gaussian Mixture Models (GMM) Color Fitting

  • Integrated 5-component multivariate GMMs in 3D RGB color space to model foreground and background color probabilities, replacing rigid 8x8x8 histograms.
  • Features an analytical closed-form 3x3 covariance inversion and determinant solver, completely bypassing external linear algebra library dependencies.

3. Hardware-Accelerated AVX2 SIMD Math

  • Redesigned image data layouts to use 32-byte memory alignment (alignas(32) std::vector), removing millions of floating-point casts inside hot loops.
  • Implemented FMA-powered AVX2 polynomial minimax approximations for exp and log functions to avoid sequential system library call roundtrips.

4. Correctness and Robustness Fixes

  • PyQt6-to-C++ Mapping: Fixed a serialization bug where signed boundaries caused green foreground seeds (255 to -1 in int8_t) to bypass the color likelihood models.
  • Covariance Collapsing: Adjusted covariance regularization to 25.0 to prevent Gaussian components from collapsing into singular delta functions when fitting uniform scribbles.
  • RGBA Channel Safety: Automated RGB conversion inside the GUI results display to prevent shape broadcasting crashes on images containing alpha channels.

5. Automated Benchmarking

  • Added a benchmarking suite (benchmark/run_benchmarks.py) and plotting tool (benchmark/plot_results.py) to profile average and minimum runtimes across multiple resolutions and generate comparison charts.

Performance Comparison (GMM-enabled)

Resolution Pixels Dinic Avg (s) BK Avg (s) Speedup Factor
160x120 19,200 0.0528s 0.0285s 1.9x
320x240 76,800 0.2445s 0.0878s 2.8x
640x480 307,200 1.3464s 0.3242s 4.2x
1024x768 786,432 Skipped (Hangs) 0.7782s Enables HD
1920x1080 2,073,600 Skipped (Hangs) 1.7545s Enables Full HD

Release Assets

  • reImage.exe: Pre-compiled standalone executable for Windows (includes C++ backend and PyQt6 GUI; no Python or C++ dependencies required to run).

reimage.exe

Choose a tag to compare

@vTusharr vTusharr released this 14 Nov 18:27

Windows only build
For Linux/macos refer to instructions in readme