Skip to content

Commit

Permalink
removed condition to download weights
Browse files Browse the repository at this point in the history
  • Loading branch information
simonszalai committed Jun 12, 2020
1 parent ccfe924 commit 5f7acce
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
21 changes: 16 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/locator/detectron.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5f7acce

Please sign in to comment.