This repository contains code and resources for segmenting abnormal regions in chest X-ray images using deep learning techniques. The goal is to accurately identify pneumonia, tumors, or other lung-related abnormalities.
- The dataset used in this project is sourced from Kaggle and is named
nikhilpandey360/chest-xray-masks-and-labels
. - It includes original chest X-ray images along with corresponding lung masks.
- Ensure you have downloaded the dataset before proceeding.
-
Data Augmentation:
- Apply data augmentation techniques (e.g., flipping, rotation) to increase dataset diversity.
- Augmented data helps improve model generalization.
-
Preprocessing:
- Crop or resize images to focus on the lung area.
- Normalize pixel values to a consistent range (e.g., [0, 1]).
- We experimented with two residual ResNets:
- Conventional ResNet:
- Utilizes standard CNN layers.
- Captures hierarchical features through residual connections.
- Depthwise Separable ResNet:
- Employs depthwise separable convolutions for efficiency.
- Reduces the number of parameters while maintaining performance.
- Conventional ResNet:
- We assessed model performance using the Dice coefficient (F1 score).
- This metric quantifies the overlap between predicted and true positive regions.
- Created segmentation figures to visualize model predictions.
- Compare predicted masks with actual abnormalities in X-rays.
- Fine-tune hyperparameters, explore additional architectures, or incorporate other evaluation metrics.
- Continue refining the model based on performance and domain-specific requirements.
-
Download Kaggle API:
- Install the Kaggle API by running
pip install kaggle
.
- Install the Kaggle API by running
-
Kaggle API Token:
- Go to your Kaggle account settings and generate an API token.
- Save the token as
kaggle.json
in the root directory of this repository.
-
Download Dataset:
- Use the Kaggle API to download the dataset:
kaggle datasets download -d nikhilpandey360/chest-xray-masks-and-labels
- Use the Kaggle API to download the dataset:
-
Upload Kaggle API Token to Colab/Notebook:
- If using Colab or Jupyter Notebook, upload the
kaggle.json
token to your environment. - Use the following code snippet:
from google.colab import files files.upload()
- If using Colab or Jupyter Notebook, upload the
-
Unzip Dataset:
- Unzip the downloaded dataset:
unzip chest-xray-masks-and-labels.zip
- Unzip the downloaded dataset:
Feel free to explore, contribute, and enhance this project! 🌟👩⚕️🔍