PolypX is a deep learning-based solution for polyp segmentation in colonoscopy images. It leverages the DeepLab v3+ architecture to accurately detect and outline polyp regions — a critical step in the early detection and diagnosis of colorectal cancer.
- DeepLab v3+ Architecture: Utilizes the powerful DeepLab v3+ model for accurate and efficient semantic segmentation of polyps.
- Data Augmentation: Applies a variety of augmentation techniques to improve robustness and reduce overfitting.
- Custom Data Loader: Includes a custom data loader tailored for the CVC-ClinicDB dataset.
- Comprehensive Evaluation Metrics: Supports Dice Coefficient and Intersection over Union (IoU) for reliable performance measurement.
- Pre-trained Weights: Provides a ready-to-use pre-trained model located in the
checkpoint/directory for quick inference.
- Python 3.8 or higher
- Linux, macOS, or Windows
- (Optional) CUDA-enabled GPU for faster training
-
Clone the repository:
git clone https://github.com/A-A7med-i/PolypX.git cd PolypX -
Create a virtual environment (recommended):
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install the required dependencies:
pip install -r requirements.txt
The model is trained on the CVC-ClinicDB dataset. Before running the pipeline, ensure your data is structured as follows:
data/
└── CVC-ClinicDB/
├── Original/ # Original colonoscopy images
│ ├── 1.tif
│ └── ...
└── Ground Truth/ # Segmentation masks
├── 1.tif
└── ...You can train the model using the main training script from your terminal:
python -m src.pipeline.mainThis will start the training process using the configurations defined in the source code.
Once the model is trained, the best weights are saved to checkpoint/best_model_weights.pth. You can use these weights to make predictions on new images.
To perform inference, adapt the prediction logic from the src/pipeline/pipeline.py script.
Load the pre-trained weights and pass your images through the model to get the segmentation masks.
For more details about the pipeline, preprocessing, model architecture, training, and results, please refer to the docs/ folder. It contains step-by-step markdown files explaining each part of the project.
PolypX/
├── checkpoint/ # Stores model checkpoints
│ └── best_model_weights.pth # Best pre-trained weights
│
├── data/ # Dataset and metadata
│ ├── metadata.csv # Dataset annotations
│ ├── README.md # Dataset description
│ └── CVC-ClinicDB/ # Dataset folder
│ ├── Ground Truth/ # Segmentation masks
│ └── Original/ # Colonoscopy images
│
├── docs/ # Documentation
│ ├── 01_pipeline_overview.md
│ ├── 02_model_architecture.md
│ ├── 03_loss.md
│ ├── 04_metrics.md
│ ├── 05_training.md
│ └── 06_pipeline_results.md
│
├── src/ # Source code
│ ├── config/ # Configurations
│ │ └── constant.py
│ ├── data/ # Data handling
│ │ ├── custom_data.py
│ │ └── loader.py
│ ├── entities/ # Entity definitions
│ │ └── models.py
│ ├── loss/ # Loss functions
│ │ └── loss.py
│ ├── metrics/ # Evaluation metrics
│ │ └── metrics.py
│ ├── model/ # Model architectures
│ │ └── model.py
│ ├── pipeline/ # Pipeline scripts
│ │ ├── main.py
│ │ └── pipeline.py
│ ├── training/ # Training loop
│ │ └── trainer.py
│ └── utils/ # Utility functions
│ └── helper.py
│
├── requirements.txt # Dependencies
├── setup.py # Setup script
├── README.md # Project documentation
├── .gitignore # Ignore rules
└── LICENSE # LicenseContributions are welcome! If you have any ideas, suggestions, or bug reports, please open an issue or submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.