• Color Grading & Restoration
  • Blog
  • ABOUT
  • Contact
Menu

Zachary Halberd

  • Color Grading & Restoration
  • Blog
  • ABOUT
  • Contact

Superior Deinterlacing and Upscaling With Machine Learning

February 2, 2021
 

A Case Study in Superior Deinterlacing and Upscaling Using Machine Learning Tools

As a colorist and restoration geek with a background in developing and working with A.I. tools, I’ve been searching for novel ways to adapt this growing field of research into useful tools which I can use to breathe new life into archival media. This article aims to provide documentary filmmakers with a renewed optimism in the potential of outdated and poorly captured archival media. 

The next time you meet a gamer or someone who mines bitcoin, be sure to thank them for their contribution to the film industry! Over the last ten years, radically efficient manufacturing techniques have given computing technology companies like Nvidia and AMD the ability to significantly increase the computational power of their graphics processing units (GPUs). As the cost of computation decreases, the number of calculations per second that we can achieve on our workstations increases. Video games become more realistic, cryptocurrencies can be mined faster, and GPU intensive plugins/effects within post-production software can be rendered more quickly and with greater precision. Although this has been a consistent trend over the years which shouldn’t surprise any of us, a recent stakeholder in GPU efficiency is beginning to make a name for itself and the potential to disrupt archival restoration is huge. Allow me to introduce you to machine learning. 

In the winter of 2017 I co-founded a technology company which utilizes A.I tools like computer vision and machine learning to automate image processing and analysis for customers with large satellite or aerial imagery. We received a large grant from New York State through the Genius New York accelerator to hire a team of computer scientists to train a computer using GPUs to stitch, analyze, and organize tens of thousands of high resolution images. Not unlike teaching a small child, we spent months teaching and grading the computer’s results in order to train a “model” which could present us with a product that met industry standards. At first the models were about as intelligent as a banana. Initial results seemed random and erroneous. After weeks of training, the model finally began to show promise with the results resembling the accuracy of what you might expect from a toddler. Using a type of supervised reinforcement learning, we were able to feed positive results back into the model to “reward” the computer when it made correct choices. Within a few months the model was so accurate it was able to compete and often surpass adult human performance. Machine learning experts sometimes refer to these models as “little robots”. You teach them how to do one thing very well and then you can store that model for later use as part of an algorithm. The downside to this approach is that because it must be supervised by a human being, it is unable to learn at the speed of a machine. The human is the bottleneck in the supervised process. There have since been quantum leaps in machine learning methods which allow for unsupervised learning and are achieving similar results in shorter turnaround times. 

Although the model that we created is of course proprietary, machine learning researchers are training computers to solve thousands of problems around the world every day and publishing their code to the web as open source. This in turn provides other researchers and hobbyists to then tinker and innovate to solve other novel challenges. The diversity of these tiny robots is becoming a vast ecosystem that permeates nearly every industry from social media to food safety. Over the last several years we’ve begun to see the film industry incorporate machine learning into post production to support services like transcription, facial/character recognition, streaming video optimization, and even visual effects. The latest version of Davinci Resolve (v17 beta as of this writing) has incorporated multiple A.I. tools into their platform to assist in power window tracking and automated object removal. While these tools are still young, I use them nearly every day in my work to the point that I take the technology for granted! 

Typically, filmmakers will use the standard deinterlacing tool in their editing software , however, this article will demonstrate why this approach destroys the image.

Badly Deinterlaced Source Media

Duke University - Department of Athletics - Duke vs Penn State Basketball 1965

In this case study, I decided to use a worst case scenario in order to exhibit the power of what I believe is the future of interlaced archival restoration. Our source material is a progressive 720x486 MPEG-4 AVC file which was improperly deinterlaced with the interleaving fields burned into a single frame (or instant). This is usually a deal breaker for restoration in that two separate moments in time are displayed simultaneously within a single raster. The goal was to separate the two fields cleanly, interpolate the missing field lines, remove as much spatial and temporal artifacts and noise as possible, and then finally upscale to increase the apparent resolution.

The below images were exported from the original media with both upper and lower fields combined to show the apparent resolution if viewing from an interlaced display. Although the first image in the slideshow below is presented in an interlaced format, I’ve combined the fields in the remaining image for the purpose of detail examination in this case study. It is not possible to exhibit interlaced images from modern digital flat panel displays.

You’ll notice that although the below images are sourced from a non-interlaced render, the lines drawn on the floor of the court are relatively smooth and consistent, albeit, fuzzy from being low resolution.


Deinterlacing Using Standard NLE Tools

The below images were deinterlaced using Davinci Resolve using the standard deinterlacing algorithm. I also had very similar results using Premiere Pro’s deinterlacing tool. The primary issue with standard deinterlacing is that they rarely incorporate field interpolation into the process. This means that the interlacer is essentially removing an entire field from the image thus reducing the vertical resolution in half! By removing half of the horizontal fields, an unpleasant stair-stepping results along any line or shape that is not perfectly vertical or horizontal. Notice the black and red free throw lines painted on the floor of the court. They have a noticeable jagged appearance which immediately betrays the loss in horizontal resolution. It is now impossible to upscale this image properly because any artifact that is a result of improper deinterlacing will be sharpened.

Deinterlacing results using the free tool inside DaVinci Resolve

RESOLVE_DEINTERLACED_1.2.6.jpg
R_DEINTERLACED_2X_1.2.5.jpg
R_DEINTERLACED_5X_1.2.4.jpg
R_DEINTERLACED_10X_1.2.2.jpg
R_DEINTERLACED_20X_1.2.3.jpg
R_DEINT_GOAL_5X_1.2.1.jpg
RESOLVE_DEINTERLACED_1.2.6.jpg R_DEINTERLACED_2X_1.2.5.jpg R_DEINTERLACED_5X_1.2.4.jpg R_DEINTERLACED_10X_1.2.2.jpg R_DEINTERLACED_20X_1.2.3.jpg R_DEINT_GOAL_5X_1.2.1.jpg
 

Deinterlacing With Standard NLE With Upscaling

The below images were deinterlaced using Davinci Resolve using the standard deinterlacing algorithm with the additional step of using a bicubic up-sampling filter in order to increase the apparent resolution. Unfortunately, due to the jagged artifacts resulting from the standard NLE deinterlacing method, the upscaling is a hot mess. Some of the compression artifacts are also artificially sharped by the bicupic sampling and thus call attention to themselves with the tell-tale “sparkling”.

RESOLVE_DEINTERLACED_1.2.1.jpg
R_DEINTERLACED_2X_1.2.2.jpg
R_DEINTERLACED_5X_1.2.3.jpg
R_DEINTERLACED_10X_1.2.4.jpg
R_DEINTERLACED_20X_1.2.5.jpg
R_DEINT_GOAL_5X_1.2.6.jpg
RESOLVE_DEINTERLACED_1.2.1.jpg R_DEINTERLACED_2X_1.2.2.jpg R_DEINTERLACED_5X_1.2.3.jpg R_DEINTERLACED_10X_1.2.4.jpg R_DEINTERLACED_20X_1.2.5.jpg R_DEINT_GOAL_5X_1.2.6.jpg
 

Deinterlacing and Deconvolutional Upscaling Using Machine Learning

The below images were deinterlaced using a more sophisticated process in Vapoursynth which interpolates the missing fields all the while compensating for the motion-induced artifacts. Once a more robust progressive frame is constructed, I was then able to deblock and denoise as well as upscale the image using deconvolution algorithms derivative of a process called machine learning. The resulting image and corresponding video exhibited a significant increase in both apparent and spatial resolution.

2.2.1_2.2.1.jpg
2.2.2_2.2.2.jpg
2.2.3_2.2.3.jpg
2.2.4_2.2.4.jpg
2.2.5_2.2.5.jpg
2.2.6_2.2.6.jpg
2.2.1_2.2.1.jpg 2.2.2_2.2.2.jpg 2.2.3_2.2.3.jpg 2.2.4_2.2.4.jpg 2.2.5_2.2.5.jpg 2.2.6_2.2.6.jpg
 

Agitation and the Uncanny Valley

Although the fidelity of the above image set has objectively improved, the results have taken a turn toward the uncanny valley. In order to dial back this unnatural effect, I sprinkled some secret sauce into the pipeline in order to agitate the image. The following slideshow is the final output of my process which I believe provides an impressive increase in resolution while remaining faithful to the original image.

2.1.1_2.1.1.jpg
2.1.2_2.1.2.jpg
2.1.3_2.1.3.jpg
2.1.4_2.1.4.jpg
2.1.5_2.1.5.jpg
1.1.1_1.1.1.jpg
2.1.1_2.1.1.jpg 2.1.2_2.1.2.jpg 2.1.3_2.1.3.jpg 2.1.4_2.1.4.jpg 2.1.5_2.1.5.jpg 1.1.1_1.1.1.jpg
 

Moving Image Result

Below is the first draft of my process in all of its naked splendor in a side by side comparison with the original source video (deinterlaced for fairness). I believe there is still some tweaking to do in order to further reduce the temporal artifacts as well as the uncanny valley, however, we’re certainly making progress!

← Deconvolutional Upscaling for Legacy MediaRendering With JPEG Compression(ism) →

Latest Posts

Featured
DOC_WORKFLOW_20240428.png
May 12, 2024
Documentary Finishing Workflow Demystified
May 12, 2024
Read more →
May 12, 2024
Using AI Models to Colorize Monochromatic Archival
September 30, 2022
Using AI Models to Colorize Monochromatic Archival
September 30, 2022
Read more →
September 30, 2022
Archival Restoration - Experimenting with Python Using VapourSynth + Resolve
October 25, 2021
Archival Restoration - Experimenting with Python Using VapourSynth + Resolve
October 25, 2021

Take a peak under the hood of my process to restore a heavily compressed archival film using the open source Python script-based image processing tool Vapoursynth.

Read more →
October 25, 2021
Qualitative Camera Test v2 - Summer 2021
October 25, 2021
Qualitative Camera Test v2 - Summer 2021
October 25, 2021

I convinced ten cinematographers to bring their cinema cameras to a qualitative camera test. Here are the results.

Read more →
October 25, 2021
axel-vazquez-nph6DcLTckI-unsplash.jpg
July 3, 2021
Premiere to Resolve and Back Again - A Remote Workflow Guide
July 3, 2021

For the love of God, please stop using shuttle drives. Just use the Resolve media manager to shrink ray your Premiere timeline down to a tiny portable file and send to your colorist!!! In this article, I show you how!

Read more →
July 3, 2021
VapourSynth Installation for Python 3.6.8
June 14, 2021
VapourSynth Installation for Python 3.6.8
June 14, 2021

My ongoing experiments with incorporating the Python-based image processing software, VapourSynth, into my color management and restoration pipeline has resulted in compiling a stable package which Windows users may use for further experimentation.

Read more →
June 14, 2021
Deconvolutional Upscaling for Legacy Media
February 9, 2021
Deconvolutional Upscaling for Legacy Media
February 9, 2021

MCM Creative in NYC reached out to Magic Lantern and asked if it was possible to clean up and upscale his feature doc Shelter Island prior to an Amazon streaming distribution sale. Unfortunately, the original media was no longer available and the master had already gone through various unknown encodes.

Read more →
February 9, 2021
Superior Deinterlacing and Upscaling With Machine Learning
February 2, 2021
Superior Deinterlacing and Upscaling With Machine Learning
February 2, 2021

Typically, filmmakers use the deinterlacing tool provided for free within their NLE or Davinci Resolve. This article will demonstrate why this approach can be destructive to the image and will offer a better alternative.

Read more →
February 2, 2021
Rendering With JPEG Compression(ism)
January 28, 2021
Rendering With JPEG Compression(ism)
January 28, 2021

A collection of photos taken with a cell phone at full magnification yields interesting results. Although the discrete cosine transform compression still has a significant effect in the image, by magnifying the image in camera prior to the encode, these images take on a hybrid of pixilation and compression decimation. There is also a slight halation ghosting around the higher contrast edges which get encoded into a pleasant glow.

Read more →
January 28, 2021
Color and the Physiological Response - A Colorist's Exploration
January 28, 2021
Color and the Physiological Response - A Colorist's Exploration
January 28, 2021

Colors, generally speaking, are instinctively associated with emotions. Working as a colorist and having to manipulate color everyday – I feel that most directors and cinematographers intuitively ask for specific colors to enhance specific emotions on special scenes without even realizing it. Here is a little help on how to actually use color in film making to activate – or not – a physical reaction in your audience.

Read more →
January 28, 2021