Upload folder using huggingface_hub
Browse files- LICENSE +16 -0
- README.md +62 -0
- aot-fp16.onnx +3 -0
- comic-text-detector-fp16.onnx +3 -0
- detector-fp16.onnx +3 -0
LICENSE
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
This repository aggregates files under different licences. Each file keeps the
|
| 2 |
+
licence of the model it was converted from.
|
| 3 |
+
|
| 4 |
+
detector-fp16.onnx Apache-2.0
|
| 5 |
+
from ogkalu/comic-text-and-bubble-detector
|
| 6 |
+
|
| 7 |
+
comic-text-detector-fp16.onnx GPL-3.0
|
| 8 |
+
from mayocream/comic-text-detector-onnx
|
| 9 |
+
|
| 10 |
+
aot-fp16.onnx GPL-3.0
|
| 11 |
+
from lemondouble/lemon-manga-translator
|
| 12 |
+
|
| 13 |
+
The GPL-3.0 files are aggregated with, not combined into, the Apache-2.0 file.
|
| 14 |
+
Full licence texts:
|
| 15 |
+
Apache-2.0 https://www.apache.org/licenses/LICENSE-2.0
|
| 16 |
+
GPL-3.0 https://www.gnu.org/licenses/gpl-3.0.txt
|
README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
license_name: per-file
|
| 4 |
+
license_link: LICENSE
|
| 5 |
+
tags:
|
| 6 |
+
- onnx
|
| 7 |
+
- manga
|
| 8 |
+
- webgpu
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# Comic text ONNX models, half precision
|
| 12 |
+
|
| 13 |
+
Float16 conversions of three ONNX models for manga and comic text
|
| 14 |
+
processing, aimed at onnxruntime-web on the WebGPU execution provider. The weights are unchanged
|
| 15 |
+
apart from the precision cast; no retraining, pruning, or architecture edit.
|
| 16 |
+
|
| 17 |
+
These exist because WebGPU rewards half precision and, in one case, punishes
|
| 18 |
+
integer quantisation badly.
|
| 19 |
+
|
| 20 |
+
## Files
|
| 21 |
+
|
| 22 |
+
| file | converted from | licence |
|
| 23 |
+
|---|---|---|
|
| 24 |
+
| `detector-fp16.onnx` | [ogkalu/comic-text-and-bubble-detector](https://huggingface.co/ogkalu/comic-text-and-bubble-detector) `detector.onnx` | Apache-2.0 |
|
| 25 |
+
| `comic-text-detector-fp16.onnx` | [mayocream/comic-text-detector-onnx](https://huggingface.co/mayocream/comic-text-detector-onnx) `comic-text-detector.onnx` | GPL-3.0 |
|
| 26 |
+
| `aot-fp16.onnx` | [lemondouble/lemon-manga-translator](https://huggingface.co/lemondouble/lemon-manga-translator) `onnx/aot-inpainting/aot_folded.onnx` | GPL-3.0 |
|
| 27 |
+
|
| 28 |
+
Each file keeps the licence of the model it was converted from. They are
|
| 29 |
+
distributed together as an aggregate, which GPL-3.0 section 5 permits; the
|
| 30 |
+
GPL-3.0 files are not combined with the Apache-2.0 one.
|
| 31 |
+
|
| 32 |
+
## Measured
|
| 33 |
+
|
| 34 |
+
Chrome, Apple M3, onnxruntime-web on WebGPU, median of repeated runs at the
|
| 35 |
+
input size these are run at. "Shipping" is the artifact each was converted from,
|
| 36 |
+
except for detection, where it is the int8 build that was in use before.
|
| 37 |
+
|
| 38 |
+
| model | shipping | this file | agreement with float32 |
|
| 39 |
+
|---|---|---|---|
|
| 40 |
+
| detector | 1610 ms (int8) | **140 ms** | same 10 regions on a real page, worst box IoU 0.969 |
|
| 41 |
+
| comic-text-detector | 468 ms | **290 ms** | 0.006% of mask pixels land on the other side of the threshold |
|
| 42 |
+
| aot | 310 ms | **237 ms** | mean absolute difference 0.6/255, worst 15/255 |
|
| 43 |
+
|
| 44 |
+
The detector number is not a half precision result so much as an integer one.
|
| 45 |
+
WebGPU has no kernels for `ConvInteger` or `MatMulInteger`, so every quantised
|
| 46 |
+
node in the int8 build crosses back to the CPU. Its float32 build already runs
|
| 47 |
+
in 188 ms; half precision takes it to 140 ms.
|
| 48 |
+
|
| 49 |
+
A LaMa conversion is deliberately absent. It overflows in the fast Fourier
|
| 50 |
+
convolution branch and returns NaN, for a 16% gain that would not have been
|
| 51 |
+
worth it anyway.
|
| 52 |
+
|
| 53 |
+
## How they were made
|
| 54 |
+
|
| 55 |
+
`onnxconverter-common`'s `convert_float_to_float16` with `keep_io_types=True`,
|
| 56 |
+
followed by a repair pass. The converter retypes tensors but leaves each `Cast`
|
| 57 |
+
node's `to` attribute on the original dtype, so the graph declares float32 where
|
| 58 |
+
it now produces float16 and the session refuses to build. Setting `to` from the
|
| 59 |
+
inferred output type fixes 5 casts in the detector and 10 in AOT.
|
| 60 |
+
|
| 61 |
+
Inputs and outputs stay float32, so these are drop-in replacements: no caller
|
| 62 |
+
change beyond the file name.
|
aot-fp16.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bccfffc100a34f9e75999e6f89d8fe478cc59d663befe58cfd3be3c2df1cc119
|
| 3 |
+
size 11770691
|
comic-text-detector-fp16.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:af802bfe7644e3ea1d803d06a7c7043f277a5ce89e86ad4502733a64136688a0
|
| 3 |
+
size 47363910
|
detector-fp16.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fda55a1bc410ed3aa72f793b99593e584faa017964983464fc244a0de68fed56
|
| 3 |
+
size 84724910
|