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


Python mobilenet.op方法代碼示例

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


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

示例1: mbv3_op

# 需要導入模塊: from nets.mobilenet import mobilenet [as 別名]
# 或者: from nets.mobilenet.mobilenet import op [as 別名]
def mbv3_op(ef, n, k, s=1, act=tf.nn.relu, se=None, **kwargs):
  """Defines a single Mobilenet V3 convolution block.

  Args:
    ef: expansion factor
    n: number of output channels
    k: stride of depthwise
    s: stride
    act: activation function in inner layers
    se: squeeze excite function.
    **kwargs: passed to expanded_conv

  Returns:
    An object (lib._Op) for inserting in conv_def, representing this operation.
  """
  return op(
      ops.expanded_conv,
      expansion_size=expand_input(ef),
      kernel_size=(k, k),
      stride=s,
      num_outputs=n,
      inner_activation_fn=act,
      expansion_transform=se,
      **kwargs) 
開發者ID:tensorflow,項目名稱:models,代碼行數:26,代碼來源:mobilenet_v3.py

示例2: _create_modified_mobilenet_config

# 需要導入模塊: from nets.mobilenet import mobilenet [as 別名]
# 或者: from nets.mobilenet.mobilenet import op [as 別名]
def _create_modified_mobilenet_config():
  conv_defs = copy.deepcopy(mobilenet_v2.V2_DEF)
  conv_defs['spec'][-1] = mobilenet.op(
      slim.conv2d, stride=1, kernel_size=[1, 1], num_outputs=256)
  return conv_defs 
開發者ID:ahmetozlu,項目名稱:vehicle_counting_tensorflow,代碼行數:7,代碼來源:ssd_mobilenet_v2_fpn_feature_extractor.py

示例3: testWithSplits

# 需要導入模塊: from nets.mobilenet import mobilenet [as 別名]
# 或者: from nets.mobilenet.mobilenet import op [as 別名]
def testWithSplits(self):
    spec = copy.deepcopy(mobilenet_v2.V2_DEF)
    spec['overrides'] = {
        (ops.expanded_conv,): dict(split_expansion=2),
    }
    _, _ = mobilenet.mobilenet(
        tf.placeholder(tf.float32, (10, 224, 224, 16)),
        conv_defs=spec)
    num_convs = len(find_ops('Conv2D'))
    # All but 3 op has 3 conv operatore, the remainign 3 have one
    # and there is one unaccounted.
    self.assertEqual(num_convs, len(spec['spec']) * 3 - 5) 
開發者ID:tensorflow,項目名稱:models,代碼行數:14,代碼來源:mobilenet_v2_test.py

示例4: testDivisibleBy

# 需要導入模塊: from nets.mobilenet import mobilenet [as 別名]
# 或者: from nets.mobilenet.mobilenet import op [as 別名]
def testDivisibleBy(self):
    tf.reset_default_graph()
    mobilenet_v2.mobilenet(
        tf.placeholder(tf.float32, (10, 224, 224, 16)),
        conv_defs=mobilenet_v2.V2_DEF,
        divisible_by=16,
        min_depth=32)
    s = [op.outputs[0].get_shape().as_list()[-1] for op in find_ops('Conv2D')]
    s = set(s)
    self.assertSameElements([32, 64, 96, 160, 192, 320, 384, 576, 960, 1280,
                             1001], s) 
開發者ID:tensorflow,項目名稱:models,代碼行數:13,代碼來源:mobilenet_v2_test.py

示例5: testDivisibleByWithArgScope

# 需要導入模塊: from nets.mobilenet import mobilenet [as 別名]
# 或者: from nets.mobilenet.mobilenet import op [as 別名]
def testDivisibleByWithArgScope(self):
    tf.reset_default_graph()
    # Verifies that depth_multiplier arg scope actually works
    # if no default min_depth is provided.
    with slim.arg_scope((mobilenet.depth_multiplier,), min_depth=32):
      mobilenet_v2.mobilenet(
          tf.placeholder(tf.float32, (10, 224, 224, 2)),
          conv_defs=mobilenet_v2.V2_DEF,
          depth_multiplier=0.1)
      s = [op.outputs[0].get_shape().as_list()[-1] for op in find_ops('Conv2D')]
      s = set(s)
      self.assertSameElements(s, [32, 192, 128, 1001]) 
開發者ID:tensorflow,項目名稱:models,代碼行數:14,代碼來源:mobilenet_v2_test.py

示例6: testFineGrained

# 需要導入模塊: from nets.mobilenet import mobilenet [as 別名]
# 或者: from nets.mobilenet.mobilenet import op [as 別名]
def testFineGrained(self):
    tf.reset_default_graph()
    # Verifies that depth_multiplier arg scope actually works
    # if no default min_depth is provided.

    mobilenet_v2.mobilenet(
        tf.placeholder(tf.float32, (10, 224, 224, 2)),
        conv_defs=mobilenet_v2.V2_DEF,
        depth_multiplier=0.01,
        finegrain_classification_mode=True)
    s = [op.outputs[0].get_shape().as_list()[-1] for op in find_ops('Conv2D')]
    s = set(s)
    # All convolutions will be 8->48, except for the last one.
    self.assertSameElements(s, [8, 48, 1001, 1280]) 
開發者ID:tensorflow,項目名稱:models,代碼行數:16,代碼來源:mobilenet_v2_test.py


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