AdaAttN: Revisit Attention Mechanism in Arbitrary Neural Style Transfer
About
Fast arbitrary neural style transfer has attracted widespread attention from academic, industrial and art communities due to its flexibility in enabling various applications. Existing solutions either attentively fuse deep style feature into deep content feature without considering feature distributions, or adaptively normalize deep content feature according to the style such that their global statistics are matched. Although effective, leaving shallow feature unexplored and without locally considering feature statistics, they are prone to unnatural output with unpleasing local distortions. To alleviate this problem, in this paper, we propose a novel attention and normalization module, named Adaptive Attention Normalization (AdaAttN), to adaptively perform attentive normalization on per-point basis. Specifically, spatial attention score is learnt from both shallow and deep features of content and style images. Then per-point weighted statistics are calculated by regarding a style feature point as a distribution of attention-weighted output of all style feature points. Finally, the content feature is normalized so that they demonstrate the same local feature statistics as the calculated per-point weighted style feature statistics. Besides, a novel local feature loss is derived based on AdaAttN to enhance local visual quality. We also extend AdaAttN to be ready for video style transfer with slight modifications. Experiments demonstrate that our method achieves state-of-the-art arbitrary image/video style transfer. Codes and models are available.
Related benchmarks
| Task | Dataset | Result | Rank | |
|---|---|---|---|---|
| Style Transfer | MS-COCO and WikiArt | Execution Time (s)0.024 | 48 | |
| Style Transfer | MS-COCO (content) + WikiArt (style) (test) | LPIPS0.51 | 31 | |
| Image Style Transfer | User Study | Overall Quality Score31 | 30 | |
| Style Transfer | MS-COCO (content) + WikiArt (style) (test) | Lcont4.46 | 17 | |
| Artistic Style Transfer | MS-COCO content images and WikiArt style images 512x512 resolution (test) | FID (Artistic Style)30.35 | 13 | |
| Artistic Style Transfer | COCO and WikiArt (test) | LPIPS0.32 | 11 | |
| Style Transfer | MS-COCO & WikiArt 512 x 512 images | Average Inference Time (s)0.042 | 11 | |
| Arbitrary Image Style Transfer | WikiArt and Places365 (test) | Content Loss0.162 | 9 | |
| Video Style Transfer | 20 styles (test) | Style 1 Optical Flow Error370 | 7 | |
| 3D Photo Stylization | 3D Photo Stylization (test) | RMSE0.135 | 7 |