Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Next Article in Journal
Optimization Strategies for Atari Game Environments: Integrating Snake Optimization Algorithm and Energy Valley Optimization in Reinforcement Learning Models
Next Article in Special Issue
Computer Vision for Safety Management in the Steel Industry
Previous Article in Journal
ZTCloudGuard: Zero Trust Context-Aware Access Management Framework to Avoid Medical Errors in the Era of Generative AI and Cloud-Based Health Information Ecosystems
Previous Article in Special Issue
Real-Time Camera Operator Segmentation with YOLOv8 in Football Video Broadcasts
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

ConVision Benchmark: A Contemporary Framework to Benchmark CNN and ViT Models

by
Shreyas Bangalore Vijayakumar
1,*,†,
Krishna Teja Chitty-Venkata
1,†,‡,
Kanishk Arya
2 and
Arun K. Somani
1,*
1
College of Enginneering, Iowa State University, Ames, IA 50011, USA
2
Department of Computer Engineering and Technology, MIT World Peace University, Pune 411038, India
*
Authors to whom correspondence should be addressed.
These authors contributed equally to this work.
Current address: Argonne National Laboratory, Lemont, IL 60439, USA.
AI 2024, 5(3), 1132-1171; https://doi.org/10.3390/ai5030056
Submission received: 11 June 2024 / Revised: 30 June 2024 / Accepted: 9 July 2024 / Published: 11 July 2024
(This article belongs to the Special Issue Artificial Intelligence-Based Image Processing and Computer Vision)

Abstract

:
Convolutional Neural Networks (CNNs) and Vision Transformers (ViTs) have shown remarkable performance in computer vision tasks, including object detection and image recognition. These models have evolved significantly in architecture, efficiency, and versatility. Concurrently, deep-learning frameworks have diversified, with versions that often complicate reproducibility and unified benchmarking. We propose ConVision Benchmark, a comprehensive framework in PyTorch, to standardize the implementation and evaluation of state-of-the-art CNN and ViT models. This framework addresses common challenges such as version mismatches and inconsistent validation metrics. As a proof of concept, we performed an extensive benchmark analysis on a COVID-19 dataset, encompassing nearly 200 CNN and ViT models in which DenseNet-161 and MaxViT-Tiny achieved exceptional accuracy with a peak performance of around 95 % . Although we primarily used the COVID-19 dataset for image classification, the framework is adaptable to a variety of datasets, enhancing its applicability across different domains. Our methodology includes rigorous performance evaluations, highlighting metrics such as accuracy, precision, recall, F1 score, and computational efficiency (FLOPs, MACs, CPU, and GPU latency). The ConVision Benchmark facilitates a comprehensive understanding of model efficacy, aiding researchers in deploying high-performance models for diverse applications.

1. Introduction

In computer vision (CV), the evolution of deep-learning (DL) models has revolutionized image classification. Convolutional Neural Networks (CNNs), a class of neural networks tailored for processing image data, have become pivotal in recognition tasks. CNNs have demonstrated exceptional performance in efficiently extracting spatial features from input images, making them indispensable in applications ranging from facial recognition and autonomous vehicles to the early detection and diagnosis of various diseases. The fundamental building blocks of CNNs are convolutional layers, which leverage convolutional operations to detect spatial hierarchies of features within an image. This hierarchical feature extraction process enables CNNs to discern patterns at different levels of abstraction. Each convolutional layer consists of learnable filters or kernels that slide across the input data, identifying low-level features such as edges, textures, and shapes. The output of this convolution operation is passed through a non-linear activation function, producing feature maps that capture the presence and location of these detected features. Pooling layers, interspersed between convolutional layers, play a pivotal role in down-sampling and reducing the spatial dimensions of the data, thereby enhancing computational efficiency and aiding in generalization.
However, as datasets grow and tasks become more complex, the limitations of the traditional convolutional approach become apparent. These limitations led to the exploration of alternative architectures, such as Vision Transformers (ViTs) [1]. ViTs represent a paradigm shift in computer vision, leveraging the self-attention mechanism traditionally used in Natural Language Processing (NLP). By dividing input images into fixed-size patches and treating each patch as a token, ViTs enable a global understanding of the image, capturing long-range dependencies and intricate patterns. This approach is particularly beneficial in medical imaging, where subtle visual cues and the spatial distribution of abnormalities are critical for an accurate diagnosis. The capability of ViTs to capture complex relationships between image patches makes them particularly effective for tasks requiring detailed spatial analysis. Transformers rely heavily on massive datasets for large-scale training. Furthermore, due to the lack of some inductive biases compared to CNNs, data quality significantly influences the generalization and robustness of transformers in computer vision.
The development and implementation of CNNs have historically relied on various frameworks, each with advantages and limitations. AlexNet, one of the first CNNs to achieve groundbreaking success in the ImageNet competition, was initially implemented using CUDA [2], a parallel computing platform and programming model developed by NVIDIA [3]. CUDA allowed AlexNet to leverage GPU acceleration, significantly speeding up training times. However, CUDA’s low-level programming model posed challenges regarding ease of use and accessibility for researchers without a deep understanding of parallel computing. Following AlexNet, ResNet, a CNN architecture known for deep residual networks, was implemented using Caffe [4]. Caffe, an open-source deep-learning framework developed by the Berkeley Vision and Learning Center, gained popularity due to its speed and modularity [5]. However, Caffe’s inflexibility and limited support for dynamic computation graphs made it less suitable for more complex and iterative model development processes. Researchers often faced difficulties modifying existing models or implementing new architectures, leading to a steep learning curve and potential reproducibility issues. The introduction of PyTorch in September 2016 marked a significant shift in the deep-learning landscape. PyTorch, developed by Facebook’s AI Research lab, provided a flexible and intuitive framework for building and training neural networks [6]. Its dynamic computation graph model allowed for more straightforward debugging and iterative development. Since its alpha release, PyTorch has grown significantly, with continuous updates and new features that enhance its usability and performance. It has become the preferred framework for many researchers due to its flexibility and extensive support for various neural network architectures.
Despite these advancements, the proliferation of deep-learning frameworks has introduced challenges related to version mismatches, reproducibility, and the need for standardized validation and performance metrics. Researchers often need help with discrepancies in results when models are implemented across different frameworks or versions. This fragmentation hinders the ability to consistently benchmark and compare models, complicating the evaluation of new architectures and their improvements. To address these challenges, we propose ConVision Benchmark, a unified framework implemented in PyTorch that integrates state-of-the-art CNN and ViT models. This framework standardizes the implementation and evaluation process, bridging the gap between different frameworks and versions. Our study conducts an extensive benchmark analysis using a COVID-19 image dataset as a proof of concept. The methodology can be extended to any dataset, enhancing its applicability across various domains. The ConVision Benchmark includes tools for evaluating performance metrics such as accuracy, precision, recall, F1 score, and computational efficiency indicators, including model runtime, FLOPs, MACs, CPU latency, GPU latency, and inference memory, and training memory. This comprehensive evaluation is crucial for applications where accuracy and computational efficiency are paramount.
Through rigorous experimentation and analysis, our study provides valuable insights into the strengths and trade-offs of various CNN and ViT architectures. For instance, the DenseNet-161 CNN model achieves exceptional accuracy with a peak performance of 95.61 % on the COVID-19 dataset, making it suitable for high-precision medical diagnoses. Conversely, the MaxViT-tiny ViT model balances accuracy and efficiency. By offering a competitive accuracy of 95.02 % and lower computational demands, it is ideal for real-time medical image classification. The ConVision Benchmark facilitates a deeper understanding of model efficacy, aiding researchers in deploying optimal models for diverse applications.
The main research contributions of this paper are as follows:
  • We provide a comprehensive benchmark framework in PyTorch to address library version mismatches and inconsistent validation metrics in existing frameworks;
  • We foster a deeper understanding of model architectures and their performance in medical image classification;
  • We analyze and compare the validation performance and efficiency of CNN and ViT models and provide insights into their strengths and weaknesses;
  • We incorporate an exhaustive set of performance metrics and computational complexity factors in the evaluation process;
  • To the best of our knowledge, we benchmark the most extensive array of CNN and ViT models extensively trained on the largest publicly available COVID-19 dataset in our ConVision benchmark;
  • Our research can serve as a benchmark for understanding the effectiveness of specific models, and the findings offer valuable insights to develop improved models for image classification in various domains;
  • We open-source the implementation of our models and training methodology for researchers to evaluate their custom dataset efficiently and effectively.
Organization of the Paper: The remainder of this paper is arranged as follows: Section 2 reviews the fundamentals of the CNN and ViT models, while Section 3 provides a brief overview of previous work. Section 4 outlines the benchmarking process of different models on the COVID-19 dataset. In Section 5, we provide a detailed analysis of the results and Section 6 concludes the ConVision Benchmark paper.

2. Background

CNNs have become a cornerstone in computer vision, revolutionizing tasks such as image recognition and object detection. The fundamental building blocks of CNNs are convolutional layers, which leverage convolutional operations to detect spatial hierarchies of features within an image. This hierarchical feature extraction process allows CNNs to discern patterns at different levels of abstraction, making them highly effective for image-related tasks. Each convolutional layer in a CNN consists of a set of learnable filters or kernels that slide across the input data. This sliding mechanism enables the network to identify low-level features such as edges, textures, and shapes. As the filters move across the image, they perform a convolution operation, producing feature maps highlighting the presence and location of these detected features. The output of this convolution operation is then passed through a non-linear activation function, such as the Rectified Linear Unit (ReLU), which introduces non-linearity and enables the network to learn intricate patterns and relationships. Pooling layers, interspersed between convolutional layers, play a crucial role in down-sampling and reducing the spatial dimensions of the data. This down-sampling is essential for improving computational efficiency and aiding the model’s generalization. By reducing the spatial resolution, pooling layers make the network more robust to distortions and variations in input images. Typical pooling operations include max pooling and average pooling, which retain the most significant features while discarding less relevant information. At the network’s end, fully connected layers integrate the hierarchical features extracted by the convolutional and pooling layers. These layers enable high-level abstraction and facilitate the final classification or regression task. The hierarchical and layered structure of CNNs allows them to automatically learn and adapt to intricate patterns in data, making them indispensable in modern deep-learning applications. However, convolutional methods face limitations with large datasets and complex tasks, requiring extensive labeled data and significant computational resources.
In recent years, ViTs have introduced a novel approach to image processing, challenging the traditional dominance of CNNs. ViTs leverage the Transformer architecture, initially designed for NLP, to handle image data. This approach has proven effective, especially in capturing long-range dependencies and global context within images. The Transformer architecture consists of several essential components. Initially, the input image is divided into fixed-size, non-overlapping patches, treating each patch as a token. These patches are then linearly embedded to create a sequence of tokens, which form the input for the subsequent Transformer encoder. Positional information is imparted to these tokens to preserve spatial relationships, a crucial step since the Transformer architecture lacks the inherent inductive biases present in CNNs. The Transformer encoder comprises multiple layers, each containing a multi-head self-attention mechanism and a feed-forward neural network. The self-attention mechanism allows each token to attend to all other tokens, capturing long-range dependencies and providing a global image view. This global perspective contrasts with traditional architectures’ local receptive fields of convolutional layers. Considering the entire image context is particularly beneficial in detecting subtle visual cues and spatial distributions of abnormalities in medical imaging. The outputs from each Transformer layer are aggregated and fed into a classification head, typically a linear layer, for the final task-specific prediction. Unlike CNNs, where hierarchical features are progressively extracted, ViTs leverage the self-attention mechanism to consider the entire image simultaneously. This global understanding is crucial for applications such as disease detection, where subtle details and their spatial relationships are of critical significance.

3. Related Work

The evolution of CNN models for image classification tasks has made significant strides since their inception. Early CNNs such as LeNet [7] laid the foundation by introducing convolutional layers, pooling operations, and fully connected layers. The groundbreaking AlexNet [2], with its deeper architecture, won the ImageNet Large Scale Visual Recognition Challenge in 2012, marking a pivotal moment. It deepened the network, utilized Rectified Linear Units (ReLUs) for activation, and used GPU acceleration, significantly boosting performance. Following this, VGGNet [8] emphasized the importance of depth in CNNs, advocating for more layers. Inception models, such as GoogLeNet [9], explored the benefits of inception modules, employing parallel filters of varying sizes. The introduction of residual connections by ResNet [4] brought about a revolutionary idea of residual learning, enabling the training of extremely deep networks by introducing skip connections. DenseNet [10] proposed an architecture in which each layer receives direct input from all preceding layers, fostering feature reuse and compact representation. The MobileNet [11] series focused on lightweight models suitable for mobile and edge devices, employing depth-wise separable convolutions. EfficientNet [12] introduced a holistic approach by optimizing network depth, width, and resolution simultaneously for enhanced efficiency.
These advancements, coupled with transfer learning and fine-tuning techniques, have propelled CNNs to remarkable performance, making them indispensable in various image classification applications. However, the research of [13], introducing the Transformer architecture, presents a notable shift in image classification. Adapting Transformers to vision tasks led to the development of ViT models. One fundamental departure from CNNs is that ViTs operate on the entire image as a sequence of patches, eliminating the need for hierarchical features. Each patch is treated as a “token”, and the self-attention mechanism allows the model to capture global dependencies efficiently [1].
The ViT architecture consists of stacked transformer blocks, performing self-attention and feedforward operations. Several modifications and improvements have since been proposed to enhance ViTs’ performance in image classification, such as patch embeddings, positional encodings, and hybrid architectures. ViTs have shown competitive results on large-scale image datasets, for example, ImageNet, challenging the supremacy of CNNs [14]. This evolution in computer vision emphasizes the importance of attention mechanisms and the potential to replace or complement CNNs in diverse image-related tasks.
The landscape of CNN models has also diversified, with ongoing research exploring hybrid architectures, attention mechanisms, and efficiency improvements. Models including Swin Transformer [15] and Twins-SVT [16] continue to push the boundaries of image classification capabilities, highlighting the ever-evolving nature of DL architectures. Benchmarking these models provides a systematic and objective means to evaluate and compare their performance in terms of accuracy, computational efficiency, and suitability for real-world applications, particularly in medical image classification tasks such as COVID-19 detection from chest X-ray images.
The authors of [17] introduced an explainable AI system for early COVID-19 detection from chest X-ray (CXR) images by comparing a limited number of CNN and ViT models. The system, designed for medical professionals, visualizes infected areas in CXR images, enhancing decision support. The experimental results demonstrate comparable performances between CNN and ViT models, with the EfficientNetB7 model achieving the highest accuracy. Incorporating UNet-based segmentation and rotation augmentation contributes to the system’s robustness and overall performance improvement.
The study [18] comprehensively compares the performance of CNNs, ViTs, hybrid systems, and ResMLP architecture on fundus images for the detection of glaucoma. The comparative analysis reveals similar performance between CNNs and ViTs in the test set. However, external test sets, particularly Drishti-GS1 and PAPILA, indicate CNNs’ superior generalization capacity. The study emphasizes the significance of dataset size and composition, suggesting ViTs’ potential superiority with a more extensive training set.
A recent study [19] presented a comprehensive literature review comparing ViTs and CNNs for image classification. The comparison involves dataset characteristics, robustness, performance, evaluation, interpretability, and architecture. ViTs exhibit promising performance in various applications, including pneumonia detection, breast ultrasound classification, and skin cancer classification. However, challenges such as computational complexity and generalization issues are noted. The study suggests that ViTs are efficient on smaller datasets due to self-attention but may require more data for better generalization.
The research work of [20] addresses the challenge of auto-focusing in Digital Holography (DH) using DL, specifically comparing CNNs and ViTs. The results indicate that EfficientNetB7, a CNN architecture, outperforms ViT models, achieving better accuracy in recognizing specific locations within holograms. CNNs focus on shape details, but ViTs demonstrate robustness, particularly when considering arbitrary regions of interest.
The comparative study [21] explores the classification performance of CNNs and ViTs on small datasets, critically analyzing their suitability for image classification tasks. The study finds that Xception is suitable for high-performance tasks with limited data, ViT for large-scale data training, and ShuffleNet-V2 for scenarios prioritizing storage space over classification performance. This comparison underscores the need for further research to refine network performance through novel data augmentation techniques and explore hybrid CNN–Transformer models to enhance classification efficacy.
A unified, comprehensive framework is crucial as it standardizes the implementation and benchmarking of various models, simplifies comparisons, ensures reproducibility, and accelerates advancements by providing a common baseline for researchers. This integration streamlines the evaluation process and enhances the accessibility and scalability of model deployment across different applications. Further, benchmarking CNN and ViT models using this framework is critical in evaluating the framework and refining the selection criteria for image classification tasks, considering all these rich, diverse sets of related work and the rapid advancements of DL models. The findings help identify models that are accurate, efficient, and relevant for applications in different domains.

4. ConVision Benchmark Process

The methodology for benchmarking CNN and ViT models in this research is shown in Figure 1. It involves a systematic and comprehensive process to assess their performance on image classification tasks related to COVID-19 detection. The dataset was carefully chosen, with an unbalanced representation of COVID-19 cases, non-COVID-19 cases, and normal lung conditions. We employed image augmentation techniques such as rotations and scaling to create a robust dataset for evaluating models in a real-world scenario. The models, implemented using the PyTorch [6] framework, were initialized without pre-trained weights to avoid leveraging prior learning. Using pre-trained models can significantly reduce training time and improve performance due to the rich feature representations learned from large-scale datasets. However, training models from scratch ensures that performance is solely attributed to the dataset and training process, providing a clear baseline for evaluating different architectures. Subsequently, the models underwent a training phase using the designated training set, allowing for the adaptation of parameters to the specific characteristics of the dataset. Fine-tuning enhances model performance, and detailed information on training parameters is presented. After completing the training phase, the models were evaluated using the testing set, and a suite of performance metrics was calculated. These metrics include top-1 accuracy, precision, recall, F1 score, Matthew’s Correlation Coefficient (MCC), False Positive Rate (FPR), False Negative Rate (FNR), and loss, providing a nuanced understanding of the models’ classification capabilities. In addition to classification performance, the benchmarking process incorporated computational efficiency metrics such as model training time, CPU and GPU latency, number of parameters, multiply–accumulate operations (MACs), floating-point operations (FLOPs), training memory, and inference memory to assess the models’ feasibility for integration into clinical workflows, where both accuracy and speed are pivotal. These metrics ensure a holistic evaluation considering both the efficacy and efficiency of CNN and ViT models. The comparison between CNN and ViT models involves a detailed analysis of their trade-offs, aiming to identify models that effectively balance accuracy and computational efficiency, providing insight into their suitability for real-time image classification tasks.

4.1. Dataset

The COVID-QU-Ex Dataset [22] is a comprehensive resource used for the benchmark process in this research. This extensive dataset includes 33,920 CXR images, providing various cases crucial for training and evaluating our models. The dataset is classified into three primary categories: 11,956 images of COVID-19 cases, 11,263 images representing non-COVID-19 infections, including viral or bacterial pneumonia, and 10,701 images of normal lung conditions. The dataset includes ground-truth lung segmentation masks, making it the most extensive dataset for lung masks ever. The dataset layout ensures a robust experimental framework for training, validation, and testing across various conditions, contributing to the reliability and generalizability of the research findings.
In our experimental setup, we used an unbalanced case by taking a subset of samples from the above dataset to test the system’s robustness in scenarios where images are acquired under specific settings. The resilience and efficacy of our system were rigorously evaluated using this imbalanced dataset, ensuring its applicability across diverse image settings and scenarios. The dataset, along with the associated codes and experiments, are made publicly available for further research and validation purposes. Table 1 illustrates each class’s total number of samples. Figure 2 shows a sample CXR image for each class.

4.2. Data Augmentation

Data augmentation is essential for enhancing the performance of DL models when training data are limited. This research implements a set of data augmentation techniques, even though the dataset is large enough. The rationale is that increasing the dataset size through augmentation can provide better training for ViTs, which tend to require more data to outperform CNNs.
In our research, we implemented a set of data augmentation techniques using PyTorch. These included resizing the images to a standard size (256), center cropping (224), random horizontal flipping with a probability of 0.5, random rotation up to 15 degrees, and color jittering for brightness, contrast, and saturation (each with a factor of 0.2). These transformations were designed to simulate variations encountered in real-world CXR images, such as different orientations, lighting conditions, and subtle changes in contrast. The transformation pipeline concludes with standard operations of converting the images to tensors and normalizing pixel values. These augmentation strategies exposed the model to diverse CXR image variations during training, preventing overfitting and improving its ability to generalize to new data.

4.3. CNN Processing

The preprocessing of input images in CNN models involves normalization, where the pixel values are scaled to a standardized range to facilitate consistent model training. In the case of gray-scale images, the single-channel representation is expanded to three channels to match the expected input format of CNN models. The images and corresponding labels indicating the disease category were divided into training, validation, and test sets. The training set updated the model’s weights through a backpropagation algorithm coupled with a stochastic gradient descent (SGD) optimization technique. The validation set helped monitor and prevent overfitting during the training process. The test set was used to evaluate the performance of the final model on unseen data. This meticulous processing workflow ensured that the CNN model could effectively learn discriminative features for accurate COVID-19 classification while being robust to variations in the input data.
Our study evaluated the performance of various CNN model families, as shown in Table 2. The architectural details of the models used in this paper are not provided due to space constraints. The exact topology is described in the original papers cited below.

4.4. ViT Processing

Preprocessing input images in ViT models involves several distinct steps compared to CNNs. Initially, images are resized to a standard resolution and then divided into fixed-size patches, typically 16 × 16 pixels. Each patch is flattened into a vector and linearly embedded into a higher-dimensional space. Unlike CNNs, ViTs typically handle color images directly and do not require channel expansion for gray-scale images. ViTs treat the sequence of these embedded patches as input tokens to a transformer model. Each token is combined with positional encodings to retain spatial information, which is essential for the self-attention mechanism. Similar to CNN preprocessing, images are normalized to ensure a consistent range of pixel values. The dataset was divided into training, validation, and test sets, serving the same purposes as outlined in the CNN preprocessing section. This ViT preprocessing workflow enabled ViTs to effectively capture global context and complex patterns for accurate COVID-19 classification, demonstrating their capability to handle diverse image features and structures.
We evaluated various ViT versions in our work, as shown in Table 3. The architectural details of all the neural networks used in this paper are not provided due to space constraints. The exact topology is described in the original papers cited below.

4.5. Training Description

The training pipeline for CNNs and ViTs involves several vital steps to train on a given dataset effectively. Setting up a training pipeline requires careful consideration of various parameters and configurations to ensure that the model converges to optimal performance. The training pipeline begins with loading the dataset and applying the necessary preprocessing steps, such as resizing images, normalization, and data augmentation. The network architectures are defined, specifying the network’s layers, filters, and connectivity for CNN and attention mechanisms for ViT. Our training parameters included the learning rate of 1 × 10 1 , batch size of 256, and SGD optimization algorithm with momentum of 0.9 . The learning rate schedule followed a cosine annealing pattern, with a warmup phase of 25 epochs. This dynamic adjustment helped the model converge faster initially and fine-tune more effectively later in training. Other hyperparameters, such as weight decay and gamma, were utilized. Epochs, which represent the number of times the entire dataset is processed, determine the duration of the training. We decided to run for 500 epochs empirically with the validation set used to monitor performance and prevent overfitting. All models in our study, including CNN and ViT, were trained using the “CrossEntropyLoss” function. Using “CrossEntropyLoss” ensures that the loss values across different models are directly comparable, thus providing a fair basis for evaluating model performance. The loss function was minimized during training, and the model’s parameters were iteratively updated through backpropagation. Performance was evaluated using loss, top-1 accuracy, F1 score, precision, recall, FPR, FNR, and MCC. To further understand the model’s computational efficiency, we measured Training Time, MACs, FLOPs, CPU and GPU latency, and memory usage for training and inference.
The experiments were conducted on a Linux system with an AMD EPYC 7543 32-core processor, 512 GB hard disk, 1.5 TB RAM, and an NVIDIA A100 80 GB graphics accelerator card. The models were implemented using PyTorch [6] libraries in Python 3.8.

4.6. Evaluation Method

Evaluating model performance is critical in deep learning, especially for COVID-19 image classification tasks. Performance metrics are quantitative measures that provide information on neural network models’ accuracy, efficiency, and reliability. Different tasks may require different metrics, and the choice of metrics depends on the problem’s nature. This study employs a comprehensive set of performance metrics to benchmark CNNs and ViTs for COVID-19 image classification. These metrics gauge the models’ abilities and facilitate a robust comparative analysis. The following are the performance metrics considered in this study, and their significance in benchmarking is described:
  • Top-1 accuracy: this metric represents the percentage of correctly classified instances among the total predictions. It is a fundamental metric in classification tasks, indicating how well the model performs in assigning the correct class to an input sample. In benchmarking, achieving a high top-1 accuracy is a primary goal, demonstrating the model’s ability to make accurate predictions.
  • Precision: it measures the accuracy of positive predictions. It is calculated as the ratio of true positive predictions to the total predicted positives. High precision is essential when minimizing false positives is crucial, where precision reflects the model’s ability to correctly identify instances of a specific class.
  • Recall: also known as sensitivity or true positive rate, it measures the ability of the model to capture all positive instances. It is calculated as the ratio of true positives to actual positives. High recall is essential when it is crucial to identify all instances of a particular class, even at the cost of more false positives.
  • F1 score: the F1 score is the harmonic mean of precision and recall. It provides a balanced measure between precision and recall, and is particularly useful when the class distribution is imbalanced. A higher F1 score indicates a better balance between precision and recall, reflecting a model’s overall performance.
  • FPR: it measures the proportion of actual negatives that are incorrectly predicted as positives. It is calculated as the ratio of false positives to the total actual negatives. In applications where minimizing false positives is critical, a lower FPR is desirable.
  • FNR: it measures the proportion of actual positives that are incorrectly predicted as negatives. It is calculated as the ratio of false negatives to the total actual positives. In scenarios where avoiding false negatives is crucial, a lower FNR is desired.
  • MCC: it provides a correlation coefficient between the observed and predicted binary classifications by considering all four confusion matrix values (true positives, true negatives, false positives, and false negatives). It is beneficial in imbalanced datasets.
  • Loss: the loss function quantifies the difference between predicted and actual values. During training, the goal is to minimize this value. It serves as an optimization objective, guiding the model to make better predictions. In benchmarking, comparing the loss across models helps understand their relative performance.
The following computation efficiency metrics are considered in this study, and their significance in benchmarking is described below:
  • Model training time: it is the total time required to train a model on a dataset. It is a practical metric for assessing the efficiency of different models. When dealing with large datasets or resource-intensive models, shorter training times are desirable.
  • CPU and GPU latency: latency measures the time taken for a model to process a single input sample. CPU and GPU latency are essential metrics for real-time applications. Lower latency is critical for applications where predictions must be made quickly, such as in autonomous vehicles or interactive systems.
  • Number of parameters: it reflects the complexity of a model. While more parameters can lead to a more expressive model, it also increases the risk of overfitting, especially in the presence of limited data. Comparing models based on the number of parameters in benchmarking helps balance complexity and generalization.
  • MACs: they represent the number of multiply–accumulate operations performed during inference. They offer insights into the computational efficiency of a model. Lower MACs are generally desirable for applications with computational constraints.
  • FLOPs: they measure the number of floating-point operations performed during inference. FLOPs, similar to MACs, provide information about the computational workload of a model. Lower FLOPs are preferred for limited computational resources.
  • Training memory and inference memory: these metrics quantify the memory requirements during training and inference. Lower memory requirements are crucial for deploying models on resource-constrained devices. In benchmarking, understanding the memory footprint helps assess a model’s practical usability.

5. Results and Discussion

5.1. COVID-19 Dataset

This section presents the results of benchmarking various CNNs and ViTs on the COVID-19 image classification task Our comprehensive evaluation included performance metrics such as accuracy, precision, recall, and F1 score, alongside computational efficiency metrics like model runtime, FLOPs, MACs, and CPU and GPU latency. By analyzing these metrics, we provide insights into the strengths and weaknesses of different model architectures and their applicability in real-world scenarios. The findings highlight vital trade-offs between accuracy and computational demands, offering valuable guidance for selecting optimal models for medical image classification and other domains.
Our analysis is presented in graph plots, making understanding the findings and relationship among different metrics easier. In all of the following graphs and in subsequent sections, a circle represents CNN models, a square represents ViT models, models within the green box are preferred models, and the size of the data point represents the number of parameters of the model. The model size for each of the models used are presented in Figure 3. Figure 4 shows the accuracy versus MACs. ViT-Small-patch8 stands out as a model with high MACs ( 16.75 billion) but relatively low accuracy ( 88.4 % ). This behavior is atypical, as higher MACs correlate with more complex models and better performance, indicating potential inefficiencies and overfitting in ViT-Small-patch8’s design. Conversely, ShuffleNetV2-x0-5 exhibits low MACs (0.04 billion), yet achieves a high accuracy of 92.85 % , which is unusual since simpler models with fewer MACs often struggle to maintain high accuracy. This finding suggests that ShuffleNetV2-x0-5 is exceptionally optimized, leveraging its architecture to achieve high accuracy efficiently. These anomalies highlight the importance of architectural innovations and careful tuning in achieving optimal performance in deep-learning models.
In our analysis of Figure 5, which shows the accuracy versus FLOPs, the relationship is not always linear and similar to accuracy versus MACs. A model such as ViT-Small-patch8, which exhibits high FLOPs ( 16.76 billion), has relatively low accuracy ( 88.4 % ) due to inefficiencies and challenges in effectively leveraging the computational resources. Conversely, the ShuffleNetV2-x0-5 model, having low FLOPs ( 0.04 billion), achieves high accuracy ( 92.85 % ) due to its efficiency and effectiveness in leveraging the available resources.
Figure 6 shows the relationship between accuracy and accuracy epoch, indicating the epoch at which the model achieved its highest accuracy during training. The relationship between epoch and accuracy is not strictly deterministic, as evidenced by the extreme cases observed. For instance, the PoolFormer-S36 model with a high epoch (484) and low accuracy ( 85.22 % ) could indicate convergence issues, overfitting, or suboptimal hyperparameter tuning, leading to a longer training time without significant accuracy improvement. Contrarily, the RegNet-y-16gf model with a low epoch (45) reaches high accuracy ( 93 % ) due to efficient architecture design, effective regularization techniques, and optimal hyperparameter settings.
Figure 7 shows the CPU latency versus accuracy. ViT-Small-patch8 exhibits high CPU latency ( 96.67 ms) and relatively low accuracy ( 88.4 % ). This anomaly suggests inefficiencies in model design or training, as higher latency typically indicates slower inference times, which can hinder real-time applications. MobileNetV2 showcases low CPU latency ( 9.13 ms) and high accuracy ( 93.97 % ). This exceptional performance is attributed to efficient architecture design and optimization, allowing faster inference times.
The GPU latency versus accuracy is shown in Figure 8. The CvT-21 model has high GPU latency ( 18.48 ms) but relatively low accuracy ( 89 % ). This behavior is not typical, as higher latency usually correlates with more parameters and better performance due to more complex computations. However, CvT-21’s lower accuracy suggests inefficiencies and possible overfitting, where the model complexity does not translate to improved prediction quality. On the other hand, Vgg-13-bn demonstrates low GPU latency ( 1.08 ms) while achieving high accuracy ( 95.27 % ). Its performance indicates exceptional optimization in its design, effectively balancing computational efficiency with high predictive accuracy.
In the relationship between training memory and accuracy, as illustrated in Figure 9, models with more parameters generally require more training memory and often achieve higher accuracy due to their increased capacity to learn complex patterns. However, in our analysis, the NFNet-F0 model exhibits high training memory usage ( 1.69 GB) but relatively lower accuracy ( 90.64 % ). This discrepancy is due to overfitting and inefficiencies in the model’s architecture. On the other hand, ShuffleNetV2-x0-5 stands out with low training memory usage ( 0.02 GB) while achieving a relatively high accuracy ( 92.86 % ).
Analyzing the relationship between inference memory, accuracy, and the number of parameters reveals interesting insights from the data. Figure 10 shows the inference memory versus accuracy graph. Typically, models with more parameters and inference memory tend to have higher accuracy due to their capacity to learn complex features. The trend is similar to the training memory versus accuracy graph but on a smaller scale, except for TNT-Base. TNT-Base has a high inference memory ( 247.23 MB) but a relatively lower accuracy ( 89.4 % ), suggesting inefficiencies and overfitting despite its capacity.
Figure 11 shows the training time versus accuracy. ViT-Small-patch8 exemplifies the case of high training time with low accuracy; it has a training time per epoch of 184.67 s, yet achieves a modest accuracy of 88.4 % . On the other hand, GoogLeNet presents an interesting case of low training time with relatively high accuracy; it has a training time per epoch of only 17.22 s and achieves an accuracy of 94.94 % . Typically, models with such quick training times do not achieve high accuracy due to the simplified architecture and fewer parameters. These exceptions highlight that model efficiency and architecture optimization play critical roles, sometimes allowing models with fewer parameters and faster training times to perform exceptionally well or causing models with high computational demands to underperform due to inefficiencies.
In examining the relationship between MCC, epoch, and the number of parameters from Figure 12, we observed some interesting extremes from the given data. Typically, a higher MCC correlates with more epochs and a more significant number of parameters due to the increased complexity and training duration improving model performance. However, the AlexNet model demonstrates an exceptional case of high MCC (indicative of high accuracy and balanced class prediction) achieved in relatively few epochs (19) and with a moderate number of parameters (57 Million). Conversely, the SqueezeNet-1-1 model, with fewer parameters ( 0.72 Million) and lower MCC, requires many epochs (443) to converge. These anomalies suggest that AlexNet is exceptionally efficient, optimizing its architecture to quickly achieve high performance, whereas SqueezeNet-1-1’s prolonged training indicates difficulties in learning the dataset effectively.
The correlation between precision, epoch, and the number of parameters in deep-learning models follows a trend where models with more parameters often achieve higher precision but require more epochs to converge. This behavior suggests that larger models can capture more complex patterns in the data but also need more training to optimize all their parameters effectively. Figure 13 shows precision versus epoch. However, through analysis, CCT-14-sine, having 21.91 million parameters, achieves a relatively higher precision after 18 epochs. Another extreme case is the MNASnet-05 model, which has 0.94 million parameters and reaches high precision after 487 epochs. These deviations are due to their architectural differences.
Figure 14 shows the recall versus epoch. The RegNet-y-16gf model achieves a high recall of 0.93 with a relatively low epoch count of 45. This result indicates that RegNet-y-16gf converges quickly during training, reaching high performance rapidly, which is notable given its relatively high number of parameters ( 80.57 million). On the other hand, MNASnet-05, with a relatively lower recall of 92 % and a high epoch count of 499, takes significantly longer to converge, despite having a low number of parameters ( 0.94 million). Typically, models with fewer parameters should train faster due to reduced computational complexity, and models with higher parameters often require more epochs to avoid overfitting. These observed extremes suggest that RegNet-y-16gf is highly efficient and well optimized, whereas MNASnet-05’s prolonged training is due to suboptimal training dynamics, both deviating from the expected behavior of deep-learning models.
Figure 15 shows the CPU latency versus MACs. In analyzing the relationship between CPU latency, MACs, and the number of parameters, two extreme cases illustrate abnormal behaviors in deep-learning models. The NFNet-F0 model exhibits high latency ( 105.72 ms) despite having low MACs ( 22.2 million) and a moderate number of parameters ( 21.85 million). Despite its computational simplicity, this high latency suggests potential inefficiencies in how the model processes data or the operations are structured. On the other hand, Vgg-13-bn showcases relatively low latency ( 50.98 ms) despite having relatively high MACs ( 11.35 billion) and a substantial number of parameters ( 0.12 billion). Typically, models with higher MACs have higher latencies due to the increased computational load.
Figure 16 shows the GPU latency versus MACs in which most of the models with higher MACs and more parameters exhibit higher GPU latency due to increased computational complexity. MobileFormer-508M, with a high GPU latency of 15.85 ms but low MACs ( 0.5 billion) and a moderate number of parameters ( 12.06 million), suggests inefficiencies possibly due to the suboptimal use of GPU resources or architectural bottlenecks. On the other hand, DenseNet-161, with a low GPU latency ( 14.4 ms), yet high MACs ( 7.84 billion) and a significant number of parameters ( 26.48 million), indicates an efficient architecture and excellent GPU optimization, resulting in faster computations despite its complexity.
Figure 17 shows the training time versus MACs. The FocalTransformer-Tiny model exhibits a high training time per epoch ( 146.15 s) despite having low MACs ( 4.66 billion) and a relatively small number of parameters ( 29.44 million). This unusual behavior is due to inefficient parallelization and bottlenecks in the data pipeline, making the training process slower than expected for its computational complexity. On the other hand, Vgg-13-bn shows a low training time per epoch ( 39.61 s) but has high MACs ( 11.35 billion) and a large number of parameters ( 128.97 million). This finding is interesting because models with higher MACs and parameter counts generally require more computational resources and time to train. The efficient training time for Vgg-13-bn suggests highly optimized implementations that minimize the expected computational burden.
In analyzing the relationship between training memory and MACs from Figure 18, we observed two extreme cases that defy typical expectations. The NFNet-F0 model has a high training memory usage of 1.69 GB but relatively low MACs at 22.2 billion. Generally, a high training memory correlates with a high number of MACs and parameters, reflecting the model’s complexity. NFNet-F0’s behavior indicates that it is highly parameter-intensive without proportional computational efficiency. On the other hand, ViT-Small-patch8 demonstrates low training memory usage ( 0.55 GB) but high MACs at 16.75 billion. This result suggests that ViT-Small-patch8 is designed to be memory-efficient despite its computational complexity, leveraging advanced architectural strategies to optimize memory usage during training. The trend follows inference memory versus MACs except that the memory sizes are scaled down, as shown in Figure 19.
Figure 20 shows the training time versus CPU latency. The Vgg-13-bn model exhibits a lower training time per epoch ( 39.61 s) with a relatively low CPU latency ( 50.98 ms) despite having a significant number of parameters ( 128.97 million). Typically, a complex model has a high training time and tends to have a higher latency due to the computational demands during inference. The NFNet-F0 model demonstrates a low training time per epoch ( 38.26 s), yet a high CPU latency ( 105.72 ms), despite having a minimal number of parameters ( 21.85 million). Usually, a model with fewer parameters and a short training time should also have a lower latency, as simpler models usually require fewer computational resources. These deviations suggest that Vgg-13-bn is highly optimized for inference despite its complexity, while NFNet-F0 suffers from inefficiencies in its implementation that increase latency despite its simplicity.
Figure 21 shows the training time versus GPU latency. The ViT-Small-patch8 model presents an unusual scenario, with a high training time ( 184.67 s per epoch) but a relatively low GPU latency ( 4.80 ms). Usually, models with extended training times also exhibit higher latencies due to their complexity. However, ViT-Small-patch8’s architecture incorporates efficient mechanisms for inference, leading to its lower latency despite prolonged training. On the other hand, MobileFormer-508M demonstrates a low training time ( 29.69 s per epoch) but a higher GPU latency ( 15.84 ms). This behavior is also atypical, as models with shorter training times generally have streamlined architectures that should result in lower latencies. MobileFormer-508M’s higher latency stems from specific architectural components that, while reducing training time, do not optimize inference speed as effectively.
The analysis of the training time versus training memory from Figure 22 shows that the ViT-Small-patch8 model has a high training time per epoch ( 184.67 s) but a relatively low training memory usage ( 0.55 GB), which is atypical since high training times usually correlate with higher memory usage due to the complexity of operations involved. Vgg-13-bn demonstrates a low training time per epoch ( 39.61 ) yet a high training memory usage ( 2.03 GB). This behavior is also abnormal because models with high memory usage typically involve extensive computations and, therefore, longer training times. A similar pattern is observed for training time versus inference memory. The memory sizes are also scaled down, as shown in Figure 23.
Figure 24 illustrates the training memory versus GPU latency, where models with more parameters tend to have a higher training memory usage and GPU latency. MobileFormer-508M has a high GPU latency ( 15.85 ms) but a relatively low training memory usage ( 0.28 GB). This is due to MobileFormer-508M’s architecture having complex operations, causing delays despite its efficient memory footprint. Vgg-13-bn demonstrates a low GPU latency ( 1.26 ms) but a high training memory usage ( 2.03 GB), suggesting that Vgg-13-bn is optimized for rapid execution at the cost of increased memory consumption.
In general, a model’s inference and training memory are influenced by its number of parameters. Figure 25 shows the training memory versus inference memory in which models with more parameters require more memory during training and inference. However, NFNet-F0 and AlexNet slightly deviate from this almost linear relationship by having lower and higher inference memories, respectively, compared to their training memory.
Table 4 provides the performance results of some high-accuracy CNNs and ViTs for COVID-19 detection among all the other trained models. The models were evaluated based on top-1 accuracy, recall, and loss, with corresponding epochs indicating the best performance for each metric. DenseNet-161 achieves the highest top-1 accuracy at 95.61 % , with a recall of 0.96 , demonstrating its robustness for high-precision medical diagnoses, albeit with increased computational complexity. Models like Vgg-13-bn and MaxVit-tiny also perform well, balancing accuracy and computational demands effectively.
Table 5 presents a detailed analysis of the computational efficiency of high-accuracy CNNs and ViTs used for COVID-19 detection among all the other trained models. Key metrics such as the number of parameters, multiply–accumulate operations (MACs), floating-point operations (FLOPs), training time per epoch, CPU and GPU latency, and memory usage during training and inference are compared across models. The findings highlight the trade-offs between accuracy and computational efficiency, guiding the selection of appropriate models based on specific application requirements. For instance, DenseNet-161 provides robust performance for high-precision diagnostics, while models like MaxVit-tiny and MobileFormer-96M are more suited for real-time deployment due to their lower computational demands. This analysis underscores the importance of considering accuracy and efficiency when choosing models for deployment in medical image classification and other computationally intensive tasks.
The results show that high-accuracy models (accuracy > 90%) have minimal variation in performance metrics: F1 scores range from 0.94 to 0.98 , recall from 0.90 to 0.96 , precision stays nearly constant at 0.99 , and MCC varies slightly from 0.04 to 0.06 . This consistency is due to the models’ robustness, optimization, and the large training dataset.
CNN models like AlexNet, GoogLeNet, and EfficientNet rely on convolutional layers for feature extraction. Factors such as depth, width, and skip connections (ResNet) influence their performance. EfficientNet uses compound scaling to balance network dimensions. DenseNet-161 achieves the highest accuracy at 95.61 % and an F1 score of 0.98 , indicating strong precision–recall balance, making it effective for medical image classification. However, its high computational complexity requires careful deployment consideration. In contrast, MobileNetV2 is efficient with the lowest parameters (2,227,715), low MACs and FLOPs, minimal training time, and low CPU and GPU latency, making it ideal for real-time applications in resource-limited environments.
Another high-performance CNN model, RegNet-y-16gf, achieves a commendable accuracy, but its significantly higher number of parameters, MACs, and FLOPs result in longer training times and increased latency. These results suggest that, despite its accuracy, this model may be more suitable for scenarios where computational resources are not a limiting factor. Efficient models exhibit relatively lower computational demands while maintaining competitive performance.
ViT models split input images into fixed-size patches, embed them linearly, and process them with Transformer layers. Factors such as the number of layers, attention heads, and tokenization strategy affect ViT performance. Max-ViT achieves a top-1 accuracy of 95.02 % but with higher parameters, MACs, and FLOPs, indicating a trade-off between accuracy and computational cost. MobileFormer, with a competitive accuracy ( 94.15 % ) and low parameters, achieves one of the shortest training times per epoch ( 17.61 s), making it ideal for real-time applications.
Comparing the overall performance of CNN and ViT models, the findings indicate that ViT models tend to have longer training times due to the self-attention mechanism, which involves processing the entire sequence at once. CNNs, especially smaller ones, converge faster. However, the accuracy of well-configured ViT models can be competitive with CNNs. ViT models can learn global context, making them suitable for tasks where understanding the entire input is crucial. At the same time, CNNs are known for their hierarchical feature extraction, which can be beneficial for capturing local patterns.
ViT models generally exhibit higher MACs and FLOPs than CNNs because ViT processes the entire image as a sequence of patches, increasing computational requirements. CNNs, on the other hand, demonstrate more parameter-efficient designs, achieving competitive performance with fewer parameters compared to some ViT models. Additionally, CNNs tend to have lower latency during CPU and GPU inference than ViT models, partly due to the sequential processing nature of ViTs, which can lead to longer dependency chains. ViT models often demand higher training and inference memory as they process image patches independently, resulting in more significant intermediate representations.
These results support decision-making about which models might suit specific use cases based on computational requirements, memory consumption, and performance. The hierarchical and layered structure of CNNs and the self-attention mechanism of ViTs have enabled these models to achieve state-of-the-art performance in COVID-19 CXR image classification tasks. However, as the dataset grows and tasks become more complex, the limitations of the traditional convolutional approach and the challenges of integrating transformers into computer vision will need to be addressed through continued research and development.

5.2. Additional Dataset Analysis

To demonstrate the broad applicability of our framework across various domains in computer vision, we conducted performance evaluations on two additional datasets: the flower recognition [60] and Multi-class Weather datasets [61]. These evaluations provided insights into how both CNN and ViT models performed in different contexts, offering a comprehensive analysis that further substantiates our framework’s adaptability. The results and analysis of these evaluations are detailed below, highlighting the strengths and weaknesses of each model type in handling diverse visual data and tasks.

5.2.1. Flower Recognition Dataset

The flower recognition dataset consists of 4242 labeled images of various flowers, sourced from Flickr, Google Images, and Yandex Images [60]. The dataset is divided into five classes: chamomile, tulip, rose, sunflower, and dandelion, each containing approximately 800 photos. The images are in different proportions and roughly have a resolution of 320 × 240 pixels, without being resized to a uniform dimension. This dataset is useful for training models to recognize and identify different types of flowers from photographs. Figure 26 shows sample images of the flower recognition dataset.
In examining the relationship between accuracy and epoch from Figure 27, we notice that GoogLeNet leads with the highest accuracy ( 78.01 % ), followed closely by MaxVit-tiny ( 75.93 % ) and then DenseNet-161 ( 73.73 % ). MaxVit-tiny achieves its peak performance faster (248 epochs) compared to GoogLeNet and DenseNet-161, both of which require 274 epochs. MNASnet-05 achieves an accuracy of 36.11 % on the flower dataset, with its peak performance reached after 273 epochs of training. MNASnet-05 is designed with a focus on mobile efficiency, emphasizing reduced computational complexity and power consumption. While this makes it suitable for deployment on resource-constrained devices, it also means that the model lacks the depth and capacity to capture intricate patterns and features in the data as effectively as larger, more complex models.
When comparing training time versus accuracy from Figure 28, we find that GoogLeNet emerges as the most efficient, achieving the highest accuracy with a training time per epoch of just over 3.2 s. MaxVit-tiny and DenseNet-161 also deliver strong performances but they require significantly longer training times per epoch of approximately 11.75 and 7.21 s. Vgg-13-bn and MobileFormer-508M provide competitive accuracies of around 73.38 % and 72.57 % , with moderate training times per epoch of 5.56 and 4.47 s, making them efficient choices for accuracy relative to training time. In contrast, T2T-ViT-T-24 lags behind with an accuracy of 51.39 % , despite an extensive training period of 19.38 s, indicating a less favorable trade-off between accuracy and training time compared to the other models.
In terms of FLOPs versus accuracy, the analysis of Figure 29 shows GoogLeNet as the most efficient, achieving the highest accuracy with only 1.5 billion FLOPs. MaxVit-tiny, with a slightly lower accuracy, requires significantly more computational power at 5.6 billion FLOPs. DenseNet-161 also has a high accuracy but with an even higher computational cost of 7.7 billion FLOPs. MobileFormer-508M strikes a balance with a good accuracy and a relatively low computational requirement of 5 billion FLOPs, making it an efficient choice. In contrast, T2T-ViT-T-24 has one of the lowest accuracies and the highest computational demand, indicating a less favorable trade-off between accuracy and computational efficiency. Analyzing MACs versus accuracy from Figure 30, we observe that the behavior follows a similar trend as FLOPs versus accuracy.
Finally, examining F1 score versus epoch from Figure 31 reveals that GoogLeNet and MaxVit-tiny show strong performance with high F1 scores, indicating their effectiveness in balanced classification tasks. GoogLeNet achieves the best F1 score but requires more epochs, while MaxVit-tiny provides a competitive F1 score with fewer epochs. In contrast, MNASnet-05 underperforms significantly, indicating potential issues with its architecture or suitability for the task.
For the flower recognition task with the chosen dataset, GoogLeNet emerges as a consistently strong performer across multiple performance metrics, particularly in achieving a high accuracy with the efficient use of computational resources. MaxVit-tiny and DenseNet-161 also show strong performance in specific metrics, highlighting the importance of architecture design in balancing training time, accuracy, and computational efficiency.

5.2.2. Weather Classification Dataset

The Multi-class Weather Dataset [61] is designed for image classification tasks focused on recognizing various weather conditions. It includes 1125 images distributed across four categories: sunrise (357 images), shine (253 images), rain (215 images), and cloudy (300 images). This dataset supports outdoor weather analysis by providing a platform for extracting features to identify different weather scenarios. Figure 32 shows sample images of the weather classification dataset.
Figure 33 shows accuracy versus epoch. MaxVit-tiny achieves the highest accuracy at 98.21 % , reaching this peak at epoch 338. The large number of epochs suggests that MaxVit-tiny benefits from extended training to fine-tune its parameters, leading to high accuracy. MobileNetV2 follows with an accuracy of 96.8 % , obtained at epoch 52. MobileNetV2 converges much faster, indicating its efficiency in learning and adjusting its parameters early in the training process making it efficient for scenarios where training time is limited. MNASnet-05, however, shows considerably lower accuracy, suggesting that it may not be suitable for the task at hand.
The relationship between training time and accuracy is shown in Figure 34. ResNet18 achieves an accuracy of 96.43 % with a training time per epoch of 1.97 s. This demonstrates ResNet18’s ability to quickly and effectively learn from the data, offering high accuracy in a relatively short training period. MobileNetV2 slightly outperforms ResNet18 with a training time of 2.13 s. While it takes marginally longer to train, MobileNetV2’s architecture, optimized for mobile and edge devices, provides a highly accurate model without a significant increase in training time. On the other hand, T2T-ViT-T-24 achieves a considerably lower accuracy of 75 % and requires a much longer training time of 5.8 s.
Figure 35 shows the FLOPs versus accuracy graph. MobileNetV2 stands out for its exceptional balance of high accuracy and low computational cost, making it highly efficient. MobileFormer-508M also provides a high accuracy but with a higher computational cost. T2T-ViT-T-24 exhibits a much lower accuracy and significantly higher computational requirements, indicating that it may not be the most efficient choice for tasks where computational efficiency and high accuracy are both critical. The trend of MACs versus accuracy, as shown in Figure 36, follows a similar trend as FLOPs versus accuracy.
The analysis of F1 score versus epoch is presented in Figure 37. MaxVit-tiny achieves an impressive F1 score of 0.98 at epoch 389, indicating a robust performance in precision and recall metrics. This model likely benefited from extensive training, allowing it to consistently improve its performance across multiple evaluation metrics. MobileNetV2, with a slightly lower but still strong F1 score of 0.97 at epoch 52, demonstrates a rapid convergence and an effective utilization of training epochs.
In summary, for weather classification tasks with the chosen dataset, MaxVit-tiny excels in achieving a higher accuracy and F1 score metrics, making it suitable for applications demanding high precision and recall. Conversely, MobileNetV2 offers efficient training and competitive performance metrics early in the training process, making it suitable for applications requiring rapid deployment and operation under resource constraints.
Overall, the analysis for all the datasets identifies the unique strengths of each architecture and underscores the importance of aligning the choice of model with a specific task. The study emphasizes the need for a wise selection process, ensuring that the chosen architecture optimally balances accuracy and computational efficiency based on the demands of the particular application in various domains. As the field continues to evolve, further research could explore efficient hybrid approaches that leverage the strengths of both architectures, potentially leading to even more nuanced and efficient solutions for image classification.

6. Conclusions

In this paper, we established ConVision Benchmark, a robust framework to address common challenges in deep-learning research, such as library version mismatches, difficulties reproducing results, and a lack of unified validation and hardware performance metrics. The ConVision Benchmark is implemented in PyTorch, integrating state-of-the-art CNN and ViT models to standardize the implementation and evaluation process across various datasets. It includes tools for assessing performance metrics and computational efficiency indicators. We presented a detailed comparative analysis to show the effectiveness of the framework and demonstrated the differences between CNNs and ViTs using three different datasets for image classification.
The analysis indicates that CNNs demonstrate a high accuracy and computational efficiency, making them suitable for real-time applications and resource-constrained environments. For example, DenseNet achieves a higher accuracy with a robust F1 score, but its computational complexity requires careful consideration for deployment. In contrast, GoogLeNet and MobileNet excel with minimal parameters and latency, striking an excellent balance between performance and efficiency. ViT models, including MaxViT and MobileFormer, can capture global context and learn complex patterns, making them advantageous for tasks requiring comprehensive understanding. However, these models often demand more computational resources and exhibit higher latency. MaxViT, despite its high accuracy, involves a trade-off with its increased computational cost. MobileFormer, though computationally efficient, achieves competitive accuracy with one of the lowest training times per epoch, highlighting its potential for real-time processing. The choice between CNN and ViT models hinges on specific task requirements, computational resources, and the trade-off between accuracy and efficiency. Hybrid models that combine the strengths of both architectures present a promising future direction, potentially revolutionizing image classification by enhancing accuracy and efficiency.
These findings underscore the versatility and applicability of our framework across different datasets and highlight the importance of selecting appropriate model architectures based on specific task requirements. This research serves as a foundational exploration, paving the way for further investigations into optimized image classification architectures as DL advances. The findings provide valuable insights for guiding the selection of appropriate models for diverse image classification applications in the medical field and other domains.

Author Contributions

Conceptualization, K.T.C.-V.; methodology, K.T.C.-V.; software, K.T.C.-V., S.B.V. and K.A.; validation, K.T.C.-V. and S.B.V.; formal analysis, K.T.C.-V.; investigation, K.T.C.-V., S.B.V. and K.A.; resources, A.K.S.; data curation, K.T.C.-V., S.B.V. and K.A.; writing—original draft preparation, S.B.V.; writing—review and editing, K.T.C.-V. and A.K.S.; visualization, K.T.C.-V. and S.B.V.; supervision, A.K.S.; project administration, A.K.S.; funding acquisition, A.K.S. All authors have read and agreed to the published version of the manuscript.

Funding

This research received support from the Philip and Virginia Sproul Professorship at Iowa State University.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

The original data presented in the study are openly available at https://github.com/krishnateja95/COVID19_Benchmarking accessed on 9 June 2024.

Acknowledgments

The authors would like to thank Yiming Bian for constructive criticism of the research work and Himani Kohli for the thorough review of this paper.

Conflicts of Interest

The authors declare no conflicts of interest.

Appendix A

Appendix A.1. Performance Results of CNN and ViT Models for COVID-19 Detection

In Appendix A.1, we present a detailed performance comparison of various CNN and ViT models on the COVID-19 detection task. The results are summarized in Table A1, highlighting key performance metrics such as the best top-1 accuracy, the epoch at which this accuracy was achieved, the best recall, the epoch at which the best recall was achieved, the best loss, and the epoch corresponding to the best loss. These metrics provide insights into the effectiveness and convergence characteristics of different models, allowing for a thorough evaluation of their performance in detecting COVID-19 from medical images.
Table A1. Performance results of CNN and ViT models for COVID-19 detection.
Table A1. Performance results of CNN and ViT models for COVID-19 detection.
ModelTop-1 Accuracy (%)Top-1 Accuracy EpochRecall (%)Recall EpochBest LossBest Loss Epoch
DenseNet-16195.614100.964100.21226
Vgg-13-bn95.272300.952300.1639
DenseNet-12195.264010.954010.23204
DenseNet-16995.243270.953270.212
Vgg-19-bn95.081870.951870.1824
MaxVit-tiny95.022960.952960.1726
Vgg-11-bn95.012930.952930.1727
Vgg-16-bn94.991310.951310.228
GoogLeNet94.951360.951360.2516
DenseNet-20194.93830.953830.2411
Vgg-1694.271300.941300.2120
EfficientNet-b494.252900.942900.1930
MobileFormer-508M94.151290.941290.2524
MobileFormer-294M94.111250.941250.269
Vgg-1194.081540.941540.2212
EfficientNet-b094.032530.942530.226
Vgg-1394900.94900.2211
MobileNetV293.974420.944420.2617
Vgg-1993.891760.941760.217
EfficientNet-b193.743710.943710.2231
EfficientNet-b393.641540.941540.2131
MobileFormer-151M93.621340.941340.2316
AlexNet93.622670.942670.2219
MobileFormer-214M93.584440.944440.2522
EfficientNet-v2-s93.413610.933610.2228
CCT-14-sine93.31200.931200.2433
MobileNetV193.271540.931540.3460
MobileFormer-96M93.21890.93890.326
CCT-7-sine93.121700.931700.2730
ResNet1893.051700.931700.29443
EfficientNet-b2932570.932570.2726
RegNet-y-16gf93450.93450.3111
CCT-1492.92060.932060.2426
EfficientNet-b592.873820.933820.2638
ShuffleNetV2-x0-592.862780.932780.2325
GhostNetV292.811600.931600.299
ResNet3492.812710.932710.38
ShuffleNetV2-x2-092.783950.933950.3112
RegNet-y-800mf92.77580.93580.3116
RegNet-y-1-6gf92.75610.93610.2514
ShuffleNetV2-x1-592.752360.932360.315
RegNet-y-8gf92.72410.93410.2915
RegNet-y-3-2gf92.72680.93680.3111
ShuffleNetV2-x1-092.64880.934470.2815
MobileFormer-26M92.58950.93950.2618
ResNext5092.53580.93580.2810
MobileNet-V3-large92.474220.924220.3661
PvT-v2-b392.43560.92560.2419
RegNet-x-8gf92.432180.922180.325
RegNet-x-1-6gf92.382540.922540.33467
RegNet-y-32gf92.34640.92640.313
MobileFormer-52M92.341350.921350.2616
RegNet-y-400mf92.321100.921100.323
RegNet-x-16gf92.244340.924340.38
ResNet5092.152330.922330.3119
MNASnet-0592.154990.924990.39499
RegNet-x-400mf92.134370.924370.3322
RegNet-x-32gf92.094880.924880.32452
RegNet-x-3-2gf92.021070.92920.3215
FocalTransformer-Tiny91.993920.923920.2832
MNASnet-1391.994990.924990.45499
PvT-v2-b291.971210.921210.2516
CCT-791.96780.92780.2728
Swin-ViT-Tiny-window791.843780.923780.2824
MNASnet-07591.824990.924990.46499
RegNet-x-800mf91.814010.924010.3314
FocalTransformer-Small91.762690.922690.2935
EfficientNet-v2-m91.744500.924500.3138
wide-ResNet5091.742860.922860.2713
mobilenet-v3-small91.744690.924690.3934
PvT-v2-b491.63800.92800.2646
GCViT-xxTiny91.623490.923490.2629
Swin-ViT-Base91.63400.923400.2731
MNASnet-1091.564990.924990.42499
Swin-ViT-Small-window791.563690.923690.2833
PvT-v2-b591.48460.91460.2519
ResNet10191.444810.914810.3214
DeepViT-S91.443400.913400.2732
Swin-ViT-Large-window791.374020.914020.2933
Swin-ViT-Small91.344370.914370.2831
PvT-v2-b2-Linear91.32540.91540.2926
VAN-b091.322570.912570.28238
PvT-v2-b191.32350.91350.2522
GCViT-xTiny91.281690.911690.2633
ResNext10191.253580.913580.336
Swin-ViT-Base-window791.154070.914070.2934
T2T-ViT-T-2491.121300.911300.332
Swin-ViT-Tiny91.073890.913890.2629
T2T-ViT-1990.951690.911690.332
GCViT-Tiny90.931110.911110.2724
wide-ResNet10190.94560.914560.45
GCViT-Tiny290.87810.91810.2531
ResNet15290.811080.911080.3717
T2T-ViT-14-wide90.791210.911140.3215
CrossFormer-small90.722320.912320.2924
T2T-ViT-1490.691330.911330.2931
LVT90.65600.91600.2828
NFNet-F090.65200.91200.2720
CrossFormer-base90.633320.913320.2840
PvT-v2-b090.62710.91710.2824
CrossFormer-large90.61920.911920.2730
DeepViT-L90.542140.912140.387
CrossFormer-tiny90.544190.914190.331
PvT-Large90.481500.91500.3132
T2T-ViT-1090.342450.92450.332
RegionViT-Small90.321350.91350.2915
T2T-ViT-14-resnext90.262360.92360.2926
VAN-b190.17640.9640.3111
Twins-PCPVT-Large90.11580.9580.2821
Twins-SVT-Base90.04520.9520.3118
Sep-ViT-Small90.03710.9710.3125
VAN-b289.97430.9430.3314
T2T-ViT-2489.952210.92100.3228
Sep-ViT-Base89.851040.91040.2822
Twins-PCPVT-Base89.81570.9570.3118
T2T-ViT-789.811910.91910.2939
PvT-Tiny89.791530.91530.3236
RegionViT-Base89.71400.91400.325
Twins-SVT-Large89.7630.9630.313
Sep-ViT-Tiny89.7560.9560.2923
PvT-Small89.67870.9870.3232
RegionViT-Medium89.641790.91790.317
T2T-ViT-T-1989.581040.91040.3224
T2T-ViT-1289.542290.92290.2933
PiT-XS89.5970.89970.3321
RegionViT-Tiny89.471570.891570.3219
TNT-Base89.412150.892150.3238
Twins-SVT-Small89.39570.89570.3121
T2T-ViT-T-1489.391340.891340.3131
Twins-PCPVT-Small89.3490.89490.2918
CrossViT-15-dagger89.252360.892360.3231
PiT-Small89.111030.891030.3418
CrossViT-9-dagger89.041350.891350.3334
CvT-2189.042860.892860.3724
CrossViT-Small88.852540.892540.3241
CrossViT-1588.772070.892070.3336
PiT-TI88.741200.891200.3516
CrossViT-Base88.741790.891790.3433
EdgeNeXt-BNHS-Xsmall88.74540.89540.338
TNT-Small88.721710.891710.3145
ConvNext-Small88.67590.89590.3259
CrossViT-1888.572650.892650.3341
ViT-Small-patch888.41430.88430.3243
Sep-ViT-Lite88.35270.88270.3227
ViT-Small-patch1688.292040.882040.3437
EdgeNeXt-BNHS-Small88.272530.882530.3542
CvT-1388.21680.88680.3527
CaiT-XS2488.161080.881080.3380
CrossViT-Tiny87.992180.882180.3246
CaiT-XS3687.95840.88840.3372
CrossViT-987.822000.882000.3341
ViT-Tiny-patch1687.671820.881820.3639
CaiT-XXS2487.511020.881020.3588
ConvNext-Tiny87.48680.87680.3568
CaiT-S2487.46740.87740.3459
MLPMixer87.43600.87600.376
ViT-Base-patch1687.291860.871860.3634
ConvNext-Base87.24470.87470.3547
ResMLP87.11380.87380.3631
EdgeNeXt-Small87.09690.87690.3554
CaiT-XXS3687.05740.87740.3574
EdgeNeXt-Base86.93540.87540.3646
ViT-Large-patch3286.731670.871670.433
EdgeNeXt-Xsmall86.65570.87570.3742
ViT-Base-patch3286.341550.861540.4136
ViT-Small-patch3286.061290.861290.4325
EdgeNeXt-BNHS-Xxsmall85.92580.86580.438
GCViT-Small85.75650.86650.3932
PoolFormer-S3685.224840.854840.39442
SqueezeNet-1-185.114630.634450.59437
PoolFormer-S1283.91370.84370.4237
NFNet-F183.44100.83100.4410
BoTNet83.382940.832940.45151
PiT-Base81.51200.82200.4720
PoolFormer-M3681.38200.81200.4814
PoolFormer-S2480.38380.8380.4933
PvT-Medium75.8440.7640.64
SqueezeNet-1-045.5420.4691.021
Inception-Resnet-v234.69180.35181.0616

Appendix A.2. Computation Efficiency of CNN and ViT Models for COVID-19 Detection

This section provides a comparative analysis of the computational efficiency of various CNN and ViT models used for COVID-19 detection. Table A2 summarizes critical metrics such as the number of parameters, multiply–accumulate operations (MACs), floating-point operations (FLOPs), training time per epoch, CPU latency, GPU latency, training memory, and inference memory. These metrics are essential for understanding the computational demands and efficiency of different models, which are crucial factors when deploying these models in real-world applications where resources may be limited.
Table A2. Computation efficiency of CNN and ViT models for COVID-19 detection.
Table A2. Computation efficiency of CNN and ViT models for COVID-19 detection.
ModelNumber of Parameters (Million)MACs (Billion)FLOPs (Billion)Training Time per Epoch (s)CPU Latency (ms)GPU Latency (ms)Training Memory (GB)Inference Memory (MB)
ShuffleNetV2-x0-50.340.040.0417.45.874.360.021.46
SqueezeNet-1-10.720.260.2617.365.171.50.032.78
SqueezeNet-1-00.740.730.7317.167.431.550.042.83
MNASnet-050.940.120.1116.976.623.160.043.78
EdgeNeXt-BNHS-Xxsmall1.160.20.217.817.274.10.044.52
ShuffleNetV2-x1-01.260.150.1518.218.594.460.044.95
mobilenet-v3-small1.520.060.0617.225.033.430.045.99
MNASnet-0751.890.230.2217.28.173.30.077.43
EdgeNeXt-Xsmall2.140.40.4118.2912.065.50.078.31
EdgeNeXt-BNHS-Xsmall2.140.410.4118.0910.665.210.078.32
MobileFormer-26M2.210.030.0317.4412.112.180.058.72
MobileFormer-52M2.210.030.0317.312.5112.230.058.72
MobileNetV22.230.330.3116.889.133.360.118.76
ShuffleNetV2-x1-52.480.310.317.199.624.250.079.66
MNASnet-103.110.330.3217.59.713.460.0912.08
MobileNetV13.210.590.5816.77.171.710.0912.35
MobileFormer-96M3.310.10.117.6114.2412.30.0812.88
Sep-ViT-Lite3.40.490.5718.9412.796.750.0813.08
PvT-v2-b03.410.530.5725.213.224.720.113.09
LVT3.420.730.7627.6517.164.680.113.12
VAN-b03.850.870.8726.1120.396.840.1414.91
RegNet-y-400mf3.90.420.4117.4311.596.140.0915.21
T2T-ViT-740.981.1621.8511.113.950.115.51
EfficientNet-b04.010.410.420.9312.675.370.1415.7
mobilenet-v3-large4.20.230.2217.198.984.140.116.31
CCT-7-sine4.51.471.6117.469.72.520.0917.38
CCT-74.51.471.6117.439.712.550.0917.38
PiT-TI4.540.50.516.958.983.410.0917.66
GhostNetV24.880.180.1823.1721.169.380.1319.14
MNASnet-135.010.550.5419.9812.043.310.1319.36
RegNet-x-400mf5.10.430.4217.4711.025.390.119.85
EdgeNeXt-Small5.270.960.9723.7316.065.580.1420.29
EdgeNeXt-BNHS-Small5.280.960.9720.2213.875.220.1320.3
ShuffleNetV2-x2-05.350.60.5917.3212.924.340.1220.62
ViT-Tiny-patch165.491.081.0817.3610.783.180.1121.22
T2T-ViT-105.581.291.5326.4714.235.010.1321.55
GoogLeNet5.61.511.517.2318.134.570.238.12
RegNet-y-800mf5.650.860.8518.2313.35.490.1321.87
MobileFormer-151M6.320.150.1518.7419.115.930.1424.49
EfficientNet-b16.520.610.5929.5619.097.480.2125.43
RegNet-x-800mf6.590.820.8117.2112.133.920.1425.45
T2T-ViT-126.631.51.7729.5216.165.680.1525.58
CrossViT-Tiny6.651.31.5726.5217.517.960.1525.84
DenseNet-1216.962.92.8629.1634.849.910.2327.03
EfficientNet-b27.710.70.6830.9819.957.50.2430.01
MobileFormer-214M7.830.210.2120.6420.9116.170.1730.29
CrossViT-98.071.541.8528.4816.757.160.1731.28
RegNet-x-1-6gf8.281.631.6219.0617.014.70.1931.98
CrossViT-9-dagger8.291.681.9929.2217.617.430.1832.14
MobileFormer-294M9.510.290.2923.4821.1415.820.2136.69
PiT-XS10.161.11.118.3212.313.50.1839.2
RegNet-y-1-6gf10.321.651.6321.7824.0610.790.2239.87
EfficientNet-b310.690.970.9536.4124.448.720.3141.52
ResNet1811.181.821.8217.699.421.570.1942.7
PoolFormer-S1211.381.811.8217.4817.633.360.2344.42
GCViT-xxTiny11.441.962.1447.3927.759.310.2846.19
CaiT-XXS2411.722.182.5354.4637.6711.80.2845.11
MobileFormer-508M12.060.50.5129.6926.115.850.2846.47
PvT-Tiny12.331.861.9427.9118.654.340.2648.7
DenseNet-16912.493.433.435.0446.8214.040.3448.48
RegionViT-Tiny13.312.312.4352.5631.9311.850.350.98
VAN-b113.342.512.535.8429.375.480.3251.57
PvT-v2-b113.52.042.1245.2825.294.760.2951.56
RegNet-x-3-2gf14.293.223.224.627.226.370.355.01
ResMLP14.943.013.013214.762.930.2758.06
CaiT-XXS3617.063.243.7780.2657.3117.660.4265.6
EfficientNet-b417.551.581.5449.7232.2710.610.4868.25
EdgeNeXt-Base17.912.922.9545.626.185.540.3869.99
RegNet-y-3-2gf17.933.223.228.7530.398.310.3769.61
DenseNet-20118.14.394.3443.9361.9517.110.4670.19
BoTNet18.84.024.0623.9828.944.860.3772.1
GCViT-xTiny19.422.712.9462.837.3112.060.4376.8
CvT-1319.614.084.5858.6139.4111.540.475.07
EfficientNet-v2-s20.182.92.8832.6236.0411.80.4679.03
PoolFormer-S2420.843.393.4123.633.956.590.4280.66
T2T-ViT-T-1421.084.356.1174.4738.45.920.4480.8
T2T-ViT-1421.084.354.855.1828.446.350.480.81
T2T-ViT-14-resnext21.084.354.887.1530.726.40.4680.81
ResNet3421.293.683.6717.2817.022.620.3582.18
ViT-Small-patch821.3716.7616.76184.6796.674.80.5583.08
ViT-Small-patch1621.594.254.2541.8523.293.110.3883.09
NFNet-F021.860.029.1838.27105.7310.761.69263.07
CCT-14-sine21.915.125.5350.127.484.80.484.13
CCT-1421.915.125.5350.0827.864.890.484.13
PvT-v2-b2-Linear22.043.763.9187.5444.6410.110.4985.04
ViT-Small-patch3222.481.121.1217.6810.953.160.3585.94
PiT-Small22.782.422.4231.4321.773.650.3987.48
ResNext5022.994.294.2628.8732.074.120.4588.61
TNT-Small23.34.855.24118.4543.9310.970.4991.95
ResNet5023.514.134.1122.3127.273.950.4389.95
Twins-SVT-Small23.552.822.8242.8331.378.280.4490.98
PvT-Small23.583.693.8349.533.568.270.4891.69
Twins-PCPVT-Small23.593.683.6847.7936.447.330.4790.47
T2T-ViT-14-wide24.234.975.2452.5123.823.170.4293.39
PvT-v2-b224.853.94.0580.4743.299.240.5394.93
VAN-b226.065.01564.1257.4810.470.6100.61
CrossViT-Small26.135.085.636533.227.910.5100.72
CaiT-XS2426.24.875.484.8559.4211.930.56100.48
DenseNet-16126.487.847.7852.7373.2414.40.63103.1
CrossViT-15-dagger27.485.496.1367.4437.028.90.53106.18
Swin-ViT-Tiny-window727.54.374.5162.930.616.260.52106.45
Swin-ViT-Base-window727.54.374.5162.9431.316.450.52106.45
Swin-ViT-Tiny27.54.384.6465.3732.725.90.54108.14
GCViT-Tiny27.584.324.7990.3459.1319.180.62112.12
ConvNext-Tiny27.814.464.4760.6625.913.650.52107.11
EfficientNet-b528.352.462.4167.674512.760.72110.67
FocalTransformer-Tiny29.444.665.22146.1465.7517.820.62116
RegionViT-Small29.795.195.3584.4444.8111.90.59114.75
CrossFormer-small29.894.794.9263.1537.449.120.56114.42
PoolFormer-S3630.294.97533.9950.589.50.62116.89
MaxVit-tiny30.385.465.6191.1664.3617.10.75118.93
Sep-ViT-Tiny30.44.284.5360.4632.766.820.56116.46
CvT-2131.246.547.2189.7160.5418.490.63119.56
GCViT-Tiny233.845.566.21110.9167.8823.660.76139.19
RegNet-y-8gf37.178.04841.5449.336.970.71143.66
RegNet-x-8gf37.668.058.0233.0946.266.530.67144.42
CaiT-XS3638.197.258.05125.6187.8116.970.81146.36
T2T-ViT-T-1938.647.89.81111.4954.77.30.75147.87
T2T-ViT-1938.647.88.591.8143.658.180.71147.88
RegionViT-Medium40.417.227.43106.9955.7516.460.76155.33
CrossViT-1842.428.219.0599.9348.949.790.78163.05
ResNet10142.517.867.8333.9349.667.910.75162.89
PvT-Medium43.316.466.6976.5853.5914.110.82167.01
Twins-PCPVT-Base43.326.466.4672.7957.6112.480.8165.82
NFNet-F143.70.0416.9266.52189.0120.183.17500.84
PvT-v2-b344.736.76.92116.4168.5515.470.88170.85
Sep-ViT-Small45.787.077.4893.9350.9311.430.84176.7
CaiT-S2446.448.639.35118.4280.5312.090.91177.99
Swin-ViT-Small-window748.798.548.77107.9956.7812.50.9188.27
Swin-ViT-Large-window748.798.558.77125.0858.612.650.92188.46
Swin-ViT-Small48.798.589.43121.6364.0310.840.98196.6
ConvNext-Small49.448.78.7108.9645.366.80.91189.73
GCViT-Small50.117.878.57135.4373.218.981.05199.24
FocalTransformer-Small50.748.879.75244.35115.7835.541.07201.32
CrossFormer-base51.28.969.19107.9363.4117.060.94196.1
RegNet-x-16gf52.2416.0415.9953.7274.416.540.98202.09
EfficientNet-v2-m52.865.455.4153.765.5716.431.05207.29
Inception-Resnet-v254.316.56.483982.1819.930.91210.51
Twins-SVT-Base55.38.368.3692.7558.7211.190.99214.47
PoolFormer-M3655.328.768.84875.199.471.07211.63
AlexNet57.020.710.7117.038.950.510.85217.5
ResNet15258.1511.611.5646.7572.2312.031.04222.54
DeepViT-L58.3812.1613.19184.1882.4413.831.12223.34
PvT-Large60.479.539.8510979.5320.331.14232.44
Twins-PCPVT-Large60.489.529.53102.8482.1318.061.12231.77
PvT-v2-b462.049.8210.14165.5897.9823.31.22237.76
T2T-ViT-T-2463.4912.715154.3671.549.341.17243.59
T2T-ViT-2463.4912.713.69134.9563.9210.351.13243.6
TNT-Base64.6413.4414.09196.0780.5311.111.19247.23
wide-ResNet5066.8411.4511.4233.1660.344.021.11257.28
Swin-ViT-Base70.0912.7513.69164.9289.2915.831.36278.57
RegionViT-Base71.6712.7913.07161.4985.4816.521.3276.61
PiT-Base72.510.5510.56105.0559.573.981.22279.65
RegNet-y-16gf80.5716.0115.9658.8783.788.361.42316.53
Sep-ViT-Base81.3312.5413.08144.8873.9211.351.42312.46
PvT-v2-b581.4411.3811.76170.68109.829.591.5311.92
ViT-Base-patch1685.6516.8616.87136.9965.714.781.39327.43
ResNext10186.7516.5416.4769.4795.977.931.55336.15
ViT-Base-patch3287.424.374.3735.7927.773.31.33333.75
ConvNext-Base87.5515.3715.38171.7273.346.81.53334.24
CrossFormer-large90.9515.8516.15168.2590.316.841.61351.68
Twins-SVT-Large98.2514.8314.84146.9885.8311.11.69379.97
CrossViT-Base103.5720.1321.22188.8790.137.961.79407.83
RegNet-x-32gf105.331.8831.81100.28132.686.821.85402.73
wide-ResNet101124.8422.8422.7955.16107.958.072.05484.85
Vgg-11128.787.617.6120.4640.370.951.97491.25
Vgg-11-bn128.787.637.6225.7140.521.081.99491.3
Vgg-13128.9611.311.330.2649.861.081.99491.96
Vgg-13-bn128.9711.3511.3339.6150.981.262.03492.01
Vgg-16134.2715.4715.4735.4860.871.32.07513.09
Vgg-16-bn134.2815.5215.4945.6362.061.522.12513.16
Vgg-19139.5819.6319.6341.0373.431.522.16532.47
Vgg-19-bn139.5919.6919.6651.773.041.712.21532.56
RegNet-y-32gf141.3432.432.3488.81146.358.372.41551.99
ViT-Large-patch32305.4615.2615.27114.1590.166.24.631165.68

Appendix A.3. Performance and Computational Results of CNN and ViT Models for Flower Recognition

In this section, we provide a comprehensive performance and computation metrics comparison of different CNN and ViT models for the flower recognition task. The summarized results, found in Table A3, include crucial metrics such as the accuracy, F1 score, MACs, FLOPs, and training time per epoch.
Table A3. Performance results of CNN and ViT models for flower recognition.
Table A3. Performance results of CNN and ViT models for flower recognition.
ModelNumber of Parameters (Million)MACs (Billion)FLOPs (Billion)Training Time per Epoch (s)Top-1 Accuracy (%)Top-1 Accuracy EpochF1 ScoreF1 Score Epoch
SqueezeNet-1-10.730.260.263.0635.0730.353
ShuffleNetV2-x0-50.350.040.043.0366.781940.75194
MobileNetV22.230.330.313.2469.91780.7978
MNASnet-050.940.120.113.2836.112730.43273
EdgeNeXt-BNHS-Xsmall2.140.410.413.2349.191110.58224
DenseNet-16126.487.847.787.2173.732740.82274
ResNet1811.181.821.823.1769.331440.78144
GoogLeNet5.611.511.53.278.012740.85274
MLPMixer7.282.592.593.1650.23110.617
PiT-XS10.171.11.13.264.12470.7487
GhostNetV24.880.180.183.6968.171310.78131
VAN-b03.850.870.87460.3880.788
BoTNet18.814.024.063.7453.473200.64375
LVT3.420.730.764.1761.46840.7189
MobileFormer-508M12.060.50.514.4772.571860.81186
GCViT-xxTiny11.441.962.146.564.121990.74199
EfficientNet-b417.561.581.546.8266.323010.76301
PoolFormer-S3630.294.9754.9744.79640.5553
NFNet-F021.860.029.185.4641.910.482
CCT-14-sine21.915.125.536.8856.4870.664
Swin-ViT-Tiny-window727.54.374.518.3559.612720.6956
CrossFormer-small29.894.794.928.4462.381820.72182
CrossViT-15-dagger27.485.496.138.962.96800.7380
RegionViT-Small29.795.195.3510.737.1550.415
DeepViT-S26.845.96.3811.2965.974150.75335
CaiT-XS2426.24.875.410.9961520.7152
MaxVit-tiny30.385.465.6111.7575.932480.83248
AlexNet57.020.710.71355.56310.6626
ViT-Small-patch821.3716.7616.7622.863.191270.73127
FocalTransformer-Tiny29.444.665.2218.3363.433740.72178
CvT-2131.246.547.2111.6556.25850.6656
Sep-ViT-Small45.787.077.4812.1756.02750.6675
RegNet-y-16gf80.5816.0115.967.8868.062880.77307
PvT-v2-b344.736.76.9214.8762.73720.7299
ConvNext-Small49.448.78.713.8751.271560.62156
Twins-PCPVT-Large60.489.529.5313.1557.993310.68331
TNT-Base64.6413.4414.0924.2462.04930.7193
T2T-ViT-T-2463.4912.71519.3851.393500.62350

Appendix A.4. Performance and Computational Results of CNN and ViT Models for Weather Classification

In this section, we provide a comprehensive performance and computation metrics comparison of different CNN and ViT models for the weather classification task. The summarized results, found in Table A4, include crucial metrics such as the accuracy, F1 score, MACs, FLOPs, and training time per epoch.
Table A4. Performance results of CNN and ViT models for weather classification.
Table A4. Performance results of CNN and ViT models for weather classification.
ModelNumber of Parameters (Million)MACs (Billion)FLOPs (Billion)Training Time per Epoch (s)Top-1 Accuracy (%)Top-1 Accuracy EpochF1 ScoreF1 Score Epoch
SqueezeNet-1-10.720.260.261.8772.77100.6510
ShuffleNetV2-x0-50.350.040.041.8995.09550.9555
MNASnet-050.940.120.112.0356.25960.4896
EdgeNeXt-BNHS-Xsmall2.140.410.412.0384.82280.8528
MLPMixer7.282.592.592.0787.05140.8714
MobileNetV22.230.330.312.1396.88520.9752
GoogLeNet5.61.511.52.1295.54660.9566
ResNet1811.181.821.821.9796.43570.96122
LVT3.420.730.762.4183.931000.84100
GhostNetV24.880.180.182.3195.09460.9546
PiT-XS10.171.11.12.2585.71630.8663
VAN-b03.850.870.872.3693.752840.94324
MobileFormer-508M12.060.50.512.5396.43890.9689
BoTNet18.814.024.062.3595.54400.96159
GCViT-xxTiny11.441.962.142.9689.731310.9131
EfficientNet-b417.561.581.543.0188.392480.88248
CCT-14-sine21.915.125.532.9881.2520.812
NFNet-F021.860.029.182.827530.723
DenseNet-16126.487.847.783.1996.43690.9669
Swin-ViT-Tiny-window727.54.374.513.3887.951490.88184
CrossViT-15-dagger27.485.496.133.5285.27910.85117
DeepViT-S26.845.96.383.9689.731420.9226
CaiT-XS2426.24.875.44.1476.79200.7625
ViT-Small-patch821.3716.7616.766.4688.842060.89206
PoolFormer-S3630.294.9752.6388.841840.89184
CrossFormer-small29.894.794.923.3881.71360.81136
RegionViT-Small29.795.195.354.1558.0450.4612
AlexNet57.020.710.711.8764.29140.5814
MaxVit-tiny30.385.465.614.2198.213380.98389
CvT-2131.246.547.214.5286.161020.86102
FocalTransformer-Tiny29.444.665.225.8490.631760.9176
Sep-ViT-Small45.787.077.484.3865.6320.6330
PvT-v2-b344.736.76.925.4375160.7415
ConvNext-Small49.448.78.75.0685.273430.85399
Twins-PCPVT-Large60.489.529.534.7387.05760.8776
RegNet-y-16gf80.5816.0115.963.3495.542510.96252
Vgg-13-bn128.9711.3511.332.7395.98770.9677
T2T-ViT-T-2463.4912.7155.8753590.74359
TNT-Base64.6413.4414.097.0587.051800.87180

References

  1. Dosovitskiy, A.; Beyer, L.; Kolesnikov, A.; Weissenborn, D.; Zhai, X.; Unterthiner, T.; Dehghani, M.; Minderer, M.; Heigold, G.; Gelly, S.; et al. An image is worth 16 × 16 words: Transformers for image recognition at scale. arXiv 2020, arXiv:2010.11929. [Google Scholar]
  2. Krizhevsky, A.; Sutskever, I.; Hinton, G.E. Imagenet classification with deep convolutional neural networks. Adv. Neural Inf. Process. Syst. 2012, 25, 84–90. [Google Scholar] [CrossRef]
  3. NVIDIA. CUDA. 2006. Available online: https://developer.nvidia.com/cuda-zone (accessed on 20 February 2024).
  4. He, K.; Zhang, X.; Ren, S.; Sun, J. Deep residual learning for image recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Las Vegas, NV, USA, 27–30 June 2016; pp. 770–778. [Google Scholar]
  5. Jia, Y.; Shelhamer, E.; Donahue, J.; Karayev, S.; Long, J.; Girshick, R.; Guadarrama, S.; Darrell, T. Caffe: Convolutional Architecture for Fast Feature Embedding. arXiv 2014, arXiv:1408.5093. [Google Scholar]
  6. Paszke, A.; Gross, S.; Massa, F.; Lerer, A.; Bradbury, J.; Chanan, G.; Killeen, T.; Lin, Z.; Gimelshein, N.; Antiga, L.; et al. Pytorch: An imperative style, high-performance deep learning library. Adv. Neural Inf. Process. Syst. 2019, 32, 1–12. [Google Scholar]
  7. Lecun, Y.; Bottou, L.; Bengio, Y.; Haffner, P. Gradient-based learning applied to document recognition. Proc. IEEE 1998, 86, 2278–2324. [Google Scholar] [CrossRef]
  8. Simonyan, K.; Zisserman, A. Very deep convolutional networks for large-scale image recognition. arXiv 2014, arXiv:1409.1556. [Google Scholar]
  9. Szegedy, C.; Liu, W.; Jia, Y.; Sermanet, P.; Reed, S.; Anguelov, D.; Erhan, D.; Vanhoucke, V.; Rabinovich, A. Going deeper with convolutions. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Boston, MA, USA, 7–12 June 2015; pp. 1–9. [Google Scholar]
  10. Huang, G.; Liu, Z.; Van Der Maaten, L.; Weinberger, K.Q. Densely connected convolutional networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Honolulu, HI, USA, 21–26 July 2017; pp. 2261–2269. [Google Scholar]
  11. 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. [Google Scholar]
  12. Tan, M.; Le, Q. Efficientnet: Rethinking model scaling for convolutional neural networks. In Proceedings of the International Conference on Machine Learning, PMLR, Long Beach, CA, USA, 9–15 June 2019; pp. 6105–6114. [Google Scholar]
  13. Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A.N.; Kaiser, Ł.; Polosukhin, I. Attention is all you need. In Advances in Neural Information Processing Systems; Curran Associates: Red Hook, NY, USA, 2017; Volume 30. [Google Scholar]
  14. Yuan, L.; Chen, Y.; Wang, T.; Yu, W.; Shi, Y.; Jiang, Z.H.; Tay, F.E.; Feng, J.; Yan, S. Tokens-to-token vit: Training vision transformers from scratch on imagenet. In Proceedings of the IEEE/CVF International Conference on Computer Vision, Montreal, BC, Canada, 11–17 October 2021; pp. 538–547. [Google Scholar]
  15. Liu, Z.; Lin, Y.; Cao, Y.; Hu, H.; Wei, Y.; Zhang, Z.; Lin, S.; Guo, B. Swin transformer: Hierarchical vision transformer using shifted windows. In Proceedings of the IEEE/CVF International Conference on Computer Vision, Montreal, BC, Canada, 11–17 October 2021; pp. 9992–10002. [Google Scholar]
  16. Chu, X.; Tian, Z.; Wang, Y.; Zhang, B.; Ren, H.; Wei, X.; Xia, H.; Shen, C. Twins: Revisiting the design of spatial attention in vision transformers. Adv. Neural Inf. Process. Syst. 2021, 34, 9355–9366. [Google Scholar]
  17. Nafisah, S.I.; Muhammad, G.; Hossain, M.S.; AlQahtani, S.A. A Comparative Evaluation between Convolutional Neural Networks and Vision Transformers for COVID-19 Detection. Mathematics 2023, 11, 1489. [Google Scholar] [CrossRef]
  18. Alayón, S.; Hernández, J.; Fumero, F.; Sigut, J.; Díaz-Alemán, T. Comparison of the Performance of Convolutional Neural Networks and Vision Transformer-Based Systems for Automated Glaucoma Detection with Eye Fundus Images. Appl. Sci. 2023, 13, 12722. [Google Scholar] [CrossRef]
  19. Maurício, J.; Domingues, I.; Bernardino, J. Comparing Vision Transformers and Convolutional Neural Networks for Image Classification: A Literature Review. Appl. Sci. 2023, 13, 5521. [Google Scholar] [CrossRef]
  20. Cuenat, S.; Couturier, R. Convolutional Neural Network (CNN) vs. Vision Transformer (ViT) for digital holography. In Proceedings of the 2022 2nd International Conference on Computer, Control and Robotics (ICCCR), Shanghai, China, 18–20 March 2022; pp. 235–240. [Google Scholar]
  21. Koay, H.V.; Chuah, J.H.; Chow, C.O. Convolutional neural network or vision transformer? Benchmarking various machine learning models for distracted driver detection. In Proceedings of the TENCON 2021–2021 IEEE Region 10 Conference (TENCON), Auckland, New Zealand, 7–10 December 2021; IEEE: Piscataway, NJ, USA, 2021; pp. 417–422. [Google Scholar]
  22. Tahir, A.M.; Chowdhury, M.E.H.; Qiblawey, Y.; Khandakar, A.; Rahman, T.; Kiranyaz, S.; Khurshid, U.; Ibtehaz, N.; Mahmud, S.; Ezeddin, M. COVID-QU-Ex Dataset. 2022. Available online: https://www.kaggle.com/datasets/anasmohammedtahir/covidqu (accessed on 15 April 2023).
  23. Liu, Z.; Mao, H.; Wu, C.Y.; Feichtenhofer, C.; Darrell, T.; Xie, S. A convnet for the 2020s. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, New Orleans, LA, USA, 18–24 June 2022; pp. 11966–11976. [Google Scholar]
  24. Han, K.; Wang, Y.; Tian, Q.; Guo, J.; Xu, C.; Xu, C. Ghostnet: More features from cheap operations. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Seattle, WA, USA, 13–19 June 2020; pp. 1577–1586. [Google Scholar]
  25. Tang, Y.; Han, K.; Guo, J.; Xu, C.; Xu, C.; Wang, Y. GhostNetV2: Enhance Cheap Operation with Long-Range Attention. arXiv 2022, arXiv:2211.12905. [Google Scholar]
  26. Szegedy, C.; Vanhoucke, V.; Ioffe, S.; Shlens, J.; Wojna, Z. Rethinking the inception architecture for computer vision. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Las Vegas, NV, USA, 27–30 June 2016; pp. 2818–2826. [Google Scholar]
  27. Szegedy, C.; Ioffe, S.; Vanhoucke, V.; Alemi, A. Inception-v4, inception-resnet and the impact of residual connections on learning. In Proceedings of the AAAI Conference on Artificial Intelligence, San Francisco, CA, USA, 4–9 February 2017; Volume 31. [Google Scholar]
  28. Tan, M.; Chen, B.; Pang, R.; Vasudevan, V.; Sandler, M.; Howard, A.; Le, Q.V. Mnasnet: Platform-aware neural architecture search for mobile. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Long Beach, CA, USA, 15–20 June 2019; pp. 2815–2823. [Google Scholar]
  29. Sandler, M.; Howard, A.; Zhu, M.; Zhmoginov, A.; Chen, L.C. Mobilenetv2: Inverted residuals and linear bottlenecks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Salt Lake City, UT, USA, 18–23 June 2018; pp. 4510–4520. [Google Scholar]
  30. Howard, A.; Sandler, M.; Chu, G.; Chen, L.C.; Chen, B.; Tan, M.; Wang, W.; Zhu, Y.; Pang, R.; Vasudevan, V.; et al. Searching for mobilenetv3. In Proceedings of the IEEE/CVF International Conference on Computer Vision, Seoul, Republic of Korea, 27 October–2 November 2019; pp. 1314–1324. [Google Scholar]
  31. Brock, A.; De, S.; Smith, S.L.; Simonyan, K. High-performance large-scale image recognition without normalization. In Proceedings of the International Conference on Machine Learning, PMLR, Virtual, 18–24 July 2021; pp. 1059–1071. [Google Scholar]
  32. Radosavovic, I.; Kosaraju, R.P.; Girshick, R.; He, K.; Dollár, P. Designing network design spaces. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Seattle, WA, USA, 13–19 June 2020; pp. 10425–10433. [Google Scholar]
  33. Xie, S.; Girshick, R.; Dollár, P.; Tu, Z.; He, K. Aggregated residual transformations for deep neural networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Honolulu, HI, USA, 21–26 July 2017; pp. 5987–5995. [Google Scholar]
  34. Zagoruyko, S.; Komodakis, N. Wide residual networks. arXiv 2016, arXiv:1605.07146. [Google Scholar]
  35. Ma, N.; Zhang, X.; Zheng, H.T.; Sun, J. Shufflenet v2: Practical guidelines for efficient cnn architecture design. In Proceedings of the European Conference on Computer Vision (ECCV), Munich, Germany, 8–14 September 2018; pp. 122–138. [Google Scholar]
  36. Iandola, F.N.; Han, S.; Moskewicz, M.W.; Ashraf, K.; Dally, W.J.; Keutzer, K. SqueezeNet: AlexNet-level accuracy with 50x fewer parameters and <0.5 MB model size. arXiv 2016, arXiv:1602.07360. [Google Scholar]
  37. Srinivas, A.; Lin, T.Y.; Parmar, N.; Shlens, J.; Abbeel, P.; Vaswani, A. Bottleneck transformers for visual recognition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Nashville, TN, USA, 20–25 June 2021; pp. 16514–16524. [Google Scholar]
  38. Touvron, H.; Cord, M.; Sablayrolles, A.; Synnaeve, G.; Jégou, H. Going deeper with image transformers. In Proceedings of the IEEE/CVF International Conference on Computer Vision, Montreal, QC, Canada, 10–17 October 2021; pp. 32–42. [Google Scholar]
  39. Hassani, A.; Walton, S.; Shah, N.; Abuduweili, A.; Li, J.; Shi, H. Escaping the big data paradigm with compact transformers. arXiv 2021, arXiv:2104.05704. [Google Scholar]
  40. Wang, W.; Yao, L.; Chen, L.; Lin, B.; Cai, D.; He, X.; Liu, W. CrossFormer: A Versatile Vision Transformer Hinging on Cross-scale Attention. arXiv 2021, arXiv:2108.00154. [Google Scholar] [CrossRef] [PubMed]
  41. Chen, C.F.; Fan, Q.; Panda, R. CrossViT: Cross-Attention Multi-Scale Vision Transformer for Image Classification. arXiv 2021, arXiv:2103.14899. [Google Scholar]
  42. Wu, H.; Xiao, B.; Codella, N.; Liu, M.; Dai, X.; Yuan, L.; Zhang, L. CvT: Introducing Convolutions to Vision Transformers. arXiv 2021, arXiv:2103.15808. [Google Scholar]
  43. Zhou, D.; Kang, B.; Jin, X.; Yang, L.; Lian, X.; Jiang, Z.; Hou, Q.; Feng, J. DeepViT: Towards Deeper Vision Transformer. arXiv 2021, arXiv:2103.11886. [Google Scholar]
  44. Maaz, M.; Shaker, A.; Cholakkal, H.; Khan, S.; Zamir, S.W.; Anwer, R.M.; Khan, F.S. EdgeNeXt: Efficiently Amalgamated CNN-Transformer Architecture for Mobile Vision Applications. arXiv 2022, arXiv:2206.10589. [Google Scholar]
  45. Li, Y.; Yuan, G.; Wen, Y.; Hu, J.; Evangelidis, G.; Tulyakov, S.; Wang, Y.; Ren, J. EfficientFormer: Vision Transformers at MobileNet Speed. arXiv 2022, arXiv:2206.01191. [Google Scholar]
  46. Yang, J.; Li, C.; Zhang, P.; Dai, X.; Xiao, B.; Yuan, L.; Gao, J. Focal Self-attention for Local-Global Interactions in Vision Transformers. arXiv 2021, arXiv:2107.00641. [Google Scholar]
  47. Hatamizadeh, A.; Yin, H.; Heinrich, G.; Kautz, J.; Molchanov, P. Global Context Vision Transformers. arXiv 2023, arXiv:2206.09959. [Google Scholar]
  48. Graham, B.; El-Nouby, A.; Touvron, H.; Stock, P.; Joulin, A.; Jégou, H.; Douze, M. LeViT: A Vision Transformer in ConvNet’s Clothing for Faster Inference. arXiv 2021, arXiv:2104.01136. [Google Scholar]
  49. Yang, C.; Wang, Y.; Zhang, J.; Zhang, H.; Wei, Z.; Lin, Z.; Yuille, A. Lite Vision Transformer with Enhanced Self-Attention. arXiv 2021, arXiv:2112.10809. [Google Scholar]
  50. Tu, Z.; Talebi, H.; Zhang, H.; Yang, F.; Milanfar, P.; Bovik, A.; Li, Y. MaxViT: Multi-Axis Vision Transformer. arXiv 2022, arXiv:2204.01697. [Google Scholar]
  51. Tolstikhin, I.; Houlsby, N.; Kolesnikov, A.; Beyer, L.; Zhai, X.; Unterthiner, T.; Yung, J.; Steiner, A.; Keysers, D.; Uszkoreit, J.; et al. MLP-Mixer: An all-MLP Architecture for Vision. arXiv 2021, arXiv:2105.01601. [Google Scholar]
  52. Chen, Y.; Dai, X.; Chen, D.; Liu, M.; Dong, X.; Yuan, L.; Liu, Z. Mobile-Former: Bridging MobileNet and Transformer. arXiv 2022, arXiv:2108.05895. [Google Scholar]
  53. Heo, B.; Yun, S.; Han, D.; Chun, S.; Choe, J.; Oh, S.J. Rethinking Spatial Dimensions of Vision Transformers. arXiv 2021, arXiv:2103.16302. [Google Scholar]
  54. Yu, W.; Luo, M.; Zhou, P.; Si, C.; Zhou, Y.; Wang, X.; Feng, J.; Yan, S. MetaFormer Is Actually What You Need for Vision. arXiv 2022, arXiv:2111.11418. [Google Scholar]
  55. Wang, W.; Xie, E.; Li, X.; Fan, D.P.; Song, K.; Liang, D.; Lu, T.; Luo, P.; Shao, L. Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without Convolutions. arXiv 2021, arXiv:2102.12122. [Google Scholar]
  56. Chen, C.F.; Panda, R.; Fan, Q. RegionViT: Regional-to-Local Attention for Vision Transformers. arXiv 2022, arXiv:2106.02689. [Google Scholar]
  57. Li, W.; Wang, X.; Xia, X.; Wu, J.; Li, J.; Xiao, X.; Zheng, M.; Wen, S. SepViT: Separable Vision Transformer. arXiv 2023, arXiv:2203.15380. [Google Scholar]
  58. Han, K.; Xiao, A.; Wu, E.; Guo, J.; Xu, C.; Wang, Y. Transformer in Transformer. arXiv 2021, arXiv:2103.00112. [Google Scholar]
  59. Guo, M.H.; Lu, C.Z.; Liu, Z.N.; Cheng, M.M.; Hu, S.M. Visual Attention Network. arXiv 2022, arXiv:2202.09741. [Google Scholar] [CrossRef]
  60. Mamaev, A. Flowers Recognition, Version 2. 2021. Available online: https://kaggle.com/datasets/alxmamaev/flowers-recognition/data (accessed on 22 June 2024).
  61. Ajayi, G. Multi-Class Weather Dataset for Image Classification, Mendeley Data. 2018. V1. Available online: https://data.mendeley.com/datasets/4drtyfjtfy/1 (accessed on 22 June 2024).
Figure 1. Block diagram of benchmark process for CNN and ViT models.
Figure 1. Block diagram of benchmark process for CNN and ViT models.
Ai 05 00056 g001
Figure 2. Sample CXR images: (a) COVID-19. (b) Non-COVID-19. (c) Normal.
Figure 2. Sample CXR images: (a) COVID-19. (b) Non-COVID-19. (c) Normal.
Ai 05 00056 g002
Figure 3. Model sizes of CNNs and ViTs.
Figure 3. Model sizes of CNNs and ViTs.
Ai 05 00056 g003
Figure 4. MACs vs. top-1 accuracy.
Figure 4. MACs vs. top-1 accuracy.
Ai 05 00056 g004
Figure 5. FLOPs vs. top-1 accuracy.
Figure 5. FLOPs vs. top-1 accuracy.
Ai 05 00056 g005
Figure 6. Top-1 accuracy vs. epoch.
Figure 6. Top-1 accuracy vs. epoch.
Ai 05 00056 g006
Figure 7. CPU latency vs. top-1 accuracy.
Figure 7. CPU latency vs. top-1 accuracy.
Ai 05 00056 g007
Figure 8. GPU latency vs. top-1 accuracy.
Figure 8. GPU latency vs. top-1 accuracy.
Ai 05 00056 g008
Figure 9. Training memory vs. top-1 accuracy.
Figure 9. Training memory vs. top-1 accuracy.
Ai 05 00056 g009
Figure 10. Inference memory vs. top-1 accuracy.
Figure 10. Inference memory vs. top-1 accuracy.
Ai 05 00056 g010
Figure 11. Training time vs. top-1 accuracy.
Figure 11. Training time vs. top-1 accuracy.
Ai 05 00056 g011
Figure 12. MCC vs. epoch.
Figure 12. MCC vs. epoch.
Ai 05 00056 g012
Figure 13. Precision vs. epoch.
Figure 13. Precision vs. epoch.
Ai 05 00056 g013
Figure 14. Recall vs. epoch.
Figure 14. Recall vs. epoch.
Ai 05 00056 g014
Figure 15. CPU latency vs. MACs.
Figure 15. CPU latency vs. MACs.
Ai 05 00056 g015
Figure 16. GPU latency vs. MACs.
Figure 16. GPU latency vs. MACs.
Ai 05 00056 g016
Figure 17. Training time vs. MACs.
Figure 17. Training time vs. MACs.
Ai 05 00056 g017
Figure 18. Training memory vs. MACs.
Figure 18. Training memory vs. MACs.
Ai 05 00056 g018
Figure 19. Inference memory vs. MACs.
Figure 19. Inference memory vs. MACs.
Ai 05 00056 g019
Figure 20. Training time vs. CPU latency.
Figure 20. Training time vs. CPU latency.
Ai 05 00056 g020
Figure 21. Training time vs. GPU latency.
Figure 21. Training time vs. GPU latency.
Ai 05 00056 g021
Figure 22. Training time vs. training memory.
Figure 22. Training time vs. training memory.
Ai 05 00056 g022
Figure 23. Training time vs. inference memory.
Figure 23. Training time vs. inference memory.
Ai 05 00056 g023
Figure 24. GPU latency vs. training memory.
Figure 24. GPU latency vs. training memory.
Ai 05 00056 g024
Figure 25. Training memory vs. inference memory.
Figure 25. Training memory vs. inference memory.
Ai 05 00056 g025
Figure 26. Sample flower images: (a) daisy; (b) dandelion; (c) rose; (d) sunflower; (e) tulip.
Figure 26. Sample flower images: (a) daisy; (b) dandelion; (c) rose; (d) sunflower; (e) tulip.
Ai 05 00056 g026
Figure 27. Top-1 accuracy vs. epoch.
Figure 27. Top-1 accuracy vs. epoch.
Ai 05 00056 g027
Figure 28. Training time vs. top-1 accuracy.
Figure 28. Training time vs. top-1 accuracy.
Ai 05 00056 g028
Figure 29. FLOPs vs. top-1 accuracy.
Figure 29. FLOPs vs. top-1 accuracy.
Ai 05 00056 g029
Figure 30. MACs vs. top-1 accuracy.
Figure 30. MACs vs. top-1 accuracy.
Ai 05 00056 g030
Figure 31. F1 score vs. epoch.
Figure 31. F1 score vs. epoch.
Ai 05 00056 g031
Figure 32. Sample weather images: (a) cloudy; (b) rain; (c) shine; (d) sunrise.
Figure 32. Sample weather images: (a) cloudy; (b) rain; (c) shine; (d) sunrise.
Ai 05 00056 g032
Figure 33. Top-1 accuracy vs. epoch.
Figure 33. Top-1 accuracy vs. epoch.
Ai 05 00056 g033
Figure 34. Training time vs. top-1 accuracy.
Figure 34. Training time vs. top-1 accuracy.
Ai 05 00056 g034
Figure 35. FLOPs vs. top-1 accuracy.
Figure 35. FLOPs vs. top-1 accuracy.
Ai 05 00056 g035
Figure 36. MACs vs. top-1 accuracy.
Figure 36. MACs vs. top-1 accuracy.
Ai 05 00056 g036
Figure 37. F1 score vs. epoch.
Figure 37. F1 score vs. epoch.
Ai 05 00056 g037
Table 1. COVID-19 dataset classification.
Table 1. COVID-19 dataset classification.
SplitTotalCOVID-19Non-COVID-19Normal
Training21,706765872086849
Test6788239522532140
Validation5417190318021712
Table 2. Family of CNN models.
Table 2. Family of CNN models.
AlexNet [2]ConvNext [23]DenseNet [10]EfficientNet [12]
Ghost-resnet [24]GhostNetv2 [25]Inception [26,27]MNASNet [28]
MobileNet [11,29,30]NFNet [31]RegNet [32]ResNet [4]
ResNext [33]Wide-ResNet [34]ShuffleNetv2 [35]SqueezeNet [36]
VGG [8]
Table 3. Family of ViT models.
Table 3. Family of ViT models.
BoTNet [37]CaiT [38]CCT [39]CrossFormer [40]
CrossViT [41]CvT [42]DeepViT [43]EdgeNeXt [44]
EfficientFormer [45]FocalTransformer [46]GC-ViT [47]LeViT [48]
LVT [49]Max-ViT [50]MLP-Mixer [51]MobileFormer [52]
PiT [53]PoolFormer [54]PVT [55]Region-ViT [56]
SepViT [57]Swin [15]T2T-ViT [14]TNT [58]
Twins [16]VAN [59]Vision Transformer [13]
Table 4. Performance results of CNN and ViT models for COVID-19 detection with accuracy 93 % .
Table 4. Performance results of CNN and ViT models for COVID-19 detection with accuracy 93 % .
ModelTop-1 Accuracy (%)Top-1 Accuracy EpochRecall (%)Recall EpochBest LossBest Loss Epoch
DenseNet-16195.614100.964100.21226
Vgg-13-bn95.272300.952300.1639
DenseNet-12195.264010.954010.23204
DenseNet-16995.243270.953270.212
Vgg-19-bn95.081870.951870.1824
MaxVit-tiny95.022960.952960.1726
Vgg-11-bn95.012930.952930.1727
Vgg-16-bn94.991310.951310.228
GoogLeNet94.951360.951360.2516
DenseNet-20194.93830.953830.2411
Vgg-1694.271300.941300.2120
EfficientNet-b494.252900.942900.1930
MobileFormer-508M94.151290.941290.2524
MobileFormer-294M94.111250.941250.269
Vgg-1194.081540.941540.2212
EfficientNet-b094.032530.942530.226
Vgg-1394900.94900.2211
MobileNetV293.974420.944420.2617
Vgg-1993.891760.941760.217
EfficientNet-b193.743710.943710.2231
EfficientNet-b393.641540.941540.2131
MobileFormer-151M93.621340.941340.2316
AlexNet93.622670.942670.2219
MobileFormer-214M93.584440.944440.2522
EfficientNet-v2-s93.413610.933610.2228
CCT-14-sine93.31200.931200.2433
MobileNetV193.271540.931540.3460
MobileFormer-96M93.21890.93890.326
CCT-7-sine93.121700.931700.2730
ResNet1893.051700.931700.29443
EfficientNet-b2932570.932570.2726
RegNet-y-16gf93450.93450.3111
Table 5. Computation efficiency of CNN and ViT models for COVID-19 detection with accuracy 93 % .
Table 5. Computation efficiency of CNN and ViT models for COVID-19 detection with accuracy 93 % .
ModelMultiply–Accumulate Operations (million)MACs (billion)FLOPs (billion)Training Time per Epoch (s)CPU Latency (ms)GPU Latency (ms)Training Memory (GB)Inference Memory (MB)
DenseNet-16126.487.847.7852.7373.2414.40.63103.1
Vgg-13-bn128.9711.3511.3339.6150.981.262.03492.01
DenseNet-1216.962.92.8629.1634.849.910.2327.03
DenseNet-16912.493.433.435.0446.8214.040.3448.48
Vgg-19-bn139.5919.6919.6651.773.041.712.21532.56
MaxVit-tiny30.385.465.6191.1664.3617.10.75118.93
Vgg-11-bn128.787.637.6225.7140.521.081.99491.3
Vgg-16-bn134.2815.5215.4945.6362.061.522.12513.16
GoogLeNet5.61.511.517.2318.134.570.238.12
DenseNet-20118.14.394.3443.9361.9517.110.4670.19
Vgg-16134.2715.4715.4735.4860.871.32.07513.09
EfficientNet-b417.551.581.5449.7232.2710.610.4868.25
MobileFormer-508M12.060.50.5129.6926.115.850.2846.47
MobileFormer-294M9.510.290.2923.4821.1415.820.2136.69
Vgg-11128.787.617.6120.4640.370.951.97491.25
EfficientNet-b04.010.410.420.9312.675.370.1415.7
Vgg-13128.9611.311.330.2649.861.081.99491.96
MobileNetV22.230.330.3116.889.133.360.118.76
Vgg-19139.5819.6319.6341.0373.431.522.16532.47
EfficientNet-b16.520.610.5929.5619.097.480.2125.43
EfficientNet-b310.690.970.9536.4124.448.720.3141.52
MobileFormer-151M6.320.150.1518.7419.115.930.1424.49
AlexNet57.020.710.7117.038.950.510.85217.5
MobileFormer-214M7.830.210.2120.6420.9116.170.1730.29
EfficientNet-v2-s20.182.92.8832.6236.0411.80.4679.03
CCT-14-sine21.915.125.5350.127.484.80.484.13
MobileNetV13.210.590.5816.77.171.710.0912.35
MobileFormer-96M3.310.10.117.6114.2412.30.0812.88
CCT-7-sine4.51.471.6117.469.72.520.0917.38
ResNet1811.181.821.8217.699.421.570.1942.7
EfficientNet-b27.710.70.6830.9819.957.50.2430.01
RegNet-y-16gf80.5716.0115.9658.8783.788.361.42316.53
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.

Share and Cite

MDPI and ACS Style

Bangalore Vijayakumar, S.; Chitty-Venkata, K.T.; Arya, K.; Somani, A.K. ConVision Benchmark: A Contemporary Framework to Benchmark CNN and ViT Models. AI 2024, 5, 1132-1171. https://doi.org/10.3390/ai5030056

AMA Style

Bangalore Vijayakumar S, Chitty-Venkata KT, Arya K, Somani AK. ConVision Benchmark: A Contemporary Framework to Benchmark CNN and ViT Models. AI. 2024; 5(3):1132-1171. https://doi.org/10.3390/ai5030056

Chicago/Turabian Style

Bangalore Vijayakumar, Shreyas, Krishna Teja Chitty-Venkata, Kanishk Arya, and Arun K. Somani. 2024. "ConVision Benchmark: A Contemporary Framework to Benchmark CNN and ViT Models" AI 5, no. 3: 1132-1171. https://doi.org/10.3390/ai5030056

Article Metrics

Back to TopTop