Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Index your code
hub
/
github.com/FeiFeiAlbert/ophthalmic-segmentation
/ functions
Functions
43 in github.com/FeiFeiAlbert/ophthalmic-segmentation
⨍
Functions
43
◇
Types & classes
8
↓ 5 callers
Function
calculate_metrics
Calculate Dice and IoU metrics per class
scripts/train_v16.py:196
↓ 2 callers
Method
__init__
(self, smooth=1.0)
ophthalmic_segmentation/losses.py:24
↓ 2 callers
Function
create_colored_mask
Create colored visualization of segmentation mask
scripts/predict.py:105
↓ 2 callers
Function
inference_single
Run inference on a single image Args: model: trained segmentation model image_path: path to input image ou
scripts/predict.py:160
↓ 2 callers
Function
predict_with_tta
4-direction TTA: original + horizontal flip + vertical flip + both flips Average predictions for more robust results
scripts/train_v16.py:224
↓ 1 callers
Method
_augment
Data augmentation for training
scripts/train_v16.py:173
↓ 1 callers
Method
_match_files
Match image files with their corresponding label JSON files
scripts/train_v16.py:111
↓ 1 callers
Method
_predict_tta
Test-time augmentation prediction
ophthalmic_segmentation/__init__.py:112
↓ 1 callers
Method
_to_tensor
Convert numpy array to torch tensor
ophthalmic_segmentation/__init__.py:105
↓ 1 callers
Function
create_mask_from_polygons
Create segmentation mask from polygon annotations
scripts/train_v16.py:86
↓ 1 callers
Method
create_model
Create segmentation model
ophthalmic_segmentation/__init__.py:35
↓ 1 callers
Function
inference_batch
Run inference on all images in a directory
scripts/predict.py:199
↓ 1 callers
Function
lovasz_grad
(gt_sorted)
ophthalmic_segmentation/losses.py:53
↓ 1 callers
Function
lovasz_softmax_flat
(probas, labels)
ophthalmic_segmentation/losses.py:64
↓ 1 callers
Function
main
()
scripts/predict.py:226
↓ 1 callers
Function
main
()
scripts/train_v16.py:404
↓ 1 callers
Function
parse_labelme_json
Parse LabelMe JSON annotation file
scripts/train_v16.py:74
↓ 1 callers
Function
postprocess_mask
Resize mask back to original size
scripts/predict.py:95
↓ 1 callers
Function
predict_with_tta
4-direction TTA: average predictions from original and flipped versions
scripts/predict.py:47
↓ 1 callers
Function
preprocess_image
Load and preprocess image
scripts/predict.py:76
↓ 1 callers
Function
train_epoch
Train for one epoch
scripts/train_v16.py:255
↓ 1 callers
Function
validate
Validate model
scripts/train_v16.py:285
↓ 1 callers
Function
validate_with_tta
Validate with TTA on specified indices
scripts/train_v16.py:304
↓ 1 callers
Method
visualize
Create overlay visualization Args: image: PIL Image or numpy array mask: segmentation mask
ophthalmic_segmentation/__init__.py:139
↓ 1 callers
Function
visualize_all_samples
Visualize all samples in dataset
scripts/train_v16.py:353
↓ 1 callers
Function
visualize_prediction
Visualize single prediction
scripts/train_v16.py:320
↓ 1 callers
Function
visualize_results
Visualize original image, mask, and overlay
scripts/predict.py:127
Method
__getitem__
(self, idx)
scripts/train_v16.py:135
Method
__init__
(self, image_dir, label_dir, img_size=448, num_classes=3, augment=False, image_size_limit=2
scripts/train_v16.py:100
Method
__init__
(self, model=None, device=None)
ophthalmic_segmentation/__init__.py:27
Method
__init__
(self, alpha=1, gamma=2)
ophthalmic_segmentation/losses.py:11
Method
__init__
(self, focal_weight=0.3, dice_weight=0.4, lovasz_weight=0.3)
ophthalmic_segmentation/losses.py:85
Method
__len__
(self)
scripts/train_v16.py:132
Function
create_overlay
Create overlay of image and segmentation mask
scripts/predict.py:116
Method
forward
(self, pred, target)
ophthalmic_segmentation/losses.py:16
Method
forward
(self, pred, target)
ophthalmic_segmentation/losses.py:28
Method
forward
(self, probas, labels)
ophthalmic_segmentation/losses.py:46
Method
forward
(self, pred, target)
ophthalmic_segmentation/losses.py:94
Method
load_checkpoint
Load model weights from checkpoint
ophthalmic_segmentation/__init__.py:63
Function
load_image
Load and preprocess image
ophthalmic_segmentation/__init__.py:165
Function
load_model
Load a new segmentation model
ophthalmic_segmentation/__init__.py:211
Method
predict
Predict segmentation mask for an image Args: image: PIL Image or numpy array (H, W, 3) input_size: Targ
ophthalmic_segmentation/__init__.py:72
Function
visualize_results
Visualize segmentation results
ophthalmic_segmentation/__init__.py:172