{'fraction_non_alphanumeric': 0.03466867644501131, 'fraction_numerical': 0.01565308133804858, 'mean_word_length': 5.082510578279266, '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}}
Neural Network Compression by Joint Sparsity Promotion and Redundancy Reduction

Compression of convolutional neural network models has recently been dominated by pruning approaches. A class of previous works focuses solely on pruning the unimportant filters to achieve network compression. Another important direction is the design of sparsity-inducing constraints which has also been explored in isolation. This paper presents a novel training scheme based on composite constraints that prune redundant filters and minimize their effect on overall network learning via sparsity promotion. Also, as opposed to prior works that employ pseudo-norm-based sparsity-inducing constraints, we propose a sparse scheme based on gradient counting in our framework. Our tests on several pixel-wise segmentation benchmarks show that the number of neurons and the memory footprint of networks in the test phase are significantly reduced without affecting performance. MobileNetV3 and UNet, two well-known architectures, are used to test the proposed scheme. Our network compression method not only results in reduced parameters but also achieves improved performance compared to MobileNetv3, which is an already optimized architecture.


Introduction
One of the key enablers of the unprecedented success of deep learning in recent years is the availability of very large neural network models [1]. Modern deep neural networks (DNNs), in particular convolutional neural networks (CNNs), typically consist of many cascaded layers totaling millions to hundreds of millions of parameters (weights) [2][3][4]. The larger-scale neural networks tend to enable the extraction of more complex highlevel features and therefore lead to a significant improvement of the overall accuracy [5][6][7]. On the other side, the layered deep structure and large model sizes also demand increasing computational and memory resources [8,9]. The problem with many modern neural networks is that they suffer from parameter explosion [10,11]. Due to the large number of parameters, training can take weeks on a central processing unit (CPU) or days on a graphics processing unit (GPU) [12]. For larger and higher-dimensional image sizes, even a GPU is not able to train a network with a large number of parameters.
The aim of the work presented in this paper is to design sparse, low-complexity neural networks by reducing the number of parameters while keeping performance degradation negligible. Memory and computational requirements in particular complicate the deployment of deep neural networks on low-power embedded platforms as they have limited computing and power budget. The energy efficiency challenge of large models motivates model compression. Several algorithm-level techniques have been proposed to compress models and accelerate DNNs, such as quantization to 16-bit [13], group L1 or L2 regularization [14], node pruning [15][16][17], filter pruning for CNNs ( [17][18][19][20], weight pruning using magnitude-based methods [21], weight quantization [3,22], connection pruning [21], and low-rank approximation [23]. Pruning--which removes entire filters, or neurons, that make little or no contribution to the output of a trained network-is a way to make a network smaller and faster. There are two forms in which structural pruning is commonly applied: i) using a predefined per-layer pruning ratio, or ii) simultaneously over all layers. The second form allows pruning to automatically find a better architecture [24]. An exact solution for pruning will be to minimize the l 0 norm of all neurons and remove those that are zeroed out. However, l 0 minimization is impractical as it is non-convex, NP-hard, and requires combinatorial search. Therefore, prior work has tried to relax the optimization using Bayesian methods [25,29] or regularization terms.
Motivated by the success of sparse coding, several methods relax l 0 minimization with l 1 or l 2 regularization, followed by soft thresholding of parameters with a predefined threshold. These methods belong to the family of iterative shrinkage and thresholding algorithms (ISTA) [3]. Han et al. [7] applied a similar approach for removing individual weights of a neural network to obtain sparse non-regular convolutional kernels. Li et al. [22] extended this approach to remove filters with small l 1 norms.
Due to the popularity of batch-normalization [17] layers in recent networks [10,15], several approaches have been proposed for filter pruning based on batch-norm parameters [23,33]. These works regularize the scaling term (γ) of batch-norm layers and apply soft thresholding when the value falls below a predefined threshold. Furthermore, floating-point operations (FLOPS) based penalties can also be included to directly reduce computational costs [5]. A more general scheme that uses an ISTA-like method on scaling factors [16] can be applied to any layer.
While these approaches can offer a reasonable parameter reduction (e.g. by 9× to 13× in [21]) with minor accuracy degradation, they suffer from three drawbacks: 1) the sparsity regularization and pruning typically result in an irregular network structure, thereby undermining the compression ratio and limiting performance and throughput [24]; 2) the training complexity is increased due to the additional pruning process [21] or low-rank approximation step [23]; and 3) the compression ratios depending on network are heuristic and cannot be precisely controlled.
The main contributions of this work are threefold. First, we propose a novel training scheme based on composite constraints that removes redundant filters during training. Second, our experiments on several benchmarks demonstrate a significant reduction in the number of neurons and the memory footprint of networks in the test phase without affecting their accuracy. And, finally, we demonstrate online filter redundancy removal in encoder-decoder networks for the task of pixel-wise segmentation.

Loss Function
Our goal is to formulate the loss function with added constraints given as where α is the standard loss, y and y are the true and predicted labels respectively, and g(W ) represents the set of added constraints on the network parameters W . Correspondingly, the l-th iteration of the back-propagation can be defined as: where W l represents the parameters learned in the l-th iteration, t and t + 1 represent the current and next states, and γ is the learning rate. According to (2), a new term ∇ i∈l g (W i ) must be added to each constrained layer during back-propagation to compute the overall gradient. In our case, the two terms that define g(W ) are differentiable and therefore can be easily incorporated in the back-propagation as shown in later sections.

Composite Constraints
We aim to remove the effect of redundant filters during training and effectively minimize network parameters without compromising network performance. To this end, we propose the following two composite constraints for g(W ) in (1).
Inter-Filter Orthogonality Constraint: The idea of inter-filter orthogonality has been explored in the past [25] as a measure to guide the filter pruning process, which is generally performed in an offline manner. In contrast, we employ it as a regularization term in our loss function to remove the effect of redundant filters during online training. The proposed inter-filter orthogonality constraint R is given as: ( Here, instead of using the absolute difference [25], we use the squared l 2 norm, which we found to perform well in our experiments.
Sparse Regularization Constraint: Prior works have explored group-sparse regularization including l 2 or l 1 norms [17,26]. Instead, we propose to use the l 0 norm to further eliminate the contribution of redundant filters towards network learning. The proposed sparsity constraint is defined as: Here, S l represent the layer-wise sparse gradients corresponding to the weights.

Overall Update Equations
Having defined the composite constraints constituting g(W ), we now define the overall update equations during online training. The updated loss function incorporating the composite constraints is defined as: where λ and β are the parameters controlling the two regularization terms. Correspondingly, the weight update in the l-th iteration incorporating the gradient terms for the constraints is given as: As the contribution of the sparsity term approaches zero, the update equation (6) becomes where the gradient for the inter-filter orthogonality constraint is calculated as: The update for the sparsity regularization term is obtained as: 3 Experiments

Benchmark Datasets
We have evaluated our proposed training strategy on three publicly available benchmark datasets across diverse applications including medical image segmentation, saliency detection, and scene understanding. Specifically, we employed the retinal vessel segmentation dataset DRIVE [27], the salient object dataset DUT-OMRON [28], and the video recognition dataset CamVid [29] for these applications, respectively. The DRIVE [27] dataset consists of 40 retinal scans from a population of 400 diabetic patients from the Netherlands, out of which only 7 exhibited signs of mild diabetic retinopathy. The color images (RGB) were acquired using a Canon 3CCD camera at a resolution of 768 × 584 pixels at 8 bits per pixel per color channel and are stored in JPEG format. Half of the images constitute the training set, while the other half were employed as test images. Manual segmentations of the vasculature verified by experts are available as gold standard for both training and test images. The standard training and test sets were employed in our experiments. The CamVid [29] dataset includes 700 color images (RGB) with pixel-wise reference masks for 32 semantic classes. As the name suggests, the images were derived from 30 Hz footage of driving scenarios acquired from CCTV cameras from the perspective of a driving automobile. In this work, 307 training images, 60 validation images, and 101 test images with labels corresponding to three semantic classes were employed. The included classes feature the "sky" class and "building" class while all other semantic objects are grouped into a single "other" class. The images have a resolution of 360×480 pixels and are stored in PNG format. Finally, the DUT-OMRON [28] dataset consists of a collection of 5168 natural color images (RGB) with various resolutions available in JPEG format. The images include one or more salient objects with a challenging background. Binary reference masks are also available. For our experiments, we randomly sampled 420 images from the DUT dataset, with 70-30 ratio for training and test images.

Network Models
To demonstrate the prunability of the proposed scheme, we selected U-Net [30] as a large-scale model and MobileNetV3-Small [31] as a lightweight model for our experiments. For U-Net, we employed the implementation from [32] 4 , whereas the subclassing-based implementation of [33] 5 was adopted for MobileNetV3-Small. We used weight-based pruning in our experiments, where 10% and 50% weights are magnitude pruned. To evaluate the efficacy of the proposed scheme on a wide range of weight percentages, we used iterative pruning. Specifically, we used three iterations of 10% and 50% pruning, and after each iteration the model was trained for an additional 5 epochs to update the weights. The experimental results include performance results for different iterations specified by the keyword "iter". For training the networks, stochastic gradient descent with a learning rate of 0.2 and a momentum of 0.9 was used, where the learning rate was reduced on plateaus. The models were first trained for 100 epochs before pruning with early stopping. The intersection-over-union (IOU) score was employed for monitoring the learning rate and early stopping.

Evaluation Measures
The available gold-standard reference segmentation maps are binary images indicating for each pixel whether it corresponds to a feature (object) or non-feature (background). Hence there are four types of pixels for each output image: feature pixels correctly predicted as features (true positives: TP), non-feature pixels correctly predicted as nonfeatures (true negatives: TN), non-feature pixels incorrectly predicted as features (false positives: FP), and feature pixels incorrectly predicted as non-features (false negatives: FN). From these, we calculated several common performance metrics [34]: Balance Accuracy = Sensitivity + Specificity 2 , The Jaccard measure (16) is the ratio between the intersection and the union of the segmented image and the gold-standard mask and is also known as the intersection-overunion (IOU) measure [35]. For all measures, higher values imply better performance, except for the error measure (17) where lower values imply better performance.

Experiment I
In the first experiment, we used the DRIVE dataset to evaluate the efficacy of the proposed loss function and the corresponding prunability (potential parameter saving) on the lightweight network MobileNetV3-Small [31]. For a thorough evaluation, variants of the MobileNetV3-Small architecture with unique training settings were compared. These included training from scratch, training from scratch with additional filters added to the backbone, and pretrained backbone. The lightweight network was trained with both the binary cross-entropy loss (default) and the proposed loss (termed as custom loss) to obtain six variants. From the results (Table 1) it is evident that the proposed custom loss achieved performance improvements over the cross-entropy loss in most cases.  This confirms the sparsification property of the proposed loss and its ability to suppress unwanted information and attend to important regions of interest. The proposed loss incited parameter savings and train/test time savings (Table 2). Visual comparison of sample results with the different losses ( Fig. 1) illustrates overall superior performance of the proposed loss, in that it resulted in less false pixel predictions.

Experiment II
In the second experiment, we evaluated the performance of the proposed pruning scheme using U-Net [30] and MobileNetV3-Small [31] on the CamVid and DUT-OMRON datasets in terms of mean IOU (mIOU) and the number of model parameters.
The results on the CamVid dataset (Table 3) show a decrease in mIOU for both 10% and 50% weight pruning. The drop in performance is relative to the degree of pruning, which could be attributed to training-based damage and network forgetting. For 10% pruning, there is about 14% decrease in mIOU after three iterations, with a decrease of about 18% (4.6 M) parameters. For 50% pruning, while there is a considerable decrease of about 25% in mIOU, this is achieved at a significant decrease of about 88% (22.7 M) parameters. Example visual results (Fig. 2) show that the segmentation outputs of the 10% pruned U-Net (iter 3) have considerable overlap with the gold standard and closely follow the original U-Net for the "building" class with slight misclassification for the "sky" class. These segmentations are achieved with around 18% fewer parameters compared with U-Net. The U-Net (iter 3) 50% model still remembers the semantic level segregation between the "building" and "sky" class but slightly forgets the representation for the background class. It is noteworthy that the 50% pruned model predicts the building occluded by the trees which is also neglected in the reference maps.
Results of the proposed pruning scheme for the DUT-OMRON dataset (Table 4) exhibit a slight decrease of about 4% in mIOU performance of U-Net for 10% pruning with a 3 M parameter saving. For the 50% pruned U-Net model we observe about 16% loss in mIOU at almost 59% parameter saving. It is noteworthy that the performance of the 10% pruned MobileNetV3-Small network is improved with a decrease in the number of parameters. Similar to U-Net, there is a considerable decrease in the mIOU for the 50% pruned MobileNetV3-Small model, but with only a slight decrease of 4.4% parameters in this lightweight network. Representative visual example results of MobileNetV3-Small on the DUT-OMRON dataset (Fig. 3) show that the pruned model can obtain better coverage of objects of interest. This can be attributed to the prunability of the model and the weight selection of the proposed scheme, which enable the network to better attend to regions of interest.

Conclusion
In this paper, a novel training scheme based on composite constraints is presented. The scheme removes redundant filters and reduces the impact that these filters have on the overall learning of the network by promoting sparsity. In addition, in contrast to previous works that make use of pseudo-norm-based sparsity-inducing constraints, the framework that we have developed includes a sparse scheme that is based on gradient  counting. The proposed strategy is evaluated on three publicly available dataset across diverse application such as DRIVE (medical image segmentation), DUT-OMRON (saliency detection) and CamViD (scene understanding). The efficacy of the proposed filter pruning is tested on UNet and several variants of MobileNetV3.