本文整理匯總了Python中chainer.links.DilatedConvolution2D方法的典型用法代碼示例。如果您正苦於以下問題:Python links.DilatedConvolution2D方法的具體用法?Python links.DilatedConvolution2D怎麽用?Python links.DilatedConvolution2D使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類chainer.links
的用法示例。
在下文中一共展示了links.DilatedConvolution2D方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from chainer import links [as 別名]
# 或者: from chainer.links import DilatedConvolution2D [as 別名]
def __init__(self, in_channels, out_channels, ksize=None,
stride=1, pad=0, dilate=1, nobias=False, initialW=None,
initial_bias=None, activ=relu):
if ksize is None:
out_channels, ksize, in_channels = in_channels, out_channels, None
self.activ = activ
super(Conv2DActiv, self).__init__()
with self.init_scope():
if dilate > 1:
self.conv = DilatedConvolution2D(
in_channels, out_channels, ksize, stride, pad, dilate,
nobias, initialW, initial_bias)
else:
self.conv = Convolution2D(
in_channels, out_channels, ksize, stride, pad,
nobias, initialW, initial_bias)
示例2: __init__
# 需要導入模塊: from chainer import links [as 別名]
# 或者: from chainer.links import DilatedConvolution2D [as 別名]
def __init__(self):
super(VGG16, self).__init__()
with self.init_scope():
self.conv1_1 = L.Convolution2D(64, 3, pad=1)
self.conv1_2 = L.Convolution2D(64, 3, pad=1)
self.conv2_1 = L.Convolution2D(128, 3, pad=1)
self.conv2_2 = L.Convolution2D(128, 3, pad=1)
self.conv3_1 = L.Convolution2D(256, 3, pad=1)
self.conv3_2 = L.Convolution2D(256, 3, pad=1)
self.conv3_3 = L.Convolution2D(256, 3, pad=1)
self.conv4_1 = L.Convolution2D(512, 3, pad=1)
self.conv4_2 = L.Convolution2D(512, 3, pad=1)
self.conv4_3 = L.Convolution2D(512, 3, pad=1)
self.norm4 = Normalize(512, initial=initializers.Constant(20))
self.conv5_1 = L.DilatedConvolution2D(512, 3, pad=1)
self.conv5_2 = L.DilatedConvolution2D(512, 3, pad=1)
self.conv5_3 = L.DilatedConvolution2D(512, 3, pad=1)
self.conv6 = L.DilatedConvolution2D(1024, 3, pad=6, dilate=6)
self.conv7 = L.Convolution2D(1024, 1)
示例3: __init__
# 需要導入模塊: from chainer import links [as 別名]
# 或者: from chainer.links import DilatedConvolution2D [as 別名]
def __init__(self, in_size, out_size, ch, stride=1):
super(DilatedBottleNeckA, self).__init__()
initialW = chainer.initializers.HeNormal()
with self.init_scope():
self.conv1 = L.Convolution2D(
in_size, ch, 1, stride, 0, initialW=initialW, nobias=True)
self.bn1 = L.BatchNormalization(ch, eps=self.eps)
self.conv2 = L.DilatedConvolution2D(
ch, ch, 3, 1, 2, dilate=2,
initialW=initialW, nobias=True)
self.bn2 = L.BatchNormalization(ch, eps=self.eps)
self.conv3 = L.Convolution2D(
ch, out_size, 1, 1, 0, initialW=initialW, nobias=True)
self.bn3 = L.BatchNormalization(out_size, eps=self.eps)
self.conv4 = L.Convolution2D(
in_size, out_size, 1, stride, 0,
initialW=initialW, nobias=True)
self.bn4 = L.BatchNormalization(out_size)
示例4: __init__
# 需要導入模塊: from chainer import links [as 別名]
# 或者: from chainer.links import DilatedConvolution2D [as 別名]
def __init__(self, nb_in, nb_out, ksize=3, dilate=1, no_bn=False):
super(DConv_BN, self).__init__()
self.no_bn = no_bn
with self.init_scope():
self.conv = L.DilatedConvolution2D(nb_in, nb_out, ksize=(ksize, 1), pad=(dilate, 0), dilate=(dilate, 1))
if not no_bn:
self.bn = L.BatchNormalization(nb_out)
示例5: setUp
# 需要導入模塊: from chainer import links [as 別名]
# 或者: from chainer.links import DilatedConvolution2D [as 別名]
def setUp(self):
self.link = links.DilatedConvolution2D(
3, 2, 3, stride=2, pad=2, dilate=2)
b = self.link.b.data
b[...] = numpy.random.uniform(-1, 1, b.shape)
self.link.cleargrads()
self.x = numpy.random.uniform(-1, 1,
(2, 3, 4, 3)).astype(numpy.float32)
self.gy = numpy.random.uniform(-1, 1,
(2, 2, 2, 2)).astype(numpy.float32)