This project leverages advanced deep learning techniques, specifically Vision Transformers (ViTs) and UNetR architectures, to classify and segment breast cancer from ultrasound images. The solution utilizes the Breast Ultrasound Images (BUSI) dataset from Baheya Hospital, Cairo, Egypt.
- Overview
- Project Workflow
- Dataset
- Vision Transformers
- UNetR for Segmentation
- Model Results
- Usage
- Contributing
- Data Acquisition: Downloaded the BUSI dataset from Kaggle.
- Data Preprocessing: Performed data augmentation and preprocessing on the ultrasound images.
- Model Training: Implemented and trained models using Vision Transformers for classification and UNetR for segmentation.
- Evaluation: Assessed model performance and validated results using metrics and visualizations.
- Deployment: Integrated the trained models into a MERN stack application for real-time breast cancer detection and segmentation.
- Name: Breast Ultrasound Images (BUSI) Dataset
- Source: Baheya Hospital for Early Detection & Treatment of Women's Cancer, Cairo, Egypt
- Accessibility: Kaggle
- Description: The dataset contains ultrasound images and corresponding masks. It is divided into three classes: normal, benign, and malignant.
Vision Transformers (ViTs) are used to classify the ultrasound images into the specified categories. The ViT_B_16 model, a pretrained transformer, was used for this task.
- Architecture: Vision Transformer (ViT)
- Pretrained Model: ViT_B_16
- Training Accuracy: High accuracy achieved on the classification task.
- Prediction: Efficient in distinguishing between normal, benign, and malignant ultrasound images.
UNetR is employed for the segmentation of breast cancer in ultrasound images. The model architecture comprises:
- Transformer Encoder: Extracts features from the input images.
- CNN Decoder: Decodes the features to generate segmentation masks.
- Linear Layer: For linear transformations.
- Convolution Layer: For feature extraction.
- Deconvolution Layer: For upsampling and reconstruction of the image.
- Input Images: Ultrasound images of breast cancer.
- Actual Masks: Ground truth masks for segmentation.
- Predicted Masks: Generated by the UNetR model.
The UNetR model demonstrated robust performance in segmenting the breast cancer regions from ultrasound images. The workflow involved:
- Data Augmentation: Enhanced the training data by upsampling and other augmentation techniques.
- Passes: Multiple passes through the model for refining segmentation.
The Vision Transformer model achieved significant accuracy in classifying the ultrasound images into the correct categories.
The UNetR model produced detailed segmentation masks closely aligned with the actual masks. The results are visualized below:
- Input: Original ultrasound images.
- Actual: Ground truth segmentation masks.
- Predicted: Segmentation masks generated by the UNetR model.
To use this project, follow these steps:
- Clone the repository:
git clone https://github.com/Bharadwajreddy1406/Classification-of-breast-cancer-tumor-using-vision-transformer.git
- Navigate to the project directory:
cd Classification-of-breast-cancer-tumor-using-vision-transformer - Install the necessary dependencies:
pip install -r requirements.txt
- Download the BUSI dataset from Kaggle and place it in the data directory.
- Run the training scripts to train the models on the dataset.
- Use the provided scripts to evaluate the models and visualize the results.
We welcome contributions to improve the project. Please follow these steps to contribute:
- Fork the repository: Click the "Fork" button on the top right of the repository page to create a copy of the repository under your GitHub account.
- Create a new branch: Open your terminal or command prompt and navigate to the project directory. Then, create a new branch for your feature or bug fix:
git checkout -b feature-branch