summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-12 11:50:52 +0100
committerskal <pascal.massimino@gmail.com>2026-02-12 11:50:52 +0100
commit7547e8ff4744339b92650b6ef3ff7405befe4beb (patch)
tree0388b064c6bb2fcb2346796f9d1134c5ed9214b5 /scripts
parentc878631f24ddb7514dd4db3d7ace6a0a296d4157 (diff)
CNN v2: Patch-based training as default (like CNN v1)
Salient point detection on original images with patch extraction. Changes: - Added PatchDataset class (harris/fast/shi-tomasi/gradient detectors) - Detects salient points on ORIGINAL images (no resize) - Extracts 32×32 patches around salient points - Default: 64 patches/image, harris detector - Batch size: 16 (512 patches per batch) Training modes: 1. Patch-based (default): --patch-size 32 --patches-per-image 64 --detector harris 2. Full-image (option): --full-image --image-size 256 Benefits: - Focuses training on interesting regions - Handles variable image sizes naturally - Matches CNN v1 workflow - Better convergence with limited data (8 images → 512 patches) Script updated: - train_cnn_v2_full.sh: Patch-based by default - Configuration exposed for easy switching Example: ./scripts/train_cnn_v2_full.sh # Patch-based # Edit script: uncomment FULL_IMAGE for resize mode Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/train_cnn_v2_full.sh20
1 files changed, 16 insertions, 4 deletions
diff --git a/scripts/train_cnn_v2_full.sh b/scripts/train_cnn_v2_full.sh
index 119b788..4ddd9ac 100755
--- a/scripts/train_cnn_v2_full.sh
+++ b/scripts/train_cnn_v2_full.sh
@@ -14,8 +14,17 @@ CHECKPOINT_DIR="checkpoints"
VALIDATION_DIR="validation_results"
EPOCHS=10000
CHECKPOINT_EVERY=500
-BATCH_SIZE=8
-IMAGE_SIZE=256
+BATCH_SIZE=16
+
+# Patch-based training (default)
+PATCH_SIZE=32
+PATCHES_PER_IMAGE=64
+DETECTOR="harris"
+
+# Full-image training (alternative - uncomment to use)
+# FULL_IMAGE="--full-image"
+# IMAGE_SIZE=256
+
KERNEL_SIZES="1 3 5"
CHANNELS="16 8 4"
@@ -31,13 +40,16 @@ echo "[1/4] Training CNN v2 model..."
python3 training/train_cnn_v2.py \
--input "$INPUT_DIR" \
--target "$TARGET_DIR" \
- --image-size $IMAGE_SIZE \
+ --patch-size $PATCH_SIZE \
+ --patches-per-image $PATCHES_PER_IMAGE \
+ --detector $DETECTOR \
--kernel-sizes $KERNEL_SIZES \
--channels $CHANNELS \
--epochs $EPOCHS \
--batch-size $BATCH_SIZE \
--checkpoint-dir "$CHECKPOINT_DIR" \
- --checkpoint-every $CHECKPOINT_EVERY
+ --checkpoint-every $CHECKPOINT_EVERY \
+ $FULL_IMAGE
if [ $? -ne 0 ]; then
echo "Error: Training failed"