
You can even do this for each frame in a video and create videomosaics (see video.py). This project cuts up the target image into tiles (you control the tile size with scale parameter), and for each tile patch, uses the L2 similarity metric (with an ultrafast lookup using Facebook's faiss library) to find the closest codebook tile image to replace it with. If you intelligently search through and pick the best "codebook" image in your tileset, you can create arbitrarily good recreations of your target image. You can recreate that target image as a mosaic using a "codebook" of other images as tiles. Take a target image, say, a family photo. We're doing the digital equivalent of a very old technique - creating mosaics:Įxcept instead of using physical tiles, you can use your photo collection, emojis, or any set of digital images you'd like. You just need to make a folder with a few examples so it can learn which face to include.

This makes use of an embedding network, a simple linear classifier on top, and a warp matrix for each image to align the eyes and scale it appropriately. Creating fun photomosaics, GIFs, and murals from your family pictures using ML & similarity search.īecause I tend to get carried away with things, you can also (unrelated to photomosaics, but related to doing cool things with your photo collection) make facial montages aligned on a particular person's face:
