informative-drawings-onnx
ONNX export of the three generators of Informative Drawings (Chan et al., CVPR 2022, MIT licence) used by the
OutlineKid app (com.ipsilondev.outlinekid) to turn photos into line art. Mirror/conversion owned by ipsilondev.
Provenance
- Upstream code: https://github.com/carolineec/informative-drawings at commit
2349aee4daf7cb01d8de645b0bbb4f4392fd1395(MIT). - Weights:
model.ziplinked from the upstream README (Google Drive id1MIdHzecxz-z0uY3ARL_R40DlKcuQxiDk), SHA-256 of the zip00e845f815f8e75a4358db50ef24eb3ec27a3bfc54deda49a9fb5dd46cd3d1b2; stylescontour_style,anime_style,opensketch_style(netG_A_latest.pth). Generator as in upstreamtest.py:Generator(input_nc=3, output_nc=1, n_blocks=3). - Export:
convert.py(torch.onnx.export, opset 17, dynamic H and W) thenonnxslim, then fp16 (onnxconverter_common.float16,keep_io_types=True) inverify.py. Added packages in the shared venv: none (onnxslim 0.1.99, onnxconverter_common 1.16.0 were present).
Files
| File | Bytes | SHA-256 |
|---|---|---|
anime.onnx |
8602686 | d0317ccb8713dfa45dbbfc6f51c038aa4d94d5ae4dd568eb0cfb8c2f91e3bd1c |
contour.onnx |
8602686 | df4e518f3a958d2eba69cbc4e1fea63d3b0feb57f6aa4f8315a7575efcbc5e11 |
contour_fp32.onnx |
17185981 | ad2afcd1c5df459e2ff8e23dee888fc68b8b7b22dd3752f9e36f94acd19622a4 |
opensketch.onnx |
8602686 | e4abb6849fc3f3e47ab07dcdc44ee93a7b2b60cb3a841b77c95483633d812cad |
contour.onnx, anime.onnx, opensketch.onnx are fp16 weights with float32 input/output; contour_fp32.onnx is the fp32 fallback of the default style.
I/O
- Input
image: float32[1,3,H,W], RGB, values 0..1 (upstream appliesResize+ToTensoronly, no mean/std). H and W dynamic; the app uses multiples of 8 (long edge 512 preview / 1024 final). Note: InstanceNorm statistics depend on the image size, so the app feeds the whole picture, not tiles. - Output
lines: float32[1,1,H,W], 0..1 (sigmoid), lines dark on white (1 = paper). Dark =< 0.5.
Verification (10 photos: upstream cat/lizard/bridge, skimage chelsea/coffee/rocket/motorcycle/camera, sklearn china/flower)
Against PyTorch; IoU of the thresholded (< 0.5) line maps; ONNX Runtime 1.24.1 CPU provider, 4 threads, x86-64 desktop.
fp32 ONNX: IoU 1.0000, max abs diff <= 4.6e-4 for every style. fp16:
| style | IoU 512 (min of 10) | IoU 1024 (min of 2) | max abs diff 512 | fp16 ms 512 / 1024 | fp32 ms 512 / 1024 |
|---|---|---|---|---|---|
| contour | 0.9998 | 0.9999 | 0.0059 | 605 / 2031 | 652 / 2485 |
| anime | 0.9997 | 0.9995 | 0.0008 | 623 / 2371 | 599 / 2075 |
| opensketch | 0.9996 | 0.9998 | 0.0016 | 531 / 2325 | 531 / 2393 |
fp16 runs on the ORT CPU provider and is not slower than fp32 on x86; not yet measured on an arm64 phone (hence the fp32 fallback file for the default style).
Full numbers: verify_report.json.
Licence
MIT (upstream LICENSE included). Credit: Caroline Chan, Fredo Durand, Phillip Isola, "Learning to generate line drawings that convey geometry and semantics", CVPR 2022.