简体   繁体   English

3D 体积图像沿三个正交(轴)的二维卷积

[英]2D convolution along three orthogonals (axis) for 3D volumetric image

Since 3D convolution requires too much computational cost, so I prefer to use 2D conv.由于 3D 卷积需要太多的计算成本,所以我更喜欢使用 2D conv。 My motivation here is using 2D conv for volumetric images to reduce this cost.我的动机是使用 2D conv 处理体积图像来降低成本。

I want to apply 2D convolution along three orthogonals to get 3 results, each belongs to one of these orthogonals.我想沿三个正交应用 2D 卷积以获得 3 个结果,每个结果都属于这些正交之一。 More clearly, suppose I have a 3D volumetric image.更清楚地说,假设我有一个 3D 体积图像。 Instead of apply 3D conv, I want to use 2D conv both xy, xz, yz axis.而不是应用 3D conv,我想同时使用 xy、xz、yz 轴的 2D conv。 Then, I expect that 3 different volumetric results.然后,我希望有 3 种不同的体积结果。 Each result represent three different orthogonals.每个结果代表三个不同的正交。

Is there way to do that?有没有办法做到这一点? Thanks for help.感谢帮助。

You can permute your images.您可以排列您的图像。 (Some frameworks such as numpy calls it transpose ). (一些框架,如numpy称之为transpose )。

Assume we use 3 x 3 a convolutional kernel.假设我们使用3 x 3个卷积 kernel。

# A batch of 16 3 channel images (channels first)
a = tensor(shape=[16,3,1920,1080])

# 2D conv will slide over a `1920 x 1080` image, kernel size is `3 x 3 x 3`
a.shape is (16,3,1920,1080)

# 2D conv will slide over a `3 x 1080` image, kernel size is `1920 x 3 x 3`
a.permute(0,2,1,3)
a.shape is (16,1920,3,1080)

# 2D conv will slide over a `1920 x 3` image, kernel size is `1080 x 3 x 3`
a.permute(0,3,2,1)
a.shape is (16,1080,1920,3)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM