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


Python mobilenet_v2.mobilenet_base方法代碼示例

本文整理匯總了Python中nets.mobilenet.mobilenet_v2.mobilenet_base方法的典型用法代碼示例。如果您正苦於以下問題:Python mobilenet_v2.mobilenet_base方法的具體用法?Python mobilenet_v2.mobilenet_base怎麽用?Python mobilenet_v2.mobilenet_base使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在nets.mobilenet.mobilenet_v2的用法示例。


在下文中一共展示了mobilenet_v2.mobilenet_base方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: testWithOutputStride8

# 需要導入模塊: from nets.mobilenet import mobilenet_v2 [as 別名]
# 或者: from nets.mobilenet.mobilenet_v2 import mobilenet_base [as 別名]
def testWithOutputStride8(self):
    out, _ = mobilenet.mobilenet_base(
        tf.placeholder(tf.float32, (10, 224, 224, 16)),
        conv_defs=mobilenet_v2.V2_DEF,
        output_stride=8,
        scope='MobilenetV2')
    self.assertEqual(out.get_shape().as_list()[1:3], [28, 28]) 
開發者ID:leimao,項目名稱:DeepLab_v3,代碼行數:9,代碼來源:mobilenet_v2_test.py

示例2: testMobilenetBase

# 需要導入模塊: from nets.mobilenet import mobilenet_v2 [as 別名]
# 或者: from nets.mobilenet.mobilenet_v2 import mobilenet_base [as 別名]
def testMobilenetBase(self):
    tf.reset_default_graph()
    # Verifies that mobilenet_base returns pre-pooling layer.
    with slim.arg_scope((mobilenet.depth_multiplier,), min_depth=32):
      net, _ = mobilenet_v2.mobilenet_base(
          tf.placeholder(tf.float32, (10, 224, 224, 16)),
          conv_defs=mobilenet_v2.V2_DEF, depth_multiplier=0.1)
      self.assertEqual(net.get_shape().as_list(), [10, 7, 7, 128]) 
開發者ID:leimao,項目名稱:DeepLab_v3,代碼行數:10,代碼來源:mobilenet_v2_test.py

示例3: testWithOutputStride16

# 需要導入模塊: from nets.mobilenet import mobilenet_v2 [as 別名]
# 或者: from nets.mobilenet.mobilenet_v2 import mobilenet_base [as 別名]
def testWithOutputStride16(self):
    tf.reset_default_graph()
    out, _ = mobilenet.mobilenet_base(
        tf.placeholder(tf.float32, (10, 224, 224, 16)),
        conv_defs=mobilenet_v2.V2_DEF,
        output_stride=16)
    self.assertEqual(out.get_shape().as_list()[1:3], [14, 14]) 
開發者ID:leimao,項目名稱:DeepLab_v3,代碼行數:9,代碼來源:mobilenet_v2_test.py

示例4: testWithOutputStride8AndExplicitPadding

# 需要導入模塊: from nets.mobilenet import mobilenet_v2 [as 別名]
# 或者: from nets.mobilenet.mobilenet_v2 import mobilenet_base [as 別名]
def testWithOutputStride8AndExplicitPadding(self):
    tf.reset_default_graph()
    out, _ = mobilenet.mobilenet_base(
        tf.placeholder(tf.float32, (10, 224, 224, 16)),
        conv_defs=mobilenet_v2.V2_DEF,
        output_stride=8,
        use_explicit_padding=True,
        scope='MobilenetV2')
    self.assertEqual(out.get_shape().as_list()[1:3], [28, 28]) 
開發者ID:leimao,項目名稱:DeepLab_v3,代碼行數:11,代碼來源:mobilenet_v2_test.py

示例5: testWithOutputStride16AndExplicitPadding

# 需要導入模塊: from nets.mobilenet import mobilenet_v2 [as 別名]
# 或者: from nets.mobilenet.mobilenet_v2 import mobilenet_base [as 別名]
def testWithOutputStride16AndExplicitPadding(self):
    tf.reset_default_graph()
    out, _ = mobilenet.mobilenet_base(
        tf.placeholder(tf.float32, (10, 224, 224, 16)),
        conv_defs=mobilenet_v2.V2_DEF,
        output_stride=16,
        use_explicit_padding=True)
    self.assertEqual(out.get_shape().as_list()[1:3], [14, 14]) 
開發者ID:leimao,項目名稱:DeepLab_v3,代碼行數:10,代碼來源:mobilenet_v2_test.py

示例6: _image_to_head

# 需要導入模塊: from nets.mobilenet import mobilenet_v2 [as 別名]
# 或者: from nets.mobilenet.mobilenet_v2 import mobilenet_base [as 別名]
def _image_to_head(self, is_training, reuse=None):
        with slim.arg_scope(mobilenet_v2.training_scope(is_training=is_training)):
            net, endpoints = mobilenet_v2.mobilenet_base(self._image, conv_defs=CTPN_DEF)

        self.variables_to_restore = slim.get_variables_to_restore()

        self._act_summaries.append(net)
        self._layers['head'] = net

        return net 
開發者ID:Sanster,項目名稱:tf_ctpn,代碼行數:12,代碼來源:mobilenet_v2.py

示例7: _mobilenet_v2

# 需要導入模塊: from nets.mobilenet import mobilenet_v2 [as 別名]
# 或者: from nets.mobilenet.mobilenet_v2 import mobilenet_base [as 別名]
def _mobilenet_v2(net,
                  depth_multiplier,
                  output_stride,
                  reuse=None,
                  scope=None,
                  final_endpoint=None):
    """Auxiliary function to add support for 'reuse' to mobilenet_v2.

    Args:
      net: Input tensor of shape [batch_size, height, width, channels].
      depth_multiplier: Float multiplier for the depth (number of channels)
        for all convolution ops. The value must be greater than zero. Typical
        usage will be to set this value in (0, 1) to reduce the number of
        parameters or computation cost of the model.
      output_stride: An integer that specifies the requested ratio of input to
        output spatial resolution. If not None, then we invoke atrous convolution
        if necessary to prevent the network from reducing the spatial resolution
        of the activation maps. Allowed values are 8 (accurate fully convolutional
        mode), 16 (fast fully convolutional mode), 32 (classification mode).
      reuse: Reuse model variables.
      scope: Optional variable scope.
      final_endpoint: The endpoint to construct the network up to.

    Returns:
      Features extracted by MobileNetv2.
    """
    with tf.variable_scope(
            scope, 'MobilenetV2', [net], reuse=reuse) as scope:
        return mobilenet_v2.mobilenet_base(
            net,
            conv_defs=mobilenet_v2.V2_DEF,
            depth_multiplier=depth_multiplier,
            min_depth=8 if depth_multiplier == 1.0 else 1,
            divisible_by=8 if depth_multiplier == 1.0 else 1,
            final_endpoint=final_endpoint or _MOBILENET_V2_FINAL_ENDPOINT,
            output_stride=output_stride,
            scope=scope)


# A map from network name to network function. 
開發者ID:sercant,項目名稱:mobile-segmentation,代碼行數:42,代碼來源:feature_extractor.py


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