EveryRobotTools portrait line-drawing models (ONNX, fp16)
ONNX conversions of two published line-drawing generators. They are used in the browser by the portrait pen-path tool at https://everyrobottools.com/tools/portrait with onnxruntime-web, on the WASM CPU backend. No images are uploaded; inference runs on the user's device.
These files are conversions only. All credit for the models goes to the original authors listed below. Conversion scripts and the comparison against PyTorch are in the site repository under scripts/models/.
Files
| File | Bytes | sha256 | Original | License |
|---|---|---|---|---|
informative_drawings_style2_fp16.onnx |
8,641,428 | b3483f0616fdcf2fa87983d4c73f8fac56d55661b4a97c8b1da1008ad2eca925 |
informative-drawings, style 2 (model2.pth) |
MIT — see LICENSE-informative-drawings |
apdrawinggan_global_fp16.onnx |
108,848,509 | c92bc878f7dcbfae5ad22de4fa80876c6aa87e9ccc9fd19200324f40aa24659f |
APDrawingGAN formal_author epoch 300, global generator G |
Apache-2.0 — see LICENSE-APDrawingGAN |
apdrawinggan_parts_fp16.onnx |
18,468,570 | 40ceab8a6c35fff33a703972ba028f6cf8a8d9d0303d181212d5cbe13f0c0185 |
APDrawingGAN local generators GLEyel, GLEyer, GLNose, GLMouth, GLHair, GLBG |
Apache-2.0 |
apdrawinggan_combine_fp16.onnx |
344,984 | f78fa7e5d6af2d1b17fc8e49d131e7ccbf105fa76a09013c064c7367847aedc3 |
APDrawingGAN fusion network GCombine |
Apache-2.0 |
All files store weights in float16. Inputs and outputs stay float32 (keep_io_types).
Input / output
- informative-drawings style 2
- Input
input:[1,3,H,W], RGB in 0..1, no normalization. H and W are dynamic; multiples of 8 are recommended. - Output
output:[1,1,H,W], 0..1, white background with dark lines.
- Input
- APDrawingGAN (all tensors in [-1,1])
- Preprocessing: 512×512 face aligned by the 5-point similarity transform of the original
face_align_512.m. Part crops are taken at the originalsingle_dataset.pypositions. Sizes: eyes 80×112, nose 96×96, mouth 80×128. apdrawinggan_global:A[1,3,512,512]→B0[1,1,512,512]apdrawinggan_parts:eyel, eyer [1,3,80,112],nose [1,3,96,96],mouth [1,3,80,128],hair, bg [1,3,512,512]→ the six corresponding part outputs- Pasting: the parts are pasted onto a 512 canvas outside the graphs, with min-pooling as in the original
partCombiner2_bg(comb_op 1), because the paste offsets depend on the face. apdrawinggan_combine:B01[1,2,512,512](concatenation of B0 and the pasted parts) →B[1,1,512,512]
- Preprocessing: 512×512 face aligned by the 5-point similarity transform of the original
NOTICE — modifications made in conversion
- Converted from the original PyTorch weights to ONNX (opset 17). Weights were converted to float16.
- APDrawingGAN: the original test script runs the networks without
eval().- BatchNorm therefore uses per-image statistics. With batch size 1 this equals affine InstanceNorm, so BatchNorm was exported as InstanceNormalization with the same affine parameters. Output is unchanged.
- Dropout was disabled to make inference deterministic. The original produces slightly different strokes on every run; visually there was no difference.
- Fidelity: on the repository's example photos, the full pipeline was compared with the original PyTorch.
- fp32 ONNX: max |Δ| ≤ 1e-3.
- fp16: mean |Δ| ≤ 1.5e-4, and ≤ 0.01 % of pixels change after binarizing at 0.6.
- informative-drawings style 2: max |Δ| 5.6e-4 against PyTorch, and ≤ 0.001 % of pixels change after binarizing.
Sources and credits
- informative-drawings
- Paper: Caroline Chan, Frédo Durand, Phillip Isola, Learning to Generate Line Drawings that Convey Geometry and Semantics, CVPR 2022.
- Code: https://github.com/carolineec/informative-drawings (MIT).
- Weights: Hugging Face Space
carolineec/informativedrawingsat revisionbd4b4299be505803e036203a39c02024b4cfee11, filemodel2.pth, sha25630a534781061f34e83bb9406b4335da4ff2616c95d22a585c1245aa8363e74e0.
- APDrawingGAN
- Paper: Ran Yi, Yong-Jin Liu, Yu-Kun Lai, Paul L. Rosin, APDrawingGAN: Generating Artistic Portrait Drawings from Face Photos with Hierarchical GANs, CVPR 2019.
- Code: https://github.com/yiranran/APDrawingGAN at commit
38f4319f8e724f6bef5a32c348a8c0967baad773(Apache-2.0). - Weights: https://cg.cs.tsinghua.edu.cn/people/~Yongjin/APDrawingGAN-Models1.zip, sha256
7b1d41cc8bfdf28f4c9c67fb5f2bb90fd08b0a4582a41994a1c8a5e3387c8a17. Inside it,formal_author/300_net_gen.pthas sha256652c3cd14e2fafd50c020e4a17b2cdd58bf0fa1e5b692a43f8dc8852270fc604.
@inproceedings{YiLLR19,
title = {{APDrawingGAN}: Generating Artistic Portrait Drawings from Face Photos with Hierarchical GANs},
author = {Yi, Ran and Liu, Yong-Jin and Lai, Yu-Kun and Rosin, Paul L},
booktitle = {{IEEE} Conference on Computer Vision and Pattern Recognition (CVPR '19)},
pages = {10743--10752},
year = {2019}
}
@inproceedings{chan2022drawings,
title = {Learning to generate line drawings that convey geometry and semantics},
author = {Chan, Caroline and Durand, Fr{\'e}do and Isola, Phillip},
booktitle = {CVPR},
year = {2022}
}