Commit 7246044d authored by mibaumgartner's avatar mibaumgartner
Browse files

Merge remote-tracking branch 'origin/master' into main

parents fcec502f 6f4c3333
.git
.cache
.mypy_cache
.gitignore
*.py[cod]
*$py.class
*.vscode
*.so
*.sif
__pycache__/
/nndet.egg-info
/build
/notebooks
/projects
/singularity
---
name: Bug
about: Report a bug
title: "[Bug]"
labels: Bug
assignees: ''
---
### :skull: Bug
<!-- Please provide a short and cleaer describtion of the bug. What happens? What should happen? If applicable, please include the full error message. -->
### Environment
Please provide some information about the used environment.
<!--
Please run the following command to collect environment information and paste them below:
If nnDetection is already installed:
```bash
nndet_env
```
otherwise execute the script directly from the nndetection source folder:
```bash
python scripts/utils.py
```
-->
How was nnDetection installed [`docker` | `source`]:
Environment Information:
```text
[paste here]
```
If necessary, please provide the used run command with all overwrites:
```text
[paste here]
```
---
name: Question
about: Ask a question
title: "[Question]"
labels: Question
assignees: ''
---
### :question: Question
<!-- Please provide a short and cleaer question-->
...@@ -2,12 +2,16 @@ ...@@ -2,12 +2,16 @@
__pycache__/ __pycache__/
*.py[cod] *.py[cod]
*$py.class *$py.class
*.vscode
*.simg
*.sif
# C extensions # C extensions
*.so *.so
# Distribution / packaging # Distribution / packaging
.Python .Python
env/
build/ build/
develop-eggs/ develop-eggs/
dist/ dist/
...@@ -19,13 +23,9 @@ lib64/ ...@@ -19,13 +23,9 @@ lib64/
parts/ parts/
sdist/ sdist/
var/ var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/ *.egg-info/
.installed.cfg .installed.cfg
*.egg *.egg
MANIFEST
# PyInstaller # PyInstaller
# Usually these files are written by a python script from a template # Usually these files are written by a python script from a template
...@@ -40,16 +40,13 @@ pip-delete-this-directory.txt ...@@ -40,16 +40,13 @@ pip-delete-this-directory.txt
# Unit test / coverage reports # Unit test / coverage reports
htmlcov/ htmlcov/
.tox/ .tox/
.nox/
.coverage .coverage
.coverage.* .coverage.*
.cache .cache
nosetests.xml nosetests.xml
coverage.xml coverage.xml
*.cover *,cover
*.py,cover
.hypothesis/ .hypothesis/
.pytest_cache/
# Translations # Translations
*.mo *.mo
...@@ -58,8 +55,6 @@ coverage.xml ...@@ -58,8 +55,6 @@ coverage.xml
# Django stuff: # Django stuff:
*.log *.log
local_settings.py local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff: # Flask stuff:
instance/ instance/
...@@ -74,56 +69,49 @@ docs/_build/ ...@@ -74,56 +69,49 @@ docs/_build/
# PyBuilder # PyBuilder
target/ target/
# Jupyter Notebook # IPython Notebook
.ipynb_checkpoints .ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv # pyenv
.python-version .python-version
# pipenv # celery beat schedule file
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/
# Celery stuff
celerybeat-schedule celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments # dotenv
.env .env
.venv
env/ # virtualenv
venv/ venv/
ENV/ ENV/
env.bak/
venv.bak/
# Spyder project settings # Spyder project settings
.spyderproject .spyderproject
.spyproject
# Rope project settings # Rope project settings
.ropeproject .ropeproject
# mkdocs documentation *.memmap
/site *.png
*.zip
# mypy *.npz
.mypy_cache/ *.npy
.dmypy.json *.jpg
dmypy.json *.jpeg
.idea
# Pyre type checker *.txt
.pyre/ .idea/*
*.nii.gz
*.nii
*.tif
*.bmp
*.pkl
*.xml
*.pkl
*.pdf
*.jpg
*.jpeg
*.model
.DS_Store
#Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
#Licensed under the Apache License, Version 2.0 (the "License");
#you may not use this file except in compliance with the License.
#You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#Unless required by applicable law or agreed to in writing, software
#distributed under the License is distributed on an "AS IS" BASIS,
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#See the License for the specific language governing permissions and
#limitations under the License.
# Contains pytorch, torchvision, cuda, cudnn
FROM nvcr.io/nvidia/pytorch:20.12-py3
ARG env_det_num_threads=6
ARG env_det_verbose=1
# Setup environment variables
ENV det_data=/opt/data det_models=/opt/models det_num_threads=$env_det_num_threads det_verbose=$env_det_verbose OMP_NUM_THREADS=1
# Install some tools
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive && apt-get install -y \
git \
cmake \
make \
wget \
gnupg \
build-essential \
software-properties-common \
gdb \
ninja-build
RUN pip install numpy
# Install own code
COPY ./requirements.txt .
RUN mkdir ${det_data} \
&& mkdir ${det_models} \
&& mkdir -p /opt/code/nndet \
&& pip install -r requirements.txt \
&& pip install hydra-core --upgrade --pre \
&& pip install git+https://github.com/mibaumgartner/pytorch_model_summary.git
WORKDIR /opt/code/nndet
COPY . .
RUN FORCE_CUDA=1 pip install -v -e .
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [2019] [Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
################################################################################
Some parts of nndet/core/boxes/anchors.py, coder.py, matcher.py are derived
from torchvision and thus licensed under:
BSD 3-Clause License
Copyright (c) Soumith Chintala 2016,
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
include README.md
include LICENSE
global-exclude *.pyc
global-exclude __pycache__
recursive-include nndet/conf *
This diff is collapsed.
# nnDetection v0.1
## Pool v0.1
<div align="center">
<img src=./source/v001/results_full_final.svg width="800px">
&nbsp;
### Train Pool [AP @ IoU 0.1]
5 Fold Cross Validation
| Model | LIDC | RibFrac | CADA | Kits19 |
|:-----------:|:--------------------:|:--------:|:--------:|:--------:|
| nnDetection | 0.605 | 0.765 | 0.924 | 0.923 |
| nnUNetPlus | 0.385<sup>*</sup> | 0.700 | 0.955 | 0.935 |
| nnUNetBasic | 0.346<sup>*</sup> | 0.667 | 0.930 | 0.908 |
<sup>*</sup> results with corrected numerical values in softdice loss. Out of the box results: nnUNetPlus 0.304 and nnUNetBasic 0.232
&nbsp;
### Validation Pool [AP @ IoU 0.1]
5 Fold Cross Validation
| Model | ADAM | ProstateX | Pancreas | Hepatic Vessel | Colon | Liver |
|:-----------:|:--------:|:----------:|:--------:|:----------------:|:-----:|:-----:|
| nnDetection | 0.780 | 0.300 | 0.766 | 0.727 | 0.662 | 0.628 |
| nnUNetPlus | 0.720 | 0.197 | 0.721 | 0.721 | 0.579 | 0.678 |
| nnUNetBasic | 0.657 | 0.204 | 0.691 | 0.699 | 0.509 | 0.567 |
&nbsp;
Test Split
| Model | ProstateX | Pancreas | Hepatic Vessel | Colon | Liver |
|:-----------:|:----------:|:--------:|:----------------:|:-----:|:-----:|
| nnDetection | 0.221 | 0.791 | 0.664 | 0.696 | 0.790 |
| nnUNetPlus | 0.078 | 0.704 | 0.684 | 0.731 | 0.760 |
ADAM Results are listed under Benchmarks
&nbsp;
### Test Pool [AP @ IoU 0.1]
5 Fold Cross Validation
| Model | Lymph Nodes |
|:-----------:|:-----------:|
| nnDetection | 0.205 |
| nnUNetPlus | 0.162 |
| nnUNetBasic | 0.159 |
&nbsp;
Test Split
| Model | Lymph Nodes |
|:-----------:|:-----------:|
| nnDetection | 0.270 |
| nnUNetPlus | 0.169 |
Luna results are listed under Benchmarks
&nbsp;
</div>
## Benchmarks
### Luna
<div align="center">
<img src=./source/v001/luna.png width="800px">
| Methods | 1/8 | 1/4 | 1/2 | 1 | 2 | 4 | 8 | CPM |
|:-----------:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|
| nnDetection | 0.812 | 0.885 | 0.927 | 0.950 | 0.969 | 0.979 | 0.985 | 0.930 |
&nbsp;
</div>
### ADAM Live Leaderboard
<div align="center">
<img src=./source/v001/adam.svg width="300">
| Model | Sens | FP |
|:-----------:|:----:|:---:|
| nnDetection | 0.64 | 0.3 |
</div>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<svg width="1198px" height="948px" viewBox="0 0 1198 948" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Group 33</title>
<defs>
<path d="M0,0 L1198,0 L1198,47 L0,47 L0,0 Z" id="path-1"></path>
<mask id="mask-2" maskContentUnits="userSpaceOnUse" maskUnits="objectBoundingBox" x="0" y="0" width="1198" height="47" fill="white">
<use xlink:href="#path-1"></use>
</mask>
</defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Group-27">
<g id="Group-19">
<g id="Group-15" transform="translate(0.000000, 65.000000)">
<rect id="Rectangle" stroke="#979797" stroke-width="3" x="185.5" y="1.5" width="406" height="102"></rect>
<rect id="Rectangle" stroke="#979797" stroke-width="3" fill="#BEEEB8" x="1.5" y="1.5" width="184" height="102"></rect>
<text id="Resampling-Strategy" font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="44.4775391" y="18">Resampling</tspan>
<tspan x="58.4829102" y="40">Strategy</tspan>
</text>
<text id="Image:-We-use-the-sa" font-family="Helvetica-Bold, Helvetica" font-size="18" font-weight="bold" fill="#000000">
<tspan x="196" y="27">Image</tspan>
<tspan x="248.022461" y="27" font-family="Helvetica" font-weight="normal">: We use the same image resampling </tspan>
<tspan x="196" y="49" font-family="Helvetica" font-weight="normal">procedure as nnU-Net</tspan>
<tspan x="196" y="71">Annotation</tspan>
<tspan x="290.974609" y="71" font-family="Helvetica" font-weight="normal">: Annotations are resampled with </tspan>
<tspan x="196" y="93" font-family="Helvetica" font-weight="normal">nearest neighbor</tspan>
</text>
</g>
<g id="Group-15">
<rect id="Rectangle" stroke="#979797" stroke-width="3" x="185.5" y="1.5" width="406" height="65"></rect>
<rect id="Rectangle" stroke="#979797" stroke-width="3" fill="#FFFFFF" x="1.5" y="1.5" width="184" height="65"></rect>
<text id="Parameter" font-family="Helvetica-Bold, Helvetica" font-size="18" font-weight="bold" fill="#000000">
<tspan x="49.9711914" y="18">Parameter</tspan>
</text>
<text id="Description" font-family="Helvetica-Bold, Helvetica" font-size="18" font-weight="bold" fill="#000000">
<tspan x="340.491211" y="18">Description</tspan>
</text>
</g>
<g id="Group-15" transform="translate(0.000000, 167.000000)">
<rect id="Rectangle" stroke="#979797" stroke-width="3" x="185.5" y="1.5" width="406" height="214"></rect>
<rect id="Rectangle" stroke="#979797" stroke-width="3" fill="#BEEEB8" x="1.5" y="1.5" width="184" height="214"></rect>
<text id="Network-Topology-&amp;-F" font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="12.1206055" y="18">Network Topology &amp;</tspan>
<tspan x="36.9804688" y="40">FPN Levels &amp;</tspan>
<tspan x="48.9775391" y="62">Patch Size</tspan>
</text>
<text id="The-anisotric-axis-o" font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="195" y="27">The anisotric axis of the patch size is initialized </tspan>
<tspan x="195" y="49">with the median shape of the anisotropic axis of </tspan>
<tspan x="195" y="71">the dataset. The isotropic axes are initialized </tspan>
<tspan x="195" y="93">with the minimum size of the isotropic axes of </tspan>
<tspan x="195" y="115">the dataset. </tspan>
<tspan x="195" y="137">The patch size is decreased while adapting the </tspan>
<tspan x="195" y="159">network architecture and feature pyramid </tspan>
<tspan x="195" y="181">network levels until the memory constrains are </tspan>
<tspan x="195" y="203">fulfilled. The batch size is fixed to four.</tspan>
</text>
</g>
<g id="Group-15" transform="translate(0.000000, 381.000000)">
<rect id="Rectangle" stroke="#979797" stroke-width="3" x="185.5" y="1.5" width="406" height="121"></rect>
<rect id="Rectangle" stroke="#979797" stroke-width="3" fill="#BEEEB8" x="1.5" y="1.5" width="184" height="121"></rect>
<text id="Anchor-Optimization" font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="63.4838867" y="18">Anchor</tspan>
<tspan x="41.9814453" y="40">Optimization</tspan>
</text>
<text id="The-anchor-sizes-are" font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="195" y="25">The anchor sizes are determined by maximising </tspan>
<tspan x="195" y="47">the IoU of the best fitting anchor on the given </tspan>
<tspan x="195" y="69">object sizes extracted from the training set. </tspan>
<tspan x="195" y="91">Optimization of three anchor sizes per axis is </tspan>
<tspan x="195" y="113">performed via differential evolution.</tspan>
</text>
</g>
<g id="Group-15" transform="translate(0.000000, 502.000000)">
<rect id="Rectangle" stroke="#979797" stroke-width="3" x="185.5" y="1.5" width="406" height="168"></rect>
<rect id="Rectangle" stroke="#979797" stroke-width="3" fill="#B8EEDC" x="1.5" y="1.5" width="184" height="168"></rect>
<text id="Low-Resolution-Model" font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="30.4633789" y="18">Low Resolution</tspan>
<tspan x="67.4873047" y="40">Model</tspan>
</text>
<text id="The-low-resolution-c" font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="195" y="24">The low resolution configuration will be triggered </tspan>
<tspan x="195" y="46">if the 99.5 percentile of object sizes along any</tspan>
<tspan x="195" y="68">axes exceeds the patch size of the full </tspan>
<tspan x="195" y="90">resolution model. If the low resolution </tspan>
<tspan x="195" y="112">configuration is triggered, the target spacing </tspan>
<tspan x="195" y="134">along each axes will be increased by two to </tspan>
<tspan x="195" y="156">incorporate more contextual information.</tspan>
</text>
</g>
<g id="Group-15" transform="translate(605.000000, 263.000000)">
<rect id="Rectangle" stroke="#979797" stroke-width="3" x="185.5" y="1.5" width="406" height="275"></rect>
<rect id="Rectangle" stroke="#979797" stroke-width="3" fill="#B8C6EE" x="1.5" y="1.5" width="184" height="275"></rect>
<text id="Optimizer-&amp;-Learning" font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="44.9916992" y="18">Optimizer &amp;</tspan>
<tspan x="35.4599609" y="40">Learning Rate</tspan>
</text>
<text id="All-configurations-a" font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="195" y="24">All configurations are trained for 60 epochs with </tspan>
<tspan x="195" y="46">2500 mini batches per epoch and half of the </tspan>
<tspan x="195" y="68">batch is forced to contain at least one object. </tspan>
<tspan x="195" y="90">SGD with Nesterov momentum 0.9 is used.</tspan>
<tspan x="195" y="112">At the beginning of the training the learning rate </tspan>
<tspan x="195" y="134">is linearly ramped up from 1e-6 to 1e-2 over the </tspan>
<tspan x="195" y="156">first 4000 iterations. Poly learning rate schedule </tspan>
<tspan x="195" y="178">is used until epoch 50. The last 10 epochs are </tspan>
<tspan x="195" y="200">trained with a cyclic learning rate fluctuating </tspan>
<tspan x="195" y="222">between 1e-3 and 1e-6 during every epoch.</tspan>
<tspan x="195" y="244">We snapshot the model weights after each </tspan>
<tspan x="195" y="266">epoch for Stochastic Weight Averaging.</tspan>
</text>
</g>
<g id="Group-15" transform="translate(0.000000, 671.000000)">
<rect id="Rectangle" stroke="#979797" stroke-width="3" x="185.5" y="1.5" width="406" height="121"></rect>
<rect id="Rectangle" stroke="#979797" stroke-width="3" fill="#B8C6EE" x="1.5" y="1.5" width="184" height="121"></rect>
<text id="Architecture-Templat" font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="43.980957" y="18">Architecture</tspan>
<tspan x="55.4814453" y="40">Template</tspan>
</text>
<text id="Retina-U-Net-with-an" font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="195" y="25">Retina U-Net with an encoder which consists of </tspan>
<tspan x="195" y="47">plain convolutions, ReLU and instance </tspan>
<tspan x="195" y="69">normalization blocks. The detection heads used </tspan>
<tspan x="195" y="91">for anchor classification and regression consist </tspan>
<tspan x="195" y="113">of three convolutions with group norm.</tspan>
</text>
</g>
<g id="Group-15" transform="translate(605.000000, 0.000000)">
<rect id="Rectangle" stroke="#979797" stroke-width="3" x="185.5" y="1.5" width="406" height="263"></rect>
<rect id="Rectangle" stroke="#979797" stroke-width="3" fill="#B8C6EE" x="1.5" y="1.5" width="184" height="263"></rect>
<text id="Loss-Functions" font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="31.4697266" y="18">Loss Functions</tspan>
</text>
<text id="Detection-Branch:-To" font-family="Helvetica-Bold, Helvetica" font-size="18" font-weight="bold" fill="#000000">
<tspan x="195" y="30">Detection Branch</tspan>
<tspan x="344.027344" y="30" font-family="Helvetica" font-weight="normal">: To balance positive and </tspan>
<tspan x="195" y="52" font-family="Helvetica" font-weight="normal">negative anchors, hard negative mining is used </tspan>
<tspan x="195" y="74" font-family="Helvetica" font-weight="normal">while selecting 1/3 positive and 2/3 negative </tspan>
<tspan x="195" y="96" font-family="Helvetica" font-weight="normal">anchors. The classification branch is trained with </tspan>
<tspan x="195" y="118" font-family="Helvetica" font-weight="normal">the Binary Cross-Entropy loss and the </tspan>
<tspan x="195" y="140" font-family="Helvetica" font-weight="normal">Generalized IoU Loss is used for anchor </tspan>
<tspan x="195" y="162" font-family="Helvetica" font-weight="normal">regression.</tspan>
<tspan x="195" y="184">Segmentation Branch</tspan>
<tspan x="381.029297" y="184" font-family="Helvetica" font-weight="normal">: The segmentation </tspan>
<tspan x="195" y="206" font-family="Helvetica" font-weight="normal">branch is trained with the Dice and Cross-</tspan>
<tspan x="195" y="228" font-family="Helvetica" font-weight="normal">Entropy loss to distinguish foreground and </tspan>
<tspan x="195" y="250" font-family="Helvetica" font-weight="normal">background pixels.</tspan>
</text>
</g>
<g id="Group-15" transform="translate(605.000000, 538.000000)">
<rect id="Rectangle" stroke="#979797" stroke-width="3" x="185.5" y="1.5" width="406" height="72"></rect>
<rect id="Rectangle" stroke="#979797" stroke-width="3" fill="#B8C6EE" x="1.5" y="1.5" width="184" height="72"></rect>
<text id="Data-Augmentation" font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="15.4428711" y="18">Data Augmentation</tspan>
</text>
<text id="We-use-the-same-augm" font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="195" y="22">We use the same augmentation strategy as </tspan>
<tspan x="195" y="44">nnU-Net without simulating low resolution </tspan>
<tspan x="195" y="66">samples.</tspan>
</text>
</g>
<g id="Group-15" transform="translate(0.000000, 792.000000)">
<rect id="Rectangle" stroke="#979797" stroke-width="3" x="185.5" y="1.5" width="406" height="99"></rect>
<rect id="Rectangle" stroke="#979797" stroke-width="3" fill="#B8C6EE" x="1.5" y="1.5" width="184" height="99"></rect>
<text id="Anchor-Matching" font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="24.4648438" y="18">Anchor Matching</tspan>
</text>
<text id="Adaptive-Training-Sa" font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="195" y="24">Adaptive Training Sample Selection (ATSS) is </tspan>
<tspan x="195" y="46">used to match anchors and ground truth boxes. </tspan>
<tspan x="195" y="68">The center of the anchor boxes do not need to </tspan>
<tspan x="195" y="90">lie within the ground truth box.</tspan>
</text>
</g>
<g id="Group-15" transform="translate(605.000000, 610.000000)">
<rect id="Rectangle" stroke="#979797" stroke-width="3" x="185.5" y="1.5" width="406" height="187"></rect>
<rect id="Rectangle" stroke="#979797" stroke-width="3" fill-opacity="0.45" fill="#EE7400" x="1.5" y="1.5" width="184" height="187"></rect>
<text id="Empirical-Parameter" font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="10.4770508" y="18">Empirical Parameter</tspan>
<tspan x="41.9814453" y="40">Optimization</tspan>
</text>
<text id="Parameters-which-are" font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="195" y="23">Parameters which are only required during the </tspan>
<tspan x="195" y="45">inference procedure are empirically optimized </tspan>
<tspan x="195" y="67">by evaluating the performance on the validation </tspan>
<tspan x="195" y="89">set. This includes: the IoU threshold required for </tspan>
<tspan x="195" y="111">the NMS of the model, the IoU threshold </tspan>
<tspan x="195" y="133">required to perform WBC, a minimum probability </tspan>
<tspan x="195" y="155">for predictions of the model, a minimum object </tspan>
<tspan x="195" y="177">size.</tspan>
</text>
</g>
<g id="Group-15" transform="translate(605.000000, 797.000000)">
<rect id="Rectangle" stroke="#979797" stroke-width="3" x="185.5" y="1.5" width="406" height="94"></rect>
<rect id="Rectangle" stroke="#979797" stroke-width="3" fill-opacity="0.45" fill="#EE7400" x="1.5" y="1.5" width="184" height="94"></rect>
<text id="Model-Selection" font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="67.4873047" y="18">Model</tspan>
<tspan x="54.9760742" y="40">Selection</tspan>
</text>
<text id="If-the-low-resolutio" font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="195" y="30">If the low resolution model was triggered, only </tspan>
<tspan x="195" y="52">the best model as determined by the five fold </tspan>
<tspan x="195" y="74">cross-validation will be used for the test set.</tspan>
</text>
</g>
</g>
<g id="Group-25" transform="translate(0.000000, 901.000000)">
<use id="Rectangle-2" stroke="#585757" mask="url(#mask-2)" stroke-width="8" stroke-dasharray="3" xlink:href="#path-1"></use>
<g id="Group-23" transform="translate(110.000000, 13.000000)" fill="#000000">
<path id="Line-8" d="M57,4 L71,11 L57,18 L57,12 L-1,12 L-1,10 L57,10 L57,4 Z" fill-rule="nonzero"></path>
<text id="Symbolizes-a-depende" font-family="Helvetica" font-size="18" font-weight="normal">
<tspan x="82" y="18">Symbolizes a dependency</tspan>
</text>
</g>
<g id="Group-22" transform="translate(720.000000, 13.000000)" fill="#000000">
<path id="Line-10" d="M59.3686857,3.88816322 L60.2402612,4.37842446 L72.2402612,11.1284245 L73.7897289,12 L72.2402612,12.8715755 L60.2402612,19.6215755 L59.3686857,20.1118368 L58.3881632,18.3686857 L59.2597388,17.8784245 L69.71,12 L59.2597388,6.12157554 L58.3881632,5.6313143 L59.3686857,3.88816322 Z M8,11 L8,13 L-1,13 L-1,11 L8,11 Z M22,11 L22,13 L13,13 L13,11 L22,11 Z M36,11 L36,13 L27,13 L27,11 L36,11 Z M50,11 L50,13 L41,13 L41,11 L50,11 Z M64,11 L64,13 L55,13 L55,11 L64,11 Z" fill-rule="nonzero"></path>
<text id="Denotes-sequential-p" font-family="Helvetica" font-size="18" font-weight="normal">
<tspan x="85" y="18">Denotes sequential procedures</tspan>
</text>
</g>
</g>
</g>
</g>
</svg>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<svg width="1186px" height="312px" viewBox="0 0 1186 312" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Group 31</title>
<defs>
<polygon id="path-1" points="0 0 526 0 526 312 259.271786 312 0 312"></polygon>
<mask id="mask-2" maskContentUnits="userSpaceOnUse" maskUnits="objectBoundingBox" x="0" y="0" width="526" height="312" fill="white">
<use xlink:href="#path-1"></use>
</mask>
<rect id="path-3" x="25" y="13" width="238" height="284"></rect>
<mask id="mask-4" maskContentUnits="userSpaceOnUse" maskUnits="objectBoundingBox" x="0" y="0" width="238" height="284" fill="white">
<use xlink:href="#path-3"></use>
</mask>
<polygon id="path-5" points="0 1.08246745e-15 442 1.08246745e-15 648 0 648 147 442 147 442 312 0 312"></polygon>
<mask id="mask-6" maskContentUnits="userSpaceOnUse" maskUnits="objectBoundingBox" x="0" y="0" width="648" height="312" fill="white">
<use xlink:href="#path-5"></use>
</mask>
<rect id="path-7" x="455" y="156" width="193" height="156"></rect>
<mask id="mask-8" maskContentUnits="userSpaceOnUse" maskUnits="objectBoundingBox" x="0" y="0" width="193" height="156" fill="white">
<use xlink:href="#path-7"></use>
</mask>
</defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Group-31">
<g id="Group-29">
<g id="Group-9" transform="translate(38.000000, 25.000000)">
<rect id="Rectangle" stroke="#000000" stroke-width="2" fill="#D0B8EE" x="1" y="1" width="209" height="60" rx="7"></rect>
<text id="planning.properties." font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="25.9467773" y="27">planning.properties.</tspan>
<tspan x="71.4785156" y="49">instance</tspan>
</text>
</g>
<g id="Group-9" transform="translate(38.000000, 125.000000)">
<rect id="Rectangle" stroke="#000000" stroke-width="2" fill="#D0B8EE" x="1" y="1" width="209" height="60" rx="7"></rect>
<text id="planning.properties." font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="25.9467773" y="27">planning.properties.</tspan>
<tspan x="71.9838867" y="49">intensity</tspan>
</text>
</g>
<g id="Group-9" transform="translate(36.000000, 225.000000)">
<rect id="Rectangle" stroke="#000000" stroke-width="2" fill="#D0B8EE" x="1" y="1" width="209" height="60" rx="7"></rect>
<text id="planning.properties." font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="25.9467773" y="27">planning.properties.</tspan>
<tspan x="73.987793" y="49">medical</tspan>
</text>
</g>
<g id="Group-9" transform="translate(282.000000, 13.000000)">
<rect id="Rectangle" stroke="#000000" stroke-width="2" fill="#BEEEB8" x="1" y="1" width="221" height="60" rx="7"></rect>
<text id="planning.-plan_exper" font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="74.9682617" y="27">planning.</tspan>
<tspan x="44.9580078" y="49">plan_experiment</tspan>
</text>
</g>
<g id="Group-9" transform="translate(282.000000, 87.000000)">
<rect id="Rectangle" stroke="#000000" stroke-width="2" fill="#BEEEB8" x="1" y="1" width="221" height="60" rx="7"></rect>
<text id="planning.-plan_archi" font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="74.9682617" y="27">planning.</tspan>
<tspan x="42.4575195" y="49">plan_architecture</tspan>
</text>
</g>
<g id="Group-9" transform="translate(282.000000, 161.000000)">
<rect id="Rectangle" stroke="#000000" stroke-width="2" fill="#BEEEB8" x="1" y="1" width="221" height="60" rx="7"></rect>
<text id="planning.-estimator" font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="74.9682617" y="27">planning.</tspan>
<tspan x="74.4892578" y="49">estimator</tspan>
</text>
</g>
<g id="Group-9" transform="translate(282.000000, 235.000000)">
<rect id="Rectangle" stroke="#000000" stroke-width="2" fill="#BEEEB8" x="1" y="1" width="221" height="60" rx="7"></rect>
<text id="preprocessing" font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="54.96875" y="38">preprocessing</tspan>
</text>
</g>
<use id="Rectangle" stroke="#64BF58" mask="url(#mask-2)" stroke-width="8" stroke-dasharray="2" xlink:href="#path-1"></use>
<use id="Rectangle" stroke="#A261F4" mask="url(#mask-4)" stroke-width="6" stroke-dasharray="3" xlink:href="#path-3"></use>
</g>
<g id="Group-30" transform="translate(538.000000, 0.000000)">
<g id="Group-9" transform="translate(226.000000, 161.000000)">
<rect id="Rectangle" stroke="#000000" stroke-width="2" fill="#B8C6EE" x="1" y="1" width="177" height="60" rx="7"></rect>
<text id="io.datamodule.-bg_lo" font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="30.4594727" y="27">io.datamodule.</tspan>
<tspan x="49.4658203" y="49">bg_loader</tspan>
</text>
</g>
<g id="Group-9" transform="translate(226.000000, 235.000000)" fill="#E0E0E0" stroke="#000000" stroke-width="2">
<rect id="Rectangle" x="1" y="1" width="177" height="60" rx="7"></rect>
</g>
<g id="Group-9" transform="translate(454.000000, 8.000000)">
<rect id="Rectangle" stroke="#000000" stroke-width="2" fill="#E0E0E0" x="1" y="1" width="177" height="60" rx="7"></rect>
<text id="evaluator" font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="52.4760742" y="38">evaluator</tspan>
</text>
</g>
<g id="Group-9" transform="translate(454.000000, 75.000000)">
<rect id="Rectangle" stroke="#000000" stroke-width="2" fill="#E0E0E0" x="1" y="1" width="177" height="60" rx="7"></rect>
<text id="utils" font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="73.4951172" y="38">utils</tspan>
</text>
</g>
<g id="Group-9" transform="translate(12.000000, 13.000000)">
<rect id="Rectangle" stroke="#000000" stroke-width="2" fill="#E0E0E0" x="1" y="1" width="177" height="60" rx="7"></rect>
<text id="ptmodule" font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="52.4760742" y="38">ptmodule</tspan>
</text>
</g>
<g id="Group-9" transform="translate(226.000000, 87.000000)">
<rect id="Rectangle" stroke="#000000" stroke-width="2" fill="#B8C6EE" x="1" y="1" width="177" height="60" rx="7"></rect>
<text id="io.-augmentation" font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="79.9946289" y="27">io.</tspan>
<tspan x="34.9594727" y="49">augmentation</tspan>
</text>
</g>
<g id="Group-9" transform="translate(226.000000, 13.000000)">
<rect id="Rectangle" stroke="#000000" stroke-width="2" fill="#B8C6EE" x="1" y="1" width="177" height="60" rx="7"></rect>
<text id="training" font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="59.9819336" y="38">training</tspan>
</text>
</g>
<g id="Group-9" transform="translate(12.000000, 161.000000)">
<rect id="Rectangle" stroke="#000000" stroke-width="2" fill="#B8C6EE" x="1" y="1" width="177" height="60" rx="7"></rect>
<rect id="Rectangle" stroke="#000000" stroke-width="2" fill="#B8C6EE" x="1" y="1" width="177" height="60" rx="7"></rect>
<text id="models" font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="60.4873047" y="38">models</tspan>
</text>
</g>
<g id="Group-9" transform="translate(462.000000, 169.000000)">
<rect id="Rectangle" stroke="#000000" stroke-width="2" fill="#B8C6EE" x="1" y="1" width="177" height="60" rx="7"></rect>
<rect id="Rectangle" stroke="#000000" stroke-width="2" fill="#F7C08C" x="1" y="1" width="177" height="60" rx="7"></rect>
<text id="inferene" font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="56.9760742" y="38">inferene</tspan>
</text>
</g>
<g id="Group-9" transform="translate(462.000000, 241.000000)">
<rect id="Rectangle" stroke="#000000" stroke-width="2" fill="#B8C6EE" x="1" y="1" width="177" height="60" rx="7"></rect>
<rect id="Rectangle" stroke="#000000" stroke-width="2" fill="#F7C08C" x="1" y="1" width="177" height="60" rx="7"></rect>
<text id="inferene.-sweeper" font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="54.4755859" y="27">inferene.</tspan>
<tspan x="55.4819336" y="49">sweeper</tspan>
</text>
</g>
<g id="Group-9" transform="translate(12.000000, 87.000000)">
<rect id="Rectangle" stroke="#000000" stroke-width="2" fill="#B8C6EE" x="1" y="1" width="177" height="60" rx="7"></rect>
<rect id="Rectangle" stroke="#000000" stroke-width="2" fill="#B8C6EE" x="1" y="1" width="177" height="60" rx="7"></rect>
<text id="detection" font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="52.9726562" y="38">detection</tspan>
</text>
</g>
<g id="Group-9" transform="translate(12.000000, 235.000000)">
<rect id="Rectangle" stroke="#000000" stroke-width="2" fill="#B8C6EE" x="1" y="1" width="177" height="60" rx="7"></rect>
<rect id="Rectangle" stroke="#000000" stroke-width="2" fill="#B8C6EE" x="1" y="1" width="177" height="60" rx="7"></rect>
<text id="losses" font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="63.9897461" y="38">losses</tspan>
</text>
</g>
<use id="Rectangle" stroke="#537EF9" mask="url(#mask-6)" stroke-width="8" stroke-dasharray="2" xlink:href="#path-5"></use>
<use id="Rectangle" stroke="#EE7400" mask="url(#mask-8)" stroke-width="6" stroke-dasharray="3" xlink:href="#path-7"></use>
<text id="io.datamodule.-bg_mo" font-family="Helvetica" font-size="18" font-weight="normal" fill="#000000">
<tspan x="256.459473" y="262">io.datamodule.</tspan>
<tspan x="270.96582" y="284">bg_module</tspan>
</text>
</g>
</g>
</g>
</svg>
\ No newline at end of file
"""
Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from typing import Dict, Tuple, Any, Optional
import torch
from abc import abstractmethod
from torch import Tensor
class AbstractModel(torch.nn.Module):
@classmethod
@abstractmethod
def from_config_plan(cls,
model_cfg: dict,
plan_arch: dict,
plan_anchors: dict,
log_num_anchors: str = None,
**kwargs,
):
raise NotImplementedError
@abstractmethod
def train_step(self,
images: Tensor,
targets: dict,
evaluation: bool,
batch_num: int,
) -> Tuple[Dict[str, torch.Tensor], Optional[Dict]]:
"""
Perform a single training step
Args:
images: images to process
targets: labels for training
evaluation (bool): compute final predictions which should be used for metric evaluation
batch_num (int): batch index inside epoch
Returns:
torch.Tensor: final loss for back propagation
Dict: predictions for metric calculation
Dict[str, torch.Tensor]: scalars for logging (e.g. individual loss components)
"""
raise NotImplementedError
@abstractmethod
def inference_step(self,
images: Tensor,
*args,
**kwargs,
) -> Dict[str, Any]:
"""
Perform a single training step
Args:
images: images to process
*args: positional arguments
**kwargs: keyword arguments
Returns:
Dict: predictions for metric calculation
"""
raise NotImplementedError
from nndet.arch.blocks.basic import AbstractBlock, StackedConvBlock, \
StackedResidualBlock, StackedConvBlock2
from nndet.arch.blocks.res import ResBasic, ResBottleneck
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