summaryrefslogtreecommitdiff
path: root/doc/HOWTO.md
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-10 22:54:38 +0100
committerskal <pascal.massimino@gmail.com>2026-02-10 22:54:38 +0100
commit2adcf1bac1ec651861930eb2af00641eb23f6ef1 (patch)
tree2208b753b68783be5a26906b5bc1690c23a267d0 /doc/HOWTO.md
parent58f276378735e0b51f4d1517a844357e45e376a7 (diff)
docs: Update CNN training documentation with patch extraction
Streamlined and updated all training docs with new patch-based approach. Changes: - HOWTO.md: Updated training section with patch/full-image examples - CNN_EFFECT.md: Streamlined training workflow, added detector info - training/README.md: Complete rewrite with detector comparison table New sections: - Detector comparison (harris, fast, shi-tomasi, gradient) - Practical examples for different use cases - Tips for patch size and batch size selection - Benefits of patch-based training Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Diffstat (limited to 'doc/HOWTO.md')
-rw-r--r--doc/HOWTO.md33
1 files changed, 25 insertions, 8 deletions
diff --git a/doc/HOWTO.md b/doc/HOWTO.md
index 5ea6afd..ba550bb 100644
--- a/doc/HOWTO.md
+++ b/doc/HOWTO.md
@@ -88,23 +88,40 @@ make run_util_tests # Utility tests
## Training
+### Patch-Based (Recommended)
+Extracts patches at salient points, preserves natural pixel scale:
```bash
-./training/train_cnn.py --layers 3 --kernel_sizes 3,5,3 --epochs 10000 --batch_size 8 --input training/input/ --target training/output/ --checkpoint-every 1000
+# Train with 32×32 patches at detected corners/edges
+./training/train_cnn.py \
+ --input training/input/ --target training/output/ \
+ --patch-size 32 --patches-per-image 64 --detector harris \
+ --layers 3 --kernel_sizes 3,5,3 --epochs 5000 --batch_size 16 \
+ --checkpoint-every 1000
```
-Generate shaders from checkpoint:
+**Detectors:** `harris` (default), `fast`, `shi-tomasi`, `gradient`
+
+### Full-Image (Legacy)
+Resizes to 256×256 (distorts scale):
```bash
-./training/train_cnn.py --export-only training/checkpoints/checkpoint_epoch_7000.pth
+./training/train_cnn.py \
+ --input training/input/ --target training/output/ \
+ --layers 3 --kernel_sizes 3,5,3 --epochs 10000 --batch_size 8 \
+ --checkpoint-every 1000
```
-Generate ground truth (for shader validation):
+### Export & Validation
```bash
-./training/train_cnn.py --infer input.png --export-only checkpoints/checkpoint_epoch_7000.pth --output ground_truth.png
+# Generate shaders from checkpoint
+./training/train_cnn.py --export-only checkpoints/checkpoint_epoch_5000.pth
+
+# Generate ground truth for comparison
+./training/train_cnn.py --infer input.png \
+ --export-only checkpoints/checkpoint_epoch_5000.pth \
+ --output ground_truth.png
```
-**Note:** Kernel sizes must match shader functions:
-- 3×3 kernel → `cnn_conv3x3_7to4` (36 weights: 9 pos × 4 channels)
-- 5×5 kernel → `cnn_conv5x5_7to4` (100 weights: 25 pos × 4 channels)
+**Kernel sizes:** 3×3 (36 weights), 5×5 (100 weights), 7×7 (196 weights)
---