The above video was generated with the help of an algorithm called Neural Styles. It is an algorithm based on neural networks that is used to learn artistic styles and happens to be commonly used in apps like Prisma to beautify images. The algorithm extracts features from a "style image" and then applies it to a "content image". Since a video is basically a collection of frames, we were able to apply our algorithm to every frame. This is the original video which we took as input to our model:
We ran the transformation on an Azure Data Science VM. The Azure DSVM is a pre-built image with many data science libraries included. It contains an installation of JuliaPro, and includes over a 100 major Julia packages. It is by far the easiest way to get started with running Julia code on the Azure ecosystem.
Our VM came with an Intel(R) Xeon(R) CPU E5-2660 with 8 physical cores and 56 GB RAM. We first extracted the frames from the video with VideoIO.jl, and then processed them in parallel with 8 Julia worker processes. Julia has several high level primitives for distributed computing, and we used the parallel map pmap
function to split the images amongst the workers and subsequently texturize them. For larger videos, exactly the same code would be used to run this on a cluster of multiple physical or virtual servers.
@everywhere function f(a)
texturize(a, "fire", "style")
end
pmap(x -> f(x), frames_from_video)
After the parallel processing, we stitched the images back together via ffmpeg
to form a video.
The first video of this article was the output of passing the original video through a model we call "fire", due to the fiery texture that was transferred. Here's the result of passing through another model called "frost":