Turn images into probability distributions


Just released a tiny library for making .gifs from images using PyMC3. It includes a custom theano.Op for defining a probability density function from an image.

If anyone would like to help, it does not do a great job on color images right now. For example, here is my poor dog wearing a jedi robe:


I sort of suspect you could get a gradient based sampler (NUTS) to work: I am just computing a cubic spline over the each RGB channel in the original image to generate the pdf, and it should be reasonable to compute that gradient analytically. Not sure if that will look nice in a .gif or .jpg, though. Anyways, take a look, and let me know what you think!


Awesome! Actually I think Metropolis works better in this case (eg. the first example which also displays the trajectory): large jump might make it ugly.


True, but it might make it scientifically more interesting :smiley:. Another thought on continuing the project is that Hamiltonian paths are guaranteed to be closed, eventually. It might be neat to make a looping gif of a bunch of these paths in an image.


Or have the trajectories transparent and slowly fading away.

This would be awesome! Something like giving the right momentum and the sampler just zig zag throught the image like:


We’ll need to make sure we can amble on A, bounce on B, and circuit on C before moving to more advanced applications like that.