jbarrow commited on
Commit
f411267
·
verified ·
1 Parent(s): 958874c

Upload FFDNet-L-cpu weights

Browse files
Files changed (2) hide show
  1. FFDNet-L.onnx +3 -0
  2. README.md +107 -0
FFDNet-L.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e00c59edd9a5275dab5847d38f042c8ecc827063650c8aac22b0e486c414cd35
3
+ size 101944542
README.md ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ pipeline_tag: object-detection
3
+ tags:
4
+ - form-field-detection
5
+ - documents
6
+ - commonforms
7
+ library_name: commonforms
8
+ datasets:
9
+ - jbarrow/CommonForms
10
+ ---
11
+
12
+ 🪄 Automatically convert a PDF into a fillable form.
13
+
14
+ [💻 Hosted Models (detect.semanticdocs.org)](https://detect.semanticdocs.org) | [📄 CommonForms Paper](https://arxiv.org/abs/2509.16506) | [🤗 Dataset](https://huggingface.co/datasets/jbarrow/CommonForms) | [🦾 Models](https://github.com/jbarrow/commonforms/tree/main/commonforms/models)
15
+
16
+ ![Pipeline](https://raw.githubusercontent.com/jbarrow/commonforms/main/assets/pipeline.png)
17
+
18
+ # FFDNet-L-cpu
19
+
20
+ FFDNet-L is the 25 million parameter object detector trained on the dataset from the paper [CommonForms: A Large, Diverse Dataset for Form Field Detection](https://arxiv.org/abs/2509.16506).
21
+ The model detects widgets from among three classes: TextBoxes, ChoiceButtons (checkboxes), and Signature fields.
22
+
23
+ ⚠️ This is the CPU-optimized ONNX export of the model!
24
+
25
+ ## Results
26
+
27
+ | Model | Text | Choice | Signature | AP (↑) |
28
+ |-------|------|--------|-----------|--------|
29
+ | FFDNet-S (1216px) | 61.5 | 71.3 | 84.2 | 72.3 |
30
+ | FFDNet-L (1216px) | 71.4 | 78.1 | 93.5 | 81.0 |
31
+
32
+
33
+ ## Installation
34
+
35
+ The `commonforms` package can be installed with either `uv` or `pip`, feel free to choose your package manager flavor.
36
+ The `uv` command:
37
+
38
+ ```sh
39
+ uv pip install commonforms
40
+ ```
41
+
42
+ The `pip` command:
43
+
44
+ ```
45
+ pip install commonforms
46
+ ```
47
+
48
+ Once it's installed, you should be able to run the CLI command on ~any PDF.
49
+ Refer to [the `commonforms` documentation](https://github.com/jbarrow/commonforms) for the latest information.
50
+
51
+ ## CLI
52
+
53
+ The simplest usage will run inference on your CPU using the default suggested settings:
54
+
55
+ ```
56
+ commonforms <input.pdf> <output.pdf>
57
+ ```
58
+
59
+ | Input | Output |
60
+ |-------|--------|
61
+ | ![Input PDF](https://raw.githubusercontent.com/jbarrow/commonforms/main/assets/input.png) | ![Output PDF](https://raw.githubusercontent.com/jbarrow/commonforms/main/assets/output.png) |
62
+
63
+ ### Command Line Arguments
64
+
65
+ | Argument | Type | Default | Description |
66
+ |----------|------|---------|-------------|
67
+ | `input` | Path | Required | Path to the input PDF file |
68
+ | `output` | Path | Required | Path to save the output PDF file |
69
+ | `--model` | str | `FFDNet-L` | Model name (FFDNet-L/FFDNet-S) or path to custom .pt file |
70
+ | `--keep-existing-fields` | flag | `False` | Keep existing form fields in the PDF |
71
+ | `--use-signature-fields` | flag | `False` | Use signature fields instead of text fields for detected signatures |
72
+ | `--device` | str | `cpu` | Device for inference (e.g., `cpu`, `cuda`, `0`) |
73
+ | `--image-size` | int | `1600` | Image size for inference |
74
+ | `--confidence` | float | `0.3` | Confidence threshold for detection |
75
+ | `--fast` | flag | `False` | If running on a CPU, you can trade off accuracy for speed and run in about half the time |
76
+
77
+ ## CommonForms API
78
+
79
+ In addition to the CLI, you can use
80
+
81
+ ```py
82
+ from commonforms import prepare_form
83
+
84
+ prepare_form(
85
+ "path/to/input.pdf",
86
+ "path/to/output.pdf"
87
+ )
88
+ ```
89
+
90
+ All of the above arguments are keyword arguments to the `prepare_form` function.
91
+ E.g. if you want to prepare a with signature fields and keep existing fields at 1216 resolution, you would run:
92
+
93
+ ```
94
+ from commonforms import prepare_form
95
+
96
+ prepare_form(
97
+ "path/to/input.pdf",
98
+ "path/to/output.pdf",
99
+ keep_existing_fields=True,
100
+ use_signature_fields=True,
101
+ image_size=1216
102
+ )
103
+ ```
104
+
105
+ ## References
106
+
107
+ * [CommonForms: A Large, Diverse Dataset for Form Field Detection](https://arxiv.org/abs/2509.16506)