cbct / configs /default.yaml
JulianHJR's picture
Add files using upload-large-folder tool
c4c5273 verified
Raw
History Blame Contribute Delete
6.89 kB
# ===================== ToothCanal-SDF default config =====================
paths:
# On AutoDL, the large data disk is /root/autodl-tmp (system disk /root is small).
hf_repo: "zgy0823/label"
raw_dir: "/root/autodl-tmp/toothcanal/data/raw"
proc_dir: "/root/autodl-tmp/toothcanal/data/processed"
out_dir: "/root/autodl-tmp/toothcanal/outputs"
# Drop the supplementary 21-30 TOOTH-label zip's contents here (see run notes).
# Files named by case number, e.g. 21.nii.gz ... 30.nii.gz (or a per-case folder).
extra_tooth_dir: "/root/autodl-tmp/toothcanal/extra_tooth_labels"
# Zips whose name contains any of these substrings are NOT downloaded/used.
skip_zip_substrings: ["36-40"]
label_scheme:
n_teeth: 28 # 28 tooth positions
canal_lo: 1 # canal/pulp labels: 1..28 (inner)
canal_hi: 28
body_lo: 29 # tooth-body labels: 29..56 (outer)
body_hi: 56
pair_offset: 28 # instance i: canal=label i, body=label i+28
pair_mode: geometric # geometric = assign each canal to the body it sits inside
# (robust to mis-numbered annotations; fixes 032/035/013/014).
# set to 'offset' to restore legacy canal=i / body=i+28 pairing.
preprocess:
spacing: [0.4, 0.4, 0.4] # mm; whole-volume working resolution (memory friendly)
clip_hu: [-1000, 3000] # intensity clip before normalization
descriptor_erode_iter: 3 # erosion iters to build separable tooth-core descriptors
# ---- canal cleaning ----
speck_min_voxels: 30 # remove connected components smaller than this (keeps real multi-canals)
closing_radius: 0 # 0 = no morphological closing (avoids canal dilation at 0.25mm).
# set to 1 only if your canals have many artifact-induced breaks.
fill_holes: true
split:
# Cases 1-30 -> training (5-fold CV). Cases 31-35 -> held-out eval.
# 36-40 has no usable data and is excluded.
train_range: [1, 30]
test_range: [31, 35]
exclude_range: [36, 99]
exclude_cases: [26] # 026 has tooth labels but NO canal labels (would teach
# the model "no canal" for 28 teeth). add 19,20 too if
# you want to drop the near-empty partial annotations.
n_folds: 5
seed: 42
stage1: # coarse semantic seg: 0 bg / 1 tooth / 2 canal / 3 descriptor-core
patch_size: [96, 96, 96]
batch_size: 2
num_classes: 4
channels: [16, 32, 64, 128, 256]
lr: 2.0e-4
max_epochs: 300
samples_per_volume: 4
val_interval: 10
use_descriptor: true # use class-3 cores for instance localization at inference
min_core_voxels: 80 # drop tiny spurious cores (false detections)
core_merge_mm: 3.0 # merge over-split cores whose centroids are <this apart
# (fixes Stage-1 one-tooth-as-many). 0 disables merging.
stage2: # per-tooth dual-SDF implicit reconstruction
roi_mm: 24.0 # MATCHES the current stage2.pt (trained at 24mm). do NOT raise
ckpt_name: stage2.pt # the current good model; retrain configs use a different name
roi_vox: 96 # 24/96 = 0.25 mm. matches current stage2.pt
roi_center: com # matches how the current checkpoint was trained
latent_dim: 64
enc_channels: [32, 64, 128] # U-Net encoder (fine+coarse local features)
feat_dim: 96 # per-point local feature width (was 64)
mlp_hidden: 384 # wider decoder (was 256)
mlp_layers: 6 # deeper decoder (was 5)
encoder_latent: true # predict latent z = enc(ROI) (generalizes to new cases)
points_per_tooth: 8192 # more query points (was 6144)
canal_point_frac: 0.45 # fraction near the canal surface
centerline_frac: 0.15 # extra fraction near the canal centerline
canal_weight: 3.0 # up-weight the small canal (was 2.5)
near_surface_ratio: 0.65
near_surface_sigma_mm: 0.5
sdf_clamp_mm: 2.0
occ_tau_mm: 0.3
loss_weights:
sdf: 1.0
eikonal: 0.1
occ: 1.0
normal: 0.15
nest: 4.0
prior: 1.0e-3
centerline: 0.2 # softened clDice continuity (was 0.5, caused phantom blobs)
smoothness: 0.5 # Duan-2021-style anti-phantom / volume control
order_weight: 1.0 # weight of the hard SDF-ordering containment term
lr: 4.0e-4
lr_latent: 1.0e-3
lr_min: 1.0e-5 # cosine anneal floor
batch_teeth: 3 # local-feature grids use more memory
max_epochs: 700 # deeper run for the bigger model
margin_mm: 0.2 # containment margin
augment: true # random 3D flips + 90-deg rotations (small-data regime)
tto: # test-time optimization of the latent code
steps: 500 # was 200 -- helps the long-tail cases (032/035)
lr: 5.0e-3
infer:
grid: 128 # was 96 -- finer marching cubes (smoother thin canals)
mc_level: -0.2 # legacy fallback (used if the split knobs below are absent)
mc_level_tooth: 0.0 # Tier 1: tooth meshed at GT level (0.0) -> removes -0.12 undersize
mc_level_canal: -0.2 # canal body; scan -0.2/-0.25/-0.3 against signed_rvd (Tier 2)
tooth_watertight_postprocess: true # tooth: keep largest component + fill holes (good)
canal_watertight_postprocess: false # canal: do NOT fill -> preserves apex foramen + fine branches (Tier 2)
pad_roi: true # pad the SDF grid border so MC closes boundary openings
roi_source: "oracle" # "oracle"=GT instances (upper bound); "predicted"=Stage-1 drives ROIs
use_tto: false # main results use NO test-time optimization (avoids GT leakage)
canal_min_component_frac: 0.02 # 0.08->0.02 (Tier 2): keep small apical branches; rely on
# largest (removes SDF bridge stubs; lower it if real thin
# accessory canals are being discarded)
eval:
n_surface_samples: 30000
apex_mm: 3.0 # apical region size (mm) for root-tip-only canal metrics
gt_wise_predicted: true # predicted eval: score 1 best prediction per GT tooth
gt_roi_vox: 144 # GT meshed at 24/144=0.167mm, FIXED regardless of model,
gt_grid: 144 # so 96- and 144-voxel models are compared on the SAME GT