Hybrid Architecture for Brain Abnormality Detection on brain MR Scans via FastAI

With lot happening in the �eld of Deep Learning, classi�cation of brain tumor is still a matter of concern. Brain tumor segmentation and classi�cation using MRI scans has achieved lot of interest in the area of medical imaging. The emphasis still lies on developing automatic computer-aided system for early predictions and diagnosis. MRI of brain Tumors not only varies in shape but sometimes gives less contrasted details also. In this paper, we present a FastAI based Transfer Learning tumor classi�cation in which pre-trained model with segmented features classi�es tumor based on its learning. The proposed model with the technique of Deep learning applies ResNet152 as base model to extract features from the MRI brain images. With certain changes in the last 3 layers of ResNet152, 97% accuracy in Dataset-253, 96% accuracy in Dataset-205 is achieved. Models such as Resnet50, VGG16, ResNet34 and Basic CNN is also evaluated. The model improved from ResNet152 has provided improved results. The observations suggest that usage of Transfer Learning is effective when the Dataset is limited. The prepared model is effective and can be collaborated in computer-aided brain MR images Tumor classi�cation.


Introduction
Modern Arti cial Intelligence techniques of computer vision has brought rapid improvement in Medical Diagnosis. For a better treatment of cancer exact and accurate diagnosis is need of the hour. Brain Cancer is an unwanted growth of a tissue which could be deadly [1]. Early and correct treatment plays a signi cant role. The treatment required is directly dependent on the tumor grade and stage. Brain MR Images was the medium of database taken for tumor classi cation. Pre-trained network model of Deep Learning can give better results in large brain MRI databases. MR images of brain these days are the most effective way for detection. It is a non-invasive technique for nding various abnormalities of brain [2].
Brain tumor abnormality classi cation using MR scans is a challenging eld. It needs accurate and précised outcomes as the matter is concerned to subject's health [19]. MR scans of brain reveals most of the details in relation to physical, genetical and chemical abnormalities existing in a brain [20]. In order to detect, tumor existence ample classi cation methodologies have been proposed. The conventional methods carry out classi cation on brain MR scans via pre-processing, exact tumor portion segmentation, extracting the relevant features and then feeding into classi er for training and validation testing. These broad steps lead to separation of benign images and malignant images.
Few conventional machine learning methods for tumor classi cation are employed in [21]. Certain hybrid approaches involve the combination of genetic algorithm for reducing the features, further classi ed benign and malignant tumor by Support Vector Machine Kernel [1]. Techniques like fuzzy clustering Bayesian segmentation of region of tumor [7] with hybrid autoencoder is also implemented for tumor classi cation. Method of symmetry segmentation with active contour in [8] are followed for classi cation of tumor portion. Classi ers like CNN architecture [14], are used. Square centroid gray level distribution method with re ned gravitational search technique is employed in [15]. Such early techniques help in providing direction to computer-aided way of brain MR scans tumor classi cation.
The recent research involves solutions improved through optimization algorithms. Techniques like Particle Swarm Optimization [18], Fire y optimization [16] and Ant-Bee colony optimization [17] when combined with neural networks give better classi cation accuracy rate.

Methodology And Material
In the proposed work, the concept of transfer learning is employed by using a pre-trained CNN with Resnet152. In addition, the Resnet152 is improvised further for classifying tumor. The proposed methodology is validated to classify tumorous and non-tumorous data on Dataset-253. Similarly, classi cation of High Grade Glioma (HGG) and Low Grade Glioma (LGG) is also validated in Dataset-205.

Transfer Learning
The concept of transfer learning focuses on fetching knowledge from a previously trained model on learning related problem. In other words, a previously trained model on the same type of image classi cation data is preferred instead of developing model from the scratch. Transfer learning is bene cial in instances when there is lesser number of data present for model training. Formally, transfer learning is useful for improving the target domain (T D ) learning. The improvement is directly proportional to the pre-gained knowledge in root domain (R D ) and learning task (L D ). On the basis of task type and nature of dataset available in root and target domain, different setting changes are implied for transfer learning [4]. When R D ≠T D and not even root task is equal to target task, the concept is known as basic transfer learning. In such cases, the dataset with small brain sample data gets knowledge from pretrained large brain data model [5].
The concept of deep neural network [6] with pre-trained weights is applied. The method gives fruitful outcomes when dealt with large MR Image datasets. Other pre-trained models such as ResNet50 [26], VGG16 [25], ResNet34 [27] and ResNet152[23] were also experimented for tumor classi cation on the 2 brain MRI datasets. The classi cation as tumorous and non-tumorous is performed on Dataset-253 and Dataset-205. In continuation, further classi cation with improved model is done. The Fig. 1 below gives the basic layout of the transfer learning concept applied in our proposed work.
The mechanism of proposed methodology follows three basic steps: FastAI ResNet152 model creation, optimal learning rate detection, and Fine-Tune and model unfreezing. The details are described in below sub-sections.

FastAI ResNet152 model creation
FastAI being a deep learning library focusses on two basic goals i.e., being approachable and to have a rapid productivity [29]. The application of FastAI are vision, text, tabular and collab. The vision module includes functions which for a computer vision task can easily de ne the data and do model training. For this, four submodules are vision.image, vision.transform, vision.data and vision.learner. This top hierarchy helps user to avoid learning usage of lowest level API.
The deep learning ResNet152 model architecture is a pre-trained model from the repository of ImageNet data, where 1 million computer vision images exist from class 1 to class 1000. The model is a commonly practised framework for deep learning outcomes. Residual Network models are state-of-the-art Convolutional Neural Networks that are reconstructed newly for the research area of Computer Vision. The ResNet152 model connects fast in comparison to models like inception and VGG due to one parameter adjustment [30]. When compared with inception and VGG, ResNet is simple to use in different kind of datasets. Even if the network is deeper with increase in layers, gradient is easily maintained in ResNet by passing input data further avoiding information loss whereas it cannot be easily updated in inception and VGG. The Fig. 2 below shows the basic ResNet152 architecture and the concept of skip connections adapted.

Optimal learning rate detection
In order to get increment in model working an effective optimal learning rate is detected. The optimal learning rate plays signi cance in controlling quick adaption of model to the problem. Learning rate being a hyper-parameter controls adjustment of weights in network with reference to the loss gradient. Setting of small learning rate results in slow progress in model training with minute updates in network weights. Even setting high learning rate can lead to undesirable divergence in loss function. Thus, learning rate signi cantly controls the model performance.

Adam Optimizer
The Adam optimizer is chosen due to its better learning rate and is parameter speci c in adapting the nature of learning. Adam optimizer helps in minimizing the loss function while model training.
Fine-Tune and model unfreezing

Experiment And Discussions
The experiments were performed on Python with i7 processor, GPU card and RAM capacity 8 GB.
FastAI[28] framework vision library was imported for building a tumor classi er. The results of FastAI based transfer learning are obtained by creation of FastAI pre-trained model, locating optimal learning rate and deep learning architecture ne-tuning for model tting. The model performance is evaluated on each strategy. The step by analysis of training the model is carried in three steps: 1) FastAI model creation; 2) Detecting optimal learning rate; 3) Fine-Tune and unfreezing for model enhancement 3.1.
Step 1: FastAI model creation ResNet152 [13,24] architecture is employed as the base model for tumor and non-tumor brain images classi cation. ResNet152 architecture is a pre-trained model on ImageNet and is included using FastAI package. A callback_fns functions is applied in order to check improvement in model via graphs. In function Metrics, accuracy is used as a metric for outcome. The model is trained and validated using binary-cross entropy. This is done for two class binary classi cation. The Fig. 6 below gives a layout model summary of ResNet152 after model training of base Convolutional architecture. The model depicts total trained parameters with the help of Adam Optimizer.

3.2.
Step 2: Detecting optimal learning rate With the basic training of the model, the optimal learning rate is found with in-built learner object functionality. It helps to nd ranges in learning rates. This is done for model training. The optimal learning rate is achieved by tting the model for a few epochs. The learning rate when the loss starts degrading is saved. The function learner.lr_ nd() is used for nding the learning rates and learner.recorder.plot() function constructs the learning rate curve. The learning rate with steepest slope and decreasing loss curve is chosen. The Fig. 7 below shows learning rate curves for brain MRI Dataset-253 and Dataset-205 respectively. The initial value of learning rate is chosen in our case as e-02. There is a gradual increase in learning rate and decrease in validation loss. For one cycle, model training done for few epochs. In our case we did for 10 epochs. After training, again learning rate is updated for the next learning cycle. This is basically model tting and is also known as Annealing of learning rate [19].
Further, we t our improved ResNet152 model with a learning rate e-02 for both Dataset-253 and Dataset-205. A maximum of 10 epochs considered for one cycle. The Fig. 8 below depicts training and validation loss for each epoch before unfreezing. The function learner. t_one_cycle() is used each time. Figure 5 clearly demonstrates that the model needs re-training for another cycle by nding optimal learning rate.  The model re-training is done for 3 cycles and for each cycle optimized learning rate is used. The next step involves the nal ne-tuning of the improved model.

3.3.
Step 3: Fine-Tune and unfreezing for model enhancement Finally, in this step the model is re-trained. Learner curve is plotted after unfreezing using learner.unfreeze() function. This helps in nding the new optimal learning rate. The Fig. 9 below depicts the same where Dataset-253 and Dataset-205 of brain images are re-trained with new optimized learning rates. Learning rates are set as 1e-04 and 1e-05 respectively for both the datasets.
After re-training the model accuracy for both brain MR scans datasets is validated to 97% and 96% respectively. The model is not causing over-tting, since at each epoch cycle validation loss is lesser than training loss. The Fig. 10    The improved model performs tumor classi cation for both the Datasets. The confusion matrix for both Dataset-253 and Dataset-205 is given below in Fig. 11 and Fig. 12 respectively.
Page 10/23 The Confusion Matrix de nes: True-Positive(TP) as: brain MR scan is tumorous and predicted tumorous as well.
True-Negative(TN) as: predicted image is non-tumorous and is actually the same.
False-Positive(FP) as: image is tumorous but predicted non-tumorous.
False-Negative(FN) as: image is non-tumorous but predicted tumorous.
Accuracy: is calculated as total number of true predicted values divided by total predicted values.
The Table 1 below gives the performance criteria of ResNet152 for both the brain MR scans datasets used. The Fig. 13 and Fig. 14 below shows few correct and few incorrect classi cation predictions for both Dataset-253 and Dataset-205 after nal ne-tuning and unfreezing of the model layers. It involves predicted labels which is true output of model. Actual label is the true ground truth class label of MR image.

Conclusion
In this paper, ResNet152 architecture which is a pre-trained FastAI CNN model is used. The ResNet152 architecture is taken as base model and improved by modifying the last 3 layers. The dense layer, followed by softmax layer and binary cross-entropy layers are improved with new layers. After that improved ResNet152 deep learning model was trained on 2 different brain Datasets collected from Kaggle and BRATS2015. Fine-tuning of the model is performed. The accuracy percent of improved model is 97% and 96% respectively when veri ed on Dataset-253 and Dataset-205. The improved model when compared with other deep learning models gives best results with 2 different brain MRI Datasets. The accuracy percent comparison is given in the Fig. 15 below. Data augmentation applied to increment MR images of brain dataset. The developed improved model can be helpful in nding other brain diseases as well such as brain stroke, haemorrhage, Alzheimer's etc. Also further, other pre-trained architectures can also be improved by modifying the layers of the network.

Declarations
ETHICAL APPROVE: The script does not contain any type of material or data which is unethical.
CONSENT OF PARTICIPANT: No consent was needed for writing this research paper.
CONSENT TO PUBLISH: I, the undersigned, give my consent for the publication of identi able details, which can include photograph(s) and/or videos and/or case history and/or details within the text ("Material") to be published in the above Journal and Article.
AUTHORS CONTRIBUTION: In this work, pre-trained weights transfer learning FastAI architecture is employed. The ResNet152 [24] deep neural network pre-trained architecture is selected for Dataset-253 and Dataset-205 for predicting tumorous and non-tumorous brain images. The motivation for using ResNet152 improved model is to avoid conventional approaches. The new improved model is full automatic system and its major details are given in experiment and discussion section. The model worked on classifying raw brain MR scans from start-to-end structure unlike any manual-crafted feature extraction technique. AVAILABILTY OF DATA AND MATERIAL: The dataset "BRATS 2015" is available free for research on the internet and the institution has MATLAB software licence on which the code was tested.
AUTHORSHIP I, the undersigned author(s), certify that: 1. I have read and approved the nal version of the manuscript.
2. I have made substantial contributions to the submitted work, which may include study design, data acquisition and/or analysis, and data interpretation.
3. I have made signi cant contributions to the preparation of the manuscript and/or critical revisions for important intellectual content.
4. I will be accountable for all aspects of the submitted work.
5. I agree to help investigate and resolve any issues/questions that may arise regarding the accuracy and integrity of the submitted work.
I understand that if necessary, the Editor-in-Chief of Brain Imaging and Behavior or designate may request deidenti ed data that has been submitted as part of the manuscript. In this event, I agree to produce the data.
I certify that this manuscript is not under consideration for publication in any other journal, nor has it been accepted for publication in any form, and no rights have been assigned to a third party.
I certify that all individuals who have made speci c contributions to this manuscript but who do not ful ll the authorship criteria are listed with their speci c contributions in the Acknowledgments section of the manuscript.
All funding sources directly or indirectly supporting this research have been acknowledged within the manuscript, including grant numbers where appropriate.
I understand that after the initial submission, authorship changes are strongly discouraged unless clearly warranted. If a major revision is submitted and authors have been added, removed or reordered, a rationale must be clearly indicated on the authorship change form, and all authors, prior and newly proposed, must sign the form indicating their agreement. Original signatures are required. Changes are subject to approval by the Editor-in-Chief.

CONFLICT OF INTEREST AND FINANCIAL DISCLOSURE
"None of the authors have a con ict of interest to declare." By signing this document, I agree to accept full responsibility for the work submitted in the manuscript, including the accuracy and integrity of the data and data analyses.
Additionally, I assert that there are no con icts of interest, either personal or institutional, that have compromised the integrity of the work reported in this manuscript.
[30] He, Kaiming, et al. "Deep residual learning for image recognition." Proceedings of the IEEE conference on computer vision and pattern recognition. 2016. Figure 1 Basic Transfer Learning Concept