blob: 052f22a09a610c951dda23549d288ee45a3c9be1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# CNN v1: Original Post-Processing Neural Network
**Architecture:** 3-layer convolution, generated shader weights
**Status:** Active (used in timeline), legacy architecture
## Overview
Original CNN implementation with per-layer WGSL shaders. Supports multiple kernel sizes (1×1, 3×3, 5×5, 7×7) with generated weight arrays.
**For new work, use CNN v2** (`cnn_v2/`) which provides:
- Storage buffer architecture (~3.2 KB vs generated WGSL)
- 7D static features (RGBD + UV + sin + bias)
- Sigmoid activation with stable training
- Dynamic layer configuration
## Quick Reference
**Training:**
```bash
./cnn_v1/training/train_cnn.py --input training/input --target training/output \
--layers 3 --kernel_sizes 3,5,3 --epochs 5000
```
**Integration:**
- **C++:** `cnn_v1/src/cnn_effect.{h,cc}`
- **Assets:** `workspaces/main/assets.txt` (lines 40-46)
- **Timeline:** `workspaces/main/timeline.seq` (CNNEffect)
## Documentation
- [CNN.md](docs/CNN.md) - Architecture overview
- [CNN_V1_EFFECT.md](docs/CNN_V1_EFFECT.md) - Implementation details
- [CNN_TEST_TOOL.md](docs/CNN_TEST_TOOL.md) - Testing guide
- [CNN_DEBUG.md](docs/CNN_DEBUG.md) - Debugging notes
## Directory Structure
```
cnn_v1/
├── README.md # This file
├── src/
│ ├── cnn_effect.h # Effect header
│ └── cnn_effect.cc # Effect implementation
├── shaders/ # WGSL shaders (7 files)
├── training/ # Python training script
└── docs/ # Documentation (7 markdown files)
```
## Differences from CNN v2
| Feature | CNN v1 | CNN v2 |
|---------|--------|--------|
| Architecture | Generated WGSL weights | Storage buffer weights |
| Input Features | 4D (RGBA/prev layer) | 12D (4D + 8D static) |
| Activation | ReLU | Sigmoid + ReLU |
| Size | ~Variable (WGSL gen) | ~3.2 KB (binary) |
| Training | Full-image | Patch-based (default) |
| Layer Config | Compile-time | Runtime (dynamic) |
## Migration Notes
CNN v1 remains in the timeline for historical validation. For new effects or experiments, use CNN v2's enhanced feature set and compact binary format.
See `cnn_v2/docs/CNN_V2.md` for CNN v2 architecture details.
|