Project-MONAI / Project-MONAI/MONAI

Add TensorRT conversion support for diffusion unet and hovernet

Open
#6,838 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Feature request
Dominant language
Python
Stars
8.7k
Forks
1.6k
Avg merge
5d 1h
Merged PRs (30d)
20

Description

Is your feature request related to a problem? Please describe.
MONAI supported the TensorRT model conversion since 1.2. However, when tried to export the diffusion unet and hovernet to the TensorRT engine-based torchscript, there are some issues that some features need to be added to MONAI core to fix.

  1. For the diffusion unet, the forward function needs two inputs, a tensor and an extra time step. While the trt_export API only supports one input shape and one dynamic batchsize now, these two parameters should be extended to support the multiple inputs case.
  2. For the hovernet, the output of the forward function is a dict, which is not supported very well by the torchscript and TensorRT conversion. Therefore, a optional list output with a predefined order would be a good solution. There is a fixed similar issue of the detection network.

Describe the solution you'd like

  1. Support the multiple inputs case by extending the input_shape and dynamic_batchsize parameters from Sequence[int] to Sequence[int] | Sequence[Sequence[int]] type, where each element in these two parameters stands for a shape requirement and a batch size range of one input.
  2. Add a list output support option parameter for the hovernet like this PR and update the MONAI model zoo bundle accordingly.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the trt_export entry point in monai/bundle/scripts.py and the forward implementation in monai/networks/nets/hovernet.py. Compare the related detection-network issue 6330 and PR 6393, then inspect the referenced MONAI model zoo bundle. Done means conversion supports multiple inputs and HoverNet can provide ordered list outputs with the bundle updated accordingly.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.