Repository navigation
2727 transunet - #9218
Draft
nicolasbeaujoin wants to merge 3 commits into
Draft
2727 transunet#9218nicolasbeaujoin wants to merge 3 commits into
nicolasbeaujoin wants to merge 3 commits into
Conversation
Signed-off-by: Nicolas Beaujoin <beaujoin.nicolas@gmail.com> Assisted-by: Mistral Vibe <vibe@mistral.ai>
Signed-off-by: Nicolas Beaujoin <beaujoin.nicolas@gmail.com> Assisted-by: Mistral Vibe <vibe@mistral.ai> Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
for more information, see https://pre-commit.ci
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes # .
Description
A few sentences describing the changes proposed in this pull request.
Fixes #2727
Adds
TransUNet(Chen et al., 2021, arXiv:2102.04306), a hybrid CNN-Transformer segmentation network, following the structure ofUNETR:UnetrBasicBlock) produces skip features at 1/1, 1/2, 1/4, and 1/8 scale, and bottleneck features at 1/16 scale. Each spatial position of the 1/16-scale feature map is tokenized (PatchEmbeddingBlockwithpatch_size=1, learnable positional embedding) and processed by a stack ofTransformerBlocks.UnetrUpBlockupsampling from 1/16 back to full resolution, fusing the transformer output with the CNN skip connections.UNETR(in_channels,out_channels,img_size,feature_size,hidden_size,mlp_dim,num_heads,num_layers,norm_name,res_block,dropout_rate,qkv_bias,spatial_dims).Implementation notes / deviations from the paper
spatial_dims=2by default, 2D and 3D supported), consistent with MONAI convention, and uses a lightweight convolutional stem instead of a pretrained R50. A ResNet-based stem and aload_old_state_dictshim for the original checkpoint could follow up if wanted.Files changed
monai/networks/nets/transunet.py— networkmonai/networks/nets/__init__.py— exporttests/networks/nets/test_transunet.py— parameterized 2D/3D shape tests + ill-arg casesdocs/source/networks.rst— autoclass entryTesting
tests/networks/nets/test_transunet.pypasses locally (2D and 3D forward shapes, argument validation) against torch 2.5.1.Draft until review feedback from the maintainers on the open design questions in #2727 is incorporated.
Types of changes
./runtests.sh -f -u --net --coverage../runtests.sh --quick --unittests --disttests.make htmlcommand in thedocs/folder.