AdaIN-Style
Trained on
MS-COCO and Painter by Numbers Data
Released in 2017, this is the first real-time feedforward image stylization model to accept arbitrary styles. Building on the interpretation of neural style transfer as a statistical domain adaptation task, the model leverages a novel technique called Adaptive Instance Normalization (AdaIN). The AdaIN layer inside the net performs the style transfer by aligning the mean and variance of the content and style feature maps.
Number of layers: 109 |
Parameter count: 10,516,675 |
Trained size: 42 MB |
Examples
Resource retrieval
Get the pre-trained net:
Basic usage
Restyle an image:
Control the stylization weighting
More flexibility can be obtained by manipulating the different subnetworks separately. Separate the NetGraph into its components:
Obtain the encoded content and style features:
Run the net on the features:
To control the stylization weight, blend the adapted features with the content features:
Stylize the content with different style weights:
Adapt to any size
Automatic image resizing can be avoided by replacing the net encoders. First get the net:
Extract the original mean channel values:
Obtain the content and style features:
Create the new net encoders with the desired dimensions:
Attach the new net encoders:
Restyle an image using the new resized network:
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 MXNet
Export the net into a format that can be opened in MXNet:
Export also creates a net.params file containing parameters:
Get the size of the parameter file:
The size is similar to the byte count of the resource object:
Represent the MXNet net as a graph:
Requirements
Wolfram Language
11.2
(September 2017)
or above
Resource History
Reference