Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates aide-svrtk MAP with MONAI-based CNN #13

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
28 changes: 14 additions & 14 deletions app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ WORKDIR /var/monai

# Add SVRTK to MAP

WORKDIR /home
WORKDIR /bin

# Install general libraries
RUN apt-get update && apt-get install --no-install-recommends --no-install-suggests -y \
Expand All @@ -37,40 +37,40 @@ RUN apt-get install -y \

# Install MIRTK/SVRTK
RUN git clone https://github.com/SVRTK/MIRTK.git \
&& mkdir -p /home/MIRTK/Packages/SVRTK
RUN git clone https://github.com/SVRTK/SVRTK.git /home/MIRTK/Packages/SVRTK \
&& mkdir -p /home/MIRTK/build \
&& cd /home/MIRTK/build \
&& mkdir -p /bin/MIRTK/Packages/SVRTK
RUN git clone https://github.com/SVRTK/SVRTK.git /bin/MIRTK/Packages/SVRTK \
&& mkdir -p /bin/MIRTK/build \
&& cd /bin/MIRTK/build \
&& cmake -D WITH_TBB="ON" -D MODULE_SVRTK="ON" .. \
&& make -j

ENV PATH="$PATH:/home/MIRTK/build/bin:/home/MIRTK/build/lib/tools"
ENV PATH="$PATH:/bin/MIRTK/build/bin:/bin/MIRTK/build/lib/tools"

WORKDIR /var/monai


# Add 3D UNet model weights & execution script
# Add MONAI 3D UNet model weights & execution script

WORKDIR /home

# Setup 3D UNet models
RUN git clone https://github.com/SVRTK/Segmentation_FetalMRI.git --branch svrtk-docker-gpu-0.10 --single-branch /home/Segmentation_FetalMRI
RUN git clone https://github.com/SVRTK/auto-proc-svrtk.git /home/auto-proc-svrtk
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the errors are to do with this line currently. You've changed the location of the recon Shell script, but not updated the rest of the Dockerfile and Python code to reflect the new script location, so... see other comments where I can see you need to make changes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i fixed paths and was able to run monai-deploy run ghcr.io/svrtk/aide-svrtk/map:0.2.1 input/ output/


RUN wget https://gin.g-node.org/SVRTK/fetal_mri_network_weights/raw/master/checkpoints-brain-loc-2-labels/latest.ckpt -P /home/Segmentation_FetalMRI/trained-models/checkpoints-brain-loc-labels \
&& wget https://gin.g-node.org/SVRTK/fetal_mri_network_weights/raw/master/checkpoints-brain-loc-2-labels-cropped/latest.ckpt -P /home/Segmentation_FetalMRI/trained-models/checkpoints-brain-loc-labels-cropped \
&& wget https://gin.g-node.org/SVRTK/fetal_mri_network_weights/raw/master/checkpoints-brain-reo-5-labels/latest.ckpt -P /home/Segmentation_FetalMRI/trained-models/checkpoints-brain-reorientation \
&& wget https://gin.g-node.org/SVRTK/fetal_mri_network_weights/raw/master/checkpoints-brain-reo-5-labels-raw-stacks/latest.ckpt -P /home/Segmentation_FetalMRI/trained-models/checkpoints-brain-reorientation-stacks
RUN wget https://gin.g-node.org/SVRTK/fetal_mri_network_weights/raw/master/monai-checkpoints-atunet-brain_bet_all_degree_raw_stacks-1-lab/best_metric_model.pth -P /home/auto-proc-svrtk/trained-models/monai-checkpoints-atunet-brain_bet_all_degree_raw_stacks-1-lab \
&& wget https://gin.g-node.org/SVRTK/fetal_mri_network_weights/raw/master/monai-checkpoints-unet-global-loc-2-lab/best_metric_model.pth -P /home/auto-proc-svrtk/trained-models/monai-checkpoints-unet-global-loc-2-lab \
&& wget https://gin.g-node.org/SVRTK/fetal_mri_network_weights/raw/master/monai-checkpoints-unet-svr-brain-reo-5-lab/best_metric_model.pth -P /home/auto-proc-svrtk/trained-models/monai-checkpoints-unet-svr-brain-reo-5-lab \
&& wget https://gin.g-node.org/SVRTK/fetal_mri_network_weights/raw/master/monai-checkpoints-unet-svr-brain-reo-raw-stacks-5-lab/best_metric_model.pth -P /home/auto-proc-svrtk/trained-models/monai-checkpoints-unet-svr-brain-reo-raw-stacks-5-lab

# Install Python packages
RUN python -m pip install -r /home/Segmentation_FetalMRI/requirements.txt
RUN python -m pip install -r /home/auto-proc-svrtk/config/requirements.txt

# Bugfix: without below, cannot import torch within Python
# Error: OSError: /opt/hpcx/ompi/lib/libmpi.so.40: undefined symbol: opal_hwloc201_hwloc_get_type_depth
# Fix: https://forums.developer.nvidia.com/t/issues-building-docker-image-from-ngc-container-nvcr-io-nvidia-pytorch-22-py3/209034/5
ENV PATH="${PATH}:/opt/hpcx/ompi/bin"
ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/hpcx/ompi/lib"

COPY docker-recon-brain-auto.bash /home/scripts/docker-recon-brain-auto.bash
COPY /home/auto-proc-svrtk/scripts/auto-brain-reconstruction-aide.sh /home/scripts/auto-brain-reconstruction.sh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove this line entirely. The COPY command in Docker copies from your local machine into the corresponding place in the container. It fails here because /home/auto-proc-svrtk/scripts/auto-brain-reconstruction-aide.sh doesn't exist in the aide-svrtk repo.

Instead, you clone the auto-proc-svrtk repo into the container further up this file, which means auto-brain-reconstruction.sh will be downloaded into the container already.

One thing I noticed – you have two scripts in here, one of which is labelled "aide". Make sure you are pointing at the correct script.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated thank you

RUN mkdir -p /home/recon \
&& mkdir -p /home/output \
&& chmod +x /home/scripts/*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The most important thing here is the chmod on the scripts folder. This enables the Docker container to run the shell scripts in the folder. You need to update this so that it points at the correct folder in the cloned auto-proc-svrtk repo.

I think you can remove the mkdir lines – I don't think they are needed anymore.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated thank you

Expand Down
Loading