rockglacierNET / bash_script /run_bandselect_v2b.sh
kabiriitb's picture
Upload folder using huggingface_hub
820fab0 verified
Raw History Blame Contribute Delete
6.07 kB
#!/bin/bash
# ============================================================
# Band Selection Round 2 β€” 6 experiments, 2 per GPU (no idle)
# ============================================================
# Questions this round answers:
# GPU 0: Where exactly is the sweet spot between 16-24 bands?
# β†’ top18 and top22 (narrow between 16β†’0.5448 and 24β†’0.5497)
# GPU 1: How much does SAR contribute? Does optical alone work?
# β†’ top20 without SAR (19 bands) and optical-only (12 bands)
# GPU 2: Does curvature/aspect hurt? Is a curated set better?
# β†’ terrain+SAR compact (8 bands) and custom curated (18 bands,
# good terrain only + top optical, no noisy curvature/aspect)
# ============================================================
set -e
source /data1/nasiruddink/miniconda3/etc/profile.d/conda.sh
conda activate brats
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data1/nasiruddink/miniconda3/envs/brats/lib:/data1/nasiruddink/miniconda3/envs/brats/lib/python3.10/site-packages/nvidia/cudnn/lib
export TF_CPP_MIN_LOG_LEVEL=2
DATA="dataset/patches_v2"
mkdir -p bandselection/logs
# ── Band lists ─────────────────────────────────────────────────────────────
# Global rank order (Cohen's d on patches_v2):
# band_25,band_18,band_22,band_23,band_10,band_6,band_24,band_27,
# band_17,band_11,band_13,band_14,band_4,band_3,band_9,band_26,
# band_8,band_5,band_15,band_7,band_19,band_0,band_1,band_2,
# band_12,band_16,band_20,band_21
# Experiment 1: Top 18 by Cohen's d (between top16=0.5448 and top20=0.5700)
TOP18="band_25,band_18,band_22,band_23,band_10,band_6,band_24,band_27,band_17,band_11,band_13,band_14,band_4,band_3,band_9,band_26,band_8,band_5"
# Experiment 2: Top 22 by Cohen's d (between top20=0.5700 and top24=0.5497)
TOP22="band_25,band_18,band_22,band_23,band_10,band_6,band_24,band_27,band_17,band_11,band_13,band_14,band_4,band_3,band_9,band_26,band_8,band_5,band_15,band_7,band_19,band_0"
# Experiment 3: Top 20 minus S1_VV SAR (19 bands) β†’ tests SAR contribution
NOSAR="band_25,band_18,band_22,band_23,band_10,band_6,band_24,band_17,band_11,band_13,band_14,band_4,band_3,band_9,band_26,band_8,band_5,band_15,band_7"
# Experiment 4: Optical + indices only (12 bands, no terrain, no SAR)
# Tests: how much does terrain contribute above optical alone?
OPTICAL="band_10,band_6,band_11,band_13,band_14,band_4,band_3,band_9,band_8,band_5,band_15,band_7"
# Experiment 5: Terrain top-7 + SAR (8 bands) β€” no optical at all
# Tests: what is the terrain+SAR floor without any optical?
TERRAIN_SAR="band_25,band_18,band_22,band_23,band_24,band_17,band_26,band_27"
# Experiment 6: Curated 18 β€” good terrain only (no curvature/aspect noise)
# + SAR + top-9 spectral by Cohen's d
# Removes: Aspect(d=0.077), PlanCurv(d=0.008), ProfCurv(d=0.005) from terrain
# Terrain kept: Roughness,Slope,TPI,TRI,TWI,Elevation,Hillshade (7) + SAR (1) = 8
# Spectral: NDVI,B12,NDWI,NDMI,BSI,B8A,B8,RedEdge3,RedEdge2,B11 = 10
# Total: 18 bands
CURATED="band_25,band_18,band_22,band_23,band_24,band_17,band_26,band_27,band_10,band_6,band_11,band_13,band_14,band_4,band_3,band_9,band_8,band_5"
# ==============================================================
# GPU 0 β€” top18 then top22 (sequential, no idle)
# ==============================================================
run_gpu0() {
echo "[GPU 0] Starting v2_top18 ..."
CUDA_VISIBLE_DEVICES=0 MODEL_NAME="attention_unet" DATA_DIR=$DATA \
BAND_LIST=$TOP18 RUN_NAME="v2_top18" CKPT_DIR="bandselection/v2_top18" \
python3 train.py > bandselection/logs/v2_top18.log 2>&1
echo "[GPU 0] v2_top18 done. Starting v2_top22 ..."
CUDA_VISIBLE_DEVICES=0 MODEL_NAME="attention_unet" DATA_DIR=$DATA \
BAND_LIST=$TOP22 RUN_NAME="v2_top22" CKPT_DIR="bandselection/v2_top22" \
python3 train.py > bandselection/logs/v2_top22.log 2>&1
echo "[GPU 0] v2_top22 done."
}
# ==============================================================
# GPU 1 β€” nosar then optical (sequential, no idle)
# ==============================================================
run_gpu1() {
echo "[GPU 1] Starting v2_nosar ..."
CUDA_VISIBLE_DEVICES=1 MODEL_NAME="attention_unet" DATA_DIR=$DATA \
BAND_LIST=$NOSAR RUN_NAME="v2_nosar" CKPT_DIR="bandselection/v2_nosar" \
python3 train.py > bandselection/logs/v2_nosar.log 2>&1
echo "[GPU 1] v2_nosar done. Starting v2_optical ..."
CUDA_VISIBLE_DEVICES=1 MODEL_NAME="attention_unet" DATA_DIR=$DATA \
BAND_LIST=$OPTICAL RUN_NAME="v2_optical" CKPT_DIR="bandselection/v2_optical" \
python3 train.py > bandselection/logs/v2_optical.log 2>&1
echo "[GPU 1] v2_optical done."
}
# ==============================================================
# GPU 2 β€” terrain_sar then curated (sequential, no idle)
# ==============================================================
run_gpu2() {
echo "[GPU 2] Starting v2_terrain_sar ..."
CUDA_VISIBLE_DEVICES=2 MODEL_NAME="attention_unet" DATA_DIR=$DATA \
BAND_LIST=$TERRAIN_SAR RUN_NAME="v2_terrain_sar" CKPT_DIR="bandselection/v2_terrain_sar" \
python3 train.py > bandselection/logs/v2_terrain_sar.log 2>&1
echo "[GPU 2] v2_terrain_sar done. Starting v2_curated ..."
CUDA_VISIBLE_DEVICES=2 MODEL_NAME="attention_unet" DATA_DIR=$DATA \
BAND_LIST=$CURATED RUN_NAME="v2_curated" CKPT_DIR="bandselection/v2_curated" \
python3 train.py > bandselection/logs/v2_curated.log 2>&1
echo "[GPU 2] v2_curated done."
}
# Launch all 3 GPUs in parallel
run_gpu0 & PID0=$!
run_gpu1 & PID1=$!
run_gpu2 & PID2=$!
echo "All 6 experiments running:"
echo " GPU 0 (PID $PID0): v2_top18 β†’ v2_top22"
echo " GPU 1 (PID $PID1): v2_nosar β†’ v2_optical"
echo " GPU 2 (PID $PID2): v2_terrain_sar β†’ v2_curated"
echo ""
wait $PID0 $PID1 $PID2
echo "ALL 6 EXPERIMENTS COMPLETE."
echo ""
echo "Results in bandselection/: v2_top18 v2_top22 v2_nosar v2_optical v2_terrain_sar v2_curated"