ProcessTilesNNUNet

MLModule

genre

ML_Inference

author

Felix Thielke

package

FMEstable/ReleaseMeVis

dll

MLProcessTilesNNUNet

definition

ProcessTilesNNUNet.def

keywords

deep, learning, nnUNet, inference, prediction, apply, execute, RedLeaf

Purpose

Performs overlapping weighted tile-based inference for nnU-Net models analogous to the inference algorithm in the nnU-Net code base.

nnU-Net paper: https://www.nature.com/articles/s41592-020-01008-z

nnU-Net code base: https://github.com/MIC-DKFZ/nnUNet/tree/master/nnunetv2/inference

Usage

Connect a pre-processed image and a TileProcessor providing the trained nnU-Net (e.g. using an ONNXTileProcessor or RemoteTritonTileProcessor). Set the parameters according to the trained nnU-Net and press Update.

Details

Processes the tiles of an image and apply a U-Net trained by nnU-Net for inference on these tiles. The input image should already be preprocessed according to the trained nnU-Net model.

Debugging/Profiling of Individual Batch Processing Requests

Set the environment variable TILEPROCESSING_ENABLE_REQUEST_DEBUGGING to a non “0” value to enable sending a unique request ID string with each individual tile request. This simplifies tracking for debugging and profiling in the inference providers (i.e. tile processors).

Windows

Default Panel

../../../Projects/TileProcessing/NNUNet/MLProcessTilesNNUNet/Modules/mhelp/Images/Screenshots/ProcessTilesNNUNet._default.png

Input Fields

inImage

name: inImage, type: Image, deprecated name: input0

The preprocessed image to be segmented.

inMask

name: inMask, type: Image

An optional input mask. It is used if Use Mask is set. Tiles outside the mask are not processed, so providing a mask can reduce the time needed for inference.

inTileProcessor

name: inTileProcessor, type: TileProcessor/TileProcessorContainer(MLBase)

TileProcessor wrapping the nnU-Net, e.g. ONNXTileProcessor or RemoteTritonTileProcessor.

Output Fields

outImage

name: outImage, type: Image, deprecated name: output0

The segmentation output

Parameter Fields

Field Index

[]: Trigger

Has Valid Output: Bool

T: Bool

Apply Softmax to Model Outputs: Bool

inMaxTileProcessingThreads: Integer

Update: Trigger

Batch Size: Integer

On Input Change Behavior: Enum

Use Mask: Bool

Clear: Trigger

Output Selection Mode: Enum

X: Bool

Custom Output: String

Patch Size: Vector4

Y: Bool

doNotClearOnFailedUpdate: Bool

Selected Output: String

Z: Bool

Enable debug logging: Bool

Status Code: Enum

Expected Inputs: String

Status Message: String

Visible Fields

Update

name: update, type: Trigger

Initiates update of all output field values.

Clear

name: clear, type: Trigger

Clears all output field values to a clean initial state.

On Input Change Behavior

name: onInputChangeBehavior, type: Enum, default: Clear, deprecated name: shouldAutoUpdate,shouldUpdateAutomatically

Declares how the module should react if a value of an input field changes.

Values:

Title

Name

Deprecated Name

Update

Update

TRUE

Clear

Clear

FALSE

Status Code

name: statusCode, type: Enum, persistent: no

Reflects module’s status (successful or failed computations) as one of some predefined enumeration values.

Values:

Title

Name

Ok

Ok

Invalid input object

Invalid input object

Invalid input parameter

Invalid input parameter

Internal error

Internal error

Status Message

name: statusMessage, type: String, persistent: no

Gives additional, detailed information about status code as human-readable message.

Has Valid Output

name: hasValidOutput, type: Bool, persistent: no

Indicates validity of output field values (success of computation).

[]

name: updateDone, type: Trigger, persistent: no

Notifies that an update was performed (Check status interface fields to identify success or failure).

Output Selection Mode

name: inModelOutputSelectionMode, type: Enum, default: Single

Choose how the module decides which of the processor outputs to pick. If it has only one output, just leave “Single”.

Values:

Title

Name

Description

Single

Single

If the processor defines only a single output, it will be selected. Otherwise, an error will be reported.

Custom

Custom

You have to specify the exact name of the output to select in Custom Output

Custom Output

name: inCustomModelOutput, type: String, deprecated name: inRequestedOutput

Name of the model output to pick in Output Selection Mode ‘Custom’

Apply Softmax to Model Outputs

name: inApplySoftmax, type: Bool, default: FALSE

Apply softmax to neural network outputs. This is required, if the neural network does not include a softmax layer by itself.

Batch Size

name: inBatchSize, type: Integer, default: 1, minimum: 1

The batch size used for inference, i.e. the number of patches which are processed in parallel by the neural network. Increasing the batch size can increase the inference speed, but needs more memory inside the neural network.

Patch Size

name: inPatchSize, type: Vector4, default: 128 128 128 1, deprecated name: inTileSize

The size (extent) of the patch for processing. Should be the equal to the patch size the nnU-Net model used during training. Only the first N dimensions are used, where N is the number of spatiotemporal dimensions used by the nnU-Net model.

X

name: inMirrorX, type: Bool, default: FALSE

Mirror X-axis for test time augmentation.

Y

name: inMirrorY, type: Bool, default: FALSE

Mirror Y-axis for test time augmentation.

Z

name: inMirrorZ, type: Bool, default: FALSE

Mirror Z-axis for test time augmentation. Only used for 3D or 4D models.

T

name: inMirrorT, type: Bool, default: FALSE

Mirror Z-axis for test time augmentation. Only used for 4D models.

Use Mask

name: inUseMask, type: Bool, default: FALSE

Apply a mask to the segmentation result.

Enable debug logging

name: enableDebugLogging, type: Bool, default: FALSE, deprecated name: debug

If true, timing and debug information will be provided to the console.

Expected Inputs

name: availableInputs, type: String, persistent: no

Comma-separated list of all inputs declared by the current TileProcessor

Selected Output

name: availableOutputs, type: String, persistent: no, deprecated name: outAvailableOutputs

Comma-separated list of all outputs declared by the current TileProcessor

Hidden Fields

doNotClearOnFailedUpdate

name: doNotClearOnFailedUpdate, type: Bool, persistent: no

Prevents automated clear after update failed. This does not affect status fields. It enables the developer to analyze module’s state after failure.

inMaxTileProcessingThreads

name: inMaxTileProcessingThreads, type: Integer, default: 1, minimum: 1

Maximum number of threads using the TileProcessor simultaneously. Only considered if the TileProcessor is thread-safe.