Instructions to use BDRC/TiBLA-RTDETR with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ultralytics
How to use BDRC/TiBLA-RTDETR with ultralytics:
# Couldn't find a valid YOLO version tag. # Replace XX with the correct version. from ultralytics import YOLOvXX model = YOLOvXX.from_pretrained("BDRC/TiBLA-RTDETR") source = 'http://images.cocodataset.org/val2017/000000039769.jpg' model.predict(source=source, save=True) - Notebooks
- Google Colab
- Kaggle
Tune text-area threshold to 0.55 (native per-class sweep)
Browse files
README.md
CHANGED
|
@@ -78,20 +78,24 @@ combined losslessly downstream).
|
|
| 78 |
|
| 79 |
## Recommended usage β per-class confidence thresholds
|
| 80 |
|
| 81 |
-
The detector is deliberately recall-happy
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
β0.95 for a β0.02 recall cost.
|
| 86 |
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
|
| 94 |
-
If you need a single global threshold, **0.
|
| 95 |
|
| 96 |
### Inference
|
| 97 |
|
|
@@ -101,7 +105,7 @@ from ultralytics import RTDETR
|
|
| 101 |
model = RTDETR("tibetan_book_layout.pt")
|
| 102 |
|
| 103 |
# predict once at the lowest floor, then filter per class
|
| 104 |
-
CLASS_CONF = {0: 0.60, 1: 0.
|
| 105 |
results = model.predict("page.jpg", imgsz=1024, conf=min(CLASS_CONF.values()))
|
| 106 |
|
| 107 |
for r in results:
|
|
@@ -144,9 +148,9 @@ The **mAP** columns are threshold-independent β they integrate over the full
|
|
| 144 |
precision/recall curve (every confidence), so they do not depend on any operating
|
| 145 |
threshold. The **P / R / F1** columns are reported at each class's own
|
| 146 |
**maximum-F1 confidence** (the standard Ultralytics `val` operating point), *not*
|
| 147 |
-
at a fixed
|
| 148 |
-
(header/footer β 0.60, text-area
|
| 149 |
-
for `infer.py`; they land close to these max-F1 points.
|
| 150 |
|
| 151 |
### Canonical 3-class metrics
|
| 152 |
|
|
|
|
| 78 |
|
| 79 |
## Recommended usage β per-class confidence thresholds
|
| 80 |
|
| 81 |
+
The detector is deliberately recall-happy, so **the best operating point differs
|
| 82 |
+
by class**. Using the Ultralytics default `conf=0.25` everywhere leaves
|
| 83 |
+
header/footer precision at only β0.83 and text-area at β0.955. Two cheap fixes,
|
| 84 |
+
both measured with a native per-class confidence sweep on the test set:
|
|
|
|
| 85 |
|
| 86 |
+
- Raise **header/footer to β0.60** β precision β0.83 β β0.95 (β0.02 recall cost).
|
| 87 |
+
- Raise **text-area to β0.55** β precision β0.955 β β0.98 (β0.002 recall cost).
|
| 88 |
+
- Leave **footnote at β0.25**, where recall is β1.0 (its few false positives are
|
| 89 |
+
high-confidence and can't be thresholded away without losing real footnotes).
|
| 90 |
+
|
| 91 |
+
| class | recommended conf | P β P | R |
|
| 92 |
+
| --- | --- | --- | --- |
|
| 93 |
+
| header (0) | **0.60** | 0.83 β 0.96 | 0.95 |
|
| 94 |
+
| text-area (1) | **0.55** | 0.955 β 0.98 | 0.995 |
|
| 95 |
+
| footnote (2) | 0.25 | 0.918 | 1.00 |
|
| 96 |
+
| footer (3) | **0.60** | β β 0.94 | 0.95 |
|
| 97 |
|
| 98 |
+
If you need a single global threshold, **0.50** is the best compromise.
|
| 99 |
|
| 100 |
### Inference
|
| 101 |
|
|
|
|
| 105 |
model = RTDETR("tibetan_book_layout.pt")
|
| 106 |
|
| 107 |
# predict once at the lowest floor, then filter per class
|
| 108 |
+
CLASS_CONF = {0: 0.60, 1: 0.55, 2: 0.25, 3: 0.60} # header, text-area, footnote, footer
|
| 109 |
results = model.predict("page.jpg", imgsz=1024, conf=min(CLASS_CONF.values()))
|
| 110 |
|
| 111 |
for r in results:
|
|
|
|
| 148 |
precision/recall curve (every confidence), so they do not depend on any operating
|
| 149 |
threshold. The **P / R / F1** columns are reported at each class's own
|
| 150 |
**maximum-F1 confidence** (the standard Ultralytics `val` operating point), *not*
|
| 151 |
+
at a fixed threshold. The per-class serving thresholds recommended above
|
| 152 |
+
(header/footer β 0.60, text-area β 0.55, footnote β 0.25) are the practical
|
| 153 |
+
settings for `infer.py`; they land close to these max-F1 points.
|
| 154 |
|
| 155 |
### Canonical 3-class metrics
|
| 156 |
|