sclera-segmentation-with-ui
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (16.9%) to scientific vocabulary
Repository
Basic Info
- Host: GitHub
- Owner: tayden1990
- License: mit
- Language: Python
- Default Branch: main
- Size: 5.03 MB
Statistics
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Metadata Files
Readme.md
Sclera Segmentation with UI
Explore the key interfaces of our Sclera Segmentation tool
An interactive application for training, evaluating, and running inference on sclera segmentation models using PyTorch and Gradio.
Overview
This project provides a complete end-to-end solution for sclera segmentation in eye images, with a user-friendly graphical interface built using Gradio. The application allows researchers and practitioners to train custom models on their own datasets, evaluate model performance, and run inference on new images without requiring programming knowledge.
Features
- Interactive web-based UI with Gradio for easy use without coding
- End-to-end workflow from training to inference
- Real-time training visualization with progress tracking
- Model evaluation with comprehensive metrics
- One-click inference on new images
- GPU acceleration support for faster processing
- Support for custom datasets with flexible directory structures
Installation
Requirements
- Python 3.8+
- PyTorch 1.10+
- CUDA-compatible GPU (recommended)
Setup
Clone the repository:
bash git clone https://github.com/tayden1990/Sclera-Segmentation-with-UI.git cd Sclera-Segmentation-with-UICreate a virtual environment (recommended): ```bash python -m venv venv
On Windows
venv\Scripts\activate
On Linux/Mac
source venv/bin/activate ```
Install the required dependencies:
bash pip install -r requirements.txt
Usage
Starting the Application
bash
python app.py
This will start the Gradio interface, which you can access through your web browser (typically at http://127.0.0.1:7860).
Application Tabs
The application consists of four main tabs:
- Train Model - Train new sclera segmentation models
- Inference - Run inference on new images using trained models
- Evaluation - Evaluate model performance on test datasets
- Info - View system information and dataset statistics
Screenshots
Training Tab
The training interface allows you to configure model parameters and monitor training progress
Inference Tab
Upload images and run inference with trained models
Evaluation Tab
Comprehensive model evaluation with detailed metrics
Info Tab
System information and dataset statistics
Dataset Structure
The application expects your data to be organized as follows:
sclera_dataset/
├── train/
│ ├── images/
│ └── masks/
├── val/
│ ├── images/
│ └── masks/
└── test/
├── images/
└── masks/
- Images should be in JPG or PNG format
- Masks should be binary images (white for sclera, black for background)
Training
The training tab allows you to:
- Set the number of epochs
- Adjust batch size
- Configure image size for training
- Use a subset of the training data (useful for quick experiments)
- Name your model
- Start training with a single click
- Monitor training progress in real-time
Training is performed using PyTorch's implementation of Mask R-CNN with a ResNet-50 backbone. The model is fine-tuned for sclera segmentation specifically.
Inference
The inference tab allows you to:
- Upload a new image
- Select a trained model
- Adjust the detection threshold
- Run inference with a single click
- View and download the segmentation results
Evaluation
The evaluation tab allows you to:
- Select a model to evaluate
- Choose a test dataset
- Set evaluation parameters
- Run comprehensive evaluation
- View detailed performance metrics including IoU, precision, recall, and F1 score
Command Line Usage
For advanced users, you can also use the command-line scripts directly:
```bash
Training a new model
python train.py --epochs 20 --batch-size 2 --image-size 256
Evaluating models
python evaluatetorchmodels.py --checkpoint-dir logs/yourmodeldir --test-dir sclera_dataset/test
Running inference
python inferencetorch.py --weights logs/yourmodeldir/checkpoint019.pth --image your_image.jpg ```
Project Structure
Sclera-Segmentation-with-UI/
├── app.py # Main application with Gradio UI
├── train.py # Training script
├── inference_torch.py # Inference script
├── evaluate_torch_models.py # Evaluation script
├── sclera_dataset_torch.py # Dataset handling
├── utils.py # Utility functions
├── requirements.txt # Dependencies
├── logs/ # Directory for trained models
├── sclera_dataset/ # Dataset directory
├── temp/ # Temporary files
└── results/ # Evaluation results
Technical Details
Model Architecture
The segmentation model is based on Mask R-CNN with a ResNet-50 backbone. The model is trained to segment the sclera (white part of the eye) in images.
Performance Considerations
- Training on a GPU is highly recommended
- For larger datasets, increase the batch size as your GPU memory allows
- Image size significantly affects both training time and segmentation quality
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Author & Contact
Taher Akbari Saeed
Postgraduate Student in Hematology and Blood Transfusion
Department of Oncology, Hematology, and Radiotherapy
Institute of Postgraduate Education,
Pirogov Russian National Research Medical University (RNRMU), Russia
- Email: taherakbarisaeed@gmail.com
- GitHub: tayden1990
- Telegram: tayden2023
- ORCID: 0000-0002-9517-9773
Acknowledgments
- PyTorch and TorchVision teams for providing the core deep learning frameworks
- Gradio team for simplifying the creation of web interfaces for ML models
Owner
- Login: tayden1990
- Kind: user
- Repositories: 1
- Profile: https://github.com/tayden1990
Citation (CITATION.cff)
cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Akbari Saeed"
given-names: "Taher"
orcid: "https://orcid.org/0000-0002-9517-9773"
title: "Sclera Segmentation with Mask R-CNN"
version: 1.0.0
date-released: 2025
url: "https://github.com/tayden1990/Sclera-Segmentation-with-UI"
GitHub Events
Total
- Push event: 5
- Create event: 2
Last Year
- Push event: 5
- Create event: 2
Dependencies
- gradio >=3.0.0
- matplotlib >=3.4.0
- numpy >=1.19.0
- opencv-python >=4.5.0
- pillow >=8.0.0
- scikit-image >=0.18.0
- scikit-learn >=0.24.0
- torch >=1.10.0,<2.0.0
- torchvision >=0.11.0,<0.15.0
- tqdm >=4.60.0