Spaces:
Sleeping
Sleeping
A newer version of the Gradio SDK is available: 6.14.0
InferCode: Single-Pair Interface-B Full Pipeline
This directory provides an inference entry that runs the full Interface-B pipeline on one image pair (OCTA + wfCFP): Step1, Step2, and Step3.
Pipeline:
- Step1 vessel segmentation (
CARe-VesselSegorBroad domain retinal vessel segmentation [ICASSP 2025]) - Step2 optic-disc/fovea detection (
wfCFP + OCTA) - Step3 registration (primary + retry route selection)
Run
Activate environment first:
source "$(conda info --base)/etc/profile.d/conda.sh"
conda activate MMR
Then run:
cd /path/to/CAReReleaseProject/Huggingface/InferCode
bash run_interface_b_single_pair.sh
run_interface_b_single_pair.sh is configured in-script. Edit variables inside the shell script instead of appending many CLI flags.
Key Parameters
SEG_MODEL={CARe-VesselSeg,Broad domain retinal vessel segmentation [ICASSP 2025]}CARe-VesselSeg: original vessel segmentation modelBroad domain retinal vessel segmentation [ICASSP 2025]: broad-domain vessel segmentation model
REGISTRATION_MODE={interface_b_retry,direct_no_crop}interface_b_retry: Interface-B flow (Step2 coordinates + retry routes)direct_no_crop: skip Step2 and cropping, go Step1 -> Step3 directly (suitable for CFP-CFP)
QUERY_MODALITY / REFER_MODALITY={AUTO,CFP,OCTA}- Used when
SEG_MODEL=Broad domain retinal vessel segmentation [ICASSP 2025] AUTO: infer from filename (OCTAor_001-> OCTA, otherwise CFP)
- Used when
- Auto-switch rule:
- If
interface_b_retryis requested but detected asCFP-CFP, it auto-switches todirect_no_crop
- If
INLIER_METHOD={RANSAC,LMEDS}: Step3 inlier filtering and polynomial fitting methodRETRY_FILTERED_INLIER_THRESHOLD: trigger retry when primary filtered inliers drop below this value (default20)DEVICE:auto/cuda:0/cpu(defaultauto)
Main Outputs
Default output root is InferCode/Output/single_pair_<timestamp>, including:
results/vessels/octa_vessel.pngwfcfp_vessel.png
results/keypoints/filtered_pairs_norm.txtfiltered_pairs_input_space_pixels.txtfiltered_pairs_restored_space_pixels.txtfiltered_pairs_input_space_vis.pngfiltered_pairs_restored_space_vis.png
results/overlays/vessel_overlay.pngraw_overlay.png
results/polynomial/quadratic_polynomial_params.json- quadratic polynomial coefficients
results/visualizations/summary_board.png- summary visualization board
summary.json- run summary (routing, metrics, and output paths)
Weight Loading via Hugging Face Snapshot
For lightweight deployment, weights can be hosted in Hugging Face Model repos.
Recommended: separate repos for each stage.
export CARE_WEIGHT_STEP1_REPO_ID="Hongyang-Li/CARe_VesselSeg"
export CARE_WEIGHT_STEP2_REPO_ID="Hongyang-Li/CARe_OpticDiscFoveaDetection"
export CARE_WEIGHT_STEP3_REPO_ID="Hongyang-Li/CARe_Reg"
# Optional: override broad-domain vessel model repo
export CARE_WEIGHT_BROAD_REPO_ID="AIMClab-RUC/UNet_DCP_1024"
Optional:
CARE_WEIGHT_STEP1_REVISIONCARE_WEIGHT_STEP2_REVISIONCARE_WEIGHT_STEP3_REVISIONCARE_WEIGHT_BROAD_REVISIONCARE_WEIGHTS_CACHE_DIRCARE_WEIGHT_*_RELfor per-file relative path overrides
Backward-compatible single bundled repo mode is also supported through:
CARE_WEIGHTS_REPO_IDCARE_WEIGHTS_REVISION