Floating and Falling, deep dreaming with video
Since first encountering Google’s deep dreaming research, I’ve wanted to see it how it applied to moving images. Here then, is my machine’s interpretation of a machine world in which the empty spaces within the Matrix are revealed to be full of energy; pure computronium.
Getting the expressive results I wanted took some trial and error and has opened a previously unknown world of machine learning.
Processing hundreds of HD frames is impractical if you try to do it on the CPU. It would take days. Fortunately the Caffe Deep Learning Framework supports Nvidia’s CUDA parallel processing architecture and I was able to process 1000 frames in 12-16 hours on a GTX970
Moving images present unique challenges. The human eye is highly sensitive to motion and we seem to easily substitute temporal resolution for spatial resolution.
Smaller features tended to average together. When in motion, this just appeared as noise on top of a blurry movie - not the expressive result I was looking for.
For my purposes, the size of the dreamed features needed to be proportional to the size of the 1080p image source.
The color was going to be a problem. Stills looked interesting, but the deep dream algorithm builds images using primary RGB values - pure red, green and blue. This yields a characteristic rainbow fringed appearance that can be exaggerated or suppressed depending on many other factors. This fringing led to hilarious color strobing at 24 frames a second.
I used After Effects to composite the rendered frames over the source frames with the luminance transfer mode so that all color information was derived from the source.
The neural network used for deep dreaming is organized into layers. Lower levels activate in response to simple geometric features and contours. The upper layers of these networks contain what might be called semantic information. In the case of the
bvlc_googlenet model I was using, there seem to be a lot of dogs and eyes. I like creepy eyeballs as much as anyone, but I’m trying to remix art up in here so I chose a layer that was alive with geometric hallucinations and only the
occasional
eyeball.
It’s possible to train your own neural network. I’m ooking forward to doing so. The character of the rendered output is quite different. Doing this at scale however, requires graduate students. The bvlc_googlenet model (codenamed Inception) is trained on data from the ImageNet project which contains
14,197,122 images at this time.
Encoding for YouTube posed interesting compression vs. bandwidth challenges. This 1080p clip includes a lot of high frequency detail with every pixel in motion.
While still in After Effects, I used Pixel Motion Blur to calculate motion blur for all moving pixels. I used Posterize Time to show unique (now motion blurred) frames at 10 fps while keeping the movie frame rate consistent at 24 fps.This yielded a sequence where approximately every 3 frames were identical, each having fewer high frequency pixel transitions.
In order to maximize available bandwidth I upscaled the footage to 2160p. This adds an additional quality setting in the YouTube player, which you’ll probably have to set manually to see the difference (which to my eyes is significant)
Finally, the native audio was too clean, and I wanted it to seem as though it was being generated with the same process as the images. Neural networks have been used to process audio for decades, but not here. Instead the result emerged as a happy accident when I was experimenting with the frame rate and forgot to conform the original audio to match the timebase of the output.
Enjoy.
Science Fiction Thriller