栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

2021-10-11

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

2021-10-11

标题 #使用ASPP处理3D体数据
```python-pytorch
import torch
import torch.nn as nn

class ASPP(nn.Module):
    def __init__(self, in_channel, out_channel):
        super(ASPP, self).__init__()
  
        self.mean = nn.AdaptiveAvgPool3d((1, 1, 1))
        self.conv = nn.Conv3d(in_channel, out_channel, 1, 1)
       
        self.Upsample = nn.Upsample(size=(8, 8, 8), mode='trilinear')
       
        self.atrous_block1 = nn.Conv3d(in_channel, out_channel, 1, 1)
        self.atrous_block6 = nn.Conv3d(in_channel, out_channel, 3, 1, padding=6, dilation=6)
        self.atrous_block12 = nn.Conv3d(in_channel, out_channel, 3, 1, padding=12, dilation=12)
        self.atrous_block18 = nn.Conv3d(in_channel, out_channel, 3, 1, padding=18, dilation=18)

        self.conv_1x1_output = nn.Conv3d(out_channel * 6, out_channel, 1, 1)
        self.dropout = nn.Dropout3d(0.5)

    def forward(self, x):
        size = x.shape[2:]

        image_features = self.mean(x)
        image_features = self.conv(image_features)
      
        image_features = self.Upsample(image_features)

        atrous_block1 = self.atrous_block1(x)
        atrous_block6 = self.atrous_block6(x)
        atrous_block12 = self.atrous_block12(x)
        atrous_block18 = self.atrous_block18(x)

        net = self.conv_1x1_output(torch.cat([x, image_features, atrous_block1, atrous_block6, atrous_block12, atrous_block18], dim=1))
        net = self.dropout(net)

        return net

ASPP的原理不做太多的介绍,不懂的同学参考:
https://blog.csdn.net/qq_36530992/article/details/102628455#comments_18044608
https://blog.csdn.net/qq_43534932/article/details/109253935

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/317570.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号