A PyTorch library for vessel and fundus image analysis (simplified rewrite)
Project description
vascx_simplify
A PyTorch library for vessel and fundus image analysis, providing GPU-accelerated preprocessing and inference utilities for medical imaging tasks.
Note: This is a simplified rewrite of rtnls_vascx_models by Eyened.
AI Usage Disclaimer
This project was developed with significant assistance from AI tools (GitHub Copilot, ChatGPT, Claude) for code organization, refactoring, documentation, and packaging.
Features
- GPU-Accelerated Preprocessing: Fast fundus image contrast enhancement with mixed precision support
- Sliding Window Inference: Efficient inference for large images
- Ensemble Models: Segmentation, classification, regression, and heatmap-based models
- HuggingFace Integration: Easy model loading from HuggingFace Hub
- Minimal Dependencies: Uses fewer dependency libraries for easier installation and maintenance
Installation
pip install vascx_simplify
From source:
git clone https://github.com/kapong/vascx_simplify.git
cd vascx_simplify
pip install -e .
Requirements
- Python >= 3.12
- PyTorch >= 1.10.0
- kornia >= 0.6.0
- scikit-learn >= 1.0.0
- scipy >= 1.7.0
- numpy >= 1.21.0
- huggingface-hub >= 0.10.0
Usage Examples
Artery/Vein Segmentation
Segment arteries (red), veins (blue), and crossings (green) from fundus images:
from vascx_simplify import EnsembleSegmentation, VASCXTransform, from_huggingface
from PIL import Image
import torch
# Load model
model_path = from_huggingface('Eyened/vascx:artery_vein/av_july24.pt')
model = EnsembleSegmentation(model_path, VASCXTransform())
# Predict
rgb_image = Image.open('fundus.jpg')
prediction = model.predict(rgb_image) # Returns [B, H, W] with class values
Optic Disc Segmentation
Detect and segment the optic disc:
from vascx_simplify import EnsembleSegmentation, VASCXTransform, from_huggingface
from PIL import Image
model_path = from_huggingface('Eyened/vascx:disc/disc_july24.pt')
model = EnsembleSegmentation(model_path, VASCXTransform(512))
rgb_image = Image.open('fundus.jpg')
prediction = model.predict(rgb_image) # Returns [B, H, W] with class values
Fovea Detection
Locate the fovea center using heatmap regression:
from vascx_simplify import HeatmapRegressionEnsemble, VASCXTransform, from_huggingface
from PIL import Image
model_path = from_huggingface('Eyened/vascx:fovea/fovea_july24.pt')
model = HeatmapRegressionEnsemble(model_path, VASCXTransform())
rgb_image = Image.open('fundus.jpg')
prediction = model.predict(rgb_image) # Returns [B, M, 2] with (x, y) coordinates
fovea_x = prediction[0, 0, 0].item()
fovea_y = prediction[0, 0, 1].item()
Image Quality Assessment
Classify fundus image quality (Reject/Usable/Good):
from vascx_simplify import ClassificationEnsemble, VASCXTransform, from_huggingface
from PIL import Image
model_path = from_huggingface('Eyened/vascx:quality/quality.pt')
model = ClassificationEnsemble(model_path, VASCXTransform(have_ce=False))
rgb_image = Image.open('fundus.jpg')
prediction = model.predict(rgb_image) # Returns [B, 3] with quality scores (already softmaxed)
# Get probabilities (already normalized)
q1_reject, q2_usable, q3_good = prediction[0].tolist()
License
MIT License - see LICENSE file for details.
Author
Phongphan Phienphanich garpong@gmail.com
Acknowledgments
This is a simplified rewrite of rtnls_vascx_models by Eyened.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vascx_simplify-0.1.3.tar.gz.
File metadata
- Download URL: vascx_simplify-0.1.3.tar.gz
- Upload date:
- Size: 20.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d7dcc03dcef840e81d31f80813e4b8873ae94d97eec5dfbc572ebeb49255328
|
|
| MD5 |
a1e4cfbfd76457cf4a88e8f349aa9470
|
|
| BLAKE2b-256 |
289d33abdd9e3327dbd2cf4ac2131d898c4ef5c57e3307b03490132ab8ed0c74
|
Provenance
The following attestation bundles were made for vascx_simplify-0.1.3.tar.gz:
Publisher:
build-and-publish.yml on kapong/vascx_simplify
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vascx_simplify-0.1.3.tar.gz -
Subject digest:
8d7dcc03dcef840e81d31f80813e4b8873ae94d97eec5dfbc572ebeb49255328 - Sigstore transparency entry: 659700904
- Sigstore integration time:
-
Permalink:
kapong/vascx_simplify@aaa82f4ad7cb65a8e7e1a2674e1e4b29600a9efc -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/kapong
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build-and-publish.yml@aaa82f4ad7cb65a8e7e1a2674e1e4b29600a9efc -
Trigger Event:
push
-
Statement type:
File details
Details for the file vascx_simplify-0.1.3-py3-none-any.whl.
File metadata
- Download URL: vascx_simplify-0.1.3-py3-none-any.whl
- Upload date:
- Size: 18.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d6ed824fd0811df39aa4007e1695a14e4957a640bae2d4fcdc87a32dff88f8b
|
|
| MD5 |
5f2c6d3e1f2867acb648624eb37be342
|
|
| BLAKE2b-256 |
b4d11f7aaaff9ca9e802fc67c30f712f569005b5110193a8bc086081a9a170e7
|
Provenance
The following attestation bundles were made for vascx_simplify-0.1.3-py3-none-any.whl:
Publisher:
build-and-publish.yml on kapong/vascx_simplify
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vascx_simplify-0.1.3-py3-none-any.whl -
Subject digest:
3d6ed824fd0811df39aa4007e1695a14e4957a640bae2d4fcdc87a32dff88f8b - Sigstore transparency entry: 659700918
- Sigstore integration time:
-
Permalink:
kapong/vascx_simplify@aaa82f4ad7cb65a8e7e1a2674e1e4b29600a9efc -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/kapong
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build-and-publish.yml@aaa82f4ad7cb65a8e7e1a2674e1e4b29600a9efc -
Trigger Event:
push
-
Statement type: