Benchmarking : Smil vs scikit-image

Morphological Image Libraries

Conclusion


We tested both libraries with images and functions that, seemed to us, represent quite well the most usual functions, data types and algorithms.

Tests were done in two platforms : a desktop computer (nestor), with typical memory size and processor, and a server (taurus) with lots of memory and two processors with many cores.

The first indicator is the SpeedUp which tells how fast is Smil with respect to scikit-image. It's just the ratio of the handling times of the same function handling the same image under the same conditions. The higher the value of this indicator, the faster is Smil with respect to scikit-image. The other indicator is the Resource usage - CPU and memory, evaluated in the same way as the SpeedUP.

Our experiments have shown that, most of the time, Smil is much faster than Scikit-Image.

We've identified two main reasons for this SpeedUp :

  • Smil makes extensive use of loop parallelization, at two levels :

    • processor level using SIMD instructions;

    • operating system level - thanks to OpenMP threads.

  • Smil represents Structuring Elements as a list of pixels while scikit-image uses NumPy arrays.

There are surely other minor reasons as even when executing the same algorithm Smil is faster : programming, Python interface (Cython versus Swig), …

The only situation Scikit-Image is faster is on functions depending on the function label(), which is implemented with an optimized, but not generic and not allowing for hexagonal grids, algorithm. Either way, Smil has a parallelized version of this algorithm which is faster on big images.

Future versions of this benchmark shall include comparing performance in 3D images and some other functions.

As a final point, while Scikit-Image is a quite complete general purpose image handling library, Smil can be a very interesting companion in Mathematical Morphology applications, mainly when handling big images with time constraints or for some advanced features not available under Scikit-Image.