# Fast Coherent Video Style Transfer via Flow Errors Reduction
## 4 Implementation Details  
Code Development: our method was developed on a Torch implementation called artistic video style transfer [24] in Ubuntu 18.04 LTS, which uses the Lua script language and a pretrained-VGG19 as the backbone neural network. The code was built with CUDA 10.8 on a single NVIDIA GeForce 1080 Ti card. The optimizer for the iterations is L-BFGS. The stopping criterion: we consider the optimization to be converged when the total loss does not change by more than one during ten iterations.  
Choices of Layers for Losses: the \(\{relu1\_1,relu2\_1,relu3\_1,relu4\_1,relu5\_1\}\) layers are chosen for the Style Loss, and the \(\{relu3\_2\}\) layer is chosen for the Content Loss within the Perceptual Losses. We choose \(\{relu3\_2\}\) for the Feature-Level Coherent Loss.  
Inputs and Outputs: The following inputs are fed into our method: a per-frame stylized image \(f_{s}^{t}\) as the feature and style target, a warped image \(u_{t-i}^{t}\) (\(i\in\mathcal{T}\)) as the temporal consistency target, a mask \(M^{t}\) as the per-pixel flow weight and the \(\hat{x}_{init}^{t}\) generated from Equation (1) as the initial image. Outputs: the stylized result \(\hat{x}_{out}^{t}\). In all the experiments, we used two scales (original resolution and half of the original resolution) of frame resolution for the mask fusion mentioned in Figure 8.  
Choices of Hyperparameters in Equations (2), (4), (7), (9) and (10): For videos at \(1024\times 436\) (MPI Sintel dataset) and \(854\times 480\) ([PERSON] 2017 dataset) resolution, the hyperparameters were chosen as follows: \(\alpha=3\times 10^{1}\), \(\beta=9\times 10^{1}\) and \(\gamma=1\times 10^{-3}\) in Equation (2), \(\kappa=9\times 10^{-7}\) in Equation (4), \(\mathcal{T}=\{1,2\}\) in Equations (7) and (9), \(\lambda_{coh}^{RGB}=5\times 10^{1}\) and \(\lambda_{coh}^{fca}=2\times 10^{1}\) in Equation (10). Discussions about these choices: in our experiments, a ratio of \(\alpha/\beta\) close to 0.3 preserves the stylistic texture appearance of the per-frame stylized image \(f_{s}\) in the outputs better. A higher ratio will generate results with more sharpness but fewer stylistic textures; on the contrary, a lower ratio degenerates image quality due to excessive stylization. A coherent ratio of \(\lambda_{coh}^{RGB}/\lambda_{coh}^{fca}\) close to 2.5 preserves the balance between execution time and temporal consistency better. A higher coherent ratio of warps \(f_{s}^{t}\) on RGB-level may cause pixel errors to accumulate along with propagation, which costs more time as the network has to correct them. While a lower coherent ratio tends to reduce the stylization consistency of the same object among consecutive frames. In addition, a \(\kappa\) close to \(9\times 10^{-7}\) maintains a better balance between image quality and temporal consistency. For example, larger \(\kappa\) values tend to produce outputs with better image quality (e.g., pixels updated more frequently) but poor temporal consistency as pixels propagatedfrom the beginning are lost with time. Smaller \(\kappa\) values, to some extent, fail to effectively mitigate blurriness artefacts but preserve a better temporal consistency. In this paper we chose the aforementioned hyperparameters values for all the testing videos. The optical flow used in this paper was Flownet2 [63], but Deepflow2 [67] is also supported.  
**Speed** Compared to the gradient-based optimization methods in the literature [23; 24] (3-5 min per frame), the proposed optimization process takes around \(\mathbf{1.8}\) s per frame for a resolution of \(1024\times 436\) and around \(\mathbf{1.6}\) s per frame for a resolution of \(854\times 480\) on a single NVIDIA GTX 1080 Ti graphics card. The reason for the fast speed is that the optimizer (e.g., L-BFGS) in our work needs much fewer iterations as there are already enough for temporal consistency and image sharpness.