This project implements a deep learning model to detect metastatic cancer in medical image patches. The model is trained to analyze small image patches derived from larger digital pathology scans, helping in the detection of cancerous cells.
The main goal of this project is to build a cancer image detection algorithm using a convolutional neural network (CNN) to process histopathology images and classify whether they contain metastatic tissue.
- Use of deep learning with PyTorch to process medical images.
- GPU compatibility check and usage for faster model training.
- Extensive data preprocessing, augmentation, and training pipeline setup.
Before running the project, ensure that you have the following installed:
- Python 3.x
- PyTorch and related libraries
- Additional dependencies listed in the
requirements.txt
(optional)
You can install the necessary libraries by running the following command:
pip install -r requirements.txt
Alternatively, for specific libraries (like PyTorch), run:
pip install torch torchvision
The model takes advantage of GPU acceleration if a compatible GPU is available. The script checks for GPU availability:
from torch.cuda import is_available, get_device_name
if is_available():
print(f"The environment has a compatible GPU ({get_device_name()}) available.")
else:
print("The environment does NOT have a compatible GPU model available.")
The dataset used for training and evaluation consists of histopathology images. You will need to prepare your dataset in the required format, ensuring that the images are correctly labeled for cancerous and non-cancerous tissue.
The dataset is preprocessed using various image augmentation techniques to improve the generalization of the model. You can adjust augmentation strategies in the notebook.
The model used is a convolutional neural network (CNN) implemented in PyTorch. It is designed to:
- Extract features from input medical images.
- Classify the images into different categories based on the presence of metastatic tissue.
You can modify or extend the architecture based on specific requirements or add transfer learning if needed.
To train the model, you can run the training section in the notebook, which includes:
- Loading the dataset.
- Defining the CNN model architecture.
- Training the model on the dataset with specified hyperparameters.
The notebook includes evaluation metrics such as accuracy, precision, recall, and the confusion matrix to measure the model’s performance on the validation set.
- Clone the repository:
git clone https://github.com/Precioux/Cancer-Image-Detection.git
- Install dependencies:
pip install -r requirements.txt
- Run the notebook to preprocess the dataset, train the model, and evaluate the results.
- Experiment with deeper CNN architectures.
- Fine-tune the model using transfer learning.
- Expand the dataset to improve model accuracy.
- Deploy the model in a web application for real-time cancer detection.
Feel free to open issues or pull requests for any improvements or bug fixes.
This project is licensed under the MIT License.