This repository is an implemenation of KitchenScale, a food numeracy model capable of suggesting the exact quantity of the target ingredient with units given a recipe context.
KitchenScale : Learning Food Numeracy from Recipes through Context-Aware Ingredient Quantity Prediction
Donghee Choi, Keonwoo Kim, Samy Badreddine, Hajung Kim, Donghyeon Park, Jaewoo Kang Expert System with Applications 2023 https://doi.org/10.1016/j.eswa.2023.120041
- Dataset
- Uncompress the file into ./data folder
- Task1 Measurement Type prediction checkpoint
- Task2 Unit prediction checkpoint
- Task3 Quantity prediction checkpoint
- To get inference results, move the checkpoints into ./checkpoints folder
This project is tested with Python 3.8, Pytorch 1.9, CUDA 11.1, Huggingface Transformer 4.12.2
git clone https://github.com/dmis-lab/KitchenScale.git
cd KitchenScale; pip install -r requirements.txt
- For different tasks, change exp_ver to (dim, unit, ing_q)
python train.py \
--name=ing_q_train \
--proj_name=test_project \
--food_data_path=./data \
--gpus=2 \
--batch_size=32 \
--max_epochs=80 \
--data_size=all \
--learning_rate=1e-6 \
--auto_select_gpus=True \
--is_q_predict \
--is_e_predict \
--regression_layer=3mlp \
--gradient_clip_val=0.5 \
--drop_rate=0.3 \
--exp_ver=ing_q \
--is_include_ing_phrase \
--is_include_dimension \
--is_include_tags \
--is_include_title \
--is_include_other_ing \
--is_include_serving \
--q_ing_phrase_ver=ing_name_q_u_mask \
--strategy=ddp \
--save_top_k=10 \
--patience=3 \
--early_stopping_metric=val_loss \
python infer.py
Our work was done by DMIS-lab collaborates with Sony AI and their Gastronomy Flagship Project, it is an extension idea for making an AI for assisting recipe creation which the goal is interactively helping chefs create creative but delicious and healthy recipes.