--- tags: - onnx - image-harmonization - photoblaze --- # PhotoBlaze PIH This package contains the two ONNX networks for PhotoBlaze's local Match to Scene feature, exported from the PhotoBlaze-trained PIH checkpoint. PIH is described in **Semi-supervised Parametric Real-world Image Harmonization**, CVPR 2023. Original project: https://github.com/adobe/PIH ## Provenance and license review Source revision: `2823cccf0778c6ea213a3d366f03864ac8ab82e6`. Checkpoint: `generator_30.pth`, trained from scratch by PhotoBlaze. `UPSTREAM-LICENSE.txt` contains the upstream Apache-2.0 code license. ## Model interface Both networks are required. Inputs and outputs are float32, NCHW, batch size 1. RGB inputs use values from 0 to 1. The foreground mask uses 1 for foreground. | File | Input named `inputs` | Output | | --- | --- | --- | | curves.onnx | [1,7,512,512]: composite RGB, background RGB, mask | `curves`: [1,3,32] | | gain.onnx | [1,10,512,512]: composite RGB, background RGB, mask, curve-adjusted composite RGB | `gain`: [1,1,512,512] | The split avoids a 5D GridSample operation. Apply each color curve using linear interpolation at `clamp(channel * 32 - 0.5, 0, 31)`, then blend the adjusted foreground with the background using the mask before feeding the gain network. See `export_pih.py` for the validated conversion and intermediate calculation. This is not a standalone Transformers pipeline. ## Validation and limitations `validation.json` records native PyTorch/ONNX comparisons on synthetic data; maximum absolute errors were below 0.0000003. `browser-validation.json` records a Chromium WASM smoke test with constant synthetic inputs and finite outputs. `pipeline-validation.json` checks the worker, renderer, and layer commit on a procedural fixture. `photo-quality.json` measures recovery from three controlled color and exposure shifts on the same mountain photo. Quality across diverse composites and performance on mobile, Safari, and Firefox remain unverified. The two float32 files total approximately 373 MB. Checksums are in `SHA256SUMS` and provenance is in `manifest.json`. No user photographs or credentials are included.