diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-11 07:11:59 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-11 07:11:59 +0100 |
| commit | d594609420b3d0ca43d760ff043b3750e2be55ca (patch) | |
| tree | 8e7668a4730bfe90f10b6e92e4c4992c14fa8cc8 /doc | |
| parent | 3915a5e1c8c904f8f2154845cb99223a598653ee (diff) | |
fix: CNN test tool ping-pong bug and RGBA16Float intermediates
Bugfixes:
- Fixed ping-pong logic: update current_input BEFORE flipping dst_idx
- Use RGBA16Float for intermediate layers (preserve [-1,1] range from tanh)
- Separate BGRA8Unorm final output texture for readback
- Create two pipelines: intermediate (RGBA16Float) and final (BGRA8Unorm)
- Fix all cleanup code to reference correct pipeline variables
Implementation:
- Intermediate textures use RGBA16Float to avoid clamping [-1,1] → [0,1]
- Final layer renders to separate BGRA8Unorm texture
- Correct texture view descriptors for each format
- Layer 0-1: render to RGBA16Float ping-pong textures
- Layer 2: render to BGRA8Unorm output texture
Documentation:
- Added CNN testing section to doc/HOWTO.md
- Updated CNN_TEST_TOOL.md with ground-truth comparison workflow
- Noted remaining black output bug (under investigation)
Status:
- Tool compiles and runs without GPU errors
- Architecture correct: ping-pong, format conversion, separate pipelines
- Output still all-black (unknown cause, needs debugging)
- All 36 tests still pass
handoff(Claude): CNN test tool bugfixes complete, black output remains
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/CNN_TEST_TOOL.md | 11 | ||||
| -rw-r--r-- | doc/HOWTO.md | 39 |
2 files changed, 45 insertions, 5 deletions
diff --git a/doc/CNN_TEST_TOOL.md b/doc/CNN_TEST_TOOL.md index 7a970fe..09c55d4 100644 --- a/doc/CNN_TEST_TOOL.md +++ b/doc/CNN_TEST_TOOL.md @@ -178,11 +178,12 @@ assert mse < 10.0, f'MSE too high: {mse}' ## Known Issues -**BUG: Black output (uninitialized input texture)** -- Tool produces all-black output (MSE 64860 vs ground truth) -- Root cause: First intermediate texture not initialized with input image -- Multi-layer processing starts with uninitialized data -- Fix required: Copy input_texture → intermediate_textures[0] before layer loop +**BUG: Black output (unknown cause)** +- Tool produces all-black output despite correct architecture +- Fixed ping-pong logic, RGBA16Float intermediates, proper pipelines +- Shader compiles, GPU commands execute without errors +- Possible causes: shader execution issue, synchronization, binding problem +- Status: Under investigation --- diff --git a/doc/HOWTO.md b/doc/HOWTO.md index ba550bb..c0e9363 100644 --- a/doc/HOWTO.md +++ b/doc/HOWTO.md @@ -162,6 +162,45 @@ See `doc/ASSET_SYSTEM.md` and `doc/WORKSPACE_SYSTEM.md`. --- +## CNN Testing + +### Offline Shader Validation +```bash +# Test trained CNN on PNG input +./build/cnn_test input.png output.png + +# Adjust blend amount (0.0 = original, 1.0 = full CNN) +./build/cnn_test input.png output.png --blend 0.5 + +# PPM output format +./build/cnn_test input.png output.ppm --format ppm +``` + +### Ground Truth Comparison +```bash +# Generate Python ground truth +./training/train_cnn.py --infer input.png \ + --export-only checkpoints/checkpoint_epoch_1000.pth \ + --output ground_truth.png + +# Run tool +./build/cnn_test input.png tool_output.png + +# Compare (Python required) +python3 -c " +import numpy as np +from PIL import Image +gt = np.array(Image.open('ground_truth.png').convert('RGB')) +out = np.array(Image.open('tool_output.png').convert('RGB')) +mse = np.mean((gt.astype(float) - out.astype(float)) ** 2) +print(f'MSE: {mse:.4f} (target: < 10.0)') +" +``` + +See `doc/CNN_TEST_TOOL.md` for full documentation. + +--- + ## Additional Documentation - **Build System:** `doc/BUILD.md` - Multi-platform, size optimization |
