Table 3 Pseudo code of proposed model XL-TL.

From: Brain tumor detection empowered with ensemble deep learning approaches from MRI scan images

Begin

Input:

MRI images dataset (D) with labels for tumor types (Normal, Glioma, Meningioma, Pituitary)

Output:

Classification results and performance metrics (accuracy, precision, recall, F1-score)

Step 1: Data Acquisition

- Load dataset D from Kaggle or other sources

- Split D into training (D_train) and testing (D_test) sets (e.g., 70% training, 30% testing)

Step 2: Data Augmentation

- For each image in D_train:

- Apply transformations (rotation, flipping, scaling, brightness adjustment)

- Save augmented images to D_augmented

- Combine D_train and D_augmented to create the final training set (D_final_train)

Step 3: Preprocessing

- For each image in D_final_train and D_test:

- Resize images to 227 × 227 pixels

- Normalize pixel values to range [0, 1]

Step 4: Load Pre-Trained Models

• Load Inception-V3 and Xception models with pre-trained weights (e.g., from ImageNet)

• Remove the final classification layer from both models

Step 5: Transfer Learning

- For each model (Inception-V3 and Xception):

- Add a new fully connected layer with SoftMax activation for 4-class classification

- Freeze initial layers and train only the new layers on D_final_train

Step 6: Ensemble Model Creation

- Combine predictions from Inception-V3 and Xception using weighted averaging or stacking

- Train a meta-classifier (e.g., logistic regression) on validation set prediction

Step 7: Training

- Train the ensemble model on D_final_train

- Use Adam optimizer with learning rate = 0.0001

- Apply early stopping to prevent overfitting

Step 8: Evaluation

- Evaluate the ensemble model on D_test

- Compute performance metrics: accuracy, precision, recall, F1-score

Step 9: Testing

- Test the model on unseen MRI images

- Generate classification results and confidence scores

Step 10: Output Results

- Display classification results and performance metrics

- Save the trained model for future use

14. Finish