本文整理匯總了Python中nets.mobilenet.mobilenet.mobilenet_base方法的典型用法代碼示例。如果您正苦於以下問題:Python mobilenet.mobilenet_base方法的具體用法?Python mobilenet.mobilenet_base怎麽用?Python mobilenet.mobilenet_base使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類nets.mobilenet.mobilenet
的用法示例。
在下文中一共展示了mobilenet.mobilenet_base方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: testMultiplier
# 需要導入模塊: from nets.mobilenet import mobilenet [as 別名]
# 或者: from nets.mobilenet.mobilenet import mobilenet_base [as 別名]
def testMultiplier(self):
op = mobilenet.op
new_def = copy.deepcopy(mobilenet_v2.V2_DEF)
def inverse_multiplier(output_params, multiplier):
output_params['num_outputs'] = int(
output_params['num_outputs'] / multiplier)
new_def['spec'][0] = op(
slim.conv2d,
kernel_size=(3, 3),
multiplier_func=inverse_multiplier,
num_outputs=16)
_ = mobilenet_v2.mobilenet_base(
tf.placeholder(tf.float32, (10, 224, 224, 16)),
conv_defs=new_def,
depth_multiplier=0.1)
s = [op.outputs[0].get_shape().as_list()[-1] for op in find_ops('Conv2D')]
# Expect first layer to be 160 (16 / 0.1), and other layers
# their max(original size * 0.1, 8)
self.assertEqual([160, 8, 48, 8, 48], s[:5])
示例2: testWithOutputStride8
# 需要導入模塊: from nets.mobilenet import mobilenet [as 別名]
# 或者: from nets.mobilenet.mobilenet 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])
示例3: testMobilenetBase
# 需要導入模塊: from nets.mobilenet import mobilenet [as 別名]
# 或者: from nets.mobilenet.mobilenet 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])
示例4: testWithOutputStride16
# 需要導入模塊: from nets.mobilenet import mobilenet [as 別名]
# 或者: from nets.mobilenet.mobilenet 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])
示例5: testWithOutputStride8AndExplicitPadding
# 需要導入模塊: from nets.mobilenet import mobilenet [as 別名]
# 或者: from nets.mobilenet.mobilenet 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])
示例6: testWithOutputStride16AndExplicitPadding
# 需要導入模塊: from nets.mobilenet import mobilenet [as 別名]
# 或者: from nets.mobilenet.mobilenet 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])