当前位置: 首页>>代码示例>>Python>>正文


Python functions.MaxPooling2D方法代码示例

本文整理汇总了Python中chainer.functions.MaxPooling2D方法的典型用法代码示例。如果您正苦于以下问题:Python functions.MaxPooling2D方法的具体用法?Python functions.MaxPooling2D怎么用?Python functions.MaxPooling2D使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在chainer.functions的用法示例。


在下文中一共展示了functions.MaxPooling2D方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __call__

# 需要导入模块: from chainer import functions [as 别名]
# 或者: from chainer.functions import MaxPooling2D [as 别名]
def __call__(self, x):
        h = F.relu(self.conv1_1(x))
        h = F.relu(self.conv1_2(h))
        h = F.max_pooling_2d(h, 2, stride=2)
        h = F.relu(self.conv2_1(h))
        h = F.relu(self.conv2_2(h))
        h = F.max_pooling_2d(h, 2, stride=2)
        h = F.relu(self.conv3_1(h))
        h = F.relu(self.conv3_2(h))
        h = F.max_pooling_2d(h, 2, stride=2)
        h = F.relu(self.conv4_1(h))
        h = F.relu(self.conv4_2(h))
        h = F.spatial_pyramid_pooling_2d(h, 3, F.MaxPooling2D)
        h = F.tanh(self.fc4(h))
        h = F.dropout(h, ratio=.5, train=self.train)
        h = F.tanh(self.fc5(h))
        h = F.dropout(h, ratio=.5, train=self.train)
        h = self.fc6(h)
        return h 
开发者ID:oyam,项目名称:Semantic-Segmentation-using-Adversarial-Networks,代码行数:21,代码来源:spp_discriminator.py

示例2: __init__

# 需要导入模块: from chainer import functions [as 别名]
# 或者: from chainer.functions import MaxPooling2D [as 别名]
def __init__(self):
        super(VGG, self).__init__()
        with self.init_scope():
            self.conv1_1 = L.Convolution2D(3, 64, 3, stride=1, pad=1)
            self.conv1_2 = L.Convolution2D(64, 64, 3, stride=1, pad=1)
            self.conv2_1 = L.Convolution2D(64, 128, 3, stride=1, pad=1)
            self.conv2_2 = L.Convolution2D(128, 128, 3, stride=1, pad=1)
            self.conv3_1 = L.Convolution2D(128, 256, 3, stride=1, pad=1)
            self.conv3_2 = L.Convolution2D(256, 256, 3, stride=1, pad=1)
            self.conv3_3 = L.Convolution2D(256, 256, 3, stride=1, pad=1)
            self.conv4_1 = L.Convolution2D(256, 512, 3, stride=1, pad=1)
            self.conv4_2 = L.Convolution2D(512, 512, 3, stride=1, pad=1)
            self.conv4_3 = L.Convolution2D(512, 512, 3, stride=1, pad=1)
            self.conv5_1 = L.Convolution2D(512, 512, 3, stride=1, pad=1)
            self.conv5_2 = L.Convolution2D(512, 512, 3, stride=1, pad=1)
            self.conv5_3 = L.Convolution2D(512, 512, 3, stride=1, pad=1)
            self.fc6 = L.Linear(25088, 4096)
            self.fc7 = L.Linear(4096, 4096)
            self.fc8 = L.Linear(4096, 1000)

        # Keep track of the pooling indices inside each function instance
        self.conv_blocks = [
            [self.conv1_1, self.conv1_2],
            [self.conv2_1, self.conv2_2],
            [self.conv3_1, self.conv3_2, self.conv3_3],
            [self.conv4_1, self.conv4_2, self.conv4_3],
            [self.conv5_1, self.conv5_2, self.conv5_3]
        ]
        self.deconv_blocks = []
        self.mps = [F.MaxPooling2D(2, 2) for _ in self.conv_blocks] 
开发者ID:hvy,项目名称:chainer-visualization,代码行数:32,代码来源:vgg.py

示例3: __init__

# 需要导入模块: from chainer import functions [as 别名]
# 或者: from chainer.functions import MaxPooling2D [as 别名]
def __init__(self, in_channel, n_mid=64):
        w = math.sqrt(2)
        super(EncDec, self).__init__(
            enc=L.Convolution2D(in_channel, n_mid, 7, 1, 3, w),
            bn_m=L.BatchNormalization(n_mid),
            dec=L.Convolution2D(n_mid, n_mid, 7, 1, 3, w),
            bn_o=L.BatchNormalization(n_mid),
        )
        self.p = F.MaxPooling2D(2, 2, use_cudnn=False)
        self.inside = None 
开发者ID:pfnet-research,项目名称:chainer-segnet,代码行数:12,代码来源:segnet.py

示例4: setUp

# 需要导入模块: from chainer import functions [as 别名]
# 或者: from chainer.functions import MaxPooling2D [as 别名]
def setUp(self):
        self.x = numpy.random.uniform(-1, 1, self.in_shape).astype('f')
        self.p = F.MaxPooling2D(2, 2, use_cudnn=False)
        self.pooled_y = self.p(self.x)
        self.gy = numpy.random.uniform(
            -1, 1, self.in_shape).astype(numpy.float32) 
开发者ID:pfnet-research,项目名称:chainer-segnet,代码行数:8,代码来源:test_upsampling_2d.py

示例5: __init__

# 需要导入模块: from chainer import functions [as 别名]
# 或者: from chainer.functions import MaxPooling2D [as 别名]
def __init__(self, train=False):
        super(VGG16, self).__init__()
        self.trunk = [
            ('conv1_1', L.Convolution2D(3, 64, 3, 1, 1)),
            ('relu1_1', F.ReLU()),
            ('conv1_2', L.Convolution2D(64, 64, 3, 1, 1)),
            ('relu1_2', F.ReLU()),
            ('pool1', F.MaxPooling2D(2, 2)),
            ('conv2_1', L.Convolution2D(64, 128, 3, 1, 1)),
            ('relu2_1', F.ReLU()),
            ('conv2_2', L.Convolution2D(128, 128, 3, 1, 1)),
            ('relu2_2', F.ReLU()),
            ('pool2', F.MaxPooling2D(2, 2)),
            ('conv3_1', L.Convolution2D(128, 256, 3, 1, 1)),
            ('relu3_1', F.ReLU()),
            ('conv3_2', L.Convolution2D(256, 256, 3, 1, 1)),
            ('relu3_2', F.ReLU()),
            ('conv3_3', L.Convolution2D(256, 256, 3, 1, 1)),
            ('relu3_3', F.ReLU()),
            ('pool3', F.MaxPooling2D(2, 2)),
            ('conv4_1', L.Convolution2D(256, 512, 3, 1, 1)),
            ('relu4_1', F.ReLU()),
            ('conv4_2', L.Convolution2D(512, 512, 3, 1, 1)),
            ('relu4_2', F.ReLU()),
            ('conv4_3', L.Convolution2D(512, 512, 3, 1, 1)),
            ('relu4_3', F.ReLU()),
            ('pool4', F.MaxPooling2D(2, 2)),
            ('conv5_1', L.Convolution2D(512, 512, 3, 1, 1)),
            ('relu5_1', F.ReLU()),
            ('conv5_2', L.Convolution2D(512, 512, 3, 1, 1)),
            ('relu5_2', F.ReLU()),
            ('conv5_3', L.Convolution2D(512, 512, 3, 1, 1)),
            ('relu5_3', F.ReLU()),
            ('rpn_conv_3x3', L.Convolution2D(512, 512, 3, 1, 1)),
            ('rpn_relu_3x3', F.ReLU()),
        ]
        for name, link in self.trunk:
            if 'conv' in name:
                self.add_link(name, link) 
开发者ID:uei,项目名称:deel,代码行数:41,代码来源:VGG16.py


注:本文中的chainer.functions.MaxPooling2D方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。