Commit 880d40a1 authored by mibaumgartner's avatar mibaumgartner
Browse files

adam submission docker

parent d139b97e
...@@ -15,3 +15,7 @@ Please read the information from the homepage carefully and follow the rules and ...@@ -15,3 +15,7 @@ Please read the information from the homepage carefully and follow the rules and
The data is now converted to the correct format and the instructions from the nnDetection README can be used to train the networks. The data is now converted to the correct format and the instructions from the nnDetection README can be used to train the networks.
## Submission
The submission folder contains the scripts used for our leaderboard submissions.
Before building the Docker Image the model directory needs to be copied to the the submission folder to be detected by the docker context. Make sure to adapt the name of the nndetection base container to the name you installed it with (/ the current nndetection version).
Before submitting make sure to run a test prediction on the training set to double check it :)
FROM nndetection:0.1
# inference file to run predictions
ARG task
ARG model
ARG fold
ENV ENVTASK=$task ENVMODEL=$model ENVFOLD=$fold det_results=/opt/results
ENV det_data=/opt/data
ENV det_models=/opt/models
RUN echo ${ENVTASK} ${ENVMODEL} ${ENVFOLD} \
&& mkdir -p ${det_models}/${ENVTASK}/${ENVMODEL}/${ENVFOLD} \
&& mkdir -p ${det_data}/${ENVTASK}/raw_splitted/imagesTs \
&& mkdir -p ${det_results}
COPY ./${ENVFOLD}/* ${det_models}/${ENVTASK}/${ENVMODEL}/${ENVFOLD}/
COPY scripts/inference.sh .
COPY scripts/convert.py .
import argparse
from pathlib import Path
from nndet.io import load_pickle
from nndet.core.boxes.ops_np import box_center_np
THRESHOLD = 0.5
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('source', type=Path)
args = parser.parse_args()
source = args.source
predictions = load_pickle(source / "case_boxes.pkl")
boxes = predictions["pred_boxes"]
scores = predictions["pred_scores"]
keep = scores > THRESHOLD
boxes = boxes[keep]
if boxes.size > 0:
centers = box_center_np(boxes)
else:
centers = []
with open(source / "result.txt", "a") as f:
if len(centers) > 0:
for c in centers[:-1]:
f.write(f"{round(float(c[2]))}, {round(float(c[1]))}, {round(float(c[0]))}\n")
c = centers[-1]
f.write(f"{round(float(c[2]))}, {round(float(c[1]))}, {round(float(c[0]))}")
#!/bin/bash
. /activate
# bring adam file into internal structure
cp /input/pre/struct_aligned.nii.gz ${det_data}/${ENVTASK}/raw_splitted/imagesTs/case_0000.nii.gz
cp /input/pre/TOF.nii.gz ${det_data}/${ENVTASK}/raw_splitted/imagesTs/case_0001.nii.gz
nndet_predict ${ENVTASK} ${ENVMODEL} -f -1
cp ${det_models}/${ENVTASK}/${ENVMODEL}/${ENVFOLD}/test_predictions/* ${det_results}
python convert.py ${det_results}
cp /opt/results/result.txt /output
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment