Run this model with HF Jobs

Run basketmatter/receipt-detection-grounding-dino on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/basketmatter/receipt-detection-grounding-dino. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/basketmatter/receipt-detection-grounding-dino on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Grounding DINO für Kassenbons

IDEA-Research/grounding-dino-base, nachtrainiert, um Kassenbons auf Fotos zu finden. In bite schneidet es die Bons aus Rohfotos aus (Detektor dino_receipt, Pipelines bite_photos und bite_ocr_photos). Training und Messung: bite, training/detection/ (train.py, evaluate.py), beschrieben in docs/detection-training.md und training/detection/SPEC.md.

Benutzung

Nur mit der Phrase, mit der trainiert wurde: "a receipt.". Weitere Phrasen in derselben Anfrage verändern die Scores. Das Bild vorher auf eine längere Seite von 800 px verkleinern (wie im Training), Schwelle 0,3, die Box mit dem höchsten Score ist der Bon.

from transformers import AutoModelForZeroShotObjectDetection, AutoProcessor
processor = AutoProcessor.from_pretrained("basketmatter/receipt-detection-grounding-dino")
model = AutoModelForZeroShotObjectDetection.from_pretrained("basketmatter/receipt-detection-grounding-dino")
inputs = processor(images=image, text="a receipt.", return_tensors="pt")
results = processor.post_process_grounded_object_detection(
    model(**inputs), inputs.input_ids, threshold=0.3, target_sizes=[image.size[::-1]])

Trainingsdaten

468 Fotos von Kassenbons aus billiegreen-v1 (Fotos einer Mitmach-Aktion, Supermärkte in Deutschland, Oktober/November 2024), davon 1 ohne Bon. Die Labels liegen im privaten Datensatz basketmatter/receipt-detection (billiegreen-v1/labels.json, sha256 in train_meta.json), die Fotos sind privat.

  • 389 Fotos mit DINOs eigener Box (base), behalten, wo die Extraktion eines bite_photos-Laufs zeigt, dass der ganze Bon im Ausschnitt lag (Summe, Steuern, Kopf vollständig); Umriss mit SAM 2; alle Boxen und Umrisse von Hand gesichtet.
  • 79 Fotos, an denen das scheiterte, mit Boxen von Hand geprüft oder gezeichnet.
  • Label-Box ist die Box der konvexen Hülle des Bons; die Hülle erlaubt exakte Boxen bei Drehung um freie Winkel.

Training

Eine Phrase, Fotos ohne Bon mit leerem Ziel. Augmentierung: Ausschnitte mit und ohne Bon, Drehung um 90°-Schritte und Spiegelung, freie Drehung bis ±30°, Farbe/Unschärfe/JPEG/Rauschen. Text- und Bild-Backbone eingefroren, 20 Epochen, AdamW lr 2e-5, Batch 1 mit 4 Schritten Gradientensammlung. Loss nur der Decoder-Schichten (ohne die Encoder-Vorschläge). Einstellungen und Loss je Epoche: train_meta.json.

Messung

eval.json, auf Fotos außerhalb des Trainings (billiegreen-v1/test.json im Datensatz), Box gewählt wie in bite (select_receipt, Schwelle 0,3). IoU mit der Label-Box, nicht gefunden zählt 0.

Holdout (50) Test (74 Bons + 1 ohne)
base (DINO ungelernt, wie zuvor in bite_photos) gefunden 100 %, IoU 0,975 gefunden 97,3 %, IoU 0,930, IoU ≥ 0,5 94,6 %, 1 Fehlalarm
dieses Modell (full) gefunden 100 %, IoU 0,989 gefunden 100 %, IoU 0,973, IoU ≥ 0,5 100 %, 0 Fehlalarme
ohne freie Drehung IoU 0,989 IoU 0,976, 0 Fehlalarme
ohne Ausschnitte ohne Bon IoU 0,989 IoU 0,974, 1 Fehlalarm

Der Test ist klein; Unterschiede von einem Foto sind Zufall.

Übertragung auf andere Fotos: Auf 200 Fotos einer zweiten Sammlung (corny, nicht im Training, corny-1000/ im Datensatz) fand das Modell auf allen 200 eine Box; von Hand wurden 199 unverändert bestätigt und eine neu gezogen (Vorschlag fast das ganze Foto).

Downloads last month
100
Safetensors
Model size
0.2B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for basketmatter/receipt-detection-grounding-dino

Finetuned
(11)
this model