This repository contains code for a deep learning model that detects cancerous cells in histopathologic images using computer vision. The model utilizes ViT (Vision Transformer)
and CovNExt (Convolutional Neural Network with Extra-Width and Random-Erasing Augmentation)
architectures for training.
- Python 3.7+
- PyTorch
- Transformers library
- NumPy
- Pandas
- Matplotlib
- Seaborn
- Tqdm
- Pillow
The dataset used for training and evaluation is the PatchCamelyon dataset, which contains 327,680 color images of size 96x96 pixels. The dataset is split into training and testing subsets with a ratio of 90:10.
The dataset can be loaded using the Hugging Face's datasets library by calling load_dataset('patch_camelyon')
. The images in the dataset are of size 96x96 pixels, but to be used with the ViT model, they need to be resized to 224x224 pixels.
The train.py
script trains the model using the CovNExt
and ViT
architectures. The script loads the dataset, splits it into training and validation sets, processes the examples using the transform function, and trains the model using PyTorch
.
The eval.py
script evaluates the trained model on the test set. The script loads the test set, processes the examples using the process_example function, and computes the accuracy of the model.
The model achieves an accuracy of 92.03%
on the test set.
The combination of CovNExt
and ViT
architectures provides a powerful model for histopathologic cancer detection using computer vision. The model achieves high accuracy on the test set and can be used for automated diagnosis of cancerous cells in histopathologic images.