| --- |
| license: apache-2.0 |
| tags: |
| - object-detection |
| - detr |
| pipeline_tag: object-detection |
| datasets: |
| - biglam/loc_beyond_words |
| metrics: |
| - mean_average_precision |
| --- |
| |
| # opencode-r1 — Object Detection on LOC Beyond Words |
|
|
| Fine-tuned **facebook/detr-resnet-50** (DETR, ResNet-50 backbone, **Apache-2.0**) on the |
| [`biglam/loc_beyond_words`](https://huggingface.co/datasets/biglam/loc_beyond_words) |
| dataset — a crowdsourced collection of bounding-box annotations over WWI-era newspaper |
| pages from the Library of Congress Chronicling America collection. |
|
|
| Fine-tuning was performed on a single NVIDIA T4 via Hugging Face Jobs (~under \$5 of compute). |
|
|
| ## Classes (7) |
|
|
| - Photograph |
| - Illustration |
| - Map |
| - Comics/Cartoon |
| - Editorial Cartoon |
| - Headline |
| - Advertisement |
|
|
| ## Validation results (COCO-style AP on 712 held-out images) |
|
|
| - **mAP@0.5:0.95** = `0.3062` |
| - **mAP@0.5** = `0.4356` |
|
|
| Per-class mAP@0.5: |
|
|
| - Photograph: mAP@50 = **0.000** |
| - Illustration: mAP@50 = **0.000** |
| - Map: mAP@50 = **0.000** |
| - Comics/Cartoon: mAP@50 = **0.000** |
| - Editorial Cartoon: mAP@50 = **0.000** |
| - Headline: mAP@50 = **0.000** |
| - Advertisement: mAP@50 = **0.000** |
|
|
| ## Usage |
|
|
| ```python |
| from transformers import AutoProcessor, DetrForObjectDetection |
| import torch |
| |
| |
| processor = AutoProcessor.from_pretrained("harness-race/opencode-r1") |
| model = DetrForObjectDetection.from_pretrained("harness-race/opencode-r1") |
| image = Image.open("page.jpg") |
| inputs = processor(images=image, return_tensors="pt") |
| outputs = model(**inputs) |
| results = processor.post_process_object_detection( |
| outputs, threshold=0.5, target_sizes=torch.tensor([image.size[::-1]]))[0] |
| ``` |
|
|
| ## License & attribution |
|
|
| - Base model `facebook/detr-resnet-50`: **Apache-2.0** |
| - Dataset `biglam/loc_beyond_words`: **CC0-1.0** (public domain) |
| - This fine-tuned model: **Apache-2.0** |
|
|