本文整理汇总了Python中nets.network.Network.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Network.__init__方法的具体用法?Python Network.__init__怎么用?Python Network.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nets.network.Network
的用法示例。
在下文中一共展示了Network.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from nets.network import Network [as 别名]
# 或者: from nets.network.Network import __init__ [as 别名]
def __init__(self, block, layers, num_classes=1000):
self.inplanes = 64
super(ResNet, self).__init__()
self.conv1 = nn.Conv2d(3, 64, kernel_size=7, stride=2, padding=3,
bias=False)
self.bn1 = nn.BatchNorm2d(64)
self.relu = nn.ReLU(inplace=True)
# maxpool different from pytorch-resnet, to match tf-faster-rcnn
self.maxpool = nn.MaxPool2d(kernel_size=3, stride=2, padding=1)
self.layer1 = self._make_layer(block, 64, layers[0])
self.layer2 = self._make_layer(block, 128, layers[1], stride=2)
self.layer3 = self._make_layer(block, 256, layers[2], stride=2)
# use stride 1 for the last conv4 layer (same as tf-faster-rcnn)
self.layer4 = self._make_layer(block, 512, layers[3], stride=1)
for m in self.modules():
if isinstance(m, nn.Conv2d):
n = m.kernel_size[0] * m.kernel_size[1] * m.out_channels
m.weight.data.normal_(0, math.sqrt(2. / n))
elif isinstance(m, nn.BatchNorm2d):
m.weight.data.fill_(1)
m.bias.data.zero_()
开发者ID:Sunarker,项目名称:Collaborative-Learning-for-Weakly-Supervised-Object-Detection,代码行数:24,代码来源:resnet_v1.py
示例2: __init__
# 需要导入模块: from nets.network import Network [as 别名]
# 或者: from nets.network.Network import __init__ [as 别名]
def __init__(self, block, layers, num_classes=1000):
self.inplanes = 64
super(ResNet, self).__init__()
self.conv1 = nn.Conv2d(3, 64, kernel_size=7, stride=2, padding=3,
bias=False)
self.bn1 = nn.BatchNorm2d(64)
self.relu = nn.ReLU(inplace=True)
# maxpool different from pytorch-resnet, to match tf-faster-rcnn
self.maxpool = nn.MaxPool2d(kernel_size=3, stride=2, padding=1)
self.layer1 = self._make_layer(block, 64, layers[0])
self.layer2 = self._make_layer(block, 128, layers[1], stride=2)
self.layer3 = self._make_layer(block, 256, layers[2], stride=2)
# use stride 1 for the last conv4 layer (same as tf-faster-rcnn)
if cfg.FPN:
self.layer4 = self._make_layer(block, 512, layers[3], stride=2)
else:
self.layer4 = self._make_layer(block, 512, layers[3], stride=1)
for m in self.modules():
if isinstance(m, nn.Conv2d):
n = m.kernel_size[0] * m.kernel_size[1] * m.out_channels
m.weight.data.normal_(0, math.sqrt(2. / n))
elif isinstance(m, nn.BatchNorm2d):
m.weight.data.fill_(1)
m.bias.data.zero_()
示例3: __init__
# 需要导入模块: from nets.network import Network [as 别名]
# 或者: from nets.network.Network import __init__ [as 别名]
def __init__(self):
Network.__init__(self)
self._feat_stride = [16, ]
self._feat_compress = [1. / float(self._feat_stride[0]), ]
self._depth_multiplier = cfg.MOBILENET.DEPTH_MULTIPLIER
self._net_conv_channels = 512
self._fc7_channels = 1024
开发者ID:Sunarker,项目名称:Collaborative-Learning-for-Weakly-Supervised-Object-Detection,代码行数:9,代码来源:mobilenet_v1.py
示例4: __init__
# 需要导入模块: from nets.network import Network [as 别名]
# 或者: from nets.network.Network import __init__ [as 别名]
def __init__(self):
Network.__init__(self)
self._feat_stride = [16, ]
self._feat_compress = [1. / float(self._feat_stride[0]), ]
self._net_conv_channels = 512
self._fc7_channels = 4096
开发者ID:Sunarker,项目名称:Collaborative-Learning-for-Weakly-Supervised-Object-Detection,代码行数:8,代码来源:vgg16.py
示例5: __init__
# 需要导入模块: from nets.network import Network [as 别名]
# 或者: from nets.network.Network import __init__ [as 别名]
def __init__(self):
Network.__init__(self)
# config which branch contained in the SSH should be the format of ['M1', 'M2', 'M3']
self._feat_branches = ['M1', 'M2', 'M3']
self._feat_stride = {'M1': 8, 'M2': 16, 'M3': 32}
self._Module_boxes = {'M1': 128, 'M2': 256, 'M3': 256}
self._feat_layers = {'M1': ['Conv2d_5_pointwise', 'Conv2d_13_pointwise'], 'M2': 'Conv2d_13_pointwise', 'M3': 'Conv2d_13_pointwise'}
self.end_points = {}
self._depth_multiplier = cfg.MOBILENET.DEPTH_MULTIPLIER
self._scope = 'MobilenetV1'
示例6: __init__
# 需要导入模块: from nets.network import Network [as 别名]
# 或者: from nets.network.Network import __init__ [as 别名]
def __init__(self):
Network.__init__(self)
# config which branch contained in the SSH -- should be the format of ['M1', 'M2', 'M3']
self._feat_branches = ['M1', 'M2', 'M3']
self._Module_boxes = {'M1': 128, 'M2': 256, 'M3': 256}
self._feat_stride = {"M1": 8, 'M2': 16, 'M3': 32}
self._feat_layers = {"M1": ['conv4_3', 'conv5_3'], 'M2': 'conv5_3', 'M3': 'conv5_3'}
self._scope = 'vgg_16'
self.end_points = {}
示例7: __init__
# 需要导入模块: from nets.network import Network [as 别名]
# 或者: from nets.network.Network import __init__ [as 别名]
def __init__(self, darknet53_npz_path=None):
Network.__init__(self)
self._feat_branches = {'M1', 'M2', 'M3'}
self._feat_stride = {'M1': 8, 'M2': 16, 'M3': 32}
self._feat_layers = {'M1': ['res10', 'res18'], 'M2': 'res18',
'M3': 'res22'}
self._Module_boxes = {'M1': 128, 'M2': 256, 'M3': 256}
self.end_points = {}
self._scope = 'Darknet53'
self.darknet53_npz_path = darknet53_npz_path
示例8: __init__
# 需要导入模块: from nets.network import Network [as 别名]
# 或者: from nets.network.Network import __init__ [as 别名]
def __init__(self):
Network.__init__(self)
# config which branch contained in the SSH should be the format of ['M1', 'M2', 'M3']
self._feat_branches = ['M1', 'M2', 'M3']
self._feat_stride = {'M1': 8, 'M2': 16, 'M3': 32}
self._feat_layers = {'M1': ['layer_5', 'layer_14'], 'M2': 'layer_14',
'M3': 'layer_19'}
# self._feat_layers = {'M1': ['layer_5/expansion_output', 'layer_19'], 'M2': 'layer_19',
# 'M3': 'layer_19'}
self._Module_boxes = {'M1': 128, 'M2': 256, 'M3': 256}
self.end_points = {}
self._depth_multiplier = cfg.MOBILENET_V2.DEPTH_MULTIPLIER
self._min_depth = cfg.MOBILENET_V2.MIN_DEPTH
self._scope = 'MobilenetV2'
示例9: __init__
# 需要导入模块: from nets.network import Network [as 别名]
# 或者: from nets.network.Network import __init__ [as 别名]
def __init__(self, num_layers=50):
Network.__init__(self)
# config which branch contained in the SSH should be the format of ['M1', 'M2', 'M3']
self._feat_branches = ['M1', 'M2', 'M3']
self._feat_stride = {'M1': 8, 'M2': 16, 'M3': 32}
self._Module_boxes = {'M1': 128, 'M2': 256, 'M3': 256}
# self._feat_layers = {'M1': ['block2', 'block3'], 'M2': 'block3', 'M3': 'block3'}
self._feat_layers = {'M1': ['block2', 'block4'], 'M2': 'block4', 'M3': 'block4'}
self.end_points = {}
self._num_layers = num_layers
self._scope = 'resnet_v1_%d' % num_layers
self._decide_blocks()
示例10: __init__
# 需要导入模块: from nets.network import Network [as 别名]
# 或者: from nets.network.Network import __init__ [as 别名]
def __init__(self):
Network.__init__(self)
self._feat_stride = [16, ]
self._scope = 'mobilenet_v2'
示例11: __init__
# 需要导入模块: from nets.network import Network [as 别名]
# 或者: from nets.network.Network import __init__ [as 别名]
def __init__(self):
Network.__init__(self)
self._feat_stride = [16, ]
self._scope = 'vgg_16'
示例12: __init__
# 需要导入模块: from nets.network import Network [as 别名]
# 或者: from nets.network.Network import __init__ [as 别名]
def __init__(self, num_layers=50):
Network.__init__(self)
self._feat_stride = [16, ]
self._num_layers = num_layers
self._scope = 'resnet_v1_%d' % num_layers
self._decide_blocks()
# Do the first few layers manually, because 'SAME' padding can behave inconsistently
# for images of different sizes: sometimes 0, sometimes 1
示例13: __init__
# 需要导入模块: from nets.network import Network [as 别名]
# 或者: from nets.network.Network import __init__ [as 别名]
def __init__(self):
Network.__init__(self)
self._feat_stride = [16, ]
self._feat_compress = [1. / float(self._feat_stride[0]), ]
self._depth_multiplier = cfg.MOBILENET.DEPTH_MULTIPLIER
self._scope = 'MobilenetV1'
示例14: __init__
# 需要导入模块: from nets.network import Network [as 别名]
# 或者: from nets.network.Network import __init__ [as 别名]
def __init__(self, batch_size=1):
Network.__init__(self, batch_size=batch_size)
示例15: __init__
# 需要导入模块: from nets.network import Network [as 别名]
# 或者: from nets.network.Network import __init__ [as 别名]
def __init__(self, batch_size=1, num_layers=50):
Network.__init__(self, batch_size=batch_size)
self._num_layers = num_layers
self._resnet_scope = 'resnet_v1_%d' % num_layers