Add ffdetr form field detector (jbarrow/FFDetr)
Browse files- README.md +14 -1
- ffdetr/config.json +21 -0
- ffdetr/model.onnx +3 -0
README.md
CHANGED
|
@@ -11,12 +11,13 @@ base_model:
|
|
| 11 |
- deepseek-ai/DeepSeek-OCR-2
|
| 12 |
- Helsinki-NLP/opus-mt-es-en
|
| 13 |
- storia/font-classify-onnx
|
|
|
|
| 14 |
---
|
| 15 |
|
| 16 |
# ocrtool models
|
| 17 |
|
| 18 |
ONNX models used by ocrtool, a C++ command-line tool that converts PDFs to Markdown, translates
|
| 19 |
-
PDFs in place
|
| 20 |
Python involved.
|
| 21 |
|
| 22 |
Nothing here was trained or fine-tuned by us. Each folder is a format conversion of the original
|
|
@@ -28,6 +29,7 @@ weights, or an unchanged copy, and stays under the original author's licence.
|
|
| 28 |
| `deepseek-ocr2-fp16/` | 6.6 GB | PDF to Markdown, GPU, fastest | [deepseek-ai/DeepSeek-OCR-2](https://huggingface.co/deepseek-ai/DeepSeek-OCR-2) | Apache-2.0 |
|
| 29 |
| `deepseek-ocr2-fp32/` | 13 GB | Full precision; the source for quantizing | [deepseek-ai/DeepSeek-OCR-2](https://huggingface.co/deepseek-ai/DeepSeek-OCR-2) | Apache-2.0 |
|
| 30 |
| `opus-mt-es-en/` | 0.6 GB | Spanish to English translation | [Helsinki-NLP/opus-mt-es-en](https://huggingface.co/Helsinki-NLP/opus-mt-es-en) | Apache-2.0 |
|
|
|
|
| 31 |
| `font-classify/` | 64 MB | Font identification | [storia/font-classify-onnx](https://huggingface.co/storia/font-classify-onnx) | MIT |
|
| 32 |
|
| 33 |
Each folder is self-contained. Download the whole folder and keep the file names: an `.onnx` file
|
|
@@ -38,6 +40,7 @@ hf download baker76/ocrtool-models --include "deepseek-ocr2-int4/*" --local-dir
|
|
| 38 |
ocrtool convert in.pdf -o out.md --model models/deepseek-ocr2-int4
|
| 39 |
ocrtool translate in.pdf -o out.pdf --model models/opus-mt-es-en
|
| 40 |
ocrtool fonts scan.png -o fonts.json --model models/font-classify
|
|
|
|
| 41 |
```
|
| 42 |
|
| 43 |
## DeepSeek-OCR-2
|
|
@@ -71,4 +74,14 @@ Google Fonts. `model.onnx` takes one 320 x 320 image; `model_config.yaml` lists
|
|
| 71 |
[training repository](https://github.com/Storia-AI/font-classify), maps each class to the family
|
| 72 |
name and variant used by Google Fonts.
|
| 73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
The scripts that produced the exported files are in the ocrtool repository under `tools/export/`.
|
|
|
|
| 11 |
- deepseek-ai/DeepSeek-OCR-2
|
| 12 |
- Helsinki-NLP/opus-mt-es-en
|
| 13 |
- storia/font-classify-onnx
|
| 14 |
+
- jbarrow/FFDetr
|
| 15 |
---
|
| 16 |
|
| 17 |
# ocrtool models
|
| 18 |
|
| 19 |
ONNX models used by ocrtool, a C++ command-line tool that converts PDFs to Markdown, translates
|
| 20 |
+
PDFs in place, identifies the fonts in an image and finds the fields on PDF forms. They run on ONNX Runtime with no
|
| 21 |
Python involved.
|
| 22 |
|
| 23 |
Nothing here was trained or fine-tuned by us. Each folder is a format conversion of the original
|
|
|
|
| 29 |
| `deepseek-ocr2-fp16/` | 6.6 GB | PDF to Markdown, GPU, fastest | [deepseek-ai/DeepSeek-OCR-2](https://huggingface.co/deepseek-ai/DeepSeek-OCR-2) | Apache-2.0 |
|
| 30 |
| `deepseek-ocr2-fp32/` | 13 GB | Full precision; the source for quantizing | [deepseek-ai/DeepSeek-OCR-2](https://huggingface.co/deepseek-ai/DeepSeek-OCR-2) | Apache-2.0 |
|
| 31 |
| `opus-mt-es-en/` | 0.6 GB | Spanish to English translation | [Helsinki-NLP/opus-mt-es-en](https://huggingface.co/Helsinki-NLP/opus-mt-es-en) | Apache-2.0 |
|
| 32 |
+
| `ffdetr/` | 125 MB | Form field detection | [jbarrow/FFDetr](https://huggingface.co/jbarrow/FFDetr) | Apache-2.0 |
|
| 33 |
| `font-classify/` | 64 MB | Font identification | [storia/font-classify-onnx](https://huggingface.co/storia/font-classify-onnx) | MIT |
|
| 34 |
|
| 35 |
Each folder is self-contained. Download the whole folder and keep the file names: an `.onnx` file
|
|
|
|
| 40 |
ocrtool convert in.pdf -o out.md --model models/deepseek-ocr2-int4
|
| 41 |
ocrtool translate in.pdf -o out.pdf --model models/opus-mt-es-en
|
| 42 |
ocrtool fonts scan.png -o fonts.json --model models/font-classify
|
| 43 |
+
ocrtool form detect flat.pdf -o fillable.pdf --model models/ffdetr
|
| 44 |
```
|
| 45 |
|
| 46 |
## DeepSeek-OCR-2
|
|
|
|
| 74 |
[training repository](https://github.com/Storia-AI/font-classify), maps each class to the family
|
| 75 |
name and variant used by Google Fonts.
|
| 76 |
|
| 77 |
+
## Form field detector
|
| 78 |
+
|
| 79 |
+
[FFDetr](https://huggingface.co/jbarrow/FFDetr), the RF-DETR Medium detector trained by Joe Barrow on
|
| 80 |
+
the [CommonForms](https://huggingface.co/datasets/jbarrow/CommonForms) dataset, exported with RF-DETR
|
| 81 |
+
1.12 at its training resolution of 1024 x 1024. `model.onnx` returns 300 boxes (`dets`, centre and
|
| 82 |
+
size as fractions of the page) and their class logits (`labels`); only the first three logits are
|
| 83 |
+
trained classes: text box, choice button and signature. `config.json` holds the normalisation and the
|
| 84 |
+
default score threshold (0.4). On page 1 of the IRS W-9 the export finds the same 25 fields as the
|
| 85 |
+
PyTorch model.
|
| 86 |
+
|
| 87 |
The scripts that produced the exported files are in the ocrtool repository under `tools/export/`.
|
ffdetr/config.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"resolution": 1024,
|
| 3 |
+
"mean": [
|
| 4 |
+
0.485,
|
| 5 |
+
0.456,
|
| 6 |
+
0.406
|
| 7 |
+
],
|
| 8 |
+
"std": [
|
| 9 |
+
0.229,
|
| 10 |
+
0.224,
|
| 11 |
+
0.225
|
| 12 |
+
],
|
| 13 |
+
"classes": [
|
| 14 |
+
"text",
|
| 15 |
+
"choice",
|
| 16 |
+
"signature"
|
| 17 |
+
],
|
| 18 |
+
"score_threshold": 0.4,
|
| 19 |
+
"nms_iou": 0.1,
|
| 20 |
+
"source": "jbarrow/FFDetr"
|
| 21 |
+
}
|
ffdetr/model.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:acde4e4fa4698560f9e5ff252d964094626b3a32384a36a7c0c901f882634223
|
| 3 |
+
size 125088417
|