當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。