From 5f7acce6e81f4f71e5a1520a5761de5ff702c423 Mon Sep 17 00:00:00 2001 From: Simon Szalai Date: Fri, 12 Jun 2020 11:45:43 +0200 Subject: [PATCH] removed condition to download weights --- Dockerfile | 21 ++++++++++++++++----- src/locator/detectron.py | 2 +- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3442091..91493de 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,9 +23,21 @@ ENV DEPLOY_REGION=$DEPLOY_REGION_ARG ENV WEIGHTS_URL=$WEIGHTS_URL_ARG -# Copy sample weigths, then overwrite them if WEIGHTS_URL is provided -COPY ./weights/model_final.pth /sorterbot_cloud/weights/model_final.pth -RUN if [ "$WEIGHTS_URL" != "" ] ; then \ +# # Copy sample weigths, then overwrite them if WEIGHTS_URL is provided +# COPY ./weights/model_final.pth /sorterbot_cloud/weights/model_final.pth +# RUN if [ "$WEIGHTS_URL" != "" ] ; then \ +# # Install AWS CLI +# curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \ +# unzip awscliv2.zip \ +# ./aws/install \ +# # Download weights from S3 +# --profile ${AWS_PROFILE} \ +# --mount=type=secret,id=aws_credentials,dst=/root/.aws/credentials \ +# --mount=type=secret,id=aws_config,dst=/root/.aws/config \ +# aws s3 cp ${WEIGHTS_URL} /sorterbot_cloud/weights/model_final.pth ; \ +# fi ; + +RUN \ # Install AWS CLI curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \ unzip awscliv2.zip \ @@ -34,8 +46,7 @@ RUN if [ "$WEIGHTS_URL" != "" ] ; then \ --profile ${AWS_PROFILE} \ --mount=type=secret,id=aws_credentials,dst=/root/.aws/credentials \ --mount=type=secret,id=aws_config,dst=/root/.aws/config \ - aws s3 cp ${WEIGHTS_URL} /sorterbot_cloud/weights/model_final.pth ; \ -fi ; + aws s3 cp ${WEIGHTS_URL} /sorterbot_cloud/weights/model_final.pth ; # Copy source code COPY ./src /sorterbot_cloud/src diff --git a/src/locator/detectron.py b/src/locator/detectron.py index 8a60eae..49b5f59 100644 --- a/src/locator/detectron.py +++ b/src/locator/detectron.py @@ -46,7 +46,7 @@ def __init__(self, base_img_path, model_config, threshold=0.7): self.cfg.MODEL.ROI_HEADS.NUM_CLASSES = 2 # Get pretrained weights - self.cfg.MODEL.WEIGHTS = Path(__file__).parent.parent.parent.joinpath("weights", "model_final.pth").resolve().as_posix() + self.cfg.MODEL.WEIGHTS = Path(__file__).parents[2].joinpath("weights", "model_final.pth").resolve().as_posix() # Create predictor self.predictor = DefaultPredictor(self.cfg)