如何在 keras CNN 模型中调整 3D 图像的大小?
我进行了 3D PET 扫描(无、128、128、60、1)。我想将其大小调整为(无、64、64、30、1)。有时我需要它更小。我想在 keras 模型中执行此操作。我正在考虑类似 tf.image.resize 的东西,但用于 3D 图像。
I have a 3D PET scan (None, 128, 128, 60, 1). I want to resize it to be (None, 64, 64, 30, 1). Sometimes I need it to be even smaller. I want to do this inside a keras model. I was thinking of something like tf.image.resize but for 3D images.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我们可以删除3D图像
的最后一个维度(无,128、128、60、1)
,以便转换后的张量的形状为(无,128、128、60)< /code>与代码> 是
(高度,宽度,频道)
。 (注意:所需的形状也可以是(batch_size,高度,宽度,num_channels)
)我们将使用
tf.squeeze
为此目的。输出
恢复大小
1
的删除维度的,您可以使用
tf.expand_dims
,输出,We can remove the last dimension of the 3D image
( None , 128 , 128 , 60 , 1)
so that the shape of the transformed tensor is( None , 128 , 128 , 60 )
that matches with the required shape fortf.image
which is( height , width , channels )
. ( Note: the required shape can also be( batch_size , height, width, num_channels )
)We will use
tf.squeeze
for this purpose.The output
To restore the deleted dimension of size
1
, you may usetf.expand_dims
,The output,