added fused classifier head

This commit is contained in:
rpotter6298
2026-03-02 06:44:22 +01:00
parent fd1452c187
commit 080b5999fa
11 changed files with 583 additions and 21 deletions
+41
View File
@@ -0,0 +1,41 @@
#!/usr/bin/env bash
set -euo pipefail
# Fused-head ensemble runs (2 total) — UNet ROI crop:
# binary × ensemble + fused head
# multiclass × ensemble + fused head
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)"
cd "$ROOT_DIR"
CROP_ARGS=(
--img-crop-manifest manifest.csv
--img-crop-weights models/v2/refuge/segmentation/per_image_refuge_build/best.pt
--img-crop-normalize per_image
)
COMMON_ARGS=(
--epochs 40
--n-splits 5
--batch-size 8
--backbone refugelike
--tower-mode ensemble
--fused-head
--fusion-epochs 10
)
echo "[1/2] UNet ROI — binary, ensemble + fused head..."
python3 scripts/main/v2/run_multifold_v2.py \
"${COMMON_ARGS[@]}" \
"${CROP_ARGS[@]}" \
--eval-mode binary \
--run-name v2_ensemble_fused_binary_unet_40ep_5fold_v1
echo "[2/2] UNet ROI — multiclass, ensemble + fused head..."
python3 scripts/main/v2/run_multifold_v2.py \
"${COMMON_ARGS[@]}" \
"${CROP_ARGS[@]}" \
--eval-mode multiclass \
--run-name v2_ensemble_fused_multiclass_unet_40ep_5fold_v1
echo "Fused-head runs complete."
+24 -13
View File
@@ -1,34 +1,45 @@
#!/usr/bin/env bash
set -euo pipefail
# Runs two back-to-back Hypertower mode comparisons with ROI cropping:
# 1) GT masks
# 2) UNet masks
# Six V2HyperTower runs using GT ROI crop:
# binary × {ensemble, bilateral} (runs 1-2)
# multiclass × {ensemble, bilateral} (runs 3-4)
# multiclass × {ensemble, bilateral} + balanced (runs 5-6)
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)"
cd "$ROOT_DIR"
CROP_ARGS=(
--img-crop-manifest manifest.csv
--img-crop-gt
)
COMMON_ARGS=(
--eval-modes binary multiclass
--tower-modes single ensemble bilateral
--epochs 40
--n-splits 5
--batch-size 8
--backbone refugelike
--img-crop-manifest manifest.csv
)
echo "[1/2] Starting GT ROI run..."
# Runs 1-4: binary + multiclass, ensemble + bilateral, no balanced sampling
echo "[1/2] GT ROI — binary + multiclass, ensemble + bilateral..."
python3 scripts/basic_analysis/compare_hypertower_modes.py \
"${COMMON_ARGS[@]}" \
--img-crop-gt \
--run-name v2_modes_full_40ep_5fold_roi_gt_holdout
"${CROP_ARGS[@]}" \
--eval-modes binary multiclass \
--tower-modes ensemble bilateral \
--run-name v2_modes_gt_40ep_5fold_no_single_v2
echo "[2/2] Starting UNet ROI run..."
# Runs 5-6: multiclass only, ensemble + bilateral, balanced sampling
# (reuse the crop cache built during runs 1-4)
echo "[2/2] GT ROI — multiclass, ensemble + bilateral, balanced sampling..."
python3 scripts/basic_analysis/compare_hypertower_modes.py \
"${COMMON_ARGS[@]}" \
--img-crop-weights models/v2/refuge/segmentation/per_image_refuge_build/best.pt \
--img-crop-normalize per_image \
--run-name v2_modes_full_40ep_5fold_roi_unet_perimage_refugebuild_holdout
"${CROP_ARGS[@]}" \
--eval-modes multiclass \
--tower-modes ensemble bilateral \
--balanced-sampling \
--persist-img-crop-cache \
--run-name v2_modes_gt_40ep_5fold_multiclass_balanced_v2
echo "All runs complete."
@@ -0,0 +1,44 @@
#!/usr/bin/env bash
set -euo pipefail
# Bilateral tower runs (3 total):
# binary × bilateral
# multiclass × bilateral
# multiclass × bilateral + balanced sampling
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)"
cd "$ROOT_DIR"
CROP_ARGS=(
--img-crop-manifest manifest.csv
--img-crop-gt
)
COMMON_ARGS=(
--epochs 40
--n-splits 5
--batch-size 8
--backbone refugelike
--tower-modes bilateral
)
# Runs 1-2: binary + multiclass bilateral (no balanced sampling)
echo "[1/2] GT ROI — binary + multiclass, bilateral..."
python3 scripts/basic_analysis/compare_hypertower_modes.py \
"${COMMON_ARGS[@]}" \
"${CROP_ARGS[@]}" \
--eval-modes binary multiclass \
--run-name v2_modes_gt_40ep_5fold_bilateral_v2
# Run 3: multiclass bilateral + balanced sampling
# (reuse the crop cache built above)
echo "[2/2] GT ROI — multiclass, bilateral, balanced sampling..."
python3 scripts/basic_analysis/compare_hypertower_modes.py \
"${COMMON_ARGS[@]}" \
"${CROP_ARGS[@]}" \
--eval-modes multiclass \
--balanced-sampling \
--persist-img-crop-cache \
--run-name v2_modes_gt_40ep_5fold_bilateral_balanced_v2
echo "Bilateral runs complete."
+45
View File
@@ -0,0 +1,45 @@
#!/usr/bin/env bash
set -euo pipefail
# Bilateral tower runs (3 total) — UNet ROI crop:
# binary × bilateral
# multiclass × bilateral
# multiclass × bilateral + balanced sampling
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)"
cd "$ROOT_DIR"
CROP_ARGS=(
--img-crop-manifest manifest.csv
--img-crop-weights models/v2/refuge/segmentation/per_image_refuge_build/best.pt
--img-crop-normalize per_image
)
COMMON_ARGS=(
--epochs 40
--n-splits 5
--batch-size 8
--backbone refugelike
--tower-modes bilateral
)
# Runs 1-2: binary + multiclass bilateral (no balanced sampling)
echo "[1/2] UNet ROI — binary + multiclass, bilateral..."
python3 scripts/basic_analysis/compare_hypertower_modes.py \
"${COMMON_ARGS[@]}" \
"${CROP_ARGS[@]}" \
--eval-modes binary multiclass \
--run-name v2_modes_unet_40ep_5fold_bilateral_v2
# Run 3: multiclass bilateral + balanced sampling
# (reuse the crop cache built above)
echo "[2/2] UNet ROI — multiclass, bilateral, balanced sampling..."
python3 scripts/basic_analysis/compare_hypertower_modes.py \
"${COMMON_ARGS[@]}" \
"${CROP_ARGS[@]}" \
--eval-modes multiclass \
--balanced-sampling \
--persist-img-crop-cache \
--run-name v2_modes_unet_40ep_5fold_bilateral_balanced_v2
echo "Bilateral UNet runs complete."
@@ -0,0 +1,44 @@
#!/usr/bin/env bash
set -euo pipefail
# Ensemble tower runs (3 total):
# binary × ensemble
# multiclass × ensemble
# multiclass × ensemble + balanced sampling
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)"
cd "$ROOT_DIR"
CROP_ARGS=(
--img-crop-manifest manifest.csv
--img-crop-gt
)
COMMON_ARGS=(
--epochs 40
--n-splits 5
--batch-size 8
--backbone refugelike
--tower-modes ensemble
)
# Runs 1-2: binary + multiclass ensemble (no balanced sampling)
echo "[1/2] GT ROI — binary + multiclass, ensemble..."
python3 scripts/basic_analysis/compare_hypertower_modes.py \
"${COMMON_ARGS[@]}" \
"${CROP_ARGS[@]}" \
--eval-modes binary multiclass \
--run-name v2_modes_gt_40ep_5fold_ensemble_v2
# Run 3: multiclass ensemble + balanced sampling
# (reuse the crop cache built above)
echo "[2/2] GT ROI — multiclass, ensemble, balanced sampling..."
python3 scripts/basic_analysis/compare_hypertower_modes.py \
"${COMMON_ARGS[@]}" \
"${CROP_ARGS[@]}" \
--eval-modes multiclass \
--balanced-sampling \
--persist-img-crop-cache \
--run-name v2_modes_gt_40ep_5fold_ensemble_balanced_v2
echo "Ensemble runs complete."
+45
View File
@@ -0,0 +1,45 @@
#!/usr/bin/env bash
set -euo pipefail
# Ensemble tower runs (3 total) — UNet ROI crop:
# binary × ensemble
# multiclass × ensemble
# multiclass × ensemble + balanced sampling
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)"
cd "$ROOT_DIR"
CROP_ARGS=(
--img-crop-manifest manifest.csv
--img-crop-weights models/v2/refuge/segmentation/per_image_refuge_build/best.pt
--img-crop-normalize per_image
)
COMMON_ARGS=(
--epochs 40
--n-splits 5
--batch-size 8
--backbone refugelike
--tower-modes ensemble
)
# Runs 1-2: binary + multiclass ensemble (no balanced sampling)
echo "[1/2] UNet ROI — binary + multiclass, ensemble..."
python3 scripts/basic_analysis/compare_hypertower_modes.py \
"${COMMON_ARGS[@]}" \
"${CROP_ARGS[@]}" \
--eval-modes binary multiclass \
--run-name v2_modes_unet_40ep_5fold_ensemble_v2
# Run 3: multiclass ensemble + balanced sampling
# (reuse the crop cache built above)
echo "[2/2] UNet ROI — multiclass, ensemble, balanced sampling..."
python3 scripts/basic_analysis/compare_hypertower_modes.py \
"${COMMON_ARGS[@]}" \
"${CROP_ARGS[@]}" \
--eval-modes multiclass \
--balanced-sampling \
--persist-img-crop-cache \
--run-name v2_modes_unet_40ep_5fold_ensemble_balanced_v2
echo "Ensemble UNet runs complete."