當前位置: 首頁>>代碼示例>>Python>>正文


Python Network.__init__方法代碼示例

本文整理匯總了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_() 
開發者ID:yxgeee,項目名稱:pytorch-FPN,代碼行數:27,代碼來源:resnet_v1.py

示例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' 
開發者ID:wanjinchang,項目名稱:SSH-TensorFlow,代碼行數:12,代碼來源:mobilenet_v1.py

示例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 = {} 
開發者ID:wanjinchang,項目名稱:SSH-TensorFlow,代碼行數:11,代碼來源:vgg16.py

示例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 
開發者ID:wanjinchang,項目名稱:SSH-TensorFlow,代碼行數:12,代碼來源:darknet53.py

示例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' 
開發者ID:wanjinchang,項目名稱:SSH-TensorFlow,代碼行數:16,代碼來源:mobilenet_v2.py

示例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() 
開發者ID:wanjinchang,項目名稱:SSH-TensorFlow,代碼行數:14,代碼來源:resnet_v1.py

示例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' 
開發者ID:Sanster,項目名稱:tf_ctpn,代碼行數:6,代碼來源:mobilenet_v2.py

示例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' 
開發者ID:Sanster,項目名稱:tf_ctpn,代碼行數:6,代碼來源:vgg16.py

示例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 
開發者ID:Sanster,項目名稱:tf_ctpn,代碼行數:11,代碼來源:resnet_v1.py

示例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' 
開發者ID:InnerPeace-Wu,項目名稱:densecap-tensorflow,代碼行數:8,代碼來源:mobilenet_v1.py

示例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) 
開發者ID:pengzhou1108,項目名稱:RGB-N,代碼行數:4,代碼來源:vgg16.py

示例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 
開發者ID:pengzhou1108,項目名稱:RGB-N,代碼行數:6,代碼來源:resnet_v1.py


注:本文中的nets.network.Network.__init__方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。