Title: A SPECTRAL NONLOCAL BLOCK FOR NEURAL NET-WORKS

Abstract: The nonlocal network is designed for capturing long-range spatial-temporal dependencies in several computer vision tasks. Although having shown excellent performances, it needs an elaborate preparation for both the number and position of the building blocks. In this paper, we propose a new formulation of the nonlocal block and interpret it from the general graph signal processing perspective, where we view it as a fully-connected graph filter approximated by Chebyshev polynomials. The proposed nonlocal block is more efficient and robust, which is a generalized form of existing nonlocal blocks (e.g. nonlocal block, nonlocal stage). Moreover, we give the stable hypothesis and show that the steady-state of the deeper nonlocal structure should meet with it. Based on the stable hypothesis, a full-order approximation of the nonlocal block is derived for consecutive connections. Experimental results illustrate the clear-cut improvement and practical applicability of the generalized nonlocal block on both image and video classification tasks.

1. INTRODUCTION:

Capturing the long-range spatial-temporal dependencies is crucial for the Deep Convolutional Neural Networks (CNNs) to extract discriminate features in vision tasks such as image and video classification. However, the traditional convolution operator only focuses on processing local neighborhood at a time. This makes the CNNs need to go deeper with convolutional operations to enlarge the receptive fields, which lead to higher computation and memory. Moreover, going deeper cannot always increase the effective receptive fields due to the Gaussian distribution of the kernel weight (Luo et al. (2016) ). To eliminate this limitation, some recent works focus on designing the network architecture with wider and well-designed modules to catch the long-range dependencies such as (Peng et al. (2017) , Chen et al. (2017) , Zhao et al. (2017) ). Although having larger receptive fields, these modules still need to be applied recursively to catch the dependencies of the pairs in large distances.

Inspired by the classical non-local means method in image denoising, Wang et al. (2018) proposes the nonlocal neural network which uses the nonlocal (NL) block to concern the "full-range" dependencies in only one module by exploring the correlations between each position and all other positions. In the NL block, the affinity matrix is first computed to represent the correlations between each position pair. Then the weight means of features are calculated based on the affinity matrix to refine the feature representation. Finally, the residual connection is added to the refined feature map. Due to its simplicity and effectiveness, the nonlocal block has been widely used in image and video classification (Wang et al. (2018) ; Yue et al. (2018) ; Tao et al. (2018) ; Chen et al. (2018) ), image segmentation (Huang et al. (2018) ; Yue et al. (2018) ; Wang et al. (2018) ) and person re-identification (Liao et al. (2018) ; Zhang et al. (2019) ) recently.

However, due to the complexity of the affinity matrix, the nonlocal block1 needs much more computational effort and is sensitive to its number and position in the neural network (Tao et al. (2018) ). Some works solve the first problem by simplifying the calculation of the affinity matrix such as Huang et al. (2018) , He et al. (2019) , Yue et al. (2018) , Chen et al. (2018) . Only a few works try to solve the second problem which limits the robustness of the nonlocal network2 . Tao et al. (2018) proposes the nonlocal stage (NS) block which concerns the diffusion nature and maintains the same affinity matrix for all the nonlocal units in the NS block. Comparing with the NL block, the NS block is insensitive to the numbers and allows deeper nonlocal structure. However, the deeper nonlocal structure of NS block increases the complexity and do not have a remarkable improvement.

In this work, we focus on elaborating a robust nonlocal block which is more flexible when using in the neural network. We prove that the nonlocal operator in the nonlocal block is equivalent to the Chebyshev-approximated fully-connected graph filter with irrational constraints that limits its liberty for learning. To remove these irrational constraints, we propose the Spectral-based Nonlocal (SNL) block which is more robust and can degrade into the NL and NS with specific assumptions. We also prove that the deeper nonlocal structure satisfies the stable hypothesis with the help of steadystate analysis. Based on this hypothesis, we give the full-order approximated spectral nonlocal (gSNL) block which is well-performed for deeper nonlocal structure. Finally, we add our proposed nonlocal blocks into the deep network and evaluate them on the image and video classification tasks. Experiments show that the networks with our proposed blocks are more robust and have a higher accuracy than using other types of nonlocal blocks. To summarize, our contributions are threefold: 

2. PRELIMINARY:

Nonlocal block The NL block consist of NL operator with residual connection and is expressed as:

EQUATION

where X ∈ R N ×C1 is the input feature map, F(A, Z) is the NL operator, Z ∈ R N ×Cs is the transferred feature map that compresses the channels of X ∈ R N ×C1 by a linear transformation with kernel W g ∈ R C1×Cs . Here N is the number of positions. The affinity matrix A ∈ R N ×N is composed by pairwise correlations between pixels.

In the NL block, the NL operator explores the "full-range" dependencies by concerning the relationships between all the position pairs:

EQUATION

where W ∈ R Cs×C1 is the weight matrix of a linear transformation. f (•) is the affinity kernel which can adopt the "Dot Product", "Traditional Gasuassian", "Embedded Gasussian" or other kernel matrix with a finite Frobenius norm.

Nonlocal stage To make the NL operator follow the diffusion nature that allows deeper nonlocal structure (Tao et al. (2018) ), the nonlocal stage (NS) operator uses the graph laplacian L = D A -A to replace the affinity matrix A in the NL operator:

EQUATION

where F(A, Z) is the NS operator. d i = j a ij is the degree of node i. Moreover, when adding multiple blocks with the same affinity matrix A and replacing the NL operator by the NS operator, these consecutively-connected blocks become the NS block. We called these nonlocal blocks in the NS block as the NS units.

3. METHOD:

The nonlocal operator can be divided into two steps: calculating the affinity matrix A to represent the correlations between each position pairs and refining the feature map by calculating the weighted means based on A. In this section, a fully-connected graph filter is utilized for explaining the nonlocal operator. With the Chebyshev approximation, we propose the SNL operator which is proved to be a generalized form of NL and NS operator and is more robust with higher performance in computer vision tasks. Furthermore, based on the stable hypothesis that deeper nonlocal structure tends to learn a stable affinity matrix, we extend our SNL operator into a full-order Chebyshev approximation version, i.e. the gSNL.

3.1. THE PROPOSED SPECTRAL NONLOCAL OPERATOR:

Nonlocal operator in the graph view The nonlocal operator F(A, Z) is a filter that computes a weighted mean of all the positions in the feature map Z based on the affinity matrix A and then conduct the feature transformation with the kernel W. This is the same as filtering the signal Z by a graph filter Ω in the graph domain defined by the affinity matrix A (Shuman et al. ( 2013)). Based on this perspective (Shuman et al. ( 2013)), we further define the nonlocal operator as: Theorem 1. Given an affinity matrix A ∈ R N ×N and the signal Z ∈ R N ×Cs , the nonlocal operator is the same as filtering the signal Z in the graph domain of a fully-connected weighted graph G:

EQUATION

where the graph filter Ω ∈ R N ×N is a diagonal parameter matrix, i.e. Ω = diag(ω), ω = (ω 1 , ω 2 , ..., ω n ). G = (V, A) is a fully-connected graph with the vertex set V and affinity matrix A. Λ = diag({λ 1 , λ 2 , ..., λ i , ..., λ N }) and U = {u 1 , u 2 , ..., u i , ..., u N } are the eigenvectors and eigenvalues of the graph laplacian L.

This definition requires that the graph laplacian L has non-singular eigenvalue and eigenvector, so the affinity matrix A should be a symmetric, non-negative, row-normalized matrix. To meet this requirement, the affinity matrix A can be obtained by the following steps. First, the affinity kernel is used to calculate the matrix A (we use the dot product with embeded weight matrix W φ ∈ R C1×Cs and W ϕ ∈ R C1×Cs as the affinity kernel, i.e. A = (XW φ )(XW ϕ )). Then we make the matrix

A symmetric: Ā = A T +A 2

. We normalize the row of Ā to make it satisfy d i = 1 and having Ǎ = D -1 A Ā. For the simplicity, in the following sections the symmetric, non-negative, row-normalized matrix Ǎ is denoted as A.

The proposed spectral nonlocal operator The graph filter Ω in Eq. ( 4) contains N parameters. To simplify it, we use the Chebyshev polynomials which can reduce the N parameters into k (k N ). For simplicity, we firstly assume that the input Z, the output F(A, Z) and the output F(A, Z) have only one channel.

Following the similar method as Defferrard et al. (2016) , the k st -order Chebyshev polynomials is used to approximate the graph filter function g θ (Λ):

F(A, Z) = K-1 k=0 θ k T k (L )Z with L = 2L/λ max -I n , s.t. T 0 (L ) = I n , T 1 (L ) = L , T k (L ) = 2L T k-1 (L ) -T k-2 (L ).

(5) Due to L is a random walk laplacican, the maximum eiginvalue λ max satisfies λ max = 2 which makes L = A (Shuman et al. ( 2013)). Then Eq. ( 5) becomes:

EQUATION

If k = 1, the first-order Chebyshev approximation of Eq. ( 6) becomes:

EQUATION

where θ 0 and θ 1 are the coefficients for the first and second term which are approximated by learning with SGD. Then, extending Eq. ( 7) into multi-channel conditions, we can get the formation of our SNL operator:

EQUATION

)

where

F s (A, Z) is the SNL operator, W 1 ∈ R Cs×C1 , W 2 ∈ R Cs×C1 .

Finally, a residual connection is added with the SNL operator to form the SNL block:

EQUATION

. j=0 ω j controls the total filtering intensity, which cannot be guaranteed to be 0. This setting will limit the search space when training the network and reduce the robustness of the NL block. The NL operator cannot magnify features of a large range and damp some discriminative features such as the beak of the waterfowl. Our SNL operator can also degrade into the NS operator by setting W 1 = -W 2 , i.e. θ 1 + θ 0 = 0. However, the analytic solution of this equation is

θ 1 + θ 0 = 2 N N j=0 ω j (λ j + 1) = 0.

When setting it to zero, the filter strength of the high-frequency signal (with high λ) such as the small part or twig is suppressed. Thus, it still cannot magnify the discriminative part such as the beak of the waterfowl as shown in fig. 1 . Comparing with NL and NS, our SNL does not have these irrational constraints and give these two parameters a liberal learning space. Thus, θ 0 can control the preserve strength of the discriminative features, while θ 1 can pay more attention to the low-frequency signal to diminish the noise.

3.2. THE PROPOSED GENERALIZED SPECTRAL NONLOCAL OPERATOR:

To fully exploit the "full-range" dependencies, the nonlocal block should have the ability to be consecutively stacked into the network to form a deeper nonlocal structure. However, some types of nonlocal blocks such as the NL and CGNL block cannot achieve this purpose (Tao et al. (2018) ). To show the robustness of our SNL block when used in the deeper nonlocal structure, we firstly study the steady-state of deeper nonlocal structure when consecutively adding our SNL block. We also prove the stable hypothesis that the deeper nonlocal structure tends to learn a stable affinity. Based on this hypothesis, we can extend our SNL block into a full-order Chebyshev approximation, i.e. the gSNL block which is more applicable for deeper nonlocal structure.

The stable hypothesis The Steady-state analysis can be used to analyze the stable dynamics of the nonlocal block. Here we give the steady-state analysis of our SNL block when consecutively adds into the network structure and get the Stable Hypothesis: Lemma 1. The Stable Hypothesis: when adding more than two consecutively-connected SNL blocks with the same affinity matrix A into the network structure, these SNL blocks are stable when the variable affinity matrix A satisfies: A k = A. Proof. The stability holds when the weight parameters in W 1 , W 2 and W are small enough such that the CFL condition is satisfied (Tao et al. (2018) ). So we ignore them for simplicity. The discrete nonlinear operator of our SNL have a similar formulation as the NS operator:

L h Z N := -LZ,

where h is the discretization parameter. Z N is the input of the N th block in the deeper nonlocal structure with Z 0 = X. The stable assumption demands that Z N +1 = Z N , so the steady-state equation of the last SNL block can be written as:

Z N +1 -Z N = L h Z N = -LZ N = 0.

The deeper nonlocal structure has more than one SNL blocks. So the Z N -1 and L h Z N -1 can be used to express Z N :

-LZ N = -(I -A)Z N = -(I -A)(Z N -1 + L h Z N -1 ) = -(I -A)Z N -1 + (I -A)(I -A)Z N -1 = 0.

Finally, the steady-state equation becomes:

(I -A)Z N -1 = (I -A) 2 Z N -1 ⇐⇒ A 2 = A

This equation can naturally extend to the k-hop affinity matrix A k , i.e. A k = A.

To verify the stable hypothesis, we add five consecutively-connected SNL blocks (and NS blocks) into the PreResnet56 He et al. (2016) and train this model on the train set of the CIFAR100 dataset with the initial learning rate 0.1 which is subsequently divided by 10 at 150 and 250 epochs (total 300 epochs). A weight decay 1e -4 and momentum 0.9 are also used. Then we test the trained model on the test set and output the affinity matrix of each image. Figure . 2 shows the statistics that reflects the strength of the affinity matrix, 2-hop, 3-hop, and 4-hop affinity matrix: A, A 2 , A 3 , A 4 . We can see that the number of elements in each histogram bin are nearly the same. This means that the A, A 2 , A 3 , A 4 have similar distribution of all the elements in k-hop affinity matrixes, which also empirically verifies the stable-state equation: A k = A. Full-order spectral nonlocal operator With the stable hypothesis, the Chebyshev polynomials can be simplified into a piece-wise function (details in Appendix B). Taking this piece-wise function into the Eq. 7, we can get the full-order approximation of the SNL operator:

EQUATION

where θ1 =

k%4=0 i1 θ i1 , θ2 = k%4=1||k%4=2 i2 θ i1 , θ3 = k%4=3 i1

θ i1 , whose upper bound is less than 1. Then, extending it into multi-channel input and output with the residual connection, we can get our gSNL block:

Y = X + F * s (A, Z) = X + ZW 1 + AZW 2 + (2A -I)ZW 3 (11)

The gSNL block is well-performed when the stable affinity hypothesis is satisfied, i.e. adding more than two nonlocal blocks with the same affinity matrix as shown in Table . 4.

3.3. IMPLEMENTATION DETAILS:

The implementation details of the gSNL block is shown in fig. 3 . The input feature map X ∈ R W ×H×C1 is first fed into three 1x1 convolutions with the weight kernel:

W φ ∈ R C1×Cs , W ϕ ∈ R C1×Cs , W g ∈ R C1×Cs

to subtract the number of channel. One of the output Z ∈ R W ×H×Cs is used as the transferred feature map to reduce the calculation complexity, while the other two output Φ ∈ R W ×H×Cs , Ψ ∈ R W ×H×Cs are used to get the affinity matrix A. The sub-channel C s are usually two times less than the input channel C 1 . The affinity matrix is calculated by the affinity kernel function f (•) and then use the operation in Sec3.1 to make it non-negative, symmetric and normalized. Finally, with the affinity matrix A and the transferred feature map Z, the output of the nonlocal block can be obtained by the equation Eq. ( 11). Specifically, the three weight matrixes Setting for the training For the image classification on CIFAR-10 dataset and CIFAR-100 dataset, we train the models end-to-end without using pretrained model. The initial learning rate 0.1 is used for these two datasets with the weight decay 1e -4 and momentum 0.9. The learning rate is divided by 10 at 150 and 250 epochs. The models are trained for total 300 epochs.

W 1 ∈ R Cs×C1 , W 2 ∈ R Cs×C1 , W 3 ∈ R Cs×C1

For the fine-grained classification on CUB-200 dataset, we use the models pretrained on ImageNet (Russakovsky et al. (2015) ) to initialize the weights. We train the models for total 200 epochs with the initial learning rate 0.1 which is subsequently divided by 10 at 31, 61, 81 epochs. The weight decay and momentum are the same as the setting of CIFAR-10 and CIFAR-100.

For the video classification on the UCF-101 dataset, the weights are initialized by the pretrained I3D model on Kinetics dataset (Kay et al. (2017) ). We train the models with the initial learning rate 0.1 which is subsequently divided by 10 each 40 epochs. The training stops at the 100 epochs. The weight decay and momentum are the same as the setting of CIFAR-10 and CIFAR-100.

4.2. ABLATION EXPERIMENT model:

Self-Preserving Self-Attention Approximated Conditions Channel-Wise NL × {θi = 0|i = 1, i > 2} × A2 × {θi = 0|i = 1, i > 2} × CGNL × {θi = 0|i = 1, i > 2} NS {θi = 0|i > 2} and {θ1 = -θ2} × *SNL {θi = 0|i > 2} × *gSNL - ×

Table 1 : Summary of different types nonlocal block used in the experiments. Our proposed two models have less constraints and are more flexible compared with others.

The number of channels in transferred feature space The nonlocal-based block firstly reduces the channels of original feature map C 1 into the transferred feature space C s by the 1×1 convolution to reduce the computation complexity. When C s is too large, the feature map will contain redundant information which introduces the noise when calculating the affinity matrix A. However, if C s is too small, it is hard to reconstruct the output feature map due to inadequate features. To test the robustness for the number of the C s , we generate three types of models with different number of the transferred channels with the setting: "Sub 1" (C s = C 1 ), "Sub 2" (C s = C1 2 ), "Sub 4" (C s = C1 4 ) as shown in Table . 2. Other parameters of the models and the training steps are the same as the setting in Sec.4.1. Table . 2 shows the experimental results of the three types of models with different nonlocal blocks. Our SNL and gSNL blocks outperforms other models profited by their flexible for learning. Moreover, from Table. 2, we can see that the performances of the CGNL steeply drops when the number of the transferred channels increases. This is because the CGNL block concerns the relationship between channels, when the number of the sub-channel increases, the relationship between the redundant channels seriously interferes its effects. Overall, our proposed nonlocal block is the most robust for the large number of transferred channels (our model rise 1.1% in Top1 while the best of others only rise 0.4% compared to the baseline). Here we experiment the performance of adding different types of nonlocal blocks into the three stages (the first, the second and the third stage of the preResNet) and train the models on CIFAR100 dataset with the same setting discussed in Sec.5.2. The experimental results are shown in Table . 3. We can see that the performances of the NL block is lower than the backbones when adding into the early stage. However, our proposed SNL block has 0.81% improvement compared with the backbone when respectively adding into all the three stages, which is much higher than the other type nonlocal blocks (only 0.42% for the best case). To intuitively show the stability and robustness of our SNL, we give the spectrum analysis for the estimated weight matrices (Tao et al. (2018) ). We extract the self-attention weight matrix: W g , W of the NL block and the NS block, W g , W 2 of our proposed SNL block. The dimension of the weight matrix satisfies:

W g ∈ R C1×Cs , W ∈ R Cs×C1 W 2 ∈ R Cs×C1 .

To make all the eigenvalues real, we let: W = (WgW)+(WgW) T 2

. We do the same to the W 2 . Figure . 5 shows the top thirtytwo eigenvalues of the weight matrix of W on the models in Table . 3. We can see that the density of the negative eigenvalues is higher than the positive eigenvalues of the NL block when adding into all three stages. This phenomenon makes the NL operator F(A, Z) in Eq. ( 1) less than zero. So the output feature map is less than the input feature map, i.e. Y < X (more detail of this phenomenon can be seen in Tao et al. (2018) ). The NS block can avoid "the damping effect" to some extent by concerning the diffusion nature. However, when adding into the early stage, only six eigenvalues of the nonlocal stage are not equal to zero. This phenomenon makes the nonlocal stage cannot effectively magnify the discriminated feature. Comparing with these two models, our proposed SNL block has more positive eigenvalues which takes effect to enhance the discriminated features and also avoids the "damping effect". . 4. For the model "DP3", three blocks are added into the stage 1, stage 2, and stage 3 (right after the second residual block). We can see that adding three proposed nonlocal operators into different stages of the backbone generate a larger improvement than the NS operator and NL operator (2.4% improvement). This is because when adding NS and NL into the early stage, these two models cannot better aggregate the low-level features and interfere the following blocks. For the model "SP 3" ("SP 5"), we add three (five) consecutively-connected nonlocal blocks into the stage 1. Note that different from the experiment in Tao et al. (2018) and Wang et al. (2018) , these consecutivelyconnected nonlocal blocks have the same affinity matrix. From Table . 4, we can see that profited by concerning the stable hypothesis discussed in Sec 3.3, our gSNL outperform all other models when adding consecutively-connected nonlocal blocks (rises average 0.72% to the backbone and 0.41% higher than the best performance of other type nonlocal blocks) and has a relatively stable performance. However, one drawback is that our gSNL may interfere the learning when adding only one nonlocal block (the stable hypothesis is not satisfied).

4.3. MAIN RESULTS:

We test the networks with the Nonlocal Block (NL), the Nonlocal Stage (NS), the Compact Generalized Nonlocal block (CGNL), the Double Attention Block (A2) and our SNL (gSNL) blocks in the different visual learning tasks. The experiment settings are discussed in Sec.4.1. Our models outperform other types of the nonlocal blocks across several standard benchmarks. Table . 5 shows the experimental results on the CIFAR10 dataset, we can see that by adding one proposed block, the Top1 rises about 0.65%, which is higher than adding other type nonlocal blocks (0.3%). As the experiments on CIFAR100 dataset shown in Table. 7, using our proposed block brings improvement about 1.8% with ResNet50. While using a more simple backbone PreResnet56, our model can still generate 1.1% improvement as shown in Table. 6. 

5. CONCLUSION:

In this paper, we explain the nonlocal block in the graph view and propose the spectral nonlocal (SNL) block which is more robust and well-behaved. Our SNL block is a generalized version of the NL and NS block and having more liberty for the parameter learning. We also give the stable hypothesis for deeper nonlocal structure and extend the SNL to gSNL that can be applied to the deeper nonlocal structures. The experiments on multiple computer vision tasks show the high robustness and performance of our proposed nonlocal block. Feature works will focus on using the SNL block into different vision task and its roubustness for the other type of neural network such as the Generative Adversarial Networks (GAN).

A ANALYTIC SOLUTION OF THE CHEBYSHEV APPROXIMATE:

Here we give the analytic solution for the coefficients in Chebyshev polynomials (Phillips ( 2003)):

Theorem 2. Giving a function f (x), x = {x 1 , x 2 , ..., x N }, it can be optimally approximated by Chebyshev polynomials: f (x) ≈ K-1 k=0 a k T k (x), only when a k satisfies: a k = 2 N N j=0 f (x j )T k (x j ). We call the a k as the analytic solution of the Chebyshev coeffcients.

Based on these theorem, we can get the analytic solution of the parameter θ for Eq. ( 7):

Lemma 2. The spectral nonlocal operator can be best approximated when the function g(λ) = ω can be best approximated by the Chebyshev polynomials, i.e. the analytic solutions of the Chebyshev coeffcients satisfy:

EQUATION

B THE PIECEWISE CHEBYSHEV POLYNOMIALS 

This cyclic form of Chebshev polynomials T k (A) can be reformulated as a piecewise function:

EQUATION

C EXPERIMENT OF SEMANTIC SEGMENTATION ON VOC2012 DATASET For the semantic segmentation tasks, we generate experiment on the VOC2012 dataset with the model proposed by Chen et al. (2017) .We add different types of nonlocal blocks on right before the last residual block in res4 of the ResNet50. The models are trained for 50 epochs with the SGD optimize algorithm. The learning rate is set 0.007 with the weight decay 5e -4 and momentum 0.9.

Experimental results show that the model with our proposed block can the best results. 

:

The nonlocal block is composed of a nonlocal operator and a residual connection

The nonlocal network is composed of several nonlocal blocks

Figures and Tables:

Figure 1: The comparison between the nonlocal operator (NL), nonlocal stage operator (NS) and ours spectral nonlocal operator (SNL). Our SNL has more widely attention range as shown in the two red boxes benefited from the composition of the self-attention term and the self-preserving term which is taken effect by the W 1 and W 2 . Our SNL degrades into the NL when W 1 = 0 and NS operator when W 1 = -W 2 = W.

Figure 2: The histogram of the strength statistics of the affinity matrix A where the abscissa is the range of the strength and the ordinates is the number of the elements in A in these ranges. We can see that the histogram of A k is nearly the same.

are implemented as three 1x1 convolutions.

Figure 3: The implementation of the generalized Spectral Nonlocal Block, which added the selfpreserving part (green map) and the full-order approximation part (red map) than the NL block.

The stage for adding the nonlocal blocks The nonlocal-based blocks can be added into the different stages of the preResNet (or the ResNet) to form the Nonlocal Net. In Tao et al. (2018), the nonlocalbased blocks are added into the early stage of the preResNet to catch the long-range correlations.

Figure 4: The Feature maps of Nonlocal-based Network. Our SNL block has better results for the crucial part of the birds as shown in the highlighted boxes.

Figure 5: The eigenvalue of the the nonlocal weight matrix trained on the CIFAR100 dataset

4. The result are shown in Table

Taking A k = A into the Chebyshev polynomials of the affinity matrix A, the Chebyshev polynomials becomes:T 0 (A) = I T 1 (A) = A T 2 (A) = 2AT 1 (A) -T 0 (A) = 2AA -I = 2A -I T 3 (A) = 2AT 2 (A) -T 1 (A) = 2A(2A -I) -A = A T 4 (A) = 2AT 3 (A) -T 2 (A) = 2AA -2A + I = I = T 0 (A) T 5 (A) = 2AT 4 (A) -T 3 (A) = 2AI -A = A = T 1 (A) T 6 (A) = 2AT 5 (A) -T 4 (A) = 2 * T 2 (A) -T 1 (A) = T 2 (A)

We propose a spectral nonlocal (SNL) block as an efficient, simple, and generic component for capturing long-range spatial-temporal dependencies with deep neural networks, which is a generalization of the classical nonlocal blocks.• We propose the stable hypothesis, which can enable the deeper nonlocal structure without an elaborate preparation for both the number and position of the building blocks. We further extend SNL into generalized SNL (gSNL), which can enable multiple nonlocal blocks to be plugged into the existing computer vision architectures with stable learning dynamics. • Both SNL and gSNL have outperformed other nonlocal blocks across both image and video classification tasks with a clear-cut improvement.

Table content: <table/>



Table content: <table><tr><td colspan="4">: Experiments for transferred chan-</td></tr><tr><td colspan="3">nels on CIFAR100 Dataset</td><td/></tr><tr><td/><td>model</td><td>top1</td><td>top5</td></tr><tr><td>-</td><td>PR-56</td><td>75.33%</td><td>93.97%</td></tr><tr><td/><td>+ NL</td><td>75.29%</td><td>94.07%</td></tr><tr><td/><td>+ NS</td><td>75.39%</td><td>93.00%</td></tr><tr><td>Sub 1</td><td>+ A2 + CGNL</td><td>75.51% 74.71%</td><td>92.90% 93.60%</td></tr><tr><td/><td>+ *SNL</td><td colspan="2">76.34% 94.48%</td></tr><tr><td/><td colspan="2">+ *gSNL 76.21%</td><td>94.42%</td></tr><tr><td/><td>+ NL</td><td>75.31%</td><td>92.84%</td></tr><tr><td/><td>+ NS</td><td>75.83%</td><td>93.87%</td></tr><tr><td>Sub 2</td><td>+ A2 + CGNL</td><td>75.58% 75.75%</td><td>94.27% 93.47%</td></tr><tr><td/><td>+ *SNL</td><td colspan="2">76.41% 94.38%</td></tr><tr><td/><td colspan="2">+ *gSNL 76.07%</td><td>94.16%</td></tr><tr><td/><td>+ NL</td><td>75.50%</td><td>93.75%</td></tr><tr><td/><td>+ NS</td><td>75.61%</td><td>93.66%</td></tr><tr><td>Sub 4</td><td>+ A2 + CGNL</td><td>75.61% 75.27%</td><td>93.61% 93.05%</td></tr><tr><td/><td>+ *SNL</td><td>76.02%</td><td>94.08%</td></tr><tr><td/><td colspan="3">+ *gSNL 76.05% 94.21%</td></tr></table>



Table content: <table><tr><td colspan="4">: Experiments for different positions</td></tr><tr><td colspan="2">on CIFAR100 Dataset</td><td/><td/></tr><tr><td/><td>model</td><td>top1</td><td>top5</td></tr><tr><td>-</td><td>PR-56</td><td>75.33%</td><td>93.97%</td></tr><tr><td/><td>+ NL</td><td>75.31%</td><td>92.84%</td></tr><tr><td/><td>+ NS</td><td>75.83%</td><td>93.87%</td></tr><tr><td>Stage 1</td><td>+ A2 + CGNL</td><td>75.58% 75.75%</td><td>94.27% 93.47%</td></tr><tr><td/><td>+ *SNL</td><td colspan="2">76.41% 94.38%</td></tr><tr><td/><td colspan="2">+ *gSNL 76.07%</td><td>94.16%</td></tr><tr><td/><td>+ NL</td><td>75.64%</td><td>93.79%</td></tr><tr><td/><td>+ NS</td><td>75.74%</td><td>94.02%</td></tr><tr><td>Stage 2</td><td>+ A2 + CGNL</td><td>75.60% 74.64%</td><td>93.82% 92.65%</td></tr><tr><td/><td>+ *SNL</td><td colspan="2">76.29% 94.27%</td></tr><tr><td/><td colspan="2">+ *gSNL 76.02%</td><td>93.98%</td></tr><tr><td/><td>+ NL</td><td colspan="2">75.28% 93.93%</td></tr><tr><td/><td>+ NS</td><td>75.44%</td><td>93.86%</td></tr><tr><td>Stage 3</td><td>+ A2 + CGNL</td><td>75.21% 74.90%</td><td>93.65% 92.46%</td></tr><tr><td/><td>+ *SNL</td><td>75.68%</td><td>93.90%</td></tr><tr><td/><td colspan="3">+ *gSNL 75.74% 93.78%</td></tr></table>

shows the experimental results on the fine-grained image classification task on CUB-200 datasets. Our model outperforms other non-channel-concerning blocks and generate (0.42%) im-

Table content: <table><tr><td/><td>model</td><td>top1</td><td>top5</td><td/><td>model</td><td>top1</td><td>top5</td></tr><tr><td>-</td><td>PR-56</td><td>75.33%</td><td>93.97%</td><td>-</td><td>PR-56</td><td>75.33%</td><td>93.97%</td></tr><tr><td/><td>+ NL</td><td>75.31%</td><td>92.84%</td><td/><td>+ NL</td><td>75.43%</td><td>93.67%</td></tr><tr><td/><td>+ NS</td><td>75.83%</td><td>93.87%</td><td/><td>+ NS</td><td colspan="2">75.30 % 93.74%</td></tr><tr><td>SP 1/DP 1</td><td>+ A2</td><td>75.58%</td><td>94.27%</td><td>SP 3</td><td>+ A2</td><td>75.23%</td><td>94.03%</td></tr><tr><td/><td>+ CGNL</td><td>75.75%</td><td>93.47%</td><td/><td>+ CGNL</td><td>75.64%</td><td>93.05%</td></tr><tr><td/><td>+ *SNL</td><td colspan="2">76.41% 94.38%</td><td/><td>+ *SNL</td><td>75.70%</td><td>94.10%</td></tr><tr><td/><td colspan="2">+ *gSNL 76.07%</td><td>94.16%</td><td/><td colspan="3">+ *gSNL 76.16% 94.32%</td></tr><tr><td/><td>+ NL</td><td>74.34%</td><td>93.31%</td><td/><td>+ NL</td><td>75.13%</td><td>93.53%</td></tr><tr><td/><td>+ NS</td><td>75.00%</td><td>93.57%</td><td/><td>+ NS</td><td>75.25%</td><td>94.00%</td></tr><tr><td>DP 3</td><td>+ A2</td><td>75.63%</td><td>94.12%</td><td>SP 5</td><td>+ A2</td><td>75.61%</td><td>93.81%</td></tr><tr><td/><td>+ CGNL</td><td>75.96%</td><td>93.10%</td><td/><td>+ CGNL</td><td>75.15%</td><td>92.93%</td></tr><tr><td/><td>+ *SNL</td><td colspan="2">76.70% 93.94%</td><td/><td>+ SNL</td><td>76.04%</td><td>94.19%</td></tr><tr><td/><td colspan="3">+ *gSNL 76.45% 94.53%</td><td/><td>+ gSNL</td><td colspan="2">76.04% 94.35%</td></tr></table>

Experiments for different numbers on CIFAR100 Dataset provement. Comparing with the channel-wise concerning CGNL block, our model is only a bit lower in Top1. Fig.4also shows the visualized feature map which is formed by adding the upsampled feature output with the source image. We can see that the feature maps of our proposed block can cover more critical area of the birds. For example, both the left and right wings (red square) of the birds can be focused profited by the better long-range concerning of our SNL. Moreover, benefited from the flexibility of the W 1 , our proposed SNL can also catch a relatively large range of the discriminative parts. Table.8 shows the experimental results on the action recognition task. The network with our proposed block can generate 1.8% improvement than the I3D model and outperforms all other nonlocal models on the UCF-101 dataset.

Table content: <table/>

The Results on Cifar10

Table content: <table><tr><td>model</td><td>top1</td><td>top5</td></tr><tr><td>PR-20</td><td>94.94%</td><td>99.87%</td></tr><tr><td>+ NL</td><td>94.01%</td><td>99.82%</td></tr><tr><td>+ NS</td><td>95.15%</td><td>99.88%</td></tr><tr><td>+ A2</td><td>92.44%</td><td>99.86%</td></tr><tr><td>+ CGNL</td><td>94.49%</td><td>99.92%</td></tr><tr><td>+ *SNL</td><td>94.69%</td><td>99.84%</td></tr><tr><td colspan="3">+ *gSNL 95.59% 99.92%</td></tr></table>

The Results on Cifar100

Table content: <table><tr><td>model</td><td>top1</td><td>top5</td></tr><tr><td>PR-56</td><td>75.33%</td><td>93.97%</td></tr><tr><td>+ NL</td><td>75.31%</td><td>92.84%</td></tr><tr><td>+ NS</td><td>75.83%</td><td>93.87%</td></tr><tr><td>+ A2</td><td>75.58%</td><td>94.27%</td></tr><tr><td>+ CGNL</td><td>75.75%</td><td>93.47%</td></tr><tr><td>+ *SNL</td><td colspan="2">76.41% 94.38%</td></tr><tr><td colspan="2">+ *gSNL 76.07%</td><td>94.16%</td></tr></table>

The Results on Cifar100

Table content: <table><tr><td>model</td><td>top1</td><td>top5</td></tr><tr><td>R-50</td><td>76.50%</td><td>93.14%</td></tr><tr><td>+ NL</td><td>76.77%</td><td>93.55%</td></tr><tr><td>+ NS</td><td>77.90%</td><td>94.34%</td></tr><tr><td>+ A2</td><td>77.30%</td><td>93.40%</td></tr><tr><td>+ CGNL</td><td>74.88%</td><td>92.56%</td></tr><tr><td>+ *SNL</td><td colspan="2">78.17% 94.17%</td></tr><tr><td colspan="2">+ *gSNL 77.28%</td><td>93.63%</td></tr></table>

The Results on UCF101

Table content: <table><tr><td>model</td><td>top1</td><td>top5</td></tr><tr><td>I3D</td><td>81.57%</td><td>95.40%</td></tr><tr><td>+ NL</td><td>81.37%</td><td>95.76%</td></tr><tr><td>+ NS</td><td>82.50%</td><td>95.84%</td></tr><tr><td>+ A2</td><td>82.68%</td><td>95.85%</td></tr><tr><td>+ CGNL</td><td colspan="2">83.16% 96.16 %</td></tr><tr><td>+ *SNL</td><td>82.30%</td><td>95.56%</td></tr><tr><td colspan="3">+ *gSNL 83.21% 96.53%</td></tr></table>

The Results on CUB

Table content: <table><tr><td>model</td><td>top1</td><td>top5</td></tr><tr><td>R-50</td><td>85.43%</td><td>96.70%</td></tr><tr><td>+ NL</td><td>85.34%</td><td>96.77%</td></tr><tr><td>+ NS</td><td>85.54%</td><td>96.56%</td></tr><tr><td>+ A2</td><td>86.02%</td><td>96.56%</td></tr><tr><td colspan="3">+ CGNL 86.14% 96.34%</td></tr><tr><td>+ *SNL</td><td>85.91%</td><td>96.65%</td></tr><tr><td colspan="3">+ *gSNL 85.95% 96.79%</td></tr></table>

Experiment on VOC2012 Dataset

Table content: <table><tr><td>model</td><td colspan="2">mIoU fwIoU</td><td>acc</td></tr><tr><td>R-50</td><td>0.713</td><td>0.868</td><td>0.926</td></tr><tr><td>+ NL</td><td>0.722</td><td>0.872</td><td>0.927</td></tr><tr><td>+ NS</td><td>0.722</td><td>0.873</td><td>0.927</td></tr><tr><td>+ A2</td><td>0.723</td><td>0.874</td><td>0.928</td></tr><tr><td colspan="2">+ CGNL 0.722</td><td>0.872</td><td>0.928</td></tr><tr><td>+ *SNL</td><td>0.726</td><td>0.875</td><td>0.930</td></tr><tr><td colspan="2">+ *gSNL 0.727</td><td>0.875</td><td>0.929</td></tr></table>

Peer review (iclr2020):
In this paper, authors propose a spectral nonlocal block. First, they re-interpret the nonlocal blocks in a graph view and then use Chebyshev approximation to obtain the spectral nonlocal block which is quite simple by adding a ZW_1 term. Furthermore, they analyze the steady-state to build up a deeper nonlocal structure. Also, the gSNL is simple by adding a (2A-I)ZW_3 term. Overall, the paper is written well. I like the idea to interpret the nonlocal operation in the graph view. More important, the resulting formulation is quit concise for implementation. However, my main concern is the experiment, which should be further enhanced by perform large-scale video classification like Kinetics400.