File size: 3,089 Bytes
ffba4ae
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/usr/bin/env bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

# =========================
# Edit parameters below, then run:
#   bash run_interface_b_single_pair.sh
# =========================

# Optional: load weights from Hugging Face model repos (recommended).
# 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"
# export CARE_WEIGHT_BROAD_REPO_ID="AIMClab-RUC/UNet_DCP_1024"
# Backward-compatible single bundled repo:
# export CARE_WEIGHTS_REPO_ID="your-name/care-weights"

# Input images (required)
OCTA_IMAGE="${SCRIPT_DIR}/examples/octa.jpg"
WFCFP_IMAGE="${SCRIPT_DIR}/examples/wfcfp.jpg"

# Output directory
OUTPUT_DIR="${SCRIPT_DIR}/Output/demo_single_pair"

# Step1 vessel segmentation model: CARe-VesselSeg / Broad domain retinal vessel segmentation [ICASSP 2025]
SEG_MODEL="CARe-VesselSeg"

# Registration mode:
# - interface_b_retry: Interface-B logic (includes Step2 + retry routes)
# - direct_no_crop: skip Step2 and cropping, run Step3 directly after Step1 (suitable for CFP-CFP)
REGISTRATION_MODE="interface_b_retry"

# Step1 broad-domain segmentation modality (effective only when SEG_MODEL=\"Broad domain retinal vessel segmentation [ICASSP 2025]\")
# AUTO: infer from filename (contains OCTA/_001 -> OCTA, otherwise CFP)
QUERY_MODALITY="AUTO"   # AUTO / CFP / OCTA
REFER_MODALITY="AUTO"   # AUTO / CFP / OCTA

# Step3 inlier method: RANSAC / LMEDS
INLIER_METHOD="LMEDS"

# Step3 retry trigger threshold (filtered inlier count)
RETRY_FILTERED_INLIER_THRESHOLD="20"

# Device: auto / cpu / cuda:0
DEVICE="auto"

# Disable non-essential debug artifact generation/writing: 1=on, 0=off
DISABLE_NONSESSENTIAL_IO="1"

# Step3 config and weights
CONFIG_PATH="${SCRIPT_DIR}/../Step3_Reg/Src/config/test.yaml"
MODEL_PATH="${SCRIPT_DIR}/../Step3_Reg/Src/save/crop_vseg_vessel_111.pth"

# Overwrite output if exists: 1=on, 0=off
FORCE_RERUN="1"

# Keep Step3 attempt route directories: 1=keep, 0=remove
KEEP_ATTEMPT_DIRS="0"

if [[ ! -f "${OCTA_IMAGE}" ]]; then
  echo "OCTA_IMAGE does not exist: ${OCTA_IMAGE}" >&2
  exit 2
fi
if [[ ! -f "${WFCFP_IMAGE}" ]]; then
  echo "WFCFP_IMAGE does not exist: ${WFCFP_IMAGE}" >&2
  exit 2
fi

ARGS=(
  --octa_image "${OCTA_IMAGE}"
  --wfcfp_image "${WFCFP_IMAGE}"
  --output_dir "${OUTPUT_DIR}"
  --seg_model "${SEG_MODEL}"
  --registration_mode "${REGISTRATION_MODE}"
  --query_modality "${QUERY_MODALITY}"
  --refer_modality "${REFER_MODALITY}"
  --inlier_method "${INLIER_METHOD}"
  --retry_filtered_inlier_threshold "${RETRY_FILTERED_INLIER_THRESHOLD}"
  --device "${DEVICE}"
  --config_path "${CONFIG_PATH}"
  --model_path "${MODEL_PATH}"
)

if [[ "${FORCE_RERUN}" == "1" ]]; then
  ARGS+=(--force_rerun)
fi
if [[ "${KEEP_ATTEMPT_DIRS}" == "1" ]]; then
  ARGS+=(--keep_attempt_dirs)
fi
if [[ "${DISABLE_NONSESSENTIAL_IO}" == "1" ]]; then
  ARGS+=(--disable_nonessential_io)
fi

exec python "${SCRIPT_DIR}/run_interface_b_single_pair.py" "${ARGS[@]}"