Skip to content

Commit

Permalink
Dockerfile, meta.json - Updated source to v1.1, moved cli to src dir,…
Browse files Browse the repository at this point in the history
… added improved output nodule sorting
  • Loading branch information
silvandeleemput committed Apr 24, 2024
1 parent fb17009 commit e27ec43
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
4 changes: 2 additions & 2 deletions models/gc_node21_baseline/dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ RUN pip3 install --no-cache-dir torch==2.0.1+cu118 torchvision==0.15.2+cu118 -f
RUN apt update && apt install -y --no-install-recommends git-lfs && rm -rf /var/lib/apt/lists/*

# Install node21 baseline algorithm
# - Git clone to tmp directory (main branch, tag v1.0addedtag)
# - Git clone to tmp directory (main branch, tag v1.1)
# - Extract relevant files to /opt/algorithm/
# - Remove tmp directory
RUN git clone --depth 1 --branch v1.0addedtag https://github.com/node21challenge/node21_detection_baseline.git /tmp/algorithm && \
RUN git clone --depth 1 --branch v1.1 https://github.com/node21challenge/node21_detection_baseline.git /tmp/algorithm && \
mkdir -p /opt/algorithm && \
mv /tmp/algorithm/process.py /opt/algorithm/process.py && \
mv /tmp/algorithm/postprocessing.py /opt/algorithm/postprocessing.py && \
Expand Down
2 changes: 1 addition & 1 deletion models/gc_node21_baseline/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
},
"details": {
"name": "NODE21 baseline",
"version": "1.0",
"version": "1.1",
"devteam": "DIAGNijmegen (Diagnostic Image Analysis Group, Radboud UMC, The Netherlands)",
"type": "Faster R-CNN architecture using ResNet50 as the backbone.",
"date": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ def run_classifier(input_cxr: Path, output_json_file: Path):
tmp_path = Path("/app/tmp")
predictions = Noduledetection(input_dir=tmp_path, output_dir=tmp_path).predict(input_image=input_image)

# sort predictions on probability first (descending), corner positions second (ascending)
# this was implemented because the old sorting only sorts on probability (descending) and can give different
# results if two probabilities are the same
predictions["boxes"] = list(
sorted(
predictions["boxes"],
key=lambda x : tuple([-x["probability"]] + [tuple(c) for c in x["corners"]]),
reverse=False
)
)

# Export the predictions to a JSON file
with open(output_json_file, "w") as f:
json.dump(predictions, f, indent=4)
Expand Down
2 changes: 1 addition & 1 deletion models/gc_node21_baseline/utils/Node21BaselineRunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from mhubio.core import Instance, InstanceData, IO, Module, Meta, ValueOutput, OutputDataCollection


CLI_PATH = Path(__file__).parent.absolute() / "cli.py"
CLI_PATH = Path(__file__).parent.parent.absolute() / "src" / "cli.py"


@ValueOutput.Name('noduleprob')
Expand Down

0 comments on commit e27ec43

Please sign in to comment.