Optimizing Convolutional Neural Network Architectures
Abstract
Projects with references PID2020-118224RB 100 and PID2023-151336OB-I00 granted by the Spanish Ministry of Science and Innovation, co-funded by the European Commission
Full text
Citation: Balderas, L.; Lastra, M.; Benítez, J.M. Optimizing Convolutional Neural Network Architectures. Mathematics 2024,12, 3032. https://doi.org/10.3390/ math12193032 Academic Editor: Ioannis Tsoulos Received: 29 August 2024 Revised: 23 September 2024 Accepted: 26 September 2024 Published: 28 September 2024 Copyright: © 2024 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/). mathematics Article Optimizing Convolutional Neural Network Architectures Luis Balderas 1,2,3,4* , Miguel Lastra 2,3,4,5 and José M. Benítez 1,2,3,4 1Department of Computer Science and Artificial Intelligence, University of Granada, 18071 Granada, Spain; [email protected].es 2Distributed Computational Intelligence and Time Series Lab, University of Granada, 18071 Granada, Spain; [email protected] 3Sport and Health University Research Institute, University of Granada, 18071 Granada, Spain 4Andalusian Research Institute in Data Science and Computational Intelligence, University of Granada, 18071 Granada, Spain 5Department of Software Engineering, University of Granada, 18071 Granada, Spain *Correspondence: [email protected] Abstract: Convolutional neural networks (CNNs) are commonly employed for demanding applications, such as speech recognition, natural language processing, and computer vision. As CNN architectures become more complex, their computational demands grow, leading to substantial energy consumption and complicating their use on devices with limited resources (e.g., edge devices). Furthermore, a new line of research seeking more sustainable approaches to Artificial Intelligence development and research is increasingly drawing attention: Green AI. Motivated by an interest in optimizing Machine Learning models, in this paper, we propose Optimizing Convolutional Neural Network Architectures (OCNNA). It is a novel CNN optimization and construction method based on pruning designed to establish the importance of convolutional layers. The proposal was evaluated through a thorough empirical study including the best known datasets (CIFAR-10, CIFAR-100, and Imagenet) and CNN architectures (VGG-16, ResNet-50, DenseNet-40, and MobileNet), setting accuracy drop and the remaining parameters ratio as objective metrics to compare the performance of OCNNA with the other state-of-the-art approaches. Our method was compared with more than 20 convolutional neural network simplification algorithms, obtaining outstanding results. As a result, OCNNA is a competitive CNN construction method which could ease the deployment of neural networks on the IoT or resource-limited devices. Keywords: convolutional neural network simplification; neural network pruning; efficient machine learning; Green AI MSC: 68T07 1. Introduction Over the last years, deep neural networks (DNNs) have become the state-of-the-art technique in several challenging tasks, such as speech recognition [ 1 ], natural language processing [ 2 ], and computer vision [ 3 ]. In particular, convolutional neural networks (CNNs) have achieved remarkable success across a broad range of computer vision challenges, such as image classification [ 3 ], object detection in images [ 4 ], object detection in video [ 5 ], semantic segmentation [ 6 ], video restoration [ 7 ], and medical diagnosis [ 8 ]. The astonishing results of CNNs are associated with the huge number of annotated data and important advances in hardware. Unfortunately, CNNs usually have an immense number of parameters, incurring in high storage requirements, and significant computational and energetic costs [ 9 ]. This imposes severe restrictions on the deployment of these models on devices with limited resources, such as edge devices or mobile devices. Thus, some methods to develop smaller-size models or simplify the complexity of the available models are necessary [10]. Mathematics 2024,12, 3032. https://doi.org/10.3390/math12193032 https://www.mdpi.com/journal/mathematics
Mathematics 2024,12, 3032 2 of 19 On the other hand, these large models requiring large amounts of memory and computation time have an evident environmental impact. In 2019, researchers from the University of Massachusetts discovered that training various deep learning models, such as those involving neural architecture search, could release over 284,019 kg of carbon dioxide. This amount is roughly equivalent to five times the total lifetime emissions of the typical American vehicle, including the car’s production [ 11 , 12 ]. Concretely, to classify a single image, the VGG-16 model [ 13 ] needs over 30 billion floating-point operations (FLOPs) and has 138 million parameters, which demand more than 500 MB of storage space [14]. In consequence, reducing the model’s storage requirements and computational cost becomes critical for resource-limited devices, specially in IoT applications, embedded systems, autonomous agents, mobile devices, and edge devices [ 15 ]. Actually, the concerns relative to such a high level of energy consumption—among other resources—have lead to the surge and development of a new line of research seeking a more sustainable future for Artificial Intelligence development and deployment, named Green Artificial Intelligence [16]. Nonetheless, Ref. [ 17 ] remarks that a usual DNN property is their considerable redundancy in parameterization, which leads to the idea of reducing this redundancy by compressing the networks. However, a severe problem along with compressing the models is the loss of accuracy. In order to avoid it, there are some ways of designing efficient DNNs and generating effective solutions. For instance, one approach involves using memetic algorithms to discover an effective architecture for a given task, while another method entails employing alternative optimization algorithms to fine-tune the connection weights of a pre-defined architecture. Kernel Quantization is also used for efficient network compression [ 18 ]. Alternatively, pruning is a widely utilized technique for simplifying neural networks. Since the introduction of Optimal Brain Damage (OBD) and Optimal Brain Surgery (OBS) in 1990, pruning methods have been thoroughly researched for model compression. Over the years, numerous other approaches have been developed to create more efficient and effective neural networks of various types, including dense, convolutional, and recurrent networks [ 12 ]. The primary objective of pruning algorithms is to derive a subnetwork with significantly fewer parameters while maintaining the same level of accuracy. In this paper, we propose a novel CNN optimization and construction technique called Optimizing Convolutional Neural Network Architectures (OCNNA) based on pruning which requires minimal tuning. OCNNA has been designed to assess the importance of convolutional layers. Since this measure is computed for every convolutional layer and unit from the model input to the output, it essentially reflects the importance of every single convolutional filter and its contribution to the information flow through the network [ 19 ]. Moreover, our method is able to sort convolutional filters within a layer by importance; as a consequence, it can be seen as a feature importance computation tool which can generate more explainable neural networks. OCNNA is easy to apply, having only one parameter ( k ), called the percentile of significance, which represents the proportion of filters which will be transferred to the new model based on their importance. Only the k -th percentile of filters with higher values after applying the OCNNA process will remain. The proposed OCNNA can directly be applied to trained CNNs, avoiding the training process from scratch. We thoroughly evaluated the optimization efficacy of the OCNNA method compared with the state-of-the-art pruning techniques. Our experiments on the CIFAR-10, CIFAR-100 [ 20 ], and Imagenet [ 21 ] datasets and popular CNN architectures, such as ResNet-50, VGG-16, DenseNet40, and MobileNet, show that our algorithm leads to better performance in terms of the accuracy in prediction and the reduction in the number of parameters, following a cornerstone metric for Green AI [22] and efficient Machine Learning. Our main contributions can be summarized as follows:
Mathematics 2024,12, 3032 3 of 19 • A Green AI simplification method for CNNs called OCNNA is proposed. OCNNA measures the importance of each convolutional layer and unit from a trained model by combining well-known data science and statistical techniques, such as PCA, Frobenius norm, and Coefficient of Variation. After that, it builds a simplified model which can be even more precise than the original one and more efficient in terms of computational costs and memory footprint. • Experiments on three benchmark datasets (CIFAR-10, CIFAR-100, and Imagenet) demonstrate that our simplification technique yields highly competitive results in terms of efficiency metrics (reduction in the number of parameters) and prediction accuracy when applied to the most widely used CNN models, such as VGG16, ResNet50, DenseNet40, and MobileNetV1. The paper is organized as follows: Section 2presents an overview of the latest methods for developing efficient deep neural networks. Our proposal is described in Section 3. In Section 4, our methodology is experimentally analyzed, and the results are analyzed and discussed in Section 5. Finally, Section 6highlights the conclusions. 2. Previous work The purpose of this section is to provide a brief overview of the main approaches in model compression: neuroevolution, neural architecture search, quantization, and pruning. Our research mainly focuses on convolutional neural network pruning. 2.1. Neuroevolution Neuroevolution can be applied to several tasks related to efficient neural network design, such as learning neural networks (NN) building blocks, hyperparameters, or architectures. In 2002, NeuroEvolution of Augmenting Topologies (NEAT) was presented in [ 23 ], showing the effectiveness of a Genetic Algorithm (GA) in evolving NN topologies and strengthening the analogy with biological evolution. More recently, ref. [ 24 ] drew inspiration from NEAT, evolving deep neural networks by beginning with a simple neural network and gradually increasing its complexity through mutations. In [ 25 ], a more accurate approach, which consists in stacking the same layer module to make a deep neural network, like Inception, DenseNet, and ResNet, can be found [26]. 2.2. Neural Architecture Search Recently, neural architecture search (NAS), whose main goal is to automatically design the best DNN architecture, has achieved great importance in model design. On the one hand, NAS algorithms can be divided into two categories: (1) microstructure search focuses on identifying the best operation for each layer; (2) macrostructure search aims to find the optimal number of channels or filters for each layer, or the ideal model depth [ 27 ]. Additionally, NAS algorithms can be categorized into three groups based on the optimizer used: reinforcement learning-based NAS algorithms, gradient-based NAS algorithms, and evolutionary NAS (ENAS) algorithms. In this sense, NSGA-II has been recently used for NAS creating NSGA-Net [ 28 ]. In [ 29 ], NATS-BEnch is proposed, consisting in a unified benchmark for topology and size aggregating more than 10 state-of-the-art NAS algorithms. 2.3. Quantization Quantization refers to the process of approximating a continuous signal by using a set of discrete symbols or integer values [ 30 ]. In other words, it reduces computations by reducing the precision of the data type. Advanced quantization techniques, such as asymmetric quantization [ 31 ] or calibration-based quantization, have been presented to improve accuracy. In [30], we find a complete quantization guide and recommendations.
Mathematics 2024,12, 3032 4 of 19 2.4. Knowledge Distillation Knowledge distillation, which was first defined by [ 32 ] and generalized in [ 33 ], is the process of transferring knowledge from one neural network to a different one. In [ 34 ], a student–teacher framework is presented, introducing different scenarios, such as distillation based on the number of teachers (one teacher vs. multiple teachers), distillation based on data format (data-free, with a few samples, or cross-modal distillation), or online and teacher-free distillation. 2.5. Pruning Network pruning is one of the most effective and prevalent approaches to model compression. Pruning techniques can be classified by various aspects: structured and unstructured pruning, depending on whether the pruned network is symmetric or not [ 30 , 35 ]; neuron, weight, or filter pruning, depending on the network’s element which is pruned; or static and dynamic pruning [ 30 ]. While static pruning removes elements offline from the network after training and before inference, dynamic pruning determines at runtime which elements will not participate in further activity [ 30 ]. Most researchers focus on how to find unimportant filters. Magnitude-based methods [ 36 ] use the magnitude of the weights in feature maps from certain layers as a measure of importance, pruning those with lower magnitudes. Others measure the importance of a filter through their reconstruction loss (Thinet) [ 37 ] or Taylor expansion [ 38 , 39 ]. In [ 40 ], Average Percentage of Zeros (APoZ) is used to assess the proportion of zero activations in a neuron following ReLU mapping, thus allowing for the pruning of redundant neurons. HRank [ 41 ] understands filter pruning as an optimization problem, using the feature maps as the function which measures the importance of a filter part of the CNN. Inspired by HRank, FPWT [ 42 ] introduces a new method which transforms the feature map in the spatial domain into the frequency domain by using Wavelet Transform. In [ 43 ], a new CNN compression technique is presented based on the filter-level pruning of redundant weights according to entropy importance criteria (FPEI) with different versions depending on the learning task and the NN. SFP [ 44 ] and FPGM, based on filter pruning via geometric median [ 45 ], use soft filter pruning; PScratch [?] proposes to prune from scratch, before training the model. In [ 47 ], a criterion for CNN pruning inspired by NN interpretability is proposed: the most relevant units are identified based on their relevance scores, which are derived from explainable AI (XAI) concepts. Ref. [ 48 ] introduces a data-driven CNN architecture determination algorithm called AutoCNN which consists of three training stages (spatial filter, classification layers, and hyperparameters). AutoCNN uses statistical parameters to decide whether to add new layers, prune redundant filters, or add new fully connected layers pruning low-information units. An iterative pruning method based on deep reinforcement learning (DRL) called Neon, formed by a DRL agent which controls the trade-off between performance and the efficiency of the pruned network, is introduced in [ 49 ]. For each hidden layer, Neon extracts the architecture-based and the layer-based feature maps which represent an observation. Then, the aforementioned hidden layer is compressed and fine-tuned. After that, a reward is calculated and used to update the deep reinforcement learning agent’s weights. This process is repeated several times for the whole neural network. In [ 50 ], a multi-objective evolution strategy algorithm called DeepPruningES is proposed. Its final output consists of three neural networks with different trade-offs called knee (with the best trade-off between training error and the number of FLOPs), boundary-heavy (with the smallest training error), and boundary-light solutions (with the smallest number of FLOPs). In [ 27 ], a customized correlation-based filter-level pruning method for deep CNN compression called COP, which removes redundant filters through their correlations, is presented. In [ 51 ], SCWC is introduced, a shared channel weight convolution method to decrease the number of multiplications in CNNs by leveraging the distributive property, made possible through structured channel parameter sharing. In [ 52 ], a new method called CHWP for identifying the most redundant filters is proposed, taking into account the size
Mathematics 2024,12, 3032 5 of 19 of filters, the difference between them, and the role of Batch Normalization layers. In [53], a training method for CNN compression is proposed. It integrates matrix factorization and regularization techniques, based on Singular Value Decomposition. Nonetheless, the method has been evaluated only on ResNet-18, ResNet-20, and ResNet-32. In [ 54 ], a CNN pruning method called MOP-FMS is introduced, in which the pruning task is modeled as a bi-objective optimization problem based on feature map selection. The two objectives of the method are accuracy and FLOPs, which are achieved by using an ad hoc evolutionary optimization algorithm designed to perform the pruning. Ref. [ 55 ] presents a CNN pruning method, which obtains a simplified network by clustering its filters. After that, it searches the optimal compact network structure by applying a social group optimization algorithm. In [56], an evolutionary method called Bi-CNN-Pruning is proposed to prune filters and channels with the objective of preserving the performance of the original model according to different pruning criteria, such as weight magnitude or activation statistics, among others. Concretely, it maintains the important channels in an ordered way, i.e., useful filters are selected first and then the channels. ResPrune is proposed in [ 57 ]. It is a selection filter method which uses two criteria: l2 -norm and redundancy. Unlike other methods, ResPrune does not completely omit the filters identified as irrelevant; instead, it restores them to their original values by using stochastic techniques. In [ 58 ], a pruning framework called MGPF is introduced. MGPF generates sparse models of different granularity without fine-tuning the remaining connections after pruning. CIE [ 59 ] is a cross-layer importance evaluation technique used for neural network pruning, which assesses the significance of convolutional layers based on the model’s prediction accuracy. This evaluation is highly efficient in terms of time, as the process is performed only once for a given model. 2.6. Summary As demonstrated in this section, there are numerous approaches and techniques for simplifying CNNs. Over the years, increasingly sophisticated solutions have been proposed; whether through neuroevolution, neural architecture search, quantization, knowledge distillation, or pruning, the goal remains the same: to achieve smaller models without sacrificing prediction accuracy. However, designing an efficient, versatile, and effective method is not easy. In the case of neuroevolution and neural architecture search, competitive techniques can be achieved in terms of accuracy, but the computational cost of generating them can be prohibitive. For quantization and knowledge distillation, conceptual challenges may arise, while pruning algorithms are typically designed for specific models, unable to tackle the simplification of networks of different natures or assess their performance on various benchmarks. To address all these challenges, we developed OCNNA, an efficient technique that will be evaluated on the de facto benchmarks for image classification and will simplify the most paradigmatic and general convolutional networks. It can be applied in virtually any industry or academic use case involving CNNs and image classification. 3. Proposal In this paper, we address the challenge of finding an optimized topology for a convolutional neural network. Thus, we introduce the Optimizing Convolutional Neural Network Architectures (OCNNA) method, a new convolutional neural network construction method based on pruning. In this section, we provide a detailed description of the method. 3.1. Notation First of all, we introduce the notation used in our proposal. Let Ω be a neural network with L convolutional layers. Let wl m and ol m be the convolutional filter and the output of the l -th layer. The subscript m∈ 1, . . . , Ml represents the filter index, where Ml indicates the total number of output filters in the corresponding layer. In consequence, pruning the l-th filter in layer mimplies removing the corresponding wl m.
Mathematics 2024,12, 3032 6 of 19 Principal Component Analysis (PCA) [ 60 ] is a data analysis tool applied to identify the most meaningful basis to re-express, revealing a hidden structure, a given dataset. We define Pl m=PCA(ol m) as the matrix result of computing PCA on the m -th filter’s output of the l-th layer. The Frobenius norm [61] is a norm of an m×nmatrix Adefined as ||A||F=v u u t m ∑ i=1 N ∑ j=1 |aij|2(1) It is also equal to the square root of the matrix trace of A,AH: ||A||F=qTr(AAH)(2) where AH is the conjugate transpose [ 62 ]. Let us define Fl m=||Pl m||F as the Frobenius norm of the above PCA calculation (on the m-th filter’s output of the l-th layer). The Coefficient of Variation (CV) is the relationship between mean and standard deviation [ 63 ]. If D is a data distribution, with σD its standard deviation and µD its mean, CV is calculated as CVD=σD µD (3) It is attractive as a statistical tool because it permits the comparison of variables free from scale effects (dimensionless). We call C=CV(x)if x∈Rn, for a given n∈N. Finally, we define the percentile of significance k . Only the k -th percentile of filters with higher values in terms of importance will remain. All notations can be found in Table 1. Table 1. Notations and definitions. Notation Definition LNumber of convolutional layers wl mm-th filter from the l-th convolutional layer ol mOutput of the m-th filter from the l-th layer MlNumber of output filters in the l-th layer Pl mPCA applied to the m-th filter from the l-th layer Fl mFrobenius norm of Pl m CCoefficient of Variation of a vector k-th percentile Percentile of significance 3.2. OCNNA: The Algorithm Since the main components of a CNN are the convolutional filters, OCNNA is designed to identify the most important ones, thus creating a new model in which the less significant convolutional units are not included. This way, OCNNA generates a more efficient model in terms of the number of parameters with minimum precision loss—as we will see in the next section. Additionally, OCNNA allows for the ordering of the convolutional filters by importance, providing a feature importance assessment method and, as a result, helping to better understand these models. Our method employs three important techniques to identify the significant filters: Principal Components Analysis (PCA), for selecting the most important features based on their hidden structure; the Frobenius norm, to summarize the PCA output information; and the Coefficient of Variation (CV), to measure the variability of Frobenius norm outputs. Figure 1shows, as an example, the simplification process of a VGG-16 convolutional filter. As can be seen, the algorithm takes the filters from each layer (Figure 1, 1); applies PCA, Frobenius norm, and Coefficient of Variation (Figure 1, 2); and ranks the filters by importance, selecting only their top k -th percentile (Figure 1, 3). More details can be found in Algorithm 1.
Mathematics 2024,12, 3032 7 of 19 Algorithm 1 OCNNA 1: function OCNNA(model, k,Dvar) 2: compressed_model = new Model() 3: for layer in model.Layers do 4: if layer is Convolutional then 5: variability = List() 6: for filter in layer do 7: o=model.predict(Dvar) 8: p=PCA(o, 95% var) 9: pn =FrobeniusNorm(p) 10: c=CV(pn) 11: Append cto variability 12: end for 13: new_layer_index = get k-th percentile in variability 14: Add new layer with new_layers_index filters from model 15: else 16: Add layer to compressed_model 17: end if 18: end for 19: return compressed_model 20: end function 1 2 3 Figure 1. OCNNA applied to VGG-16. Given the output from the i -th convolutional layer, PCA, Frobenius norm, and Coefficient of Variation are applied to identify the most significant filters. The k -th percentile of filters, in terms of importance, are selected, generating a new model whose i -th convolutional layer is a optimized version of the original one. This approach is applied to every convolutional filter. Given convolutional layer wl , a Dvar dataset, used exclusively for measuring the importance of filters, is evaluated by generating output ol . ol is formed by Ml filters. In consequence, ol m is the m -th filter’s output from the l -th layer. By using ol , OCNNA helps us to measure the importance of the Ml filters in the m -th layer. Concretely, we adopt a threestage process. First, for each filter and image contained in Dvar , we apply PCA retaining the 95% of variance. Pl m=PCA(ol m)(4) with Pl m a matrix which contains the most meaningful features generated by the m -th filter of the l -th convolutional layer. Nonetheless, the information embedded in Pl m is too large. In consequence, we apply the Frobenius norm to summarize this information: Fl m=||Pl m||F(5)
Mathematics 2024,12, 3032 8 of 19 obtaining a vector Fl m , in which each component is the result of the process described above applied to each image from Dvar. Finally, we calculate the CV: Cm=CV(Fl m)(6) Cm is a number which summarizes the m -th filter significance within the l -th convolutional layer by measuring the variability of the process PCA and Frobenius norm for each image in Dvar . In other words, OCNNA gives a low score of importance to a filter if for a subset of images, it generates an output whose hidden structures (PCA, 95% variance), after being summarized (Frobenius norm), have little variability (CV). To sum up, OCNNA is able to extract insights and measure the importance of each filter of a convolutional layer, starting from hundreds of arrays which constitute the output from a dataset, called Dvar , and generating a holistic vision summarizing the filter significance into a single number (Figure 2). As a result, OCNNA transforms the output of a convolutional layer into an array in which the i -th component represents the i -th filter’s importance. Finally, using parameter k , or percentile of significance, we extract the k -th percentile of filters in terms of significance, completing the simplification process. The larger k , the more strict the filter selection. In consequence, fewer filters will be selected and the new model will be simpler (a smaller number of parameters compared with the original one). Figure 2. OCNNA provides a single number for this filter which reflects its importance. This process is iterated over all filters from a layer and their k -th percentile in terms of significance will form part of the new model. 3.3. Implementation As mentioned above, OCNNA can measure the importance of a convolutional filter by extracting hidden insights from a multidimensional array and express it through a number. This process implies heavy computational costs. In this sense, OCNNA is designed to maximize its performance in terms of the time required to complete the simplification process by proposing a parallel computing paradigm. In other words, this entails counting the number of CPUs available and distributing the tasks associated to each filter (prediction, PCA, Frobenius norm, and CV) of the convolutional layer among them, carrying out the calculations simultaneously and, as a result, speeding-up the results. This parallelism is absolutely transparent to the user. Once all the operations are finished, a synchronization process between the different subtasks is accomplished, mapping every result (the significance of the filter) in the correct component of the vector, which represents the importance of each filter in the convolutional layer. It was implemented in Python 3.9, and Tensorflow 2.9 was used as the machine learning framework.
Mathematics 2024,12, 3032 9 of 19 4. Empirical Evaluation To assess the performance of OCNNA, we designed a thorough empirical procedure that included different well-known datasets (CIFAR-10, CIFAR-100, and Imagenet) and architectures (ResNet-50, VGG-16, DenseNet-40, and MobileNet) which represent core benchmarks extensively referenced in the literature. Moreover, OCNNA was compared with 20 state-of-the-art CNN simplification techniques, obtaining successful results. This section is structured as follows: The architectures and datasets, metrics, compared state- of-the-art approaches, and training process settings are explained in order to assure the experiments’ reproducibility. Finally, the results and analysis for the CIFAR and Imagenet datasets are presented, comparing them with the other state-of-the-art techniques. 4.1. Common Architectures and Datasets We thoroughly evaluated our CNN building and optimizing scheme. To obtain comparable results with other state-of-the-art approaches, we selected four popular CNN architectures: VGG-16 [ 13 ], ResNet-50 [ 64 ], DenseNet-40 [ 65 ], and MobileNet [ 66 ]. VGG-16 is a convolutional neural network formed by 138.4 M parameters and 16 layers. The input is an RGB image with a size of 224 × 224, which is passed through a stack of 3 × 3 receptive field convolutional layers, with padding fixed to 1 pixel. Five max-pooling layers (pixel window of size 2 × 2 and stride set to 2), which follow some of the convolutional layers, are included as spatial pooling. The last stack of convolutional layers is followed by three dense layers of 4096, 4096, and 1000 channels. ResNet-50, drawing inspiration from the VGG networks, incorporates the idea of residual learning to simplify training by reconfiguring the layers to learn residual functions relative to their inputs, rather than learning functions without references. In practice, ResNet includes shortcut connections and has lower complexity than VGG-16, given the fact that it is formed by 25.6 M parameters. DenseNet (1 M parameters and 40 layers) connects each convolutional unit as if it were a feed-forward neural network, reducing the number of parameters and diminishing problems such as the vanishing gradient. Finally, MobileNet is a light-weight neural network designed for mobile and embedded vision apps. It has 4.3 M parameters and 55 layers. To demonstrate the versatility of our approach, we evaluated it by using a core set of widely used benchmark datasets for image classification: CIFAR-10 [ 20 ], CIFAR-100 [ 20 ], and ImageNet [ 21 ]. The CIFAR-10 dataset is an image classification problem with 10 classes formed by 60,000 images with size 32 × 32 (each class consists of 6000 images, with a total of 50,000 images for training and 10,000 images for testing). CIFAR-100 contains the same number of images as CIFAR-10 but 100 classes (600 images each). On the other hand, Imagenet is a dataset formed by 1431,167 annotated images (224 × 224) and 1000 object classes. As we have mentioned, OCNNA requires a Dvar dataset to measure convolutional filter importance. In the case of CIFAR-10 and CIFAR-100, we selected 10% of the training images, in other words, 5000 images identically distributed by class. After completing the optimization process, we evaluated the new model’s performance by using the test images. For the Imagenet dataset, we used as Dvar the “imagenet_v2/topimages” subset and as test set “imagenet_v2/matched-frequency”. Both of them have 10,000 images sampled after a decade of progress on the original ImageNet dataset, making the new test data independent of existing models and guaranteeing that the accuracy scores are not affected by adaptive overfitting [67]. These datasets can be found in [68]. 4.2. Metrics We measured the prediction performance of the optimized models with accuracy (ACC). In addition, we registered the number of parameters to assess complexity and efficiency in terms of memory requirements and runtime as it is defined for the Green AI paradigm (a lower number of parameters may lead to increased efficiency). We also recorded the remaining parameters ratio (RPR) compared with the original model for compression, as previously performed for other state-of-the-art approaches. A higher
Mathematics 2024,12, 3032 16 of 19 Data Availability Statement: The data used in the experimentation of this article are publicly available on the Internet. Specifically, ImageNet can be accessed at the following link: https://www. image-net.org/challenges/LSVRC/2012/index.php. Additionally, CIFAR-10 and CIFAR-100 can be accessed at the following link: https://www.cs.toronto.edu/~kriz/cifar.html. Conflicts of Interest: The authors declare no conflicts of interest. Abbreviations The following abbreviations are used in this manuscript: CNN convolutional neural network OCNNA Optimizing Convolutional Neural Network Architecture DNN deep neural network FLOPs Floating-point operations OBD Optimal Brain Damage NN neural networks NEAT NeuroEvolution of Augmenting Topologies GA Genetic Algorithm NAS neural architecture search DRL deep reinforcement learning PCA Principal Component Analysis CV Coefficient of Variation ACC accuracy RPR remaining parameters ratio References 1. Graves, A.; Schmidhuber, J. Framewise phoneme classification with bidirectional LSTM and other neural network architectures. Neural Netw. 2005,18, 602–610. [CrossRef] [PubMed] 2. Collobert, R.; Weston, J.; Bottou, L.; Karlen, M.; Kavukcuoglu, K.; Kuksa, P. Natural Language Processing (almost) from Scratch. arXiv 2011, arXiv:1103.0398. 3. Krizhevsky, A.; Sutskever, I.; Hinton, G.E. ImageNet Classification with Deep Convolutional Neural Networks. In Proceedings of the 26th Annual Conference on Neural Information Processing Systems 2012, Lake Tahoe, NV, USA, 3–6 December 2012; Volume 25. 4. Zhao, H.; Yang, G.; Wang, D.; Lu, H. Deep mutualearning for visual object tracking. Pattern Recognit. 2021,112, 107796. [CrossRef] 5. Olmos, R.; Tabik, S.; Herrera, F. Automatic handgun detection alarm in videos using deepearning. Neurocomputing 2018, 275, 66–72. [CrossRef] 6. Yu, Q.; Gao, Y.; Zheng, Y.; Zhu, J.; Dai, Y.; Shi, Y. Crossover-Net: Leveraging vertical-horizontal crossover relation for robust medical image segmentation. Pattern Recognit. 2021,113, 107756. [CrossRef] 7. Guo, J.; Chao, H. Building an end-to-end spatial-temporal convolutional network for video super-resolution. In Proceedings of the 31th AAAI Conference on Artificial Intelligence, San Francisco, CA, USA, 4–9 February 2017; pp. 4053–4060. 8. Cai, L.; Gao, J.; Zhao, D. A review of the application of deepearning in medical image classification and segmentation. Ann. Transl. Med. 2020,8, 713. [CrossRef] 9. Han, S.; Pool, J.; Tran, J.; Dally, W.J. Learning both Weights and Connections for Efficient Neural Networks. arXiv 2015, arXiv:1506.0262. 10. Khouas, A.R.; Bouadjenek, M.R.; Hacid, H.; Aryal, S. Training Machine Learning Models at the Edge: A Survey. arXiv 2024, arXiv:2403.02619. 11. Strubell, E.; Ganesh, A.; McCallum, A. Energy and Policy Considerations for Deep Learning in NLP. arXiv 2019, arXiv:1906.02243. 12. Balderas, L.; Lastra, M.; Benítez, J.M. Optimizing dense feed-forward neural networks. Neural Netw. 2024,171, 229–241. [CrossRef] 13. Simonyan, K.; Zisserman, A. Very Deep Convolutional Networks for Large-Scale Image Recognition. arXiv 2015, arXiv:1409.1556. 14. Alqahtani, A.; Xie, X.; Jones, M.W.; Essa, E. Pruning CNN filters via quantifying the importance of deep visual representations. Comput. Vis. Image Underst. 2021,208–209, 103220. [CrossRef] 15. Tu, Y.; Lin, Y. Deep Neural Network Compression Technique Towards Efficient Digital Signal Modulation Recognition in Edge Device. IEEE Access 2019,7, 58113–58119. [CrossRef] 16. Bolón-Canedo, V.; Morán-Fernández, L.; Cancela, B.; Alonso-Betanzos, A. A review of green artificial intelligence: Towards a more sustainable future. Neurocomputing 2024,599, 128096. [CrossRef] 17. Denton, E.; Zaremba, W.; Bruna, J.; LeCun, Y.; Fergus, R. Exploitinginear structure within convolutional networks for efficient evaluation. In Proceedings of the Annual Conference on Neural Information Processing Systems 2014, Montreal, QC, Canada, 8–13 December 2014; pp. 1269–1277.
Mathematics 2024,12, 3032 17 of 19 18. Yu, Z.; Shi, Y. Kernel Quantization for Efficient Network Compression. IEEE Access 2022,10, 4063–4071. [CrossRef] 19. Gong, M.; Gao, Y.; Wu, Y.; Zhang, Y.; Qin, A.K.; Ong, Y.S. Heterogeneous Multi-Party Learning With Data-Driven Network Sampling. IEEE Trans. Pattern Anal. Mach. Intell. 2023,45, 13328–13343. [CrossRef] [PubMed] 20. Krizhevsky, A. Learning Multiple Layers of Features from Tiny Images. 2009. Available online: https://www.cs.toronto.edu/ ~kriz/cifar.html (accessed on 15 May 2023). 21. Russakovsky, O.; Deng, J.; Su, H.; Krause, J.; Satheesh, S.; Ma, S.; Huang, Z.; Karpathy, A.; Khosla, A.; Bernstein, M.; et al. ImageNet large scale visual recognition challenge. Int. J. Comput. Vis. 2015,115, 211–252. [CrossRef] 22. Schwartz, R.; Dodge, J.; Smith, N.A.; Etzioni, O. Green AI. Commun. ACM 2020,63, 54–63. [CrossRef] 23. Stanley, K.O.; Miikkulainen, R. Evolving Neural Networks through Augmenting Topologies. Evol. Comput. 2002,10, 99–127. [CrossRef] 24. Real, E.; Moore, S.; Selle, A.; Saxena, S.; Suematsu, Y.L.; Tan, J.; Le, Q.V.; Kurakin, A. Large-scale evolution of image classifiers. In Proceedings of the 34th International Conference on Machine Learning, ICML’17, Sydney, Australia, 6–11 August 2017; Volume 70, pp. 2902–2911. 25. Real, E.; Aggarwal, A.; Huang, Y.; Le, Q.V. Regularized evolution for image classifier architecture search. Proc. Conf. AAAI Artif. Intell. 2019,33, 4780–4789. [CrossRef] 26. Stanley, K.O.; Clune, J.; Lehman, J.; Miikkulainen, R. Designing neural networks through neuroevolution. Nat. Mach. Intell. 2019, 1, 24–35. [CrossRef] 27. Wang, W.; Yu, Z.; Fu, C.; Cai, D.; He, X. COP: Customized correlation-based Filter level pruning method for deep CNN compression. Neurocomputing 2021,464, 533–545. [CrossRef] 28. Lu, Z.; Whalen, I.; Boddeti, V.; Dhebar, Y.; Deb, K.; Goodman, E.; Banzhaf, W. NSGA-Net: Neural Architecture Search Using Multi-Objective Genetic Algorithm. In Proceedings of the Genetic and Evolutionary Computation Conference, GECCO ’19, New York, NY, USA, 13–17 July 2019; pp. 419–427. [CrossRef] 29. Dong, X.; Liu, L.; Musial, K.; Gabrys, B. NATS-Bench: Benchmarking NAS Algorithms for Architecture Topology and Size. IEEE Trans. Pattern Anal. Mach. Intell. 2022,44, 3634–3646. [CrossRef] [PubMed] 30. Liang, T.; Glossner, J.; Wang, L.; Shi, S.; Zhang, X. Pruning and quantization for deep neural network acceleration: A survey. Neurocomputing 2021,461, 370–403. [CrossRef] 31. Jacob, B.; Kligys, S.; Chen, B.; Zhu, M.; Tang, M.; Howard, A.; Adam, H.; Kalenichenko, D. Quantization and Training of Neural Networks for Efficient Integer-Arithmetic-Only Inference. In Proceedings of the 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition, Salt Lake City, UT, USA, 8–23 June 2018; pp. 2704–2713. [CrossRef] 32. Bucilu ˇ a, C.; Caruana, R.; Niculescu-Mizil, A. Model compression. In Proceedings of the 12th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, Philadelphia, PA, USA, 20–23 August 2006. 33. Hinton, G.; Vinyals, O.; Dean, J. Distilling the Knowledge in a Neural Network. arXiv 2015, arXiv:1503.02531. 34. Wang, L.; Yoon, K. Knowledge Distillation and Student-Teacher Learning for Visual Intelligence: A Review and New Outlooks. IEEE Trans. Pattern Anal. Mach. Intell. 2022,44, 3048–3068. [CrossRef] 35. Liu, Z.; Sun, M.; Zhou, T.; Huang, G.; Darrell, T. Rethinking the Value of Network Pruning. arXiv 2019, arXiv:1810.05270. 36. Liu, Z.; Li, J.; Shen, Z.; Huang, G.; Yan, S.; Zhang, C. Learning Efficient Convolutional Networks through Network Slimming. In Proceedings of the 2017 IEEE International Conference on Computer Vision (ICCV), Venice, Italy, 22–29 October 2017; pp. 2755–2763. [CrossRef] 37. Luo, J.H.; Zhang, H.; Zhou, H.Y.; Xie, C.W.; Wu, J.; Lin, W. ThiNet: Pruning CNN Filters for a Thinner Net. IEEE Trans. Pattern Anal. Mach. Intell. 2019,41, 2525–2538. [CrossRef] 38. Molchanov, P.; Tyree, S.; Karras, T.; Aila, T.; Kautz, J. Pruning Convolutional Neural Networks for Resource Efficient Inference. arXiv 2017, arXiv:1611.06440. 39. Qi, C.; Shen, S.; Li, R.; Zhao, Z.; Liu, Q.; Liang, J.; Zhang, H. An efficient pruning scheme of deep neural networks for Internet of Things applications. EURASIP J. Adv. Signal Process. 2021,2021, 31. [CrossRef] 40. Hu, H.; Peng, R.; Tai, Y.W.; Tang, C.K. Network Trimming: A Data-Driven Neuron Pruning Approach towards Efficient Deep Architectures. arXiv 2016, arXiv:1607.03250. 41. Lin, M.; Ji, R.; Wang, Y.; Zhang, Y.; Zhang, B.; Tian, Y.; Shao, L. HRank: Filter Pruning using High-Rank Feature Map. arXiv 2020, arXiv:2002.10179. 42. Liu, Y.; Fan, K.; Zhou, W. FPWT: Filter pruning via wavelet transform for CNNs. Neural Netw. 2024,179, 106577. [CrossRef] [PubMed] 43. Wang, J.; Jiang, T.; Cui, Z.; Cao, Z. Filter pruning with a feature map entropy importance criterion for convolution neural networks compressing. Neurocomputing 2021,461, 41–54. [CrossRef] 44. He, Y.; Kang, G.; Dong, X.; Fu, Y.; Yang, Y. Soft filter pruning for accelerating deep convolutional neural networks. arXiv 2018, arXiv:1808.06866. 45. He, Y.; Liu, P.; Wang, Z.; Hu, Z.; Yang, Y. Filter Pruning via Geometric Median for Deep Convolutional Neural Networks Acceleration. In Proceedings of the 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Long Beach, CA, USA, 15–20 June 2019; pp. 4335–4344. [CrossRef] 46. Wang, Y.; Zhang, X.; Xie, L.; Zhou, J.; Su, H.; Zhang, B.; Hu, X. Pruning from Scratch. arXiv 2019, arXiv:1909.12579. [CrossRef]
Mathematics 2024,12, 3032 18 of 19 47. Yeom, S.K.; Seegerer, P.; Lapuschkin, S.; Binder, A.; Wiedemann, S.; Müller, K.R.; Samek, W. Pruning by explaining: A novel criterion for deep neural network pruning. Pattern Recognit. 2021,115, 107899. [CrossRef] 48. Aradhya, A.M.; Ashfahani, A.; Angelina, F.; Pratama, M.; de Mello, R.F.; Sundaram, S. Autonomous CNN (AutoCNN): A data-driven approach to network architecture determination. Inf. Sci. 2022,607, 638–653. [CrossRef] 49. Hirsch, L.; Katz, G. Multi-objective pruning of dense neural networks using deep reinforcement learning. Inf. Sci. 2022, 610, 381–400. [CrossRef] 50. Fernandes, F.E., Jr.; Yen, G.G. Pruning Deep Convolutional Neural Networks Architectures with Evolution Strategy. Inf. Sci. 2021, 552, 29–47. [CrossRef] 51. Li, G.; Zhang, M.; Wang, J.; Weng, D.; Corporaal, H. SCWC: Structured channel weight sharing to compress convolutional neural networks. Inf. Sci. 2022,587, 82–96. [CrossRef] 52. Geng, X.; Gao, J.; Zhang, Y.; Xu, D. Complex hybrid weighted pruning method for accelerating convolutional neural networks. Sci. Rep. 2024,14, 5570. [CrossRef] 53. Sharma, M.; Heard, J.; Saber, E.; Markopoulos, P.P. Convolutional Neural Network Compression via Dynamic Parameter Rank Pruning. arXiv 2024, arXiv:2401.08014. 54. Jiang, P.; Xue, Y.; Neri, F. Convolutional neural network pruning based on multi-objective feature map selection for image classification. Appl. Soft Comput. 2023,139, 110229. [CrossRef] 55. Liu, Y.; Wu, D.; Zhou, W.; Fan, K.; Zhou, Z. EACP: An effective automatic channel pruning for neural networks. Neurocomputing 2023,526, 131–142. [CrossRef] 56. Louati, H.; Louati, A.; Bechikh, S.; Kariri, E. Joint filter and channel pruning of convolutional neural networks as a bi-level optimization problem. Memetic Comput. 2024,16, 71–90. [CrossRef] 57. Jayasimhan, A.; Pabitha, P. ResPrune: An energy-efficient restorative filter pruning method using stochastic optimization for accelerating CNN. Pattern Recognit. 2024,155, 110671. [CrossRef] 58. Zhang, P.; Tian, C.; Zhao, L.; Duan, Z. A multi-granularity CNN pruning framework via deformable soft mask with joint training. Neurocomputing 2024,572, 127189. [CrossRef] 59. Lian, Y.; Peng, P.; Jiang, K.; Xu, W. Cross-layer importance evaluation for neural network pruning. Neural Netw. 2024,179, 106496. [CrossRef] 60. Kurita, T. Principal component analysis (PCA). In Computer Vision: A Reference Guide; Springer: Cham, Switzerland, 2019; pp. 1–4. 61. Golub, G.; Van Loan, C. Matrix Computations, 3rd, ed.; JHU Press: Baltimore, MD, USA, 1996. 62. Frobenius Norm—From Wolfram MathWorld. Available online: https://mathworld.wolfram.com/FrobeniusNorm.html (accessed on 25 April 2023). 63. Everitt, B.; Skrondal, A. The Cambridge Dictionary of Statistics B.S. Everitt Aut; A. Skrondal Aut; Cambridge University Press: Cambridge, UK, 2011. 64. He, K.; Zhang, X.; Ren, S.; Sun, J. Deep residual learning for image recognition. In Proceedings of the 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Las Vegas, NV, USA, 27–30 June 2016. 65. Huang, G.; Liu, Z.; van der Maaten, L.; Weinberger, K.Q. Densely Connected Convolutional Networks. arXiv 2018, arXiv:1608.06993. 66. Howard, A.G.; Zhu, M.; Chen, B.; Kalenichenko, D.; Wang, W.; Weyand, T.; Andreetto, M.; Adam, H. MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications. arXiv 2017, arXiv:1704.04861. 67. Recht, B.; Roelofs, R.; Schmidt, L.; Shankar, V. Do ImageNet Classifiers Generalize to ImageNet? In Proceedings of the 36th International Conference on Machine Learning, Long Beach, CA, USA, 9–15 June 2019; Volume 97, pp. 5389–5400. 68. imagenet_v2|TensorFlow Datasets—tensorflow.org. 2022. Available online: https://www.tensorflow.org/datasets/catalog/ imagenet_v2 (accessed on 10 May 2023). 69. Tensorflow. Image Data Generator v2.14.1; Tensorflow. 2022. Available online: https://www.tensorflow.org/api_docs/python/tf/ keras/preprocessing/image/ImageDataGenerator (accessed on 20 May 2023). 70. Guillemot, M.; Heusele, C.; Korichi, R.; Schnebert, S.; Chen, L. Breaking Batch Normalization for better explainability of Deep Neural Networks through Layer-wise Relevance Propagation 2020.[arXiv:cs.LG/2002.11018]. 71. Lin, S.; Ji, R.; Li, Y.; Deng, C.; Li, X. Toward Compact ConvNets via Structure-Sparsity Regularized Filter Pruning. IEEE Trans. Neural Netw. Learn. Syst. 2020,31, 574–588. [CrossRef] [PubMed] 72. Ravi Ganesh, M.; Blanchard, D.; Corso, J.J.; Sekeh, S.Y. Slimming Neural Netw. Using Adaptive Connectivity Scores. IEEE Trans. Neural Netw. Learn. Syst. 2024,35, 3794–3808. [CrossRef] [PubMed] 73. Zhang, Y.; Lin, M.; Lin, C.W.; Chen, J.; Wu, Y.; Tian, Y.; Ji, R. Carrying Out CNN Channel Pruning in a White Box. IEEE Trans. Neural Netw. Learn. Syst. 2023,34, 7946–7955. [CrossRef] 74. Liu, G.; Zhang, K.; Lv, M. SOKS: Automatic Searching of the Optimal Kernel Shapes for Stripe-Wise Network Pruning. IEEE Trans. Neural Netw. Learn. Syst. 2023,34, 9912–9924. [CrossRef] 75. He, Y.; Zhang, X.; Sun, J. Channel Pruning for Accelerating Very Deep Neural Networks. arXiv 2017, arXiv:1707.06168. 76. Yvinec, E.; Dapogny, A.; Cord, M.; Bailly, K. RED++ : Data-Free Pruning of Deep Neural Networks via Input Splitting and Output Merging. IEEE Trans. Pattern Anal. Mach. Intell. 2023,45, 3664–3676. [CrossRef]
Mathematics 2024,12, 3032 19 of 19 77. Ding, G.; Zhang, S.; Jia, Z.; Zhong, J.; Han, J. Where to Prune: Using LSTM to Guide Data-Dependent Soft Pruning. IEEE Trans. Image Process. 2021,30, 293–304. [CrossRef] 78. Liu, J.; Zhuang, B.; Zhuang, Z.; Guo, Y.; Huang, J.; Zhu, J.; Tan, M. Discrimination-aware Network Pruning for Deep Model Compression. IEEE Trans. Pattern Anal. Mach. Intell. 2021,44, 4035–4051. [CrossRef] Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.