Loopy glitches

While developing a loopy belief propagation library I came across a bug that produced this interesting image. Loopy belief propagation glitch image

The code that generated the glitch can be found here (and the fix here). I was trying to do image segmentation on a frame from Spongebob, but instead of smoothing out the foreground/background beliefs the beliefs became unstable and flowered into something that looks to me like a figure.

Later I wondered how the beliefs evolved over time, which results in the cellular-automaton-like sequence: Loopy belief propagation glitch beliefs over time

I’m still not completely sure what caused the glitch, but it seems that I previously tried to use int8s with numba.jit and in my case only int32 worked. Maybe an overflow or types not lining up between Cython, Numba, and Numpy.

Written on February 6, 2019