GenSeg-Baselines / code /scripts /nnunet_predict_eval_remaining.sh
MaybeRichard's picture
Upload folder using huggingface_hub
057ec4b verified
Raw
History Blame Contribute Delete
1.74 kB
#!/bin/bash
# Bulk predict-on-test + 7-metric eval for the 6 remaining nnU-Net datasets
# (IDs 005-010, each fold 0/1/2). Splits work across the two idle A100s (#4,#5).
set -u
cd /home/wzhang/LSC/Code/NPJ
source /opt/anaconda3/etc/profile.d/conda.sh
conda activate nnunet
export CUDA_DEVICE_ORDER=PCI_BUS_ID
export nnUNet_raw=/home/wzhang/LSC/Code/NPJ/nnunet_workspace/raw
export nnUNet_preprocessed=/home/wzhang/LSC/Code/NPJ/nnunet_workspace/preprocessed
export nnUNet_results=/home/wzhang/LSC/Code/NPJ/nnunet_workspace/results_nnunet
DATA_ROOT=/home/wzhang/LSC/Dataset/Segmentation/processed_unified
PRED=/home/wzhang/LSC/Code/NPJ/nnunet_workspace/predTs
run_ds () {
local gpu=$1; shift
for spec in "$@"; do
IFS=: read -r id ds proto <<< "$spec"
dsname=$(printf "Dataset%03d_%s_%s" "$id" "$ds" "$proto")
for f in 0 1 2; do
outdir=$PRED/d${id}_f${f}
mkdir -p "$outdir"
echo "[predict] gpu=$gpu $dsname fold$f -> $outdir"
CUDA_VISIBLE_DEVICES=$gpu nnUNetv2_predict \
-i "$nnUNet_raw/$dsname/imagesTs" -o "$outdir" \
-d "$id" -c 2d -f "$f" -tr nnUNetTrainer_250epochs --disable_tta \
> "$outdir/predict.log" 2>&1
echo "[eval] $dsname fold$f"
python framework/nnunet_eval.py --data_root "$DATA_ROOT" \
--dataset "$ds" --protocol "$proto" --raw "$nnUNet_raw" \
--dataset_id "$id" --fold "$f" --pred_dir "$outdir" \
--arch nnunet --exp_name baselines > "$outdir/eval.log" 2>&1
tail -1 "$outdir/eval.log"
done
done
}
run_ds 4 "5:busi:fold01" "6:idridd_segmentation:fold01" "7:acdc_png:official" &
run_ds 5 "8:pannuke_semantic:fold01" "9:medsegdb_isic2018:holdout" "10:medsegdb_kits19:fold01" &
wait
echo ALL_NNUNET_PREDICT_EVAL_DONE