openfoodfacts/nutrition-extractor
nutrition-extractor
This model is a fine-tuned version of microsoft/layoutlmv3-large on the openfoodfacts/nutrient-detection-layout dataset. It allows to automatically extract nutrition values from images of nutrition tables.
It achieves the following results on the evaluation set:
- Loss: 0.0534
- Precision: 0.9545
- Recall: 0.9647
- F1: 0.9596
- Accuracy: 0.9917
Model description
This model can extract nutrient values from photos of food packaging containing nutrition information. This was developped as part of the Nutrisight project.
For more information about the project, please refer to the nutrisight directory in the openfoodfacts-ai GitHub repository.
As any model using the LayoutLM architecture, this model expects as input:
- the image
- the tokens (string) on the images
- the 2D coordinates of each token
The tokens and their 2D positions is provided by an OCR model. This model was trained using OCR results coming from Google Cloud Vision.
An ONNX export of the model can be found in the onnx directory.
Intended uses & limitations
This model is only intended to be used on images of products where a nutrition table can be found.
Training and evaluation data
The training and evaluation data can be found on the dataset page.
Training procedure
Training hyperparameters
The following hyperparameters were used during training:
- learning_rate: 1e-05
- trainbatchsize: 4
- evalbatchsize: 4
- seed: 42
- gradientaccumulationsteps: 8
- totaltrainbatch_size: 32
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lrschedulertype: linear
- training_steps: 3000
- mixedprecisiontraining: Native AMP
Training results
Framework versions
- Transformers 4.40.2
- Pytorch 2.5.1
- Datasets 2.19.0
- Tokenizers 0.19.1
