This project focuses on the binary classification of Invasive Ductal Carcinoma (IDC), the most common type of breast cancer, using histopathological images. The study compares the performance of a Custom Convolutional Neural Network (CNN) built from scratch with a pre-trained VGG-16 transfer learning model.
The dataset used is the "Breast Histopathology Images" from Kaggle. A balanced subset of 10,000 RGB image patches (
The entire workflow is implemented in PyTorch within a single Jupyter Notebook.
- Custom CNN: Designed from scratch with 3 Convolutional blocks, Max Pooling, ReLU activation, 50% Dropout, and Fully Connected layers.
- VGG-16 (Transfer Learning): Utilized pre-trained ImageNet weights. The final classifier layer was fine-tuned for this specific medical imaging task.
- Generative AI Integration: Generative AI (Gemini) was utilized to research and implement advanced optimization strategies, specifically applying "Differential Learning Rates" to further enhance the VGG-16 model's performance during fine-tuning.
Both models were trained on an NVIDIA T4 GPU (Google Colab).
- Custom CNN: Achieved 85.13% Validation Accuracy.
- VGG-16: Achieved 83.60% Validation Accuracy. The Custom CNN adapted more quickly to the specific tissue details within the limited epoch count (5 epochs).
-
Clone this repository:
git clone https://github.com/hakkikeman/Breast-Cancer-Detection-PyTorch.git cd Breast-Cancer-Detection-PyTorch -
Download the dataset from Kaggle and update the data path in the notebook.
-
Install the required dependencies:
pip install -r requirements.txt
-
Open and run all cells in
breast_cancer_classification_cnn_vs_vgg16.ipynb.