Get the pre-trained net:
Basic usage
Get a noisy video:
Define a noise level for a video:
Denoise a video:
Visualize the five frames of a noisy and denoised video:
Adapt to any size
Automatic frame resizing can be avoided by replacing the NetEncoder. First get the net:
Get a noisy video:
Create a new NetEncoder with the desired dimensions (to get a resizable net, the spatial dimensions should be divisible by 4):
Attach the NetEncoder, define a noise level and run the net:
Visualize the three frames of a noisy and denoised video:
FastDVDNet architecture
The video encoder takes the first five frames of the input video and encodes it into a vector of size (5,3,256,256):
Note that the first three blocks are shared. (Framei, Framei+1, Framei+2, Noise) are given as inputs to blocki to obtain an intermediate denoised frame to obtain an intermediate denoised output frame . Finally, (, , , Noise) are given as inputs to the last block to get the final denoised output frame:
Extract the first and the last blocks of the net:
All the blocks share a U-Net type architecture. Explore the input block:
Get a noisy video and define a noise level for a video:
Simply mapping the net to a list of frames can be inefficient due some blocks processing the same frame multiple times. To avoid double counting, split the inference into two steps:
Get the final denoised video:
Visualize the three frames of a noisy video and the intermediate and final result:
Memory-efficient evaluation
Define a custom videoDenoise function for memory-efficient processing of video with Gaussian or Poisson noise:
Get a noisy video:
Get a final denoised video assuming a Gaussian distribution on the input noise:
Get a final denoised video assuming a Poisson distribution on the input noise:
Visualize the four frames of a noisy video and the denoised results assuming a Gaussian and Poisson distribution on the input noise:
Net information
Inspect the number of parameters of all arrays in the net:
Obtain the total number of parameters:
Obtain the layer type counts:
Display the summary graphic:
Export to ONNX
Export the net to the ONNX format:
Get the size of the ONNX file:
The byte count of the resource object is smaller because shared arrays are currently being duplicated when exporting to ONNX:
Check some metadata of the ONNX model:
Import the model back into the Wolfram Language. However, the NetEncoder and NetDecoder will be absent because they are not supported by ONNX: