{'fraction_non_alphanumeric': 0.04297736743197974, 'fraction_numerical': 0.01515646703162023, 'mean_word_length': 4.592643363034042, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Fast Fourier Intrinsic Network

We address the problem of decomposing an image into albedo and shading. We propose the Fast Fourier Intrinsic Network, FFI-Net in short, that operates in the spectral domain, splitting the input into several spectral bands. Weights in FFI-Net are optimized in the spectral domain, allowing faster convergence to a lower error. FFI-Net is lightweight and does not need auxiliary networks for training. The network is trained end-to-end with a novel spectral loss which measures the global distance between the network prediction and corresponding ground truth. FFI-Net achieves state-of-the-art performance on MPI-Sintel, MIT Intrinsic, and IIW datasets.


Introduction
Intrinsic image decomposition refers to the problem of separating an image I into its albedo and shading [3], where albedo models the diffuse reflection of the scene materials and shading represents the lighting and scene geometry. We adopt the common assumption that the problem can be simplified to the per-pixel image formation I = A · S where A and S are the albedo and shading, respectively. Factorization of I into A and S is ill-posed. Early work tackled the factorization by applying constraints and priors which connect the properties of materials and lighting in the physical world with the gradient and color changes in images [21,18]; however, even the sophisticated physical modelling can not fully cover the complex optical interactions among materials, light sources, and object/scene geometry. Intrinsic image decomposition is an open and challenging problem per se, but it can also benefit many other vision problems, e.g., semantic segmentation [4], depth estimation [20], and color constancy [2].
Traditional approaches for intrinsic image decomposi-tion are surveyed in [2], while recent state-of-the-art performance has been achieved with image-to-image translation networks as in [29,13,12,23,25,27]. The mean squared error (MSE) loss is typically employed in the network training to enforce pixel-wise similarity between the predicted and ground truth albedo and shading [13,23,12]. The MSE loss does not consider correlations between image pixels. Extra loss terms such as loss for the learnable domain filter [13], perceptual loss [12] and generative adversarial loss [23], are often added to enforce global similarities between predictions and ground truth. Proposed models also exploit a multi-path structure in their networks to separate the prediction into different levels of details [12] or contexts [25,13].
In this work, we propose a Fast Fourier Intrinsic Network (FFI-Net) for intrinsic image decomposition. The network design focuses on the multi-path architecture and loss function, as were intensively exploited in recent works [25,13,23,12], but differs substantially from the prior arts since no published intrinsic decomposition method operates in the spectral domain. The intuition is based on the observation that published approaches [13,12] often separate the predictions of structure and details into different scales, implicitly performing operations that are indeed best understood in the spectral domain. Image details, e.g. fine edges, are naturally reflected in the highfrequency part; on the other hand, image structures such as flattened color patches are usually reflected in the lowfrequency part. Despite the frequency interpretation behind the previous works, their models were optimized in the spatial domain. Thus if the intrinsic image decomposition task is solved in the spectral domain, we might expect, and this is confirmed by our experiments, the optimization of the network to be more efficient and effective, as in the classification task [32]. Furthermore, since each pixel in the spectral domain is a complex-weighted sum over the image space, a pixel-wise loss on the spectral map thus can straightforwardly enforce a global similarity between the prediction and ground truth in the spatial domain. Contributions. We propose a novel network architecture for intrinsic image decomposition where the following spectral operations and structures replace their spatial domain counterparts used in the prior works: • Spectral banding splits the input image into several frequency bands, therefore allowing multi-path training and inference (see Fig. 1). • Spectral loss provides a global error measure on the similarity between the predicted A/S and the corresponding ground truth, effectively augmenting the pixel-wise loss. • Spectral residual block encodes original residual block with spectral weights, thus obtaining faster convergence to a lower error. To the best of our knowledge, FFI-Net is the first to address intrinsic decomposition in the Fourier domain. Our experiments with three intrinsic image datasets (MPI-Sintel, MIL Intrinsic and IIW) demonstrate state-of-the-art accuracy for FFI-Net.

Related Work
Our main objective is to develop a deep neural network architecture for intrinsic image decomposition and therefore related works will focus on the prior deep architectures [29,20,13,23,12,5]. Traditional approaches have been surveyed in the recent work by Barron and Malik [2].
Nahiriha et al. [29] were the first to propose a deep ar-chitecture to estimate albedo and shading using a pixel-wise MSE loss. Kim et al. [20] later added a conditional random field (CRF) after the network to jointly learn albedo, shading and depth. Lettry et al. [23] further proposed to add an adversarial module. To better model the flattening effects in natural reflectance images, Fan et al. [13] proposed a 1D recursive domain filter and separate loss layers customized differently for dense (e.g. MPI-Sintel [9]) and sparse (e.g. IIW [6]) datasets; Cheng et al. [12] proposed to use a cross bilateral filtering loss instead of the MSE loss to ensure the smoothness of albedo and shading output. Recently, Baslamisli et al. [5] adopted a physics-based image formation model inspired by traditional approaches. The above works assume the Lambertian reflectance model and are fully-supervised with ground truth albedo and shading.
There are also many works assuming a non-Lambertian model [34], adopting the weaklysupervised/unsupervised setting [19,25,28,27], or including more synthetic data for training [24,37]. For instance, Shi et al. [34] considered the non-Lambertian model in their algorithm design and train their network with rendered 3D models from ShapeNet [10]. Li et al. [25] learned intrinsic images from image sequences over time, where the object reflectance remains the same with varying illumination. Liu et al. [27] proposed a novel unsupervised intrinsic image decomposition framework which directly learns the latent feature of reflectance and shading from unsupervised and uncorrelated data. Zhou et al. [37] proposed a global-local spherical harmonics lighting model for intrinsic decomposition, where they apply synthetic data for model pre-training and fine-tune it with real data in a self-supervised way.
The FFI-Net is inspired by several recent works while the most important being [12,32]. FFI-Net differs from Cheng et al. [12] rather substantially in the following ways: (i) their hierarchical decomposition is done in the spatial domain with fixed-sized Gaussian kernels, while the decomposition in FFI-Net is made in the spectral domain; (ii) they use VGG perceptual loss to enforce global similarity between the intrinsic prediction and ground truth while FFI-Net uses the basic MSE in the spectral domain; (iii) their network optimization is done in the spatial domain while ours in the spectral domain. With respect to the comparison to [32], FFI-Net adopts the spectral encoding of CNN weights from it but novelly introduces several new elements i.e. spectral banding, spectral loss, spectral residual block, for intrinsic image decomposition.

Fast Fourier Intrinsic Network
Before presenting the building blocks of FFI-Net, we review the properties of the Discrete Fourier Transform.

Preliminaries
The Discrete Fourier Transform (DFT). For a discrete 2D image I(h, w) = I ∈ R H×W where h = 0, . . . , H − 1 and w = 0, . . . , W − 1, the Fourier domain representation is computed by The DFT is linear and unitary and I can be restored using the inverse DFT given by F −1 (I) = F (I) * , which is the conjugate of the transform itself.

Properties of DFT for CNN.
Convolution theorem: Convolution in the spatial domain is equal to the element-wise product in the spectral domain: where we denote by x and f two spatial signals (e.g. images), * and the operators of the convolution and the Hadamard product, respectively. DFT can be implemented using the Fast Fourier Transform (FFT), which reduces the complexity of DFT from O((HW ) 2 ) to O(HW log(HW )).
DFT differentiation: For CNN backpropagation algorithms, the gradients must be propagated through Fourier transform layers. Suppose a DFT layer F maps a real-valued input x ∈ R H×W to z ∈ C H×W , and ∂L ∂z is the gradient of loss L w.r.t z; Since both F and F −1 are unitary, the backpropagation through F and F −1 can be written as

The Network Architecture
Our network architecture is built upon the preliminary discussion about DFT and extended to the intrinsic image decomposition task with several new components (see Fig. 1). The input image I is first transformed into the spectral representation F (I). Spectral banding (Sec. 3.4) is applied afterwards to crop the spectral feature map of F (I) into M overlapped (low-pass) sub-representations. DC component is centered in the spectral feature map in Fig. 1. The M spectral bands are transformed back to the spatial domain via F −1 as input to feed into N consecutive spectral residual blocks, respectively ( Fig. 2 and Sec. 3.3). Spectral residual blocks parametrize the conv weights in the spectral domain for optimization yet their input and output are in the spatial domain. The outputs of the M subbranches are transformed to the spectral domain, ground truth in two domains are associated both before and after the transformation. The M ground truth are generated via the spectral banding that is different from previous: it produces a series of non-overlapped bands similar to the Laplacian pyramid (Sec. 3.4). The M spectral maps predicted in the network are summed up to create a complete spectral map of the image and further converted back to the spatial domain; again, ground truth are associated both in the spectral and spatial domain on the complete image. The loss function between the ground truth and network predictions are introduced in the spatial and spectral domain, respectively (Sec. 3.5 and 3.6): the spatial loss employs the commonly used pixel-wise MSE in the original images and their gradient maps [13,23] (Sec. 3.6); the spectral loss also utilizes pixel-wise MSE loss but on the spectral maps, which provides an additional global constraint on the intrinsic prediction (Sec. 3.5). Notice that, to infer both the albedo and shading simultaneously, after the N 2 -th block of each subbranch we split it into two streams for albedo and shading, respectively.
Below we present the spectral residual block, spectral banding, and spectral loss.

Spectral Residual Block
Residual blocks [17] are widely applied for intrinsic image decomposition [13,23]. Inspired by [32], we expect that spectral encoding of residual blocks can help solve the intrinsic decomposition task. As shown in Fig. 2, given a two-conv layer residual block, its input and output are in the spatial domain but the conv weights are parametrized in the spectral domain. These weights need to be converted back to the spatial domain when convolving with the input. This reparametrization does not alter the underlying model, it provides an appropriate domain for parameter optimization, as the frequency basis captures typical filter structure well. As suggested in [32], spectral encoding of the network results in more compact convolutional filters with more meaningful axis-aligned directions for optimization. In the experiment we demonstrate that residual blocks with spectral weights boost the performance.

Spectral Banding
Inspired by the multi-path structure in [12], which conducts scale space separation of the albedo/shading image, we instead perform a spectral domain separation, which provides more fine-grained control over frequency. The spectral banding is formulated as: In a spectral map, values between N l and N u in x-axis, M l and M u in y-axis are kept. If N l and M l are always zeros, spectral banding works like a smoothing filter. We apply this special case of spectral banding (N l and M l are zeros while N u and M u are increased over bands) at the beginning of the network to split the input into overlapped bands (see Fig. 1 before the spectral residual blocks). If N l and M l are non-zeros, we can separate the spectral map into multiple bands where the upper bounds (N u , M u ) of a current band are taken as the lower bounds (N l , M l ) of its adjacent band with higher frequency. When we apply the inverse FFT to these spectral bands, they look like image Laplacian pyramid with different levels of details [8,26] (see Fig. 1 after the spectral residual blocks). In the network, we generate M of these non-overlapped spectral bands from the ground truth to associate at the end of each subbranch. In this way, the subbranch output can be summed together to recover the final prediction (we call it summing spectral bands in Fig. 1).
In practice, we can provide a specific range of nm for z nm = 0 in Eq. 4, where the spatial transform of a spectral band can be of adjustable size related to the predefined range. This makes spectral banding flexible with any input and output size in a fully-convolutional neural network. Notice the level-of-detail exploited in [12] is obtained by applying the fix-sized Gaussian kernel in the spatial domain, while spectral banding retrieves the level-of-detail in the spectral domain explicitly and more effectively; Most importantly, our spectral banding enables the effective usage of another new component, spectral loss, as below.

Spectral Loss
Loss functions are defined in both the spectral and spatial domains, here we first detail the spectral loss: since each pixel in the spectral domain is a weighted sum of the whole image in the spatial domain, a pixel-wise loss defined on the spectral representation spontaneously enforces a global similarity between the spatial prediction and the ground truth. Inspired by the global loss applied in [23,13,12], we propose a spectral loss defined in the spectral domain: wherex and x denote the predicted and ground truth albedo/shading in the spatial domain, respectively. M is defined as an operator to take the magnitude of a complex value, M(F (x)) = |F (x)| We only use the magnitude part as it contains information of the image geometric structure in the spatial domain while discarding the phase part as "invisible" (see [1,15]). This also empirically gives us benefits whilst minimizing the error over the phase part does not. Notice if we minimize the squared error for the real and imaginary components, since F is a linear transform, it will be identical to minimizing the squared error in the spatial domain, as specified below.
In FFI-Net, spectral losses are directly applied pixelwise on the M spectral outputs of the network as well as on their summation.

Network Training
Beside the spectral loss, we also adopt representative local MSE loss in the spatial domain to let the predication to be both pixel-wise close and visually similar to the ground truth. Following [23,13,29], we choose the 2 loss defined on every pixel value and its gradient: Each of the M subbranches in the network is trained with loss L ss from both spectral and spatial domains: We empirically choose λ 1 = 0.2, λ 2 = 0.35, λ 3 = 10 −6 for all our experiments. L s is of larger magnitude than L g and L p thus with a smaller weight λ 3 . L ss is applied to all the M subbranches as well as their final summation in the network, so we have the overall loss L T for target albedo/shading: where we denote by x b andx b the ground truth and prediction corresponding to the b-th spectral band of the original albedo/shading, respectively. Referring to Fig. 1, L T is computed on both albedo and shading predictions (L A and L S ), so we have the final loss L AS = A · S −Â ·Ŝ 2 2 is added to address the commonly used constraint I = A · S [12].
Training Details. For all datasets, we fix the number of spectral bands to M = 5 and use N = 10 spectral residual blocks for each band. Spectral residual blocks have the same configuration as the ordinary residual block [17] in terms of filter size, batch normalization, relu etc. Training is conducted using the Adam optimizer with network weights randomly initialized. (iii) For IIW, we resize each image to 300 × 300 as in [13]; the batch size is set to 1 and the learning rate is 1e-2. All networks are trained till convergences in our experiments.
Evaluation Protocol. We report results using the four common metrics: (i) si-MSE: scale-invariant mean squared  Table 1: Results for MPI-Sintel (scene split). si-MSE, si-LMSE and DSSIM are reported for albedo (A), shading (S) and their average (avg). We also ablate the key elements of FFI-Net: number of spectral bands M ∈ {1, 3, 5}, spectral (R spec ) vs. spatial (R spat ) residual blocks, and the spectral loss L spec . FFI-Net is by default with M=5, R spec . The best results are marked in bold.
. error (MSE); (ii) si-LMSE: scale-invariant local MSE, which uses sliding windows in si-MSE; the window size w is usually 10% of the larger dimension of the image while the sliding step is 0.5w; (iii) DSSIM: dissimilarity structural similarity index measure; it is made to correlate with the subjective image quality assessments [35]. For MIT, we also report the MSE and LMSE numbers which can be seen as variants of si-MSE and si-LMSE [16]. For IIW with sparse ground truth, we report the weighted human disagreement rate (WHDR) [6,13].

Results on MPI-Sintel
Results for FFI-Net and various competing works are shown in Tab. 1 (scene-split) and Tab. 2 (image-split).
The scene-split setting is more challenging as it requires generalization over unseen scenes. Tab. 1 shows that FFI-Net performs the best on most metrics. In particular, it achieves the best average si-MSE, si-LMSE, and DSSIM of albedo and shading: 1.18, 0.73, and 8.77, respectively.
FFI-Net achieves the best performance also for the image-split setting reported in Tab. 2, but with smaller margin. We suggest a possible reason as the overfitting of deep networks on the shared contents between training and test images in image-split. This is illustrated by the recent re- Fan [13] FFI Ground Truth Figure 3: Examples on the MPI-Sintel (scene split). We emphasize the ability of FFI-Net of shadow removal (e.g. sky -red arrows) in the unseen scene compared to others.    [20,13,12] from which the error numbers are indeed close to 0 (see Tab. 2, they are multiplied by 100). LapPyrNet [12] performs in general the second best. It employs several loss functions such as joint bilateral filtering loss, VGG perceptual loss, etc. Notwithstanding, our results show that the proposed simple spectral loss (Tab. 1, only L spec ) is as effective as these multiple losses .
Qualitative illustrations are presented in Fig. 3 and Fig. 4 where in particular the low-frequency part of the sky and high frequency details of the person's face illustrate the improved prediction thanks to the spectral structure. Input (A) (S) Lee [22] Barron [2] Chen [11] DI [29] Fan [13] Lap [12] FFI Ground Truth Figure 4: Examples of (A)lbedo and (S)hading predictions on MPI-Sintel (image split). FFI-Net performs well in difficult parts, e.g. person fingers, faces (red arrows).
With si-MSE and si-LMSE (Tab. 3), FFI-Net outperforms the competing deep learning methods. The traditional method SIRFS [2] has slightly better si-MSE for albedo and total si-LMSE. It uses a prior that is particularly suitable for the MIT Intrinsic images; we notice its clear inferiority over others on MPI-Sintel in Tab. 2. MIT is a rather small dataset and is therefore often trained with additional datasets [34,29] while FFI-Net only trains on MIT.    We also provide results in MSE, LMSE, and DSSIM in Tab. 4. FFI-Net performs in general better than latest works e.g. [28,24,27]. Notice that it appears that the LMSE in [28] is computed using a different window size, thus its two numbers (italic) in LMSE are not comparable to others.   [29]. Note that due to the sparse ground truth available, FFI-Net does not use the spectral banding and loss, but instead the WHDR loss in [13].

Results on IIW
The IIW dataset differs substantially from MPI-Sintel and MIT Intrinsic in its ground truth. IIW does not have dense pixel-wise ground truth with physical grounds, but only sparse pair-wise annotations of points in each image. Therefore the losses relying on dense prediction, e.g., GAN discriminator loss/VGG loss, in [12,23,28,34] cannot apply. That also prevents using our spectral loss and subbranch losses. For this experiment, our proposed loss functions were replaced with the WHDR loss used in [13]. Our network structure remains encoded with spectral weights.
The WHDR scores are shown in Tab. 5. FFI-Net, despite being disabled with spectral banding and loss, still achieves competitive WHDR score 15.81 among the stateof-the-arts [24,13,37]. The best performance by [13] can be partly explained by its tailored domain filter that flattens albedo prediction. While [24] and [37] use additional datasets (e.g. CGI, SAW, SUNCG) along with IIW for training augmentation.

Ablation Study
Spectral Bands. Tab. 1 demonstrates that adding more spectral bands (M ) consistently improves the results. We use M = 5 as a trade-off between efficiency and accuracy. It is worth mentioning that using a single spectral band already outperforms the state-of-the-arts in si-MSE and si-  LMSE. We believe this is due to the spectral encoding of residual blocks and the spectral loss.
Spatial vs Spectral Residual Blocks. Tab. 1 shows using spectral residual blocks performs significantly better than the spatial residual blocks (R spat v.s. R spec ). Fig. 7 shows using spectral residual blocks significantly accelerates the convergence rate (3x -5x) and improves the accuracy.
Spectral Loss. Tab. 1 reports the results of FFI-Net without spectral loss (w/o L spec ): the performance is inferior to FFI-Net on the metrics si-LMSE and DSSIM but remains the same on si-MSE. Unsurprisingly, si-MSE defines the pixelwise loss while si-LMSE and DSSIM consider the windowwise correlations. The results demonstrate the effectiveness of spectral loss on the global similarity between the intrinsic prediction and the corresponding ground truth. Moreover, we point out that FFI-Net (only L spec ) already outperforms the state-of-the-arts [12,23,13] on si-MSE and si-LMSE.

Network parameters and inference time.
Tab. 6 pro-  Table 6: Network parameter numbers displayed in millionscale. The training parameters for [23] and [12] includes that of the GAN discriminator and the VGG classifier, respectively.
. files the network parameter number of FFI-Net. It generally needs less parameters compared to the others, which use extra guidance network [13], adversarial network [23], VG-GNet [12] and U-Net [24] for training. As for inference time, we reproduced [13,12] with the same GPU (GTX 1080) as ours, it is ∼100 ms for [13], ∼70 ms for [12] and ∼42 ms for FFI-Net.

Conclusion
We proposed a Fast Fourier Intrinsic Network architecture (FFI-Net) for intrinsic image decomposition. FFI-Net differs from the existing works in the sense that inference and network training is performed in the spectral domain and multi-scale learning is implemented by spectral banding. The spectral residual blocks introduced in this work converge faster and provide better accuracy than the conventional residual blocks. FFI-Net is lightweight and does not need auxiliary networks for training. Our experiments with three popular datasets verify that FFI-Net achieves state-of-the-art accuracy without auxiliary data training or specific parameter tuning. In the future work, we will explore the potential of spectral network components in other image-to-image translation tasks such as depth estimation and spatial illumination estimation.