当前位置: 首页>>代码示例>>Python>>正文


Python static_shape.get_width方法代码示例

本文整理汇总了Python中object_detection.utils.static_shape.get_width方法的典型用法代码示例。如果您正苦于以下问题:Python static_shape.get_width方法的具体用法?Python static_shape.get_width怎么用?Python static_shape.get_width使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在object_detection.utils.static_shape的用法示例。


在下文中一共展示了static_shape.get_width方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_return_correct_width

# 需要导入模块: from object_detection.utils import static_shape [as 别名]
# 或者: from object_detection.utils.static_shape import get_width [as 别名]
def test_return_correct_width(self):
    tensor_shape = tf.TensorShape(dims=[32, 299, 384, 3])
    self.assertEqual(384, static_shape.get_width(tensor_shape)) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:5,代码来源:static_shape_test.py

示例2: test_die_on_tensor_shape_with_rank_three

# 需要导入模块: from object_detection.utils import static_shape [as 别名]
# 或者: from object_detection.utils.static_shape import get_width [as 别名]
def test_die_on_tensor_shape_with_rank_three(self):
    tensor_shape = tf.TensorShape(dims=[32, 299, 384])
    with self.assertRaises(ValueError):
      static_shape.get_batch_size(tensor_shape)
      static_shape.get_height(tensor_shape)
      static_shape.get_width(tensor_shape)
      static_shape.get_depth(tensor_shape) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:9,代码来源:static_shape_test.py

示例3: check_min_image_dim

# 需要导入模块: from object_detection.utils import static_shape [as 别名]
# 或者: from object_detection.utils.static_shape import get_width [as 别名]
def check_min_image_dim(min_dim, image_tensor):
  """Checks that the image width/height are greater than some number.

  This function is used to check that the width and height of an image are above
  a certain value. If the image shape is static, this function will perform the
  check at graph construction time. Otherwise, if the image shape varies, an
  Assertion control dependency will be added to the graph.

  Args:
    min_dim: The minimum number of pixels along the width and height of the
             image.
    image_tensor: The image tensor to check size for.

  Returns:
    If `image_tensor` has dynamic size, return `image_tensor` with a Assert
    control dependency. Otherwise returns image_tensor.

  Raises:
    ValueError: if `image_tensor`'s' width or height is smaller than `min_dim`.
  """
  image_shape = image_tensor.get_shape()
  image_height = static_shape.get_height(image_shape)
  image_width = static_shape.get_width(image_shape)
  if image_height is None or image_width is None:
    shape_assert = tf.Assert(
        tf.logical_and(tf.greater_equal(tf.shape(image_tensor)[1], min_dim),
                       tf.greater_equal(tf.shape(image_tensor)[2], min_dim)),
        ['image size must be >= {} in both height and width.'.format(min_dim)])
    with tf.control_dependencies([shape_assert]):
      return tf.identity(image_tensor)

  if image_height < min_dim or image_width < min_dim:
    raise ValueError(
        'image size must be >= %d in both height and width; image dim = %d,%d' %
        (min_dim, image_height, image_width))

  return image_tensor 
开发者ID:ahmetozlu,项目名称:vehicle_counting_tensorflow,代码行数:39,代码来源:shape_utils.py


注:本文中的object_detection.utils.static_shape.get_width方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。