{"id":26005435,"url":"https://github.com/wb-az/covid-19-classification","last_synced_at":"2026-04-30T07:42:35.489Z","repository":{"id":200212895,"uuid":"673793731","full_name":"Wb-az/COVID-19-classification","owner":"Wb-az","description":"Nonparametric comparison of convolutional neural networks and transformers to classify COVID-19","archived":false,"fork":false,"pushed_at":"2024-04-18T21:53:17.000Z","size":17530,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2024-09-05T20:56:38.553Z","etag":null,"topics":["bootstrapping-statistics","chi-square-statistics","cnn-classification","computer-vision","deep-neural-networks","friedman-nemenyi","matthews-correlation-coefficient","nonparametric-statistics","pytorch","sensitivity","vision-transformer"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"ace-aitech/COVID-19-classification","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Wb-az.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-08-02T12:42:56.000Z","updated_at":"2024-09-04T14:07:42.000Z","dependencies_parsed_at":"2023-10-16T05:01:48.874Z","dependency_job_id":"0f67dbeb-b697-4c43-9121-00cfee8c7d1e","html_url":"https://github.com/Wb-az/COVID-19-classification","commit_stats":null,"previous_names":["wb-az/covid-19-classification"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wb-az%2FCOVID-19-classification","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wb-az%2FCOVID-19-classification/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wb-az%2FCOVID-19-classification/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wb-az%2FCOVID-19-classification/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Wb-az","download_url":"https://codeload.github.com/Wb-az/COVID-19-classification/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242104246,"owners_count":20072378,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bootstrapping-statistics","chi-square-statistics","cnn-classification","computer-vision","deep-neural-networks","friedman-nemenyi","matthews-correlation-coefficient","nonparametric-statistics","pytorch","sensitivity","vision-transformer"],"created_at":"2025-03-05T20:56:51.856Z","updated_at":"2026-04-30T07:42:35.417Z","avatar_url":"https://github.com/Wb-az.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Comparison of convolutional neural networks and transformers for the classification of Images of COVID-19, Pneumonia and Healthy individuals as Observed with Computed Tomography\n\nThis work has been published on the [Journal of Imaging](https://www.mdpi.com/2313-433X/8/9/237#cite). If you use our code and/or our manuscript please cite us as: \n\nAscencio-Cabral, A.; Reyes-Aldasoro, C.C. Comparison of Convolutional Neural Networks and Transformers for the Classification of Images of COVID-19, Pneumonia and Healthy Individuals as Observed with Computed Tomography. J. Imaging 2022, 8, 237. https://doi.org/10.3390/jimaging8090237\n\n\n## Introduction\nMedical classification has been  widely benefited with recent developments in computer vision,\nespecially the use of deep artificial neural networks. In this work we evaluated the performance of\nfive deep learning architectures to classify COVID-19 in a multi-class setup.\n\nWe built an experimental setup with the following deep neural network architectures:\n\n* CaiT-24-XXS-224 (Class Attention in image Transformers)\n* DenseNet-121\n* MobileNet-v3-large\n* ResNet-50\n* ResNet-50r (ResNet-50 with resized kernel in the first convolution layer Conv1 from  7 X 7 to 5 x 5)\n\n\n## Experimental setup\n\nOur experimental setup consisted of the combination of the five architectures, two loss functions and two optimizers.\nWe minimize the Cross entropy (CE) and weighted Cross Entropy (wCE) loss functions with Adam and AdamW optimizers.\n\nExp\t |Architecture  | Loss\t | Optimzer\n-----|--------------|--------|--------\n1\t |CaiT          |   CE   | Adam\n2\t |CaiT          |\tCE\t | AdamW\n3\t |CaiT          |   wCE\t | Adam\n4\t |CaiT          |   wCE\t | AdamW\n5\t |DenseNet-121  |\tCE\t | Adam\n6\t |DenseNet-121  |   CE\t | AdamW\n7\t |DenseNet-121  |   wCE\t | Adam\n8\t |DenseNet-121\t|   wCE\t | AdamW\n9\t |MobileNet-v3-l|\tCE\t | Adam\n10\t |MobileNet-v3-l|   CE\t | AdamW\n11\t |MobileNet-v3-l|   wCE\t | Adam\n12\t |MobileNet-v3-l|   wCE\t | AdamW\n13\t |ResNet-50\t    |   CE\t | Adam\n14\t |ResNet-50\t    |   CE\t | AdamW\n15\t |ResNet-50\t    |   wCE\t | Adam\n16\t |ResNet-50\t    |   wCE\t | AdamW\n17\t |ResNet-50r\t|   CE\t | Adam\n18\t |ResNet-50r\t|   CE\t | AdamW\n19\t |ResNet-50r\t|   wCE\t | Adam\n20\t |ResNet-50r\t|   wCE\t | AdamW\n\n## Datasets\nWe sourced our CT images from two public sources:\n* https://www.kaggle.com/maedemaftouni/large-covid19-ct-slice-dataset\n* https://data.mendeley.com/datasets/3y55vgckg6/2\n\n## Methods\n\nWe trained and validated the models for 8 epochs and recorded their accuracy and loss during all\nprocess. \n\n\u003cimg src='figures/flow_diagram.png'\u003e  \n\n\n## Evaluation\nWe evaluated the performance of each of the experiments by using Accuracy, Balanced Accuracy (BA),\nF1, F2, Mathew's correlation coefficient (MCC), Sensitivity and Specificity metrics on\nthe test dataset.\n\n\n## Non parametric comparison\nWe bootstrapped the results, compute the confidence intervals, ranked the bootstrapped results and compared the performance of the models with the\nFriedman-Nemenyi test.\n\n\nArchitecture  | Accuracy | BA    |  F1   |  F2   |  MCC |   Sen  | Spec\n--------------|----------|-------|-------|------ |------|--------|--------\nCait          |   5.00   | 5.00  | 5.00  | 5.00  | 5.00 | 5.00   | 5.00\nDenseNet-121  |\t  3.20   | 2.98  | 2.82  | 3.18  | 3.05 | 2.92   | 3.30\nMobileNet-v3-l|\t  3.63   | 3.62  | 3.58  | 3.50  | 3.72 | 3.54   | 3.56\nResNet-50\t  |  __1.40__   | __1.38__ | 1.92  | 1.84  | __1.53__| __1.75__  | __1.51__\nResNet-50r\t  |   1.77   | 2.02  | __1.68__ | __1.47__ | 1.71 | 1.80   | 1.63\n\n\n## Results\n\nOur results showed that models based ResNet-50 are not only more accurate but learn faster than the\nother networks. Our best models Exp-18 and Exp-20 achieved a MCC of 98.66\\% and specificity of 99.53\\% and 99.50\\% respectively.\n\n\n* _By network_\n\n\n\u003cimg src='figures/architecture/net_ba.png' height='200'/\u003e     \u003cimg src='figures/architecture/net_mcc.png' height='200'/\u003e\n\u003cimg src='figures/architecture/net_f2.png' height='200'/\u003e      \u003cimg src='figures/architecture/net_hm_epochs.png' height='200'/\u003e\n\n\n* _By experiment_\n\n\n\u003cimg src='figures/experiment/exp_ba.png' height='200'/\u003e       \u003cimg src='figures/experiment/exp_mcc.png' height='200'/\u003e\n\u003cimg src='figures/experiment/exp_f2.png' height='200'/\u003e       \u003cimg src='figures/experiment/exp_hm_epochs.png' height='200'/\u003e\n\n\u003cp 'align='center'\u003e\n\n  \u003cimg src='figures/prob_bar.png' width='200'/\u003e\n  \n\u003c/p\u003e\n\n\n## Installation\n* Setup a  Python 3.8 environment or higher\n* Install Pytorch and Torchvision\n* Install torchmetrics\n* Install timm\n\n### __Note:__\n* When running the files replace the paths/directories with your paths to files\n* The csv file contains results for the comparison\n* The classification of COVID-19 can be run directly from the jupyter notebook  ```main_class.ipynb``` or on the terminal by\nusing the command line ``` python3 /your/path/to/main_class.py ```\n* The comparison of the models performance can be run on the jupyter notebook ```main_stats.ipynb``` or on the terminal by using the command\nline ``` python3 /your/path/to/main_stats.py ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwb-az%2Fcovid-19-classification","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwb-az%2Fcovid-19-classification","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwb-az%2Fcovid-19-classification/lists"}