{'fraction_non_alphanumeric': 0.0468402004454343, 'fraction_numerical': 0.015103006681514477, 'mean_word_length': 4.471820258948972, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 2, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Deep Transform and Metric Learning Networks

Based on its great successes in inference and denosing tasks, Dictionary Learning (DL) and its related sparse optimization formulations have garnered a lot of research interest. While most solutions have focused on single layer dictionaries, the recently improved Deep DL methods have also fallen short on a number of issues. We hence propose a novel Deep DL approach where each DL layer can be formulated and solved as a combination of one linear layer and a Recurrent Neural Network, where the RNN is flexibly regraded as a layer-associated learned metric. Our proposed work unveils new insights between the Neural Networks and Deep DL, and provides a novel, efficient and competitive approach to jointly learn the deep transforms and metrics. Extensive experiments are carried out to demonstrate that the proposed method can not only outperform existing Deep DL, but also state-of-the-art generic Convolutional Neural Networks.

Synthesis Dictionary Learning (SDL) is the early primary approach in this area. Then, Analysis Dictionary Learning (ADL)/Transform Learning, the dual problem of SDL, received more attention. DL based methods [6,7,8,9,10] for image classification usually focus on learning one-layer dictionary and its associated sparse representation. Since DL methods need to simultaneously learn the dictionary and its associated representation, thanks to a sparsity promoting regularization, they raise challenging numerical issues. To address such challenges, a number of dictionary learning solvers have been developed, including K-SVD [6] and Fast Iterative Shrinkage-thresholding Algorithm (FISTA) [11] schemes, for instance. Although such alternating minimization methods provide practical solutions for DL, they remain prone to limitations and have a relatively high computational cost. To overcome such computational difficulties, differentiable programming has also been developed, to take advantage of the efficiency of neural networks, such as LISTA [12] and Sparse LSTM [13].
Although the aforementioned differentiable programming methods are efficient at solving a single-layer DL problem, the latter formulation still does not lead to the best performance in image classification tasks. With the fast development of deep learning, Deep Dictionary Learning (DDL) methods [14,15] have thus come into play. [16] deeply stacks SDLs to classify images and achieves promising performance. Also, a deep model for ADL followed by a SDL is developed for image super-resolution in [17]. Unsupervised DDL approaches have also been proposed, with interesting results [18,19].
However, to the best of our knowledge, there is no method for training such kind of end-to-end deep dictionary models in a both fast and reliable manner. This work aims at ensuring the discriminative ability of single-layer DL while benefiting from the efficiency of end-to-end models. To this end, we propose a novel differentiable programming method, namely, Deep Transform and Metric Learning. To further benefit from the efficiency of DDL models, the resulting structures are stacked into a deep network, leading to a so-called De-TraMe Network (DeTraMe-Net). Our new approach not only increases the discrimination capabilities of DL, but also brings the flexibility to construct different DDL or Deep Neural Network (DNN) architectures. It also allows to overcome the roadblocks raised by initialization and gradient propagation issues arising in standard DDL methods. Although the authors of [20] and [21] also used a CNN followed by an RNN for respectively solving super-resolution and sense recognition tasks, they directly used LISTA in their model. In turn, our method actually solves the same problem as LISTA.
Our main contributions are summarized below: 1) We theoretically transform one-layer dictionary learning into a transform learning and Q-Metric learning, and derive the conversion of DDL into DeTraMe-Net. 2) Such joint transform learning and Q-Metric learning are easily implemented into a combined linear layer and a RNN. A convolutional layer can be chosen for the linear part, and the RNN can also be simplified into a Convolutional-RNN. To the best of our knowledge, this is the first work which establishes an insightful bridge between DDL methods and the combination of Forward Neural Networks (FNNs) and RNNs. 3) The transform and Q-Metric learning use two independent variables, one for the metric and the other for the pseudo-inverse of the dictionary. This allows us to make a link with conventional SDL while introducing more discriminative power and allowing faster learning procedures than the original DL. 4) Q-Metric can also be viewed as a parametric non-separable nonlinear activation function, while in current neural network architectures, very few nonseparable nonlinear operators are used. As a module in a neural network, it can be flexibly inserted into any network architectures to easily construct DL layer. 5) The proposed DeTraMe-Net is demonstrated not only to improve the discrimination power of DDL, but also to achieve a better performance than the state-of-the-art CNNs.
The paper is organized as follows: In Section 2, we introduce the required background material. We derive the theoretical basis for our novel approach and its algorithmic solution in Section 3. Substantiating experimental results and evaluations are presented in Section 4. Finally, we provide some concluding remarks in Section 5.

Notation
Uppercase and lowercase bold letters respectively denote matrices and vectors throughout the paper. The transpose and inverse of matrices are respectively represented by the superscripts ⊤ and −1 . The identity matrix is denoted by I. The lowercase a i,j represents the element in the i th row and j th column of matrix A, and a i represents the i th component of vector a.

Deep Dictionary Learning
An efficient DDL approach [16] consists of computinĝ y = ϕ(Cx (s) ) where andŷ denotes the estimated label, C is the classifier matrix, ϕ is a nonlinear function, and • denotes the composition of operators. For every layer r ∈ {1, . . . , s}, P (r) is a reshaping operator, which is a tall matrix. Moreover, M D (r) is a nonlinear operator computing a sparse representation within a synthesis dictionary matrix D (r) . More precisely, for a given where (λ, α) ∈ (0, +∞) 2 , d (r) ∈ R kr , and ψ r is a function in Γ 0 (R kr ), the class of proper lower semicontinuous convex functions from R kr to (−∞, +∞]. A simple choice consists in setting d (r) to zero, while adopting the following specific form for ψ r : ψ r = · 1 + ι [0,+∞) kr , where ι S denotes the indicator function of a set S (equal to zero in S and +∞ otherwise). Note that Eq. (2) corresponds to the minimization of a strongly convex function (w.r.t. a), which thus admits a unique minimizer, so making the operator M D (r) properly defined.

Proximal interpretation
In the following, the superscript denoting the layer r has been omitted for simplicity. We have then the following result [22]: where prox Q λψ denotes the proximity operator of function λψ in the metric · Q = (·) ⊤ Q(·) induced by Q [23,24].
Therefore determining the optimal sparse representation a of x ∈ R m is equivalent to computing a proximity operator. Furthermore, this result shows that the SDL can be equivalently viewed as an ADL formulation involving the dictionary matrix F, provided that a proper metric is chosen.

Multilayer representation
Consequently, by substituting eq. (3) in eq. (1), the DDL model can be re-expressed in a more concise and comprehensive form aŝ where the affine operators A (r) 1≤r≤s are defined as with k 0 = m 1 , W (1) = F (1) , and ∀r ∈ {2, . . . , s}, W (r) = F (r) P (r−1) , W (s+1) = CP (s) ∀r ∈ {1, . . . , s}, Q (r) = (D (r) ) ⊤ D (r) + αI, Eq. (5) shows that we obtain a structure similar to an FNN using weight operators W (r) 1≤r≤s and bias parameters (c (r) ) 1≤r≤s , which is referred to as the transform learning part in our DeTraMe-Net method. In standard FNNs, the activation functions can be interpreted as proximity operators of convex functions [25]. Eq. (4) evidences that our model is actually more general in the sense that different metrics are introduced for these operators.

Prox computation
Reformulation (4) has the great advantage of exploiting algorithmic frameworks developed for FNNs provided that we are able to compute efficiently where · F,Q = tr((·)Q(·) ⊤ ) is the Q-weighted Frobenius norm. Hereabove, Z is a matrix where the N samples associated with the training set have been stacked columnwise. A convention is used to construct X and Y from (x j ) 1≤j≤N and (y j ) 1≤j≤N . Various iterative splitting methods could be used to find the unique solution to the above convex optimization problem [23,26]. Our purpose is to develop an algorithmic solution for which classical NN learning techniques can be applied in a fast and systematic manner. Our approach will be grounded in the following result.

Theorem 3.2 [22] Assume that an elastic-net like regularization is adopted by setting
with β ∈ (0, +∞). For every Z ∈ R k×N , the elements of prox Q λψ (Z) in eq. (7) satisfy for every i ∈ {1, . . . , k}, and j ∈ {1, . . . , N }, where We have observed that the choice of an elastic elastic-net like regularization has a positive influence in increasing stability and avoiding overfitting. Since Theorem 3.2 does not provide an explicit expression of prox Q λψ (Z), we compute it by adopting a block-coordinate approach and update the i-th row of U by fixing all the other ones. As Q is a positive definite matrix, q i,i > 0. Let where (δ ℓ ) ℓ∈Z is the Kronecker sequence (equal to 1 when ℓ = 0 and 0 otherwise). Then, (8) suggests that the elements of U can be globally updated, at iteration t, as follows where ⊙ denotes the Hadamard (element-wise) product. Note that a similar expression can be derived by applying a preconditioned forward-backward algorithm [24] to Problem (7), where the preconditioning matrix is Diag(q 1,1 , . . . , q k,k ). Given W, h, and b, this updating rule (9) can be viewed as an RNN structure for which U t is the hidden variable and Z is a constant input over time.

Algorithm 1 Deep Metric and Transform Learning
Initialization: Set t = 0.

5:
if r ≤ s then while not converged and tt < tt max do 8: Update U tt+1 according to eq. (9); tt ← tt + 1 Loss: L ′ (θ t ) = L(Y,Ŷ t ), θ t : vector of all parameters 14: Backward pass: 15: for r = 1, . . . , s + 1 do 16: end for 24: t ← t + 1 25: end while Table 1. CIFAR10 and CIFAR100 with + is trained with simple translation and flipping data augmentation. All the presented results are re-implemented over 5 runs by using the same settings, and are calculated by their means and standard deviations.

Training procedure
We have finally transformed our DDL approach in an alternation of linear layers and specific RNNs. Let ρ t > 0 be the learning rate at iteration t, the simplified form of a training method for DeTraMe-Net is provided in Alg. 1. The constraints on the parameters of the RNNs have been imposed by projections. In Alg. 1, P S denotes the projection onto a nonempty closed convex set S and D 0 is the vector space of k × k matrices with diagonal terms equal to 0.

EXPERIMENTS AND RESULTS
In this section, our DeTraMe-Net method is evaluated on two popular datasets, namely CIFAR10 [27] and CIFAR100 [27]. Since the common NN architectures are plain networks such as ALL-CNN [28] and residual ones, such as ResNet [29] , we compare DeTraMe-Net with these two respective state-of-theart architectures. We replace all the ReLU activation layers in PlainNet with Q-Metric ReLU, leading to DeTraMe-PlainNet, and replace the ReLU layer inside the block in ResNet by Q-Metric ReLU, giving rise to DeTraMe-ResNet. More detailed information can be found in [22].  First we compare our DeTraMe-Net with DDL [16]. Although DeTraMe-Net needs more parameters, DeTraMe-Net presents two main advantages: (1) A better ability to discriminate: in comparison to DDL in the top table of Table 2, in terms of averaged performance, 0.01% and 0.92% accuracy improvements are respectively obtained on these two datasets.
(2) DeTraMe-Net is implemented in a network framework, with no need for extra functions to compute gradients at each layer, which greatly reduces the time costs. The bottom part of Table 2 shows that our method with 6 times more parameters than DDL only requires half training time and a faster testing time by a factor 100. Moreover, by taking advantage of the developed implementation frameworks for neural networks, DeTraMe-Net can use up to 110 layers, while the maximum number of layers in [16] is 23.

DeTraMe-Net vs. Generic CNNs
We next compare DeTraMe-Net with generic CNNs with respect to two different aspects: Accuracy and Capacity.
Accuracy. As shown in Table 1, with the same architecture, using DeTraMe-Net structures achieves an overall better performance than all various generic CNN models do. For PlainNet architecture, DeTraMe-Net increases the accuracy with a median of 3.99% on CIFAR10, 5.11% on CIFAR100 and 0.45% on SVHN. For ResNet architecture, DeTraMe-Net also consistently increases the accuracy with a median of 0.05% on CIFAR10, 0.13% on CIFAR100.
Capacity. In terms of depth, comparing improvements with PlainNet and ResNet, shows that the shallower the network, the more accurate. It is remarkable that DeTraMe-Net leads to more than 42% accuracy increase for PlainNet 3layers on CIFAR10 and CIFAR100. When the networks become deeper, they better capture discriminative features of the classes, and albeit with smaller gains, DeTraMe-Net still achieves a better accuracy than a generic deep CNN, e.g. around 0.11% and 0.05% higher than ResNet 110 on CIFAR10 and CIFAR100.

CONCLUSION
Starting from a DDL formulation, we have shown that the introduction of metrics within standard activation operators, gives rise to a novel Joint Deep and Transform Learning problem. This has allowed us to show that the original DDL can be performed thanks to a network mixing FNN and RNN parts, so leading to a fast and flexible network framework for building efficient DDL-based classifiers. Our experiments illustrate that the resulting DeTraMe-Net performs better than the original DDL approach and state-of-the-art generic CNNs.