fix: segmentation evaluator re-scans full image once per threshold
![image.png](/uploads/92b4501bfb0e2c3b12124d35dddf91ec/image.png){width="870" height="600"} ## Benchmark Measured on 8 samples per image size. Both implementations produce identical counts. | Image size | Thresholds | Current (s) | Fixed (s) | Speedup | |------------|------------|-------------|-----------|---------| | 512×512 | 100 | 0.87 | 0.05 | 18× | | 512×512 | 1000 | 8.92 | 0.05 | 199× | | 1024×1024 | 100 | 3.46 | 0.20 | **18×** | | 1024×1024 | 1000 | 37.05 | 0.22 | **168×** | | 2048×2048 | 100 | 14.68 | 0.85 | 17× | | 2048×2048 | 1000 | 143.93 | 0.88 | 163× | Default evaluation uses 100 thresholds (`--steps 100`). At the default setting, the fix is **18× faster** with no change in results.
issue