Update README.md
Browse files
README.md
CHANGED
|
@@ -37,6 +37,7 @@ are a common source of hallucinated OCR output.
|
|
| 37 |
[olmOCR-mix-0225](https://huggingface.co/datasets/allenai/olmOCR-mix-0225). FUNSD is available
|
| 38 |
for non-commercial, research and educational purposes only, and it was what kept v0
|
| 39 |
non-commercial.
|
|
|
|
| 40 |
|
| 41 |
The previous release, [`Inceptive/document-gate-keeper-v0`](https://huggingface.co/Inceptive/document-gate-keeper-v0),
|
| 42 |
stays available unchanged. **v0.5 expects different preprocessing**, so do not reuse v0's code (see
|
|
@@ -50,7 +51,7 @@ stays available unchanged. **v0.5 expects different preprocessing**, so do not r
|
|
| 50 |
| **Input** | `input_IMAGE`, `float32[N, 3, 640, 640]`, NCHW, RGB, normalized |
|
| 51 |
| **Output** | `output_0`, `float32[N, 2]`, softmax probabilities, order `[bad, good]` |
|
| 52 |
| **Runtime** | Any ONNX Runtime execution provider (CPU is fast enough for per-crop use) |
|
| 53 |
-
| **Test F1** | 0.
|
| 54 |
|
| 55 |
## Intended use
|
| 56 |
|
|
@@ -101,7 +102,7 @@ Feeding v0.5 with v0's `preprocess()` gives it inputs it was not trained on.
|
|
| 101 |
`float32` tensor of shape `[N, 2]`, holding class probabilities in the order `["bad", "good"]`. The
|
| 102 |
graph already ends with a `Softmax`, so do **not** apply another one.
|
| 103 |
|
| 104 |
-
The decision rule we use is `P(good) < 0.
|
| 105 |
(fewer hallucinations, more missed text), or lower it to keep more.
|
| 106 |
|
| 107 |
## How to use
|
|
@@ -190,25 +191,25 @@ crop through `preprocess` above. Do not run the classifier on the detector's own
|
|
| 190 |
|
| 191 |
## Evaluation
|
| 192 |
|
| 193 |
-
The model was evaluated on a held-out test split (10% of the dataset): 1,
|
| 194 |
-
|
| 195 |
|
| 196 |
| Class | Precision | Recall | F1 | Error rate | Crops |
|
| 197 |
|---|---|---|---|---|---|
|
| 198 |
-
| `bad` | 0.
|
| 199 |
-
| `good` | 0.
|
| 200 |
-
| **Overall** | **0.
|
| 201 |
|
| 202 |
Confusion matrix (rows: true class, columns: predicted class):
|
| 203 |
|
| 204 |
| | predicted `bad` | predicted `good` |
|
| 205 |
|---|---|---|
|
| 206 |
-
| **`bad`** |
|
| 207 |
-
| **`good`** |
|
| 208 |
|
| 209 |
-
That is
|
| 210 |
`1 − recall`. The overall precision and recall are micro-averaged, so they both equal the accuracy,
|
| 211 |
-
and the overall F1 is the macro average of the two class F1 scores. The average test loss is 0.
|
| 212 |
|
| 213 |
> These crops come from the same synthetic pipeline as the training crops (see
|
| 214 |
> [Training data](#training-data)). The numbers measure how well the model detects resampling and
|
|
@@ -238,7 +239,7 @@ print({p.key: p.value for p in onnx.load(model_path).metadata_props})
|
|
| 238 |
|
| 239 |
## Training data
|
| 240 |
|
| 241 |
-
The dataset holds **
|
| 242 |
It is synthetic and was built from a single public source:
|
| 243 |
|
| 244 |
- [**olmOCR-mix-0225**](https://huggingface.co/datasets/allenai/olmOCR-mix-0225) (Allen Institute
|
|
@@ -262,14 +263,14 @@ Unlike v0, no FUNSD data is used.
|
|
| 262 |
| Setting | Value |
|
| 263 |
|---|---|
|
| 264 |
| Epochs | 10 |
|
| 265 |
-
| Batch size |
|
| 266 |
| Optimizer | AdamW, weight decay 1e-4 |
|
| 267 |
| Learning rate | 5e-4, constant |
|
| 268 |
| Loss | Cross-entropy with label smoothing 0.1 |
|
| 269 |
| Input | 640 × 640 × 3: RGB, aspect-preserving resize (upscaling allowed), centered white padding, ImageNet normalization |
|
| 270 |
|
| 271 |
-
The final training loss is 0.
|
| 272 |
-
lowest reachable loss is about 0.199, so both values are close to that floor despite the ~
|
| 273 |
accuracy.
|
| 274 |
|
| 275 |
## Limitations and biases
|
|
|
|
| 37 |
[olmOCR-mix-0225](https://huggingface.co/datasets/allenai/olmOCR-mix-0225). FUNSD is available
|
| 38 |
for non-commercial, research and educational purposes only, and it was what kept v0
|
| 39 |
non-commercial.
|
| 40 |
+
- **CORD dataset added to the training data.**
|
| 41 |
|
| 42 |
The previous release, [`Inceptive/document-gate-keeper-v0`](https://huggingface.co/Inceptive/document-gate-keeper-v0),
|
| 43 |
stays available unchanged. **v0.5 expects different preprocessing**, so do not reuse v0's code (see
|
|
|
|
| 51 |
| **Input** | `input_IMAGE`, `float32[N, 3, 640, 640]`, NCHW, RGB, normalized |
|
| 52 |
| **Output** | `output_0`, `float32[N, 2]`, softmax probabilities, order `[bad, good]` |
|
| 53 |
| **Runtime** | Any ONNX Runtime execution provider (CPU is fast enough for per-crop use) |
|
| 54 |
+
| **Test F1** | 0.9857 on 1,396 held-out crops (see [Evaluation](#evaluation)) |
|
| 55 |
|
| 56 |
## Intended use
|
| 57 |
|
|
|
|
| 102 |
`float32` tensor of shape `[N, 2]`, holding class probabilities in the order `["bad", "good"]`. The
|
| 103 |
graph already ends with a `Softmax`, so do **not** apply another one.
|
| 104 |
|
| 105 |
+
The decision rule we use is `P(good) < 0.6 → low quality`. Raise the threshold to skip more regions
|
| 106 |
(fewer hallucinations, more missed text), or lower it to keep more.
|
| 107 |
|
| 108 |
## How to use
|
|
|
|
| 191 |
|
| 192 |
## Evaluation
|
| 193 |
|
| 194 |
+
The model was evaluated on a held-out test split (10% of the dataset): 1,396 crops, 688 `bad` and
|
| 195 |
+
708 `good`.
|
| 196 |
|
| 197 |
| Class | Precision | Recall | F1 | Error rate | Crops |
|
| 198 |
|---|---|---|---|---|---|
|
| 199 |
+
| `bad` | 0.9744 | 0.9971 | 0.9856 | 0.29% | 688 |
|
| 200 |
+
| `good` | 0.9971 | 0.9746 | 0.9857 | 2.5% | 708 |
|
| 201 |
+
| **Overall** | **0.9857** | **0.9857** | **0.9857** | **1.4%** | **1,396** |
|
| 202 |
|
| 203 |
Confusion matrix (rows: true class, columns: predicted class):
|
| 204 |
|
| 205 |
| | predicted `bad` | predicted `good` |
|
| 206 |
|---|---|---|
|
| 207 |
+
| **`bad`** | 686 | 2 |
|
| 208 |
+
| **`good`** | 18 | 690 |
|
| 209 |
|
| 210 |
+
That is 20 errors out of 1,396 crops, an accuracy of 98.57%. The per-class error rate is
|
| 211 |
`1 − recall`. The overall precision and recall are micro-averaged, so they both equal the accuracy,
|
| 212 |
+
and the overall F1 is the macro average of the two class F1 scores. The average test loss is 0.2581.
|
| 213 |
|
| 214 |
> These crops come from the same synthetic pipeline as the training crops (see
|
| 215 |
> [Training data](#training-data)). The numbers measure how well the model detects resampling and
|
|
|
|
| 239 |
|
| 240 |
## Training data
|
| 241 |
|
| 242 |
+
The dataset holds **13,947 crops**, split 90% / 10% into about 12,522 training and 1,396 test crops.
|
| 243 |
It is synthetic and was built from a single public source:
|
| 244 |
|
| 245 |
- [**olmOCR-mix-0225**](https://huggingface.co/datasets/allenai/olmOCR-mix-0225) (Allen Institute
|
|
|
|
| 263 |
| Setting | Value |
|
| 264 |
|---|---|
|
| 265 |
| Epochs | 10 |
|
| 266 |
+
| Batch size | 16 |
|
| 267 |
| Optimizer | AdamW, weight decay 1e-4 |
|
| 268 |
| Learning rate | 5e-4, constant |
|
| 269 |
| Loss | Cross-entropy with label smoothing 0.1 |
|
| 270 |
| Input | 640 × 640 × 3: RGB, aspect-preserving resize (upscaling allowed), centered white padding, ImageNet normalization |
|
| 271 |
|
| 272 |
+
The final training loss is 0.2581 (test: 0.2589). With label smoothing 0.1 and two classes, the
|
| 273 |
+
lowest reachable loss is about 0.199, so both values are close to that floor despite the ~98.5%
|
| 274 |
accuracy.
|
| 275 |
|
| 276 |
## Limitations and biases
|