diff options
| author | skal <pascal.massimino@gmail.com> | 2026-03-22 07:33:28 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-03-22 07:55:18 +0100 |
| commit | 0c7bd063285a052eb7cd48b8a5c0c8dd203c7409 (patch) | |
| tree | af6daa646f5198277546cf4c0d2b111678824920 /cnn_v3/docs/HOW_TO_CNN.md | |
| parent | 56f5d86e3f15e703ab0a577aeef6a1038e71115a (diff) | |
feat(cnn_v3): gen_sample tool + 7 simple training samples
- pack_photo_sample.py: --target now required (no albedo fallback)
- gen_sample.py: bash wrapper with positional args (input target output_dir)
- input/photo7.jpg: copy of photo2 (second style target)
- target_1: photo2_1_out→photo2_out, photo2_2_out→photo7_out
- dataset/simple/sample_001..007: 7 packed photo/target pairs
handoff(Gemini): training data ready; next step is train_cnn_v3.py run
Diffstat (limited to 'cnn_v3/docs/HOW_TO_CNN.md')
| -rw-r--r-- | cnn_v3/docs/HOW_TO_CNN.md | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/cnn_v3/docs/HOW_TO_CNN.md b/cnn_v3/docs/HOW_TO_CNN.md index f325a38..6214b20 100644 --- a/cnn_v3/docs/HOW_TO_CNN.md +++ b/cnn_v3/docs/HOW_TO_CNN.md @@ -79,14 +79,16 @@ Each sample is a directory containing 7 PNG files. The dataloader discovers samp The network handles this correctly because channel-dropout training (§2e) teaches it to work with or without geometry data. -**Step 1 — Pack the photo:** +**Step 1 — Pack an input/target pair with `gen_sample`:** + ```bash cd cnn_v3/training -python3 pack_photo_sample.py \ - --photo /path/to/photo.png \ - --output dataset/simple/sample_001/ +./gen_sample.sh /path/to/photo.png /path/to/stylized.png dataset/simple/sample_001/ ``` +`gen_sample.sh <input> <target> <output_dir>` is the recommended one-shot wrapper. +It calls `pack_photo_sample.py` with both `--photo` and `--target` in a single step. + **What gets written:** | File | Content | Notes | @@ -97,26 +99,29 @@ python3 pack_photo_sample.py \ | `matid.png` | All zeros uint8 | No material IDs | | `shadow.png` | 255 everywhere uint8 | Assume fully lit | | `transp.png` | 1 − alpha uint8 | 0 = opaque | -| `target.png` | Copy of photo RGBA | **Placeholder — must be replaced** | +| `target.png` | Stylized target RGBA | Ground truth for training | -**Step 2 — Provide a styled target:** +**Step 2 — Verify the target:** -`target.png` defaults to the input photo (identity style). You must replace it with -your stylized ground truth before training: +The network learns the mapping `albedo → target`. If you pass the same image as both +input and target, the network learns identity (useful as sanity check, not for real +training). Confirm `target.png` looks correct before running training. +**Alternative — pack without a target yet:** ```bash +python3 pack_photo_sample.py \ + --photo /path/to/photo.png \ + --output dataset/simple/sample_001/ +# target.png defaults to a copy of the input; replace it before training: cp my_stylized_version.png dataset/simple/sample_001/target.png ``` -The network learns the mapping `albedo → target`. If target = albedo, the network -learns identity (useful as sanity check, not for real training). - **Batch packing:** ```bash for f in photos/*.png; do name=$(basename "${f%.png}") - python3 pack_photo_sample.py --photo "$f" \ - --output dataset/simple/sample_${name}/ + ./gen_sample.sh "$f" "targets/${name}_styled.png" \ + dataset/simple/sample_${name}/ done ``` @@ -723,6 +728,7 @@ all geometric channels (normal, depth, depth_grad, mat_id, prev) = 0. | File | Purpose | |------|---------| +| `cnn_v3/training/gen_sample.sh` | One-shot wrapper: pack input+target pair into sample directory | | `cnn_v3/training/blender_export.py` | Configure Blender Cycles passes, render multi-layer EXR | | `cnn_v3/training/pack_blender_sample.py` | EXR → sample PNG directory (7 files) | | `cnn_v3/training/pack_photo_sample.py` | Photo → zeroed-geometry sample directory | |
