Algorithm 1: BNCNN model |
INPUT IMG: Dataset of X-ray images [224 × 224 × 15,153] LAB: Set of labels {‘COVID-19’, ‘Normal’, ‘Viral Pneumonia’} corresponding to X-ray images [1 × 15,153] : number of classes used for training OUTPUT : a matrix of prediction probability of class labels [ × 683] ALGORITHM: If 3-way = 3 If 2-way = 2 For I = 1 to length (LAB) If LAB (1, i) == ‘COVID-19’ or LAB(1, i) == ‘Normal’ X(:, :, i), Y(1, i) = IMG(:, :, i), LAB(1, i) End if End_for Else = 2 X, Y = IMG, LAB End_if X = image_resize(X)/255 = one-hot_encoder (Y, ) If model_name == ‘VGG-16’ or model_name == ‘VGG-16’ model = load_pre-trained_weigts(model_name) model = freeze_feature_extration_layers(model) Else_if model_name == ‘BNCNN’ model = construct_model() End_if , , , , , = cross-validation (X, , train = 0.8, val = 0.1, test = 0.1) , = data_augmentation(, , rotation = [−20, 20], zoom = [0, 0.2], shear = [0, 0.2], horizontal_flip = True, vertical_flip = False) , = data_augmentation(, , rotation = [−20, 20], zoom = [0, 0.2], Shear = [0, 0.2], horizontal_flip = True, vertical_flip = False) model = train (, , , , custom_callbacks) = predict (model, ) cm = calculate_confusion_matrix(, , ) acc, recall, precision, F1-score = calculate_evaluation_metrics(cm, ) |