summaryrefslogtreecommitdiff
path: root/scripts/train_cnn_v2_full.sh
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-13 16:43:55 +0100
committerskal <pascal.massimino@gmail.com>2026-02-13 16:43:55 +0100
commitac334c8c92367b4baf2df4bd52430b95261b962d (patch)
treec1883eb90c33cd59ae887757e94580a3e7b4d98f /scripts/train_cnn_v2_full.sh
parentfee3ba7be896ed767d1ae680a0811e023f71fce1 (diff)
CNN v2 full pipeline: Add --mip-level option
Training pipeline now accepts --mip-level flag (0-3) and passes to train_cnn_v2.py. Compatible with all existing modes (train, validate, export-only). Changes: - Add --mip-level argument parsing (default: 0) - Pass MIP_LEVEL to training command - Display mip level in config output - Update help text with examples Usage: ./scripts/train_cnn_v2_full.sh --mip-level 1 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Diffstat (limited to 'scripts/train_cnn_v2_full.sh')
-rwxr-xr-xscripts/train_cnn_v2_full.sh56
1 files changed, 42 insertions, 14 deletions
diff --git a/scripts/train_cnn_v2_full.sh b/scripts/train_cnn_v2_full.sh
index 99c104a..6468d12 100755
--- a/scripts/train_cnn_v2_full.sh
+++ b/scripts/train_cnn_v2_full.sh
@@ -8,6 +8,7 @@
# --validate Validate only (skip training, use existing weights)
# --validate CHECKPOINT Validate with specific checkpoint file
# --export-only CHECKPOINT Export weights only (skip training, build, validation)
+# --mip-level LEVEL Mip level for p0-p3 features: 0=original, 1=half, 2=quarter, 3=eighth (default: 0)
# --help Show this help message
#
# Examples:
@@ -15,6 +16,7 @@
# ./train_cnn_v2_full.sh --validate
# ./train_cnn_v2_full.sh --validate checkpoints/checkpoint_epoch_50.pth
# ./train_cnn_v2_full.sh --export-only checkpoints/checkpoint_epoch_100.pth
+# ./train_cnn_v2_full.sh --mip-level 1
set -e
@@ -26,25 +28,48 @@ VALIDATE_ONLY=false
VALIDATE_CHECKPOINT=""
EXPORT_ONLY=false
EXPORT_CHECKPOINT=""
+MIP_LEVEL=0
if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
- head -20 "$0" | grep "^#" | grep -v "^#!/" | sed 's/^# *//'
+ head -21 "$0" | grep "^#" | grep -v "^#!/" | sed 's/^# *//'
exit 0
fi
-if [ "$1" = "--export-only" ]; then
- EXPORT_ONLY=true
- if [ -z "$2" ]; then
- echo "Error: --export-only requires a checkpoint file argument"
- exit 1
- fi
- EXPORT_CHECKPOINT="$2"
-elif [ "$1" = "--validate" ]; then
- VALIDATE_ONLY=true
- if [ -n "$2" ]; then
- VALIDATE_CHECKPOINT="$2"
- fi
-fi
+# Parse all arguments
+while [[ $# -gt 0 ]]; do
+ case "$1" in
+ --export-only)
+ EXPORT_ONLY=true
+ if [ -z "$2" ]; then
+ echo "Error: --export-only requires a checkpoint file argument"
+ exit 1
+ fi
+ EXPORT_CHECKPOINT="$2"
+ shift 2
+ ;;
+ --validate)
+ VALIDATE_ONLY=true
+ if [ -n "$2" ] && [[ ! "$2" =~ ^-- ]]; then
+ VALIDATE_CHECKPOINT="$2"
+ shift 2
+ else
+ shift
+ fi
+ ;;
+ --mip-level)
+ if [ -z "$2" ]; then
+ echo "Error: --mip-level requires a level argument (0-3)"
+ exit 1
+ fi
+ MIP_LEVEL="$2"
+ shift 2
+ ;;
+ *)
+ echo "Unknown option: $1"
+ exit 1
+ ;;
+ esac
+done
# Configuration
INPUT_DIR="training/input"
@@ -66,6 +91,7 @@ DETECTOR="harris"
KERNEL_SIZES="3,3,3" # Comma-separated per-layer kernel sizes
NUM_LAYERS=3
+# MIP_LEVEL set via --mip-level argument (default: 0)
# Handle export-only mode
if [ "$EXPORT_ONLY" = true ]; then
@@ -102,6 +128,7 @@ else
echo "Target: $TARGET_DIR"
echo "Epochs: $EPOCHS"
echo "Checkpoint interval: $CHECKPOINT_EVERY"
+ echo "Mip level: $MIP_LEVEL (p0-p3 features)"
echo ""
fi
@@ -116,6 +143,7 @@ python3 training/train_cnn_v2.py \
--detector $DETECTOR \
--kernel-sizes $KERNEL_SIZES \
--num-layers $NUM_LAYERS \
+ --mip-level $MIP_LEVEL \
--epochs $EPOCHS \
--batch-size $BATCH_SIZE \
--checkpoint-dir "$CHECKPOINT_DIR" \