summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cnn_v3/docs/HOW_TO_CNN.md32
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 |