Model Architecture

CNN Architecture Overview

This project leverages the EfficientNet-B0 architecture, a convolutional neural network known for achieving high performance with fewer parameters. EfficientNet-B0 was selected due to its balance of speed, accuracy, and scalability, which is crucial for real-time inference in a web-based diagnostic tool.

The model utilizes transfer learning from ImageNet weights, with the base layers frozen during early training. A custom classification head was added to the model, composed of global average pooling, dropout regularization, and fully connected layers to classify three categories: benign, adenocarcinoma, and squamous cell carcinoma.

Key Components

  • Input Layer: Preprocessed 224x224 RGB images
  • Feature Extraction: Pretrained EfficientNet-B0 base
  • Dropout Layers: 0.2 and 0.5 dropout rates to reduce overfitting
  • Classification Head: Dense → Dropout → Dense with softmax output
  • Activation: ReLU in intermediate layers, softmax at output
  • Loss Function: Categorical crossentropy
  • Optimizer: Adam with learning rate warm-up and decay

Development Environment

Hardware Configuration

  • Training: Google Colab Pro with NVIDIA T4 and A100 GPUs
  • RAM: 16 GB for model development and training sessions
  • Testing and Deployment: Local CPU and browser for performance validation

Software Stack

Python 3.8
TensorFlow 2.7
Flask 2.0
OpenCV 4.5
NumPy 1.21
Pandas 1.3
Matplotlib 3.4
Pillow 8.4
Gunicorn (for deployment)

Deployment Notes

The final model and web interface are bundled into a lightweight Flask application. Grad-CAM and saliency visualizations are computed dynamically using in-memory buffers to avoid disk writes — an important consideration for deployment in restricted environments like Heroku or Docker containers.

Model Performance

The final model was evaluated on a hold-out test set containing a balanced distribution of real histopathological images from both LC25000 and LungHist7000 datasets. Metrics were calculated using scikit-learn’s classification tools. Data augmentation included horizontal/vertical flips, rotation, and color jittering.

Accuracy

98.2%

Precision

97.9%

Recall

97.6%

F1 Score

97.7%

Class-wise Accuracy

  • Benign: 99.1%
  • Adenocarcinoma: 97.3%
  • Squamous Cell Carcinoma: 98.0%

Explainability Features

The diagnostic interface includes interactive support for saliency maps and Grad-CAM overlays. These help users visually verify which areas of the tissue image contributed to the AI's decision, improving trust and interpretability — a key priority in clinical settings.