Update README.md
Browse files
README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
---
|
| 2 |
license: other
|
| 3 |
license_name: mixed-permissive
|
| 4 |
-
license_link:
|
| 5 |
tags:
|
| 6 |
- onnx
|
| 7 |
- image-processing
|
|
@@ -10,4 +10,111 @@ tags:
|
|
| 10 |
- denoising
|
| 11 |
- image-segmentation
|
| 12 |
library_name: onnx
|
| 13 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: other
|
| 3 |
license_name: mixed-permissive
|
| 4 |
+
license_link: https://huggingface.co/EasyImageSharp/EasyImageSharp-models#licensing
|
| 5 |
tags:
|
| 6 |
- onnx
|
| 7 |
- image-processing
|
|
|
|
| 10 |
- denoising
|
| 11 |
- image-segmentation
|
| 12 |
library_name: onnx
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# EasyImageSharp models
|
| 16 |
+
|
| 17 |
+
ONNX models used by [EasyImageSharp.AI](https://www.nuget.org/packages/EasyImageSharp.AI), the optional
|
| 18 |
+
AI add-on for the [EasyImageSharp](https://github.com/FarhanLodi/EasyImageSharp) imaging library for .NET.
|
| 19 |
+
|
| 20 |
+
The library downloads these files at run time, verifies each against a SHA-256 pinned in its source, and
|
| 21 |
+
caches them locally. Verification is fail-closed: a file whose hash does not match is deleted rather than
|
| 22 |
+
run.
|
| 23 |
+
|
| 24 |
+
## Licensing
|
| 25 |
+
|
| 26 |
+
**These weights carry the licences of their original authors, which differ per file.** This repository
|
| 27 |
+
redistributes them unmodified in ONNX form; it does not and cannot relicense them. The repository-level
|
| 28 |
+
tag is therefore `other` — consult the per-file licence below, and the upstream project for the
|
| 29 |
+
authoritative terms and copyright notices.
|
| 30 |
+
|
| 31 |
+
| File | Task | Size | Licence | Upstream |
|
| 32 |
+
|---|---|---|---|---|
|
| 33 |
+
| `PP-LCNet_x1_0_doc_ori.onnx` | Document orientation (0/90/180/270) | 6.8 MB | Apache-2.0 | [PaddleX](https://github.com/PaddlePaddle/PaddleX) `doc_orientation_classify` |
|
| 34 |
+
| `UVDoc.onnx` | Page dewarping | 31 MB | MIT | [tanguymagne/UVDoc](https://github.com/tanguymagne/UVDoc) |
|
| 35 |
+
| `realesrgan_general_x4v3.onnx` | Super-resolution ×4 | 4.9 MB | **BSD-3-Clause** | [xinntao/Real-ESRGAN](https://github.com/xinntao/Real-ESRGAN) `realesr-general-x4v3` |
|
| 36 |
+
| `dncnn_gray_blind.onnx` | Grayscale denoising | 2.7 MB | MIT | [cszn/KAIR](https://github.com/cszn/KAIR) `dncnn_gray_blind` |
|
| 37 |
+
| `u2net.onnx` | Saliency / background removal (default) | 176 MB | Apache-2.0 | [xuebinqin/U-2-Net](https://github.com/xuebinqin/U-2-Net) `u2net` |
|
| 38 |
+
| `u2netp.onnx` | Saliency, small and fast variant | 4.6 MB | Apache-2.0 | [xuebinqin/U-2-Net](https://github.com/xuebinqin/U-2-Net) `u2netp` |
|
| 39 |
+
| `sauvolanet.onnx` | Learned document binarisation | 0.3 MB | MIT | [Leedeng/SauvolaNet](https://github.com/Leedeng/SauvolaNet) |
|
| 40 |
+
|
| 41 |
+
`realesrgan_general_x4v3.onnx` is BSD-3-Clause: redistribution must retain the copyright notice and the
|
| 42 |
+
list of conditions, and the authors' names may not be used to endorse derived products; its notice is
|
| 43 |
+
reproduced at the end of this card.
|
| 44 |
+
|
| 45 |
+
## Input and output contracts
|
| 46 |
+
|
| 47 |
+
The library feeds these tensors exactly and interprets the outputs accordingly. An export that does not
|
| 48 |
+
match will run and produce wrong results, so the contract is part of the published artefact.
|
| 49 |
+
|
| 50 |
+
| File | Input | Normalisation | Output |
|
| 51 |
+
|---|---|---|---|
|
| 52 |
+
| `PP-LCNet_x1_0_doc_ori.onnx` | `x` `[1,3,224,224]` RGB | ImageNet mean/std | `[1,4]` scores over 0°, 90°, 180°, 270° clockwise |
|
| 53 |
+
| `UVDoc.onnx` | `image` `[1,3,712,488]` RGB | 0–1 | `[1,3,712,488]` rectified image in 0–1 |
|
| 54 |
+
| `realesrgan_general_x4v3.onnx` | `input` `[1,3,H,W]` RGB, **dynamic H/W** | 0–1 | `[1,3,4H,4W]` in 0–1 |
|
| 55 |
+
| `dncnn_gray_blind.onnx` | `input` `[1,1,H,W]` luminance, **dynamic H/W** | 0–1 | `[1,1,H,W]` **noise residual**; clean = input − output |
|
| 56 |
+
| `u2net.onnx` | `input.1` `[1,3,320,320]` RGB | ImageNet mean/std | `[1,1,320,320]` saliency mask in 0–1 |
|
| 57 |
+
| `u2netp.onnx` | `input` `[1,3,320,320]` RGB | ImageNet mean/std | `[1,1,320,320]` saliency mask in 0–1 |
|
| 58 |
+
| `sauvolanet.onnx` | `input` `[1,1,H,W]` luminance, **dynamic H/W** | 0–1 | `[1,1,H,W]` per-pixel **threshold map**; white where luminance ≥ threshold |
|
| 59 |
+
|
| 60 |
+
## Checksums
|
| 61 |
+
|
| 62 |
+
Verified by the library against the values compiled into `ModelRegistry.cs`. See `checksums.json`.
|
| 63 |
+
|
| 64 |
+
```
|
| 65 |
+
PP-LCNet_x1_0_doc_ori.onnx D85B3185075AFCA1A83157F73EAC2E52B598D72E9D47DD19CC4A2F3605E23E3F
|
| 66 |
+
UVDoc.onnx 7E54E917AD9CA8F6CFFE606C7C311AAD3B6EEE457D4D9776F99F175D0CA86835
|
| 67 |
+
realesrgan_general_x4v3.onnx AAA2B465D2258BDCC30D51076BC358DA00D1595D2FA05697979E782F97DE325A
|
| 68 |
+
dncnn_gray_blind.onnx A0A21D0677EA5FB83A66D922EBFB22BC81926C79044B08778F4A6D740FA7864F
|
| 69 |
+
u2net.onnx 8D10D2F3BB75AE3B6D527C77944FC5E7DCD94B29809D47A739A7A728A912B491
|
| 70 |
+
u2netp.onnx 2B5D0563269555FC84FFCA01B24AF5081581D38614F858ECF913331DF0E2ED88
|
| 71 |
+
sauvolanet.onnx 948AAEA4882D4D6734C0FEC4739381857BE97F62526AD8BA8CA067A353106160
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
**Published files are never overwritten.** A re-export is published under a new file name with a new
|
| 75 |
+
checksum, so a pinned library version always resolves the exact bytes it was tested against.
|
| 76 |
+
|
| 77 |
+
## Provenance
|
| 78 |
+
|
| 79 |
+
`realesrgan_general_x4v3.onnx` and `dncnn_gray_blind.onnx` were exported by
|
| 80 |
+
[`tools/export_models.py`](https://github.com/FarhanLodi/EasyImageSharp/blob/main/tools/export_models.py),
|
| 81 |
+
and `sauvolanet.onnx` by
|
| 82 |
+
[`tools/export_sauvolanet.py`](https://github.com/FarhanLodi/EasyImageSharp/blob/main/tools/export_sauvolanet.py),
|
| 83 |
+
both at opset 17 from the upstream weights linked above. Each export is validated against the reference
|
| 84 |
+
implementation before publication. `u2netp.onnx` is redistributed from an existing ONNX release. `PP-LCNet_x1_0_doc_ori.onnx` and
|
| 85 |
+
`UVDoc.onnx` are redistributed unmodified.
|
| 86 |
+
|
| 87 |
+
## Usage
|
| 88 |
+
|
| 89 |
+
```csharp
|
| 90 |
+
using EasyImageSharp;
|
| 91 |
+
using EasyImageSharp.AI;
|
| 92 |
+
using EasyImageSharp.PixelFormats;
|
| 93 |
+
|
| 94 |
+
using var ai = new ImageAiSession();
|
| 95 |
+
using Image<Rgb24> page = Image.Load<Rgb24>("photo.jpg");
|
| 96 |
+
|
| 97 |
+
page.AutoOrient(ai); // PP-LCNet_x1_0_doc_ori
|
| 98 |
+
page.DewarpDocument(ai); // UVDoc
|
| 99 |
+
page.DenoiseAI(ai); // dncnn_gray_blind
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
Models download on first use into `%LOCALAPPDATA%/EasyImageSharp/models` (`~/.local/share` elsewhere).
|
| 103 |
+
For air-gapped deployment, pre-seed that directory and set `ImageAiOptions.Offline = true`.
|
| 104 |
+
|
| 105 |
+
## Upstream notices
|
| 106 |
+
|
| 107 |
+
Real-ESRGAN (`realesrgan_general_x4v3.onnx`) is distributed under the BSD 3-Clause License:
|
| 108 |
+
|
| 109 |
+
> Copyright (c) 2021, Xintao Wang. All rights reserved.
|
| 110 |
+
>
|
| 111 |
+
> Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
| 112 |
+
> that the above copyright notice, this list of conditions and the following disclaimer are retained, and
|
| 113 |
+
> that neither the name of the copyright holder nor the names of its contributors may be used to endorse
|
| 114 |
+
> or promote products derived from this software without specific prior written permission. This software
|
| 115 |
+
> is provided by the copyright holders "as is" and any warranties are disclaimed.
|
| 116 |
+
|
| 117 |
+
The full text is in the [upstream repository](https://github.com/xinntao/Real-ESRGAN/blob/master/LICENSE).
|
| 118 |
+
MIT-licensed weights (`UVDoc.onnx`, `dncnn_gray_blind.onnx`, `sauvolanet.onnx`) and Apache-2.0 weights
|
| 119 |
+
(`PP-LCNet_x1_0_doc_ori.onnx`, `u2net.onnx`, `u2netp.onnx`) retain the terms of their upstream projects,
|
| 120 |
+
linked in the table above.
|