Upload FFDNet-S-cpu weights and README
Browse files- FFDNet-S.pt +3 -0
- README.md +105 -0
FFDNet-S.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:21716bf478a5c8a515bc67c3e1c59b3d97c0e3225823e7afd95c7fe732286163
|
| 3 |
+
size 19272467
|
README.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+

|
| 17 |
+
|
| 18 |
+
# FFDNet-S
|
| 19 |
+
|
| 20 |
+
FFDNet-S is the 6 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 |
+
## Results
|
| 24 |
+
|
| 25 |
+
| Model | Text | Choice | Signature | AP (↑) |
|
| 26 |
+
|-------|------|--------|-----------|--------|
|
| 27 |
+
| FFDNet-S (1216px) | 61.5 | 71.3 | 84.2 | 72.3 |
|
| 28 |
+
| FFDNet-L (1216px) | 71.4 | 78.1 | 93.5 | 81.0 |
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
## Installation
|
| 32 |
+
|
| 33 |
+
The `commonforms` package can be installed with either `uv` or `pip`, feel free to choose your package manager flavor.
|
| 34 |
+
The `uv` command:
|
| 35 |
+
|
| 36 |
+
```sh
|
| 37 |
+
uv pip install commonforms
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
The `pip` command:
|
| 41 |
+
|
| 42 |
+
```
|
| 43 |
+
pip install commonforms
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
Once it's installed, you should be able to run the CLI command on ~any PDF.
|
| 47 |
+
Refer to [the `commonforms` documentation](https://github.com/jbarrow/commonforms) for the latest information.
|
| 48 |
+
|
| 49 |
+
## CLI
|
| 50 |
+
|
| 51 |
+
The simplest usage will run inference on your CPU using the default suggested settings:
|
| 52 |
+
|
| 53 |
+
```
|
| 54 |
+
commonforms <input.pdf> <output.pdf>
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
| Input | Output |
|
| 58 |
+
|-------|--------|
|
| 59 |
+
|  |  |
|
| 60 |
+
|
| 61 |
+
### Command Line Arguments
|
| 62 |
+
|
| 63 |
+
| Argument | Type | Default | Description |
|
| 64 |
+
|----------|------|---------|-------------|
|
| 65 |
+
| `input` | Path | Required | Path to the input PDF file |
|
| 66 |
+
| `output` | Path | Required | Path to save the output PDF file |
|
| 67 |
+
| `--model` | str | `FFDNet-L` | Model name (FFDNet-L/FFDNet-S) or path to custom .pt file |
|
| 68 |
+
| `--keep-existing-fields` | flag | `False` | Keep existing form fields in the PDF |
|
| 69 |
+
| `--use-signature-fields` | flag | `False` | Use signature fields instead of text fields for detected signatures |
|
| 70 |
+
| `--device` | str | `cpu` | Device for inference (e.g., `cpu`, `cuda`, `0`) |
|
| 71 |
+
| `--image-size` | int | `1600` | Image size for inference |
|
| 72 |
+
| `--confidence` | float | `0.3` | Confidence threshold for detection |
|
| 73 |
+
| `--fast` | flag | `False` | If running on a CPU, you can trade off accuracy for speed and run in about half the time |
|
| 74 |
+
|
| 75 |
+
## CommonForms API
|
| 76 |
+
|
| 77 |
+
In addition to the CLI, you can use
|
| 78 |
+
|
| 79 |
+
```py
|
| 80 |
+
from commonforms import prepare_form
|
| 81 |
+
|
| 82 |
+
prepare_form(
|
| 83 |
+
"path/to/input.pdf",
|
| 84 |
+
"path/to/output.pdf"
|
| 85 |
+
)
|
| 86 |
+
```
|
| 87 |
+
|
| 88 |
+
All of the above arguments are keyword arguments to the `prepare_form` function.
|
| 89 |
+
E.g. if you want to prepare a with signature fields and keep existing fields at 1216 resolution, you would run:
|
| 90 |
+
|
| 91 |
+
```
|
| 92 |
+
from commonforms import prepare_form
|
| 93 |
+
|
| 94 |
+
prepare_form(
|
| 95 |
+
"path/to/input.pdf",
|
| 96 |
+
"path/to/output.pdf",
|
| 97 |
+
keep_existing_fields=True,
|
| 98 |
+
use_signature_fields=True,
|
| 99 |
+
image_size=1216
|
| 100 |
+
)
|
| 101 |
+
```
|
| 102 |
+
|
| 103 |
+
## References
|
| 104 |
+
|
| 105 |
+
* [CommonForms: A Large, Diverse Dataset for Form Field Detection](https://arxiv.org/abs/2509.16506)
|