Rubics-Xuan / TransBTS

This repo provides the official code for : 1) TransBTS: Multimodal Brain Tumor Segmentation Using Transformer (https://arxiv.org/abs/2103.04430) , accepted by MICCAI2021. 2) TransBTSV2: Towards Better and More Efficient Volumetric Segmentation of Medical Images(https://arxiv.org/abs/2201.12785).
Apache License 2.0
386 stars 81 forks source link

would you please explain tailor_and_concat(x, model) for me? #8

Closed cqlouis closed 3 years ago

cqlouis commented 3 years ago

My dear friend, sorry to bother you.

I'm a greenhand in medical image segmentation, maybe this function seems very easy for you , but I can not understand it clearly.

Both 中文 and English are OK, ^__^

Many thanks in advance

Rubics-Xuan commented 3 years ago

好的,没问题,为了让你能理解的更清楚,我用中文给你回复一下叭。这个函数其实很简单,由于我们训练阶段在将原图crop之后,transformer里面的超参已经决定了它的输入尺寸,因此在测试阶段输入原图尺寸之后,我们必须在不crop的情况下也让模型的输入满足既定尺寸,所以我们将原图拆分成多个块,分块预测,最后把分块预测的结果拼到一起,作为最终的分割结果。不知道这样说你能否理解。

Cocofeat commented 2 years ago

y[..., :128, :128, :128] = temp[0] RuntimeError: The expanded size of the tensor (1) must match the existing size (4) at non-singleton dimension 1. Target sizes: [1, 1, 128, 128, 128]. Tensor sizes: [4, 128, 128, 128]

这里模型输出的temp是4个channel(对应0,1,2,4)嘛,这里赋值给y的时候报错哟,因为y克隆的x,x是1个通道的输入voxel。请问这里怎么解决呢