From fa305cd34bdb168bc2e190aa963fdc92f8374008 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Bournhonesque?= Date: Wed, 16 Aug 2023 17:21:58 +0200 Subject: [PATCH] chore: add make command to download ingredient detection model --- Makefile | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index b2217d26a9..1061961301 100644 --- a/Makefile +++ b/Makefile @@ -95,19 +95,31 @@ log: # Management # #------------# -dl-models: - @echo "🥫 Downloading model files …" - mkdir -p models/triton; \ +dl-models: dl-langid-model dl-object-detection-models dl-category-classifier-model dl-ingredient-detection-model + @echo "⏬ Downloading all models …" + +dl-langid-model: + @echo "⏬ Downloading language identification model file …" + mkdir -p models; \ cd models; \ - wget -cO - https://dl.fbaipublicfiles.com/fasttext/supervised-models/lid.176.bin > lid.176.bin; \ - cd triton; \ + wget -cO - https://dl.fbaipublicfiles.com/fasttext/supervised-models/lid.176.bin > lid.176.bin; + +dl-object-detection-models: + @echo "⏬ Downloading object detection model files …" + mkdir -p models/triton; \ + cd models/triton; \ for asset_name in ${ML_OBJECT_DETECTION_MODELS}; \ do \ dir=`echo $${asset_name} | sed 's/tf-//g'`; \ mkdir -p $${dir}/1; \ wget -cO - https://github.com/openfoodfacts/robotoff-models/releases/download/$${asset_name}-1.0/model.onnx > $${dir}/1/model.onnx; \ done; \ - mkdir -p clip clip/1; \ + +dl-category-classifier-model: + @echo "⏬ Downloading category classifier model files …" + mkdir -p models/triton; \ + cd models/triton; \ + mkdir -p clip/1; \ wget -cO - https://github.com/openfoodfacts/robotoff-models/releases/download/clip-vit-base-patch32/model.onnx > clip/1/model.onnx; \ dir=category-classifier-keras-image-embeddings-3.0/1/model.savedmodel; \ mkdir -p $${dir}; \ @@ -116,6 +128,17 @@ dl-models: tar -xzvf saved_model.tar.gz --strip-component=1; \ rm saved_model.tar.gz +dl-ingredient-detection-model: + @echo "⏬ Downloading ingredient detection model files …" + mkdir -p models/triton; \ + cd models/triton; \ + dir=ingredient-ner/1/model.onnx; \ + mkdir -p $${dir}; \ + wget -cO - https://github.com/openfoodfacts/robotoff-models/releases/download/pytorch-ingredient-detection-1.0/onnx.tar.gz > $${dir}/onnx.tar.gz; \ + cd $${dir}; \ + tar -xzvf onnx.tar.gz --strip-component=1; \ + rm onnx.tar.gz + init-elasticsearch: @echo "Initializing elasticsearch indices" ${DOCKER_COMPOSE} up -d elasticsearch 2>&1