Skip to content

Commit

Permalink
chore: add make command to download ingredient detection model
Browse files Browse the repository at this point in the history
  • Loading branch information
raphael0202 committed Aug 17, 2023
1 parent 76a6d73 commit fa305cd
Showing 1 changed file with 29 additions and 6 deletions.
35 changes: 29 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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}; \
Expand All @@ -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
Expand Down

0 comments on commit fa305cd

Please sign in to comment.