本文整理汇总了Python中tensorflow.contrib.slim.nets.vgg.vgg_arg_scope方法的典型用法代码示例。如果您正苦于以下问题:Python vgg.vgg_arg_scope方法的具体用法?Python vgg.vgg_arg_scope怎么用?Python vgg.vgg_arg_scope使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tensorflow.contrib.slim.nets.vgg
的用法示例。
在下文中一共展示了vgg.vgg_arg_scope方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: arg_scope
# 需要导入模块: from tensorflow.contrib.slim.nets import vgg [as 别名]
# 或者: from tensorflow.contrib.slim.nets.vgg import vgg_arg_scope [as 别名]
def arg_scope(self):
arg_scope_kwargs = self._config.get('arg_scope', {})
if self.vgg_type:
return vgg.vgg_arg_scope(**arg_scope_kwargs)
if self.truncated_vgg_type:
return truncated_vgg.vgg_arg_scope(**arg_scope_kwargs)
if self.resnet_type:
# It's the same arg_scope for v1 or v2.
return resnet_v2.resnet_utils.resnet_arg_scope(**arg_scope_kwargs)
raise ValueError('Invalid architecture: "{}"'.format(
self._config.get('architecture')
))
示例2: compute_vgg_error
# 需要导入模块: from tensorflow.contrib.slim.nets import vgg [as 别名]
# 或者: from tensorflow.contrib.slim.nets.vgg import vgg_arg_scope [as 别名]
def compute_vgg_error(output, reference, layer):
scaled_output = output * 255 - vgg_mean
scaled_reference = reference * 255 - vgg_mean
with slim.arg_scope(vgg.vgg_arg_scope()):
output_a, output_b = vgg_16(scaled_output)
reference_a, reference_b = vgg_16(scaled_reference)
if layer == 0:
return tf.abs(output_a - reference_a)
return tf.abs(output_b - reference_b)
示例3: test_vgg
# 需要导入模块: from tensorflow.contrib.slim.nets import vgg [as 别名]
# 或者: from tensorflow.contrib.slim.nets.vgg import vgg_arg_scope [as 别名]
def test_vgg(self):
with slim.arg_scope(vgg.vgg_arg_scope()):
net, end_points = vgg.vgg_16(self.inputs, self.nbclasses, is_training=False)
net = slim.softmax(net)
saver = tf.train.Saver(tf.global_variables())
check_point = 'test/data/vgg_16.ckpt'
sess = tf.InteractiveSession()
saver.restore(sess, check_point)
self.sess = sess
self.graph_origin = tf.get_default_graph()
self.target_op_name = darkon.Gradcam.candidate_featuremap_op_names(sess, self.graph_origin)[-2]
self.model_name = 'vgg'
self.assertEqual('vgg_16/conv5/conv5_3/Relu', self.target_op_name)