Paper deep dive
OkanNet: A Lightweight Deep Learning Architecture for Classification of Brain Tumor from MRI Images
Okan Uçar, Murat Kurt
Intelligence
Status: succeeded | Model: google/gemini-3.1-flash-lite-preview | Prompt: intel-v1 | Confidence: 96%
Last extracted: 4/2/2026, 11:48:38 PM
Summary
This paper introduces 'OkanNet', a lightweight custom Convolutional Neural Network (CNN) designed for brain tumor classification (Glioma, Meningioma, Pituitary, No Tumor) from MRI images. The study compares OkanNet against a pre-trained ResNet-50 model using a 7,023-image dataset. While ResNet-50 achieved higher accuracy (96.49%), OkanNet provided a competitive 88.10% accuracy with significantly lower computational requirements, being 3.2 times faster in training, making it suitable for mobile and embedded medical diagnostic systems.
Entities (5)
Relation Signals (3)
OkanNet â classifies â Brain Tumor
confidence 95% ¡ OkanNet, which is a lightweight deep learning technique for the automatic classification and diagnosis of brain tumors
OkanNet â isfasterthan â ResNet-50
confidence 95% ¡ OkanNet... proved to be a strong alternative... by yielding results approximately 3.2 times faster
ResNet-50 â outperforms â OkanNet
confidence 95% ¡ ResNet-50 model exhibited superior classification performance, achieving 96.49% Accuracy... In contrast, the custom OkanNet architecture reached an accuracy rate of 88.10%
Cypher Suggestions (0)
No Cypher suggestions yet.
Abstract
Abstract:Medical imaging techniques, especially Magnetic Resonance Imaging (MRI), are accepted as the gold standard in the diagnosis and treatment planning of neurological diseases. However, the manual analysis of MRI images is a time-consuming process for radiologists and is prone to human error due to fatigue. In this study, two different Deep Learning approaches were developed and analyzed comparatively for the automatic detection and classification of brain tumors (Glioma, Meningioma, Pituitary, and No Tumor). In the first approach, a custom Convolutional Neural Network (CNN) architecture named "OkanNet", which has a low computational cost and fast training time, was designed from scratch. In the second approach, the Transfer Learning method was applied using the 50-layer ResNet-50 [1] architecture, pre-trained on the ImageNet dataset. In experiments conducted on an extended dataset compiled by Masoud Nickparvar containing a total of $7,023$ MRI images, the Transfer Learning-based ResNet-50 model exhibited superior classification performance, achieving $96.49\%$ Accuracy and $0.963$ Precision. In contrast, the custom OkanNet architecture reached an accuracy rate of $88.10\%$; however, it proved to be a strong alternative for mobile and embedded systems with limited computational power by yielding results approximately $3.2$ times faster ($311$ seconds) than ResNet-50 in terms of training time. This study demonstrates the trade-off between model depth and computational efficiency in medical image analysis through experimental data.
Tags
Links
- Source: https://arxiv.org/abs/2604.01264v1
- Canonical: https://arxiv.org/abs/2604.01264v1
Trouble viewing inline? Open PDF directly â
Full Text
37,967 characters extracted from source content.
Expand or collapse full text
OkanNet: A Lightweight Deep Learning Architecture for Classification of Brain Tumor from MRI Images Okan Uçar Graduate School of Natural and Applied Sciences Department of Computer Engineering Ege University Izmir, Turkey okanucar2000@hotmail.com Murat Kurt International Computer Institute Ege University Izmir, Turkey murat.kurt@ege.edu.tr AbstractâMedical imaging techniques, especially Magnetic Resonance Imaging (MRI), are accepted as the gold standard in the diagnosis and treatment planning of neurological dis- eases. However, the manual analysis of MRI images is a time- consuming process for radiologists and is prone to human error due to fatigue. In this study, two different Deep Learning approaches were developed and analyzed comparatively for the automatic detection and classification of brain tumors (Glioma, Meningioma, Pituitary, and No Tumor). In the first approach, a custom Convolutional Neural Network (CNN) architecture named âOkanNet,â which has a low computational cost and fast training time, was designed from scratch. In the second approach, the Transfer Learning method was applied using the 50-layer ResNet-50 [1] architecture, pre-trained on the ImageNet dataset. In experiments conducted on an extended dataset compiled by Masoud Nickparvar containing a total of 7, 023 MRI images, the Transfer Learning-based ResNet-50 model exhibited supe- rior classification performance, achieving 96.49% Accuracy and 0.963 Precision. In contrast, the custom OkanNet architecture reached an accuracy rate of 88.10%; however, it proved to be a strong alternative for mobile and embedded systems with limited computational power by yielding results approximately 3.2 times faster (311 seconds) than ResNet-50 in terms of training time. This study demonstrates the trade-off between model depth and computational efficiency in medical image analysis through experimental data. Index TermsâDeep Learning, Brain Tumor Detection, MRI Classification, CNN, Transfer Learning, ResNet-50, Medical Im- age Analysis. I. INTRODUCTION Brain tumors are defined as abnormal and uncontrolled cell growths within the skull and constitute a significant portion of cancer-related deaths worldwide. The type, location, and stage of the tumor are of vital importance in determining the treatment protocol (surgical intervention, radiotherapy, or chemotherapy) to be applied. Today, Magnetic Resonance Imaging (MRI) technology is widely used in the imaging of brain tumors due to its lack of ionizing radiation and its ability to present soft tissue contrast with high resolution. However, the examination of hundreds of MRI slices belonging to a patient one by one by expert radiologists creates a serious workload and brings with it the risk of oversight. In this con- text, the development of Computer-Aided Diagnosis (CAD) systems has become a necessity to support clinical decision- making processes and shorten the diagnosis time. In recent years, developments in Artificial Intelligence (AI) and especially Deep Learning have produced revolutionary results in medical image analysis [2]. Unlike traditional ma- chine learning methods (SVM, Random Forest, etc.), Deep Learning-based Convolutional Neural Networks (CNN) have the ability to automatically learn complex features (edges, textures, shapes, gradients) in images without human inter- vention. This capability has made CNNs the most powerful tool in distinguishing heterogeneous lesions, such as tumors, from healthy tissue. Studies on brain tumor classification in the literature are generally gathered around two main axes: Custom architec- tures designed from scratch and Transfer Learning methods. Networks designed from scratch can be optimized specifically for the problem space and can work with fewer parameters. However, for these networks to achieve high success rates, very large datasets and careful hyperparameter optimization are needed. On the other hand, the Transfer Learning method, which uses ready-made models (ResNet, VGG, Inception, EfficientNet, etc.) trained with millions of images on massive datasets like ImageNet, allows reaching very high success rates with a limited amount of medical data. Transfer learning is a critical strategy for increasing the generalization ability of the model, especially in the field of medical imaging where training data is limited. In this study, a deep learning-based hybrid classification sys- tem is proposed using a comprehensive MRI dataset containing 4 different classes: Glioma, Meningioma, Pituitary Tumor, and Healthy Tissue. The main motivation of the study is not only to achieve a high accuracy rate but also to analyze the relationship between computational cost and performance. For this purpose, two different strategies were followed within the scope of the study: 1) Custom Architecture Design (OkanNet): A special arXiv:2604.01264v1 [eess.IV] 1 Apr 2026 CNN architecture requiring fewer layers, capable of fast training, and demanding low hardware resources was designed and trained from scratch. 2) Transfer Learning (ResNet-50): To utilize the power of deep architectures, the ResNet-50 model, famous for its residual blocks, was adapted to the problem (fine- tuning), and its performance was analyzed. The remainder of the study is organized as follows: Section I details the dataset used and the proposed methods, Section I presents the experimental findings and comparative analy- ses, and Section IV discusses the results obtained. I. APPLIED ALGORITHMS AND METHODS In this section, the characteristics of the dataset used in the study, data preprocessing steps, the mathematical infrastructure of the developed unique CNN architecture (OkanNet), and the ResNet-50 model used for Transfer Learning are detailed. Ad- ditionally, the hardware environment where experiments were performed and the training hyperparameters are presented. A. Dataset and Preprocessing Within the scope of the study, the âBrain Tumor MRI Datasetâ compiled by Masoud Nickparvar [3] and open to researchers was used 1 . The dataset consists of a total of 7, 023 images obtained from T1, T2, and FLAIR weighted MRI sequences. The dataset is divided into four main classes: Glioma, Meningioma, Pituitary, and No Tumor. The following preprocessing steps were applied to the raw data to increase the training stability of the models: ⢠Resizing: All MRI images with different resolutions were reduced to the 224Ă 224 pixel size, which is the input layer standard of the ResNet-50 architecture, using the bi-cubic interpolation method. ⢠Channel Conversion: MRI images can be single-channel (grayscale) by nature. Since deep learning models gen- erally expect 3-channel (RGB) input, grayscale images were converted to 3-channel space (Grayscale-to-RGB). ⢠Data Augmentation: Random rotation, horizontal flip- ping, and translation operations were applied to the training data to prevent deep networks from memorizing (overfitting) and to artificially increase data diversity. B. Method 1: Custom CNN Architecture (OkanNet) Inspired by pioneering studies in the literature such as LeNet-5 and AlexNet [4], a unique CNN architecture with a low parameter count but high feature extraction capacity, specific to the brain tumor classification problem, was de- signed. This model, named OkanNet, consists basically of three consecutive Convolutional Blocks followed by Classi- fication Layers. 1 DatasetAccess:https://w.kaggle.com/datasets/masoudnickparvar/ brain-tumor-mri-dataset 1) Convolution and Activation Layers: In each block, filters (kernels) of size 3 Ă 3 were used to capture local features (edges, corners, textures) on the image. The convolution operation is mathematically expressed by Equation 1: y(i, j) = X m X n x(i + m, j + n)¡ w(m, n) + b(1) Here, x represents the input image, w the filter weights, and b the bias value. After each convolution operation, the ReLU (Rectified Linear Unit) activation function was used to provide non-linearity to the network and to suppress negative values: f(x) = max(0, x)(2) By using 16, 32, and 64 filters respectively in the model, it was aimed to learn more abstract features as the network deepens. 2) Pooling & Dropout: To reduce dimensions and lighten the computational load, Max Pooling with a size of 2Ă 2 and a stride of 2 was applied in each block. Additionally, a 50% âDropoutâ technique was used in the fully connected layers to prevent overfitting. C. Method 2: Transfer Learning of ResNet-50 As Deep Neural Networks deepen, they become harder to train and reach performance saturation due to the âVanishing Gradientâ problem. The ResNet (Residual Network) architec- ture developed by He et al. solved this problem with the âSkip Connectionsâ structure [1]. In this study, the 50-layer ResNet-50 model, pre-trained with millions of images on the ImageNet dataset, was used. The âFine-Tuningâ method was adopted as the transfer learn- ing strategy. The 1000-class layer at the end of the model was removed and replaced with a new fully connected layer with 4 outputs (Glioma, Meningioma, Pituitary, No Tumor). The basic mathematical expression of the ResNet block is given in Equation 3: y = F(x,W i ) + x(3) Here, x represents the data entering the block, F(x) the learned residual function, and y the output. D. Experimental Setup and Evaluation Metrics All experiments were carried out on NVIDIA GeForce RTX 2060 GPU hardware using MATLAB R2023b and Deep Learning Toolbox libraries. Stochastic Gradient Descent with momentum (SGDM) was preferred as the optimization algo- rithm throughout the training process. 1) Hyperparameters: For a fair comparison of the models, both architectures were trained with the following common parameters: ⢠Epoch Count: 8 ⢠Mini-Batch Size: 32 ⢠Learning Rate: 10 â4 (0.0001) ⢠Validation Frequency: 50 Iterations 2) Performance Metrics: The success of the models was analyzed by recording the results obtained on the test dataset into the Result_Metrics.csv file. Accuracy, Precision, Recall, and F1-Score metrics were used in the evaluation. For the visualization of classification success, Confusion Matri- ces and Result_TrainingHistory.png graphs show- ing the training process were used instead of ROC curves. Accuracy = T P + T N T P + T N + F P + F N (4) F1-Score = 2Ă P recisionĂ Recall P recision + Recall (5) These metrics are critical for measuring not only the gen- eral accuracy of the model but especially its distinctiveness between tumor types. I. EVALUATION OF OBTAINED DATA In this section, the experimental data obtained from the training and test processes of the proposed custom CNN archi- tecture (OkanNet) and the Transfer Learning-based ResNet-50 model are analyzed in detail. The performance of the models is interpreted in terms of training stability, classification metrics, discrimination power between classes, and computational costs in light of similar studies in the literature. All numerical data were compiled from the Result_Metrics.csv file automatically created as a result of the experiments. A. Training Process and Convergence Analysis Both models were trained for 8 epochs on NVIDIA RTX 2060 GPU hardware. The changes in success (Accuracy) and loss (Loss) functions during the training process with respect to iterations are visualized in Figure 1. Figure 1. Training Processes of Models. The blue line (OkanNet) represents learning from scratch, while the red dashed line (ResNet-50) represents the adaptation of transferred knowledge. When the graphs are examined, two different learning dynamics are striking: 1) ResNet-50 (Transfer Learning): The model shown with the red curve started training from a very high accuracy level (80%+) thanks to millions of parame- ters transferred from the ImageNet dataset. The model exceeded the 90% band before the first epoch was completed and exhibited rapid convergence. 2) OkanNet (Custom Architecture): The blue curve re- flects the typical learning process of a network initialized with random weights (He Initialization). Starting with low success in the first iterations, the model achieved stable learning at the end of each epoch. B. Numerical Performance Comparison The final achievements of the models on the test dataset (Testing Folder) are presented in Table I. Table I PERFORMANCE METRICS OF MODELS Performance MetricOkanNetResNet-50 Accuracy%88.10%96.49 Precision0.8770.963 Recall0.8720.962 F1-Score0.8750.962 Training Time311 sec (âź5 min)1000 sec (âź16 min) When the data in Table I is analyzed: ⢠ResNet-50 met the high reliability standards accepted in medical diagnostic systems with 96.49% overall accuracy and 0.962 F1-Score. ⢠OkanNet exhibited a highly competitive performance despite being a shallow architecture with an 88.10% accuracy rate. The balanced Precision and Recall values indicate that the model is not biased against any class. C. Confusion Matrix Analysis Confusion Matrices were examined in Figure 2 to under- stand the root causes of classification errors. Figure 2. Confusion Matrices. Left: OkanNet, Right: ResNet-50. The analysis results show the following: ⢠Both models showed over 98% success in distinguishing the "No Tumor" (Healthy) class. ⢠Source of Error: In the OkanNet model, the vast major- ity of errors were concentrated between the Glioma and Meningioma classes. As stated in the medical literature, these two tumor types can show similar tissue character- istics in radiological images. Figure 3.Sample Predictions Performed with ResNet-50 Model (Green: Correct). D. Visual Verification and Computational Cost The success of the model on real-world data is visualized in Figure 3 on samples randomly selected from the test set. Computational Cost and Trade-off: The most striking finding of this study is the relationship between performance and time. Although the ResNet-50 model provides 8.3% higher accuracy compared to OkanNet, it is 3.2 times slower in terms of training time. ⢠ResNet-50 should be preferred in servers with high processing power. ⢠OkanNet is more efficient in mobile devices or portable MRI units with the speed and low resource consumption it offers. IV. CONCLUSIONS AND FUTURE WORKS In this study, we presented OkanNet, which is a lightweight deep learning technique for the automatic classification and diagnosis of brain tumors from MRI images. We validated our OkanNet by using the âBrain Tumor MRI Datasetâ compiled by Masoud Nickparvar [3]. We also compared OkanNet with ResNet-50 [1] based transfer learning model on a comprehen- sive dataset [3] consisting of 7, 023 images. We showed that our OkanNet has acceptable accuracy with low computation times. As a result of the experimental findings and analyses obtained, the following judgments were reached: 1) TransferLearningSuperiority: The pre-trained ResNet-50 architecture achieved a very high accuracy rate of 96.49% despite being trained with a limited number of epochs (8 cycles). This proves that the Trans- fer Learning method is a strong candidate for clinical decision support systems even if the dataset is limited in medical imaging. 2) Efficiency of Custom Architecture: The OkanNet architecture designed and trained from scratch exhib- ited a performance competitive with shallow networks in the literature with an 88.10% success rate. More importantly, OkanNetâs training time (311 seconds) is approximately 3.2 times faster compared to the ResNet- 50 model (1000 seconds). 3) Clinical Applicability: Error matrix analyses showed that both models work almost flawlessly in distinguish- ing âHealthyâ (No Tumor) brain tissue. However, in the distinction of tumor types with similar tissue structures such as Glioma and Meningioma, the sensitivity of ResNet-50, which has deeper layers, is higher. In conclusion; if the priority is high accuracy and precise diagnosis, ResNet-50 should be preferred; if the priority is op- erability on mobile devices and low processor cost, OkanNet should be preferred. In the future, we would like to test more modern hybrid architectures (e.g., EfficientNet) and use synthetic data gener- ation (GANs) methods to eliminate class imbalance. We also would like to implement our OkanNet on mobile platforms. We believe that our fast and accurate deep learning algo- rithm will work on mobile platforms at real-time frame rates. Additionally, there is potential for upgrading and optimizing our OkanNet by incorporating state of the art deep learning methods and techniques [5]â[9]. To improve classification accuracy of our OkanNet, we are also interested in implementing realistic Bidirectional Reflectance Distribution Function (BRDF) [10]â[27], Bidi- rectional Scattering Distribution Function (BSDF) [28]â [33], Bidirectional Surface Scattering Reflectance Distribution Function (BSSRDF) [34]â[40] and multi-layered material [28], [31], [41] models into our deep learning architecture (Okan- Net) as a preprocessing step. V. APPENDIX: MATLAB SOURCE CODES Below is the complete MATLAB code used for the realiza- tion of the study, covering the entire process (Data processing, Model training, Testing, and Reporting). The codes were de- veloped using MATLAB R2023b and Deep Learning Toolbox. 1 % ------------------------------------------------------------------------- 2 % COMPUTER VISION AND DEEP LEARNING - FINAL PROJECT 3 % Subject: Brain Tumor Classification (OkanNet vs ResNet-50) 4 % Prepared By: Okan Ucar 5 % Hardware: GPU (RTX 2060) 6 % Features: 7 % 1. Automatic Dataset Visualization 8 % 2. OkanNet Custom Design 9 % 3. ResNet-50 Transfer Learning 10 % 4. Visual Prediction Results 11 % 5. Detailed Reporting (PNG & CSV Export) 12 % ------------------------------------------------------------------------- 13 14 clear; clc; close all; 15 16 % ========================================================================= 17 % 1. DATASET AND PREPARATION 18 % ========================================================================= 19 datasetFolder = âBrainTumorDataâ; 20 trainFolder = fullfile(datasetFolder, âTrainingâ); 21 testFolder = fullfile(datasetFolder, âTestingâ); 22 23 % Folder check 24 if ~isfolder(trainFolder) 25 error(âERROR: "BrainTumorData" folder not found! Make sure to extract the Zip file to the project folder.â); 26 end 27 28 fprintf(âLoading dataset... â); 29 30 % Load data 31 imdsTrain = imageDatastore(trainFolder, âIncludeSubfoldersâ, true, âLabelSourceâ, â foldernamesâ); 32 imdsTest = imageDatastore(testFolder, âIncludeSubfoldersâ, true, âLabelSourceâ, â foldernamesâ); 33 34 % Class Names 35 classNames = categories(imdsTrain.Labels); 36 numClasses = numel(classNames); 37 38 disp(âDetected Classes:â); 39 disp(classNames); 40 41 % ------------------------------------------------------------------------- 42 % FEATURE 1: RANDOM SAMPLES FROM DATASET (DATA PREVIEW) 43 % ------------------------------------------------------------------------- 44 fprintf(âVisualizing samples from dataset... â); 45 numSamples = 9; 46 idx = randperm(numel(imdsTrain.Files), numSamples); 47 f_preview = figure(âNameâ, âDataset Samplesâ, âPositionâ, [100, 100, 800, 800], â Visibleâ, âonâ); 48 49 for i = 1:numSamples 50 subplot(3, 3, i); 51 I = readimage(imdsTrain, idx(i)); 52 imshow(I); 53 title(char(imdsTrain.Labels(idx(i))), âFontSizeâ, 12); 54 end 55 % Saved the visual to put in the report 56 saveas(f_preview, âResult_Dataset_Preview.pngâ); 57 58 % ------------------------------------------------------------------------- 59 % DATA PREPROCESSING CONTINUED 60 % ------------------------------------------------------------------------- 61 inputSize = [224 224 3]; % ResNet standard 62 63 % Resize & Grayscale to RGB 64 augimdsTrain = augmentedImageDatastore(inputSize(1:2), imdsTrain, â ColorPreprocessingâ, âgray2rgbâ); 65 augimdsTest = augmentedImageDatastore(inputSize(1:2), imdsTest, â ColorPreprocessingâ, âgray2rgbâ); 66 67 % Training Settings 68 options = trainingOptions(âsgdmâ, ... 69 âMiniBatchSizeâ, 32, ... 70 âMaxEpochsâ, 8, ... 71 âInitialLearnRateâ, 1e-4, ... 72 âShuffleâ, âevery-epochâ, ... 73 âValidationDataâ, augimdsTest, ... 74 âValidationFrequencyâ, 50, ... 75 âVerboseâ, false, ... 76 âPlotsâ, âtraining-progressâ, ... 77 âExecutionEnvironmentâ, âautoâ); 78 79 % ========================================================================= 80 % MODEL 1: CUSTOM CNN (OkanNet) 81 % ========================================================================= 82 myModelName = âOkanNet (My Design)â; 83 fprintf(â --- MODEL 1: %s Training... --- â, myModelName); 84 85 layersCustom = [ 86 imageInputLayer(inputSize, âNameâ, âInputâ) 87 88 % Block 1 89 convolution2dLayer(3, 16, âPaddingâ, âsameâ, âNameâ, âConv_1â) 90 batchNormalizationLayer(âNameâ, âBN_1â) 91 reluLayer(âNameâ, âReLU_1â) 92 maxPooling2dLayer(2, âStrideâ, 2, âNameâ, âPool_1â) 93 94 % Block 2 95 convolution2dLayer(3, 32, âPaddingâ, âsameâ, âNameâ, âConv_2â) 96 batchNormalizationLayer(âNameâ, âBN_2â) 97 reluLayer(âNameâ, âReLU_2â) 98 maxPooling2dLayer(2, âStrideâ, 2, âNameâ, âPool_2â) 99 100 % Block 3 101 convolution2dLayer(3, 64, âPaddingâ, âsameâ, âNameâ, âConv_3â) 102 batchNormalizationLayer(âNameâ, âBN_3â) 103 reluLayer(âNameâ, âReLU_3â) 104 maxPooling2dLayer(2, âStrideâ, 2, âNameâ, âPool_3â) 105 106 % Classification 107 fullyConnectedLayer(128, âNameâ, âFC_1â) 108 reluLayer(âNameâ, âReLU_FCâ) 109 dropoutLayer(0.5, âNameâ, âDropoutâ) 110 fullyConnectedLayer(numClasses, âNameâ, âFC_Outâ) 111 softmaxLayer(âNameâ, âSoftmaxâ) 112 classificationLayer(âNameâ, âOutputâ) 113 ]; 114 115 tic; 116 [netCustom, infoCustom] = trainNetwork(augimdsTrain, layersCustom, options); 117 timeCustom = toc; 118 fprintf(â%s Completed. Time: %.2f sec â, myModelName, timeCustom); 119 120 % ========================================================================= 121 % MODEL 2: TRANSFER LEARNING (ResNet-50) 122 % ========================================================================= 123 refModelName = âResNet-50 (Transfer)â; 124 fprintf(â --- MODEL 2: %s Training... --- â, refModelName); 125 126 try 127 netRes = resnet50; 128 catch 129 error(âResNet-50 package missing! Install from Add-Ons.â); 130 end 131 132 lgraph = layerGraph(netRes); 133 newFCLayer = fullyConnectedLayer(numClasses, âNameâ, âNewFCâ, â WeightLearnRateFactorâ, 10, âBiasLearnRateFactorâ, 10); 134 newClassLayer = classificationLayer(âNameâ, âNewOutputâ); 135 lgraph = replaceLayer(lgraph, âfc1000â, newFCLayer); 136 lgraph = replaceLayer(lgraph, âClassificationLayer_fc1000â, newClassLayer); 137 138 tic; 139 [netTransfer, infoTransfer] = trainNetwork(augimdsTrain, lgraph, options); 140 timeTransfer = toc; 141 fprintf(â%s Completed. Time: %.2f sec â, refModelName, timeTransfer); 142 143 % ========================================================================= 144 % CALCULATION OF RESULTS 145 % ========================================================================= 146 fprintf(â --- TEST AND REPORTING --- â); 147 148 % Predictions 149 [YPred1, scores1] = classify(netCustom, augimdsTest); 150 accCustom = mean(YPred1 == imdsTest.Labels) * 100; 151 152 [YPred2, scores2] = classify(netTransfer, augimdsTest); 153 accTransfer = mean(YPred2 == imdsTest.Labels) * 100; 154 155 % ========================================================================= 156 % VISUALIZATION AND SAVING 157 % ========================================================================= 158 159 % 1. Confusion Matrix 160 f1 = figure(âNameâ, âFinal Comparison: Confusion Matrixâ, âPositionâ, [100, 100, 1200, 500]); 161 subplot(1, 2, 1); 162 cm1 = confusionchart(imdsTest.Labels, YPred1); 163 cm1.Title = [myModelName â (Acc: %â num2str(accCustom, â%.1fâ) â)â]; 164 cm1.RowSummary = ârow-normalizedâ; 165 subplot(1, 2, 2); 166 cm2 = confusionchart(imdsTest.Labels, YPred2); 167 cm2.Title = [refModelName â (Acc: %â num2str(accTransfer, â%.1fâ) â)â]; 168 cm2.RowSummary = ârow-normalizedâ; 169 saveas(f1, âResult_ConfusionMatrix.pngâ); 170 171 % 2. Training Graph 172 f2 = figure(âNameâ, âTraining Performance Comparisonâ); 173 subplot(2,1,1); 174 plot(infoCustom.TrainingAccuracy, âLineWidthâ, 2, âColorâ, âbâ); hold on; 175 plot(infoTransfer.TrainingAccuracy, âLineWidthâ, 2, âColorâ, ârâ, âLineStyleâ, â--â ); 176 legend(myModelName, refModelName, âLocationâ, âsoutheastâ); 177 title(âTraining Accuracyâ); grid on; 178 subplot(2,1,2); 179 plot(infoCustom.TrainingLoss, âLineWidthâ, 2, âColorâ, âbâ); hold on; 180 plot(infoTransfer.TrainingLoss, âLineWidthâ, 2, âColorâ, ârâ, âLineStyleâ, â--â); 181 legend(myModelName, refModelName); 182 title(âTraining Lossâ); grid on; 183 saveas(f2, âResult_TrainingHistory.pngâ); 184 185 % ------------------------------------------------------------------------- 186 % FEATURE 2: VISUALIZE PREDICTION RESULTS (VISUAL PREDICTIONS) 187 % ------------------------------------------------------------------------- 188 % Test and show 9 random test images with the best model (ResNet) 189 fprintf(âVisualizing model predictions... â); 190 idxTest = randperm(numel(imdsTest.Files), 9); 191 f3 = figure(âNameâ, âModel Prediction Samplesâ, âPositionâ, [100, 100, 800, 800]); 192 193 for i = 1:9 194 subplot(3, 3, i); 195 I = readimage(imdsTest, idxTest(i)); 196 197 % Resize image (for display) 198 I_show = imresize(I, [224 224]); 199 imshow(I_show); 200 201 % Prediction and True Label 202 predLabel = YPred2(idxTest(i)); % ResNet predictions 203 trueLabel = imdsTest.Labels(idxTest(i)); 204 205 % Color Setting (Green if True, Red if False) 206 if predLabel == trueLabel 207 titleColor = âgâ; % Green 208 titleText = sprintf(âP: %sâ, char(predLabel)); 209 else 210 titleColor = ârâ; % Red 211 titleText = sprintf(âP: %s | T: %sâ, char(predLabel), char(trueLabel)); 212 end 213 214 title(titleText, âColorâ, titleColor, âFontSizeâ, 11, âFontWeightâ, âboldâ); 215 end 216 % Save 217 saveas(f3, âResult_Prediction_Visuals.pngâ); 218 219 % ========================================================================= 220 % DETAILED METRICS AND CSV 221 % ========================================================================= 222 fprintf(â ======================================================= â); 223 fprintf(â DETAILED PERFORMANCE REPORT â); 224 fprintf(â======================================================= â); 225 226 % Metric Calculation 227 confMat1 = confusionmat(imdsTest.Labels, YPred1); 228 prec1 = mean(diag(confMat1) ./ sum(confMat1, 1)â, âomitnanâ); 229 rec1 = mean(diag(confMat1) ./ sum(confMat1, 2), âomitnanâ); 230 f1_1 = 2 * (prec1 * rec1) / (prec1 + rec1); 231 232 confMat2 = confusionmat(imdsTest.Labels, YPred2); 233 prec2 = mean(diag(confMat2) ./ sum(confMat2, 1)â, âomitnanâ); 234 rec2 = mean(diag(confMat2) ./ sum(confMat2, 2), âomitnanâ); 235 f1_2 = 2 * (prec2 * rec2) / (prec2 + rec2); 236 237 fprintf(â%-20s | %-12s | %-12s â, âMETRICâ, âOkanNetâ, âResNet-50â); 238 fprintf(â---------------------|--------------|-------------- â); 239 fprintf(â%-20s | %.4f | %.4f â, âAccuracyâ, accCustom/100, accTransfer/100) ; 240 fprintf(â%-20s | %.4f | %.4f â, âPrecisionâ, prec1, prec2); 241 fprintf(â%-20s | %.4f | %.4f â, âRecallâ, rec1, rec2); 242 fprintf(â%-20s | %.4f | %.4f â, âF1-Scoreâ, f1_1, f1_2); 243 fprintf(â%-20s | %.2f sec | %.2f sec â, âTraining Timeâ, timeCustom, timeTransfer); 244 fprintf(â------------------------------------------------------- â); 245 246 metricsTable = table(... 247 âAccuracyâ; âPrecisionâ; âRecallâ; âF1-Scoreâ; âTraining Timeâ, ... 248 [accCustom/100; prec1; rec1; f1_1; timeCustom], ... 249 [accTransfer/100; prec2; rec2; f1_2; timeTransfer], ... 250 âVariableNamesâ, âMetricâ, âOkanNetâ, âResNet50â); 251 252 writetable(metricsTable, âResult_Metrics.csvâ); 253 254 disp(â ALL OPERATIONS COMPLETED!â); 255 disp(â--> Result_Dataset_Preview.png (Data Samples)â); 256 disp(â--> Result_ConfusionMatrix.png (Confusion Matrix)â); 257 disp(â--> Result_TrainingHistory.png (Training Graph)â); 258 disp(â--> Result_Prediction_Visuals.png (Prediction Samples)â); 259 disp(â--> Result_Metrics.csv (Numerical Data)â); Listing 1. Brain Tumor Classification Project Complete Source Code REFERENCES [1] K. He, X. Zhang, S. Ren, and J. Sun, âDeep residual learning for image recognition,â in Proceedings of the IEEE conference on computer vision and pattern recognition, 2016, p. 770â778. [2] G. Litjens, T. Kooi, B. E. Bejnordi, A. A. A. Setio, F. Ciompi, M. Ghafoorian, J. A. van der Laak, B. van Ginneken, and C. I. SĂĄnchez, âA survey on deep learning in medical image analysis,â Medical Image Analysis, vol. 42, p. 60â88, 2017. [Online]. Available: https://w.sciencedirect.com/science/article/pii/S1361841517301135 [3] âBrain tumor mri dataset, kaggle,â https://w.kaggle.com/datasets/ masoudnickparvar/brain-tumor-mri-dataset, 2021. [4] A. Krizhevsky, I. Sutskever, and G. E. Hinton, âImagenet classification with deep convolutional neural networks,â Communications of the ACM, vol. 60, no. 6, p. 84â90, 2017. [5] G. GĂśk, S. Kßçßk, M. Kurt, and E. TarÄą, âA u-net based segmentation and classification approach over orthophoto maps of archaeological sites,â in Proceedings of the IEEE 31st Signal Processing and Communications Applications Conference, ser. SIU â23.Istanbul, Turkey: IEEE, July 2023, p. 1â4. [6] Y. Azadvatan and M. Kurt, âMelnet: A real-time deep learning algorithm for object detection,â arXiv preprint arXiv:2401.17972, p. arXiv:2401.17972, Jan. 2024. [Online]. Available: https://doi.org/10. 48550/arXiv.2401.17972 [7] A. Akdo Ě gan and M. Kurt, âExttnet: A deep learning algorithm for extracting table texts from invoice images,â arXiv preprint arXiv:2402.02246, p. arXiv:2402.02246, Feb. 2024. [Online]. Available: https://doi.org/10.48550/arXiv.2402.02246 [8] G. JabbarlÄą and M. Kurt, âLightffdnets: Lightweight convolutional neural networks for rapid facial forgery detection,â arXiv preprint arXiv:2411.11826, p. arXiv:2411.11826, Nov. 2024. [Online]. Available: https://doi.org/10.48550/arXiv.2411.11826 [9] A. Akdo Ě gan and M. Kurt, âFeature engineering for robust post-ocr doc- ument information extraction,â in Proceedings of the 14th International Artemis Scientific Research Congress, P. Karakurt and G. Giurgiu, Eds. Bucharest, Romania: BZT Turan Publishing House, 2025, p. 346â357. [10] A. ĂztĂźrk, A. Bilgili, and M. Kurt, âPolynomial approximation of blinn-phong model,â in Proceedings of the 4th Theory and Practice of Computer Graphics, ser. TPCG â06, L. M. Lever and M. McDerby, Eds. Middlesbrough, United Kingdom: Eurographics Association, 2006, p. 55â61. [11] M. Kurt, âA new illumination model in computer graphics,â Masterâs thesis, International Computer Institute, Ege University, Izmir, Turkey, August 2007, 140 pages. [12] A. Ozturk, M. Kurt, A. Bilgili, and C. Gungor, âLinear approximation of bidirectional reflectance distribution functions,â Computers & Graphics, vol. 32, no. 2, p. 149â158, April 2008. [13] M. Kurt and M. G. Cinsdikici, âRepresenting brdfs using soms and mans,â SIGGRAPH Computer Graphics, vol. 42, no. 3, p. 1â18, August 2008. [14] M. Kurt and D. Edwards, âA survey of brdf models for computer graphics,â SIGGRAPH Computer Graphics, vol. 43, no. 2, p. 1â7, May 2009. [15] M. Kurt, L. Szirmay-Kalos, and J. K Ë rivĂĄnek, âAn anisotropic brdf model for fitting and monte carlo rendering,â SIGGRAPH Computer Graphics, vol. 44, no. 1, p. 1â15, February 2010. [16] A. ĂztĂźrk, M. Kurt, and A. Bilgili, âModeling brdf by a probability distribution,â in Proceedings of the 20th International Conference on Computer Graphics and Vision, St. Petersburg, Russia, 2010, p. 57â 63. [17] L. SzĂŠcsi, L. Szirmay-Kalos, M. Kurt, and B. CsĂŠbfalvi, âAdaptive sampling for environment mapping,â in Proceedings of the 26th Spring Conference on Computer Graphics, ser. SCCG â10.New York, NY, USA: ACM, 2010, p. 69â76. [Online]. Available: http://doi.acm.org/10.1145/1925059.1925073 [18] A. ĂztĂźrk, M. Kurt, and A. Bilgili, âA copula-based brdf model,â Computer Graphics Forum, vol. 29, no. 6, p. 1795â1806, September 2010. [19] A. Bilgili, A. ĂztĂźrk, and M. Kurt, âA general BRDF representation based on tensor decomposition,â Computer Graphics Forum, vol. 30, no. 8, p. 2427â2439, December 2011. [20] A. Bilgili, A. ĂztĂźrk, and M. Kurt, âRepresenting brdf by wavelet transformation of pair-copula constructions,â in Proceedings of the 28th Spring Conference on Computer Graphics, ser. SCCG â12. New York, NY, USA: ACM, 2012, p. 63â69. [Online]. Available: http://doi.acm.org/10.1145/2448531.2448539 [21] S. Ergun, M. Kurt, and A. ĂztĂźrk, âReal-time kd-tree based importance sampling of environment maps,â in Proceedings of the 28th Spring Conference on Computer Graphics, ser. SCCG â12. New York, NY, USA: ACM, 2012, p. 77â84. [Online]. Available: http://doi.acm.org/10.1145/2448531.2448541 [22] O. A. TĂśral, S. Ergun, M. Kurt, and A. ĂztĂźrk, âMobile gpu-based im- portance sampling,â in Proceedings of the IEEE 22nd Signal Processing and Communications Applications Conference, ser. SIU â14. Trabzon, Turkey: IEEE, April 2014, p. 510â513. [23] T. Tongbuasirilai, J. Unger, and M. Kurt, âEfficient BRDF sampling using projected deviation vector parameterization,â in Proceedings of the IEEE International Conference on Computer Vision Workshops, ser. ICCVW â17.Venice, Italy: IEEE Computer Society, Oct. 2017, p. 153â158. [Online]. Available: http://doi.ieeecomputersociety.org/10. 1109/ICCVW.2017.26 [24] M. Kurt, âReal-time shading with phong brdf model,â Journal of Science and Engineering, vol. 21, no. 63, p. 859â867, September 2019. [25] T. Tongbuasirilai, J. Unger, J. Kronander, and M. Kurt, âCompact and intuitive data-driven brdf models,â The Visual Computer, vol. 36, no. 4, p. 855â872, April 2020. [Online]. Available: https://doi.org/10.1007/s00371-019-01664-z [26] E. Akleman, M. Kurt, D. Akleman, G. Bruins, S. Deng, and M. Subramanian, âHyper-realist rendering: A theoretical framework,â arXiv preprint arXiv:2401.12853, p. arXiv:2401.12853, Jan. 2024. [Online]. Available: https://doi.org/10.48550/arXiv.2401.12853 [27] M. Kurt, âMul2mar: A multi-marker mobile augmented reality applicationforimprovedvisualperception,âarXivpreprint arXiv:2502.05953, p. arXiv:2502.05953, Feb. 2025. [Online]. Available: https://doi.org/10.48550/arXiv.2502.05953 [28] G. Ward, M. Kurt, and N. Bonneel, âA practical framework for sharing and rendering real-world bidirectional scattering distribution functions,â Lawrence Berkeley National Laboratory, Tech. Rep. LBNL-5954E, September 2012. [29] â, âReducing anisotropic bsdf measurement to common practice,â in Proceedings of the 2nd Eurographics Workshop on Material Appearance Modeling: Issues and Acquisition, ser. MAM â14, R. Klein and H. Rushmeier, Eds.Lyon, France: Eurographics Association, 2014, p. 5â8. [Online]. Available: http://diglib.eg.org/EG/DL/WS/ MAM/MAM2014/005-008.pdf [30] M. Kurt, âGrand challenges in bsdf measurement and modeling,â The Workshop on Light Redirection and Scatter: Measurement, Modeling, Simulation, Lucerne, Switzerland, August 2014, (Invited Talk). [31] M. Kurt, G. Ward, and N. Bonneel, âA data-driven bsdf framework,â in Proceedings of the ACM SIGGRAPH 2016, Posters, ser. SIGGRAPH â16.New York, NY, USA: ACM, Jul. 2016, p. 31:1â31:2. [Online]. Available: http://doi.acm.org/10.1145/2945078.2945109 [32] M. Kurt, âExperimental Analysis of BSDF Models,â in Proceedings of the 5th Eurographics Workshop on Material Appearance Modeling: Issues and Acquisition, ser. MAM â17, R. Klein and H. Rushmeier, Eds.Helsinki, Finland: The Eurographics Association, 2017, p. 35â39. [Online]. Available: https://diglib.eg.org:443/handle/10.2312/ mam20171330 [33] â, âA survey of bsdf measurements and representations,â Journal of Science and Engineering, vol. 20, no. 58, p. 87â102, January 2018. [34] M. Kurt, A. ĂztĂźrk, and P. Peers, âA compact tucker-based factorization model for heterogeneous subsurface scattering,â in Proceedings of the 11th Theory and Practice of Computer Graphics, ser. TPCG â13, S. Czanner and W. Tang, Eds.Bath, United Kingdom: Eurographics Association, 2013, p. 85â92. [35] M. Kurt and A. ĂztĂźrk, âA heterogeneous subsurface scattering rep- resentation based on compact and efficient matrix factorization,â in Proceedings of the 24th Eurographics Symposium on Rendering, Posters, ser. EGSR â13. Zaragoza, Spain: Eurographics Association, Jun. 2013. [36] M. Kurt, âAn efficient model for subsurface scattering in translucent materials,â Ph.D. dissertation, International Computer Institute, Ege University, Izmir, Turkey, January 2014, 122 pages. [37] S. Ănel, M. Kurt, and A. ĂztĂźrk, âAn efficient plugin for representing heterogeneous translucent materials,â in Contemporary Topics in Com- puter Graphics and Games: Selected Papers from the Eurasia Graphics Conference Series, V. Ě I ̧sler, H. GĂźrçay, H. K. SĂźher, and G. Ăatak, Eds. Peter Lang GmbH, Internationaler Verlag der Wissenschaften, December 2019, ch. 18, p. 309â321, (Book Chapter). [38] M. Kurt, âA Genetic Algorithm Based Heterogeneous Subsurface Scattering Representation,â in Proceedings of the 8th Eurographics Workshop on Material Appearance Modeling: Issues and Acquisition, ser. MAM â20, R. Klein and H. Rushmeier, Eds.London, UK: The Eurographics Association, 2020, p. 13â16. [Online]. Available: https://diglib.eg.org/handle/10.2312/mam20201140 [39] â, âGensss: a genetic algorithm for measured subsurface scattering representation,â The Visual Computer, vol. 37, no. 2, p. 307â 323, February 2021. [Online]. Available: https://doi.org/10.1007/ s00371-020-01800-0 [40] B. YÄąldÄąrÄąm and M. Kurt, âGenplusss: A genetic algorithm based plugin for measured subsurface scattering representation,â arXiv preprint arXiv:2401.15245, p. arXiv:2401.15245, Jan. 2024. [Online]. Available: https://doi.org/10.48550/arXiv.2401.15245 [41] S. Mir, B. YÄąldÄąrÄąm, and M. Kurt, âAn analysis of goniochromatic and sparkle effects on multi-layered materials,â Journal of Science and Engineering, vol. 24, no. 72, p. 737â746, September 2022.