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


Python perspective_transform.transformer方法代码示例

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


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

示例1: model

# 需要导入模块: from nets import perspective_transform [as 别名]
# 或者: from nets.perspective_transform import transformer [as 别名]
def model(voxels, transform_matrix, params, is_training):
  """Model transforming the 3D voxels into 2D projections.

  Args:
    voxels: A tensor of size [batch, depth, height, width, channel]
      representing the input of projection layer (tf.float32).
    transform_matrix: A tensor of size [batch, 16] representing
      the flattened 4-by-4 matrix for transformation (tf.float32).
    params: Model parameters (dict).
    is_training: Set to True if while training (boolean).

  Returns:
    A transformed tensor (tf.float32)

  """
  del is_training  # Doesn't make a difference for projector
  # Rearrangement (batch, z, y, x, channel) --> (batch, y, z, x, channel).
  # By the standard, projection happens along z-axis but the voxels
  # are stored in a different way. So we need to switch the y and z
  # axis for transformation operation.
  voxels = tf.transpose(voxels, [0, 2, 1, 3, 4])
  z_near = params.focal_length
  z_far = params.focal_length + params.focal_range
  transformed_voxels = perspective_transform.transformer(
      voxels, transform_matrix, [params.vox_size] * 3, z_near, z_far)
  views = tf.reduce_max(transformed_voxels, [1])
  views = tf.reverse(views, [1])
  return views 
开发者ID:rky0930,项目名称:yolo_v2,代码行数:30,代码来源:perspective_projector.py


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