Ingredient-list detector (multilingual)

A token-classification model that finds the ingredient list inside the raw OCR text of a food package. It is part of the project AI-Powered Food Allergen Detection and Ingredient Risk Assistant Using NLP and OCR (Professional Training course, student folder rah086).

Task

Every word of the text gets one tag:

id label meaning
0 O not part of the ingredient list
1 B-ING first word of the ingredient list
2 I-ING inside the ingredient list

Training

  • Base model: distilbert-base-multilingual-cased
  • Data: Open Food Facts ingredient detection dataset (labelled OCR texts of product packages in several languages); 5065 training documents
  • Setup: 2 epochs, learning rate 5e-5, batch size 16, texts split into chunks of 100 words, trained on a CPU in 77.1 minutes

Evaluation

Evaluated on 556 held-out test documents (74691 words). The score answers the question "is this word part of the ingredient list?".

Metric Score
Precision 0.9887
Recall 0.9901
F1 0.9894
Accuracy 0.9919

Usage

The model works on single words, so split the text into words first (punctuation marks are separate words) and classify chunks of up to 100 words. The project repository contains the full pipeline (src/extractor.py).

Limitations

  • Scores are word-level, not exact span matches.
  • Accuracy drops when the OCR text is very noisy or the list is cut by the photo.
  • Allergen statements such as "may contain ..." are usually outside the ingredient list, so they must be handled separately.
  • Check the license and terms of the Open Food Facts data before reusing the model.
Downloads last month
27
Safetensors
Model size
0.1B params
Tensor type
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for mirwaisrahimi/ingredient-list-ner

Finetuned
(460)
this model