Skip to content
Snippets Groups Projects
Commit 5f1c86d1 authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

[doc] Add object detection

parent 74b5c670
No related branches found
No related tags found
1 merge request!64Add object detection
.. SPDX-FileCopyrightText: Copyright © 2024 Idiap Research Institute <contact@idiap.ch>
..
.. SPDX-License-Identifier: GPL-3.0-or-later
.. _mednet.databases.detect.cxr8:
=======
CXR-8
=======
* DataModule and support code: :py:mod:`.data.detect.cxr8`
* Splits:
.. list-table::
:align: left
* - Config. key
- Module
* - ``cxr8-detect``
- :py:mod:`.config.detect.data.cxr8.default`
.. SPDX-FileCopyrightText: Copyright © 2024 Idiap Research Institute <contact@idiap.ch>
..
.. SPDX-License-Identifier: GPL-3.0-or-later
.. _mednet.databases.detect:
==================
Object Detection
==================
.. toctree::
:maxdepth: 1
cxr8
jsrt
montgomery
shenzhen
.. SPDX-FileCopyrightText: Copyright © 2024 Idiap Research Institute <contact@idiap.ch>
..
.. SPDX-License-Identifier: GPL-3.0-or-later
.. _mednet.databases.detect.jsrt:
======
JSRT
======
* DataModule and support code: :py:mod:`.data.detect.jsrt`
* Splits:
.. list-table::
:align: left
* - Config. key
- Module
* - ``jsrt-detect``
- :py:mod:`.config.detect.data.jsrt.default`
.. SPDX-FileCopyrightText: Copyright © 2024 Idiap Research Institute <contact@idiap.ch>
..
.. SPDX-License-Identifier: GPL-3.0-or-later
.. _mednet.databases.detect.montgomery:
===================
Montgomery County
===================
* DataModule and support code: :py:mod:`.data.detect.montgomery`
* Splits:
.. list-table::
:align: left
* - Config. key
- Module
* - ``montgomery-detect``
- :py:mod:`.config.detect.data.montgomery.default`
.. SPDX-FileCopyrightText: Copyright © 2024 Idiap Research Institute <contact@idiap.ch>
..
.. SPDX-License-Identifier: GPL-3.0-or-later
.. _mednet.databases.detect.shenzhen:
===================
Shenzhen Hospital
===================
* DataModule and support code: :py:mod:`.data.detect.shenzhen`
* Splits:
.. list-table::
:align: left
* - Config. key
- Module
* - ``shenzhen-detect``
- :py:mod:`.config.detect.data.shenzhen.default`
...@@ -15,3 +15,4 @@ ...@@ -15,3 +15,4 @@
classify/index classify/index
segment/index segment/index
detect/index
...@@ -89,4 +89,22 @@ Pre-configured models supporting semantic segmentation tasks. ...@@ -89,4 +89,22 @@ Pre-configured models supporting semantic segmentation tasks.
- :py:class:`.models.segment.unet.Unet` - :py:class:`.models.segment.unet.Unet`
.. _mednet.models.detect:
Object Detection
----------------
Pre-configured models supporting object detection tasks.
.. list-table:: Pre-configured object detection models
:align: left
* - Config. key
- Module
- Base type
* - ``faster-rcnn``
- :py:mod:`.config.detect.models.faster_rcnn`
- :py:class:`.models.detect.faster_rcnn.FasterRCNN`
.. include:: links.rst .. include:: links.rst
...@@ -34,7 +34,10 @@ pre-configured :ref:`datamodule <mednet.datamodel>`, run the one of following: ...@@ -34,7 +34,10 @@ pre-configured :ref:`datamodule <mednet.datamodel>`, run the one of following:
mednet predict -vv pasa montgomery --weight=<results/model.ckpt> --output-folder=predictions mednet predict -vv pasa montgomery --weight=<results/model.ckpt> --output-folder=predictions
# example for a segmentation task # example for a segmentation task
mednet predict -vv lwnet drive --weight=<results/model.ckpt> --output-folder=predictions mednet predict -vv lwnet drive --weight=<results/model.ckpt> --output-folder=predictions
# example for a object detection task
mednet predict -vv faster-rcnn montgomery-detect --weight=<results/model.ckpt> --output-folder=predictions
Replace ``<results/model.ckpt>`` to a path leading to the pre-trained model. Replace ``<results/model.ckpt>`` to a path leading to the pre-trained model.
...@@ -71,5 +74,8 @@ the following: ...@@ -71,5 +74,8 @@ the following:
# segmentation task # segmentation task
mednet segment evaluate -vv --predictions=path/to/predictions.json mednet segment evaluate -vv --predictions=path/to/predictions.json
# object detection task
mednet detect evaluate -vv --predictions=path/to/predictions.json
.. include:: ../links.rst .. include:: ../links.rst
...@@ -29,6 +29,11 @@ performance curves, run the one of following: ...@@ -29,6 +29,11 @@ performance curves, run the one of following:
$ mednet experiment -vv lwnet drive $ mednet experiment -vv lwnet drive
# check results in the "results" folder # check results in the "results" folder
# example object detection task using the "faster-rcnn" network model
# on the "montgomery" (for object detection) datamodule
$ mednet experiment -vv montgomery-detect faster-rcnn
# check results in the "results" folder
You may run the system on a GPU by using the ``--device=cuda``, or You may run the system on a GPU by using the ``--device=cuda``, or
``--device=mps`` option. ``--device=mps`` option.
......
...@@ -8,14 +8,14 @@ ...@@ -8,14 +8,14 @@
Usage Usage
======= =======
This package supports a fully reproducible research experimentation cycle for This package supports a fully reproducible research experimentation cycle for medical
medical image classification and segmentation with support for the following image classification, segmentation, and object detection with support for the following
activities: activities:
* Training: Images are fed to a deep neural network that is trained to match * Training: Images are fed to a deep neural network that is trained to match labels
(classification) or reconstruct (segmentation) annotations automatically, via (classification), reconstruct (segmentation), or find objects (detections)
error back propagation. The objective of this phase is to produce a model. automatically, via error back propagation. The objective of this phase is to produce a
We support training on CPU and a few GPU architectures (``cuda`` or ``mps``). model. We support training on CPU and a few GPU architectures (``cuda`` or ``mps``).
* Prediction (inference): The model is used to generate predictions * Prediction (inference): The model is used to generate predictions
* Evaluation: Predictions are used evaluate model performance against provided * Evaluation: Predictions are used evaluate model performance against provided
annotations, or visualize prediction results overlayed on the original raw annotations, or visualize prediction results overlayed on the original raw
...@@ -32,7 +32,7 @@ generate intermediate outputs required for subsequent commands: ...@@ -32,7 +32,7 @@ generate intermediate outputs required for subsequent commands:
.. graphviz:: img/cli-core-dark.dot .. graphviz:: img/cli-core-dark.dot
:align: center :align: center
:class: only-dark :class: only-dark
:caption: Overview of core CLI commands for model training, inference and evaluation. Clicking on each item leads to the appropriate specific documentation. The workflow is the same across different task types (e.g. classification or segmentation), except for evaluation, that remains task-specific. The right implementation is chosen based on the type of datamodule being used. :caption: Overview of core CLI commands for model training, inference and evaluation. Clicking on each item leads to the appropriate specific documentation. The workflow is the same across different task types (e.g. classification, segmentation or object detection), except for evaluation, that remains task-specific. The right implementation is chosen based on the type of datamodule being used.
The CLI interface is configurable using :ref:`clapper's extensible The CLI interface is configurable using :ref:`clapper's extensible
configuration framework <clapper.config>`. In essence, each command-line configuration framework <clapper.config>`. In essence, each command-line
......
...@@ -27,6 +27,10 @@ For example, to train a model on a pre-configured :ref:`datamodule ...@@ -27,6 +27,10 @@ For example, to train a model on a pre-configured :ref:`datamodule
mednet train -vv lwnet drive mednet train -vv lwnet drive
# check results in the "results" folder # check results in the "results" folder
# example object detection task
$ mednet train -vv montgomery-detect faster-rcnn
# check results in the "results" folder
You may run the system on a GPU by using the ``--device=cuda``, or You may run the system on a GPU by using the ``--device=cuda``, or
``--device=mps`` option. ``--device=mps`` option.
......
...@@ -65,7 +65,7 @@ class FasterRCNN(Model): ...@@ -65,7 +65,7 @@ class FasterRCNN(Model):
num_classes: int = 1, num_classes: int = 1,
variant: typing.Literal[ variant: typing.Literal[
"resnet50-v1", "resnet50-v2", "mobilenetv3-large", "mobilenetv3-small" "resnet50-v1", "resnet50-v2", "mobilenetv3-large", "mobilenetv3-small"
] = "resnet50-v1", ] = "mobilenetv3-small",
): ):
super().__init__( super().__init__(
name=f"faster-rcnn[{variant}]", name=f"faster-rcnn[{variant}]",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment