pytorch3d.ops是pytorch提供的一些关于3d数据,即计算机图形学的一些运算的包。

1.pytorch3d.ops.ball_query()

pytorch3d.ops.ball_query(p1: torch.Tensor, p2: torch.Tensor, lengths1: Optional[torch.Tensor] = None, lengths2: Optional[torch.Tensor] = None, K: int = 500, radius: float = 0.2, return_nn: bool = True)

Ball Query is an alternative to KNN. It can be used to find all points in p2 that are within a specified radius to the query point in p1 (with an upper limit of K neighbors).

The neighbors returned are not necssarily the nearest to the point in p1, just the first K values in p2 which are within the specified radius.

在p2中找距离p1的在特定半径范围内的点,它不一定是k最邻近点。

2.pytorch3d.ops.cubify()

pytorch3d.ops.cubify(voxelsthreshdevice=Nonealign: str = 'topleft') → pytorch3d.structures.meshes.Meshes[source]

Converts a voxel to a mesh by replacing each occupied voxel with a cube consisting of 12 faces and 8 vertices. Shared vertices are merged, and internal faces are removed. :param voxels: A FloatTensor of shape (N, D, H, W) containing occupancy probabilities. :param thresh: A scalar threshold. If a voxel occupancy is larger than

将voxel转为mesh

3.pytorch3d.ops.knn_gather

pytorch3d.ops.knn_gather(x: torch.Tensoridx: torch.Tensorlengths: Optional[torch.Tensor] = None)[source]

A helper function for knn that allows indexing a tensor x with the indices idx returned by knn_points.

For example, if dists, idx = knn_points(p, x, lengths_p, lengths, K) where p is a tensor of shape (N, L, D) and x a tensor of shape (N, M, D), then one can compute the K nearest neighbors of p with p_nn = knn_gather(x, idx, lengths). It can also be applied for any tensor x of shape (N, M, U) where U != D.

返回p的k最邻近点以及点的坐标·

4.pytorch3d.ops.knn_points

pytorch3d.ops.knn_points(p1: torch.Tensorp2: torch.Tensorlengths1: Optional[torch.Tensor] = Nonelengths2: Optional[torch.Tensor] = NoneK: int = 1version: int = -1return_nn: bool = Falsereturn_sorted: bool = True) → pytorch3d.ops.knn.KNN[source]

Returns:

dists –

Tensor of shape (N, P1, K) giving the squared distances to

the nearest neighbors. This is padded with zeros both where a cloud in p2 has fewer than K points and where a cloud in p1 has fewer than P1 points.

idx: LongTensor of shape (N, P1, K) giving the indices of the

K nearest neighbors from points in p1 to points in p2. Concretely, if p1_idx[n, i, k] = j then p2[n, j] is the k-th nearest neighbors to p1[n, i] in p2[n]. This is padded with zeros both where a cloud in p2 has fewer than K points and where a cloud in p1 has fewer than P1 points.

nn: Tensor of shape (N, P1, K, D) giving the K nearest neighbors in p2 for

each point in p1. Concretely, p2_nn[n, i, k] gives the k-th nearest neighbor for p1[n, i]. Returned if return_nn is True. The nearest neighbors are collected using knn_gather

which is a helper function that allows indexing any tensor of shape (N, P2, U) with the indices p1_idx returned by knn_points. The output is a tensor of shape (N, P1, K, U).

5.pytorch3d.ops.corresponding_points_alignment

pytorch3d.ops.corresponding_points_alignment(X: Union[torch.Tensor, Pointclouds], Y: Union[torch.Tensor, Pointclouds], weights: Union[torch.Tensor, List[torch.Tensor], None] = None, estimate_scale: bool = False, allow_reflection: bool = False, eps: float = 1e-09) → pytorch3d.ops.points_alignment.SimilarityTransform[source]

Finds a similarity transformation (rotation R, translation T and optionally scale s) between two given sets of corresponding d-dimensional points X and Y such that:

s[i] X[i] R[i] + T[i] = Y[i],

for all batch indexes i in the least squares sense.

The algorithm is also known as Umeyama [1].

计算两个向量x,y他们之间的相似变换矩阵,包括旋转矩阵R, 平移矩阵T,缩放矩阵s。

6.拉普拉斯矩阵计算

pytorch3d.ops.cot_laplacian(verts: torch.Tensorfaces: torch.Tensoreps: float = 1e-12) → Tuple[torch.Tensor, torch.Tensor][source]

Returns the Laplacian matrix with cotangent weights and the inverse of the face areas.

Parameters:
  • verts – tensor of shape (V, 3) containing the vertices of the graph
  • faces – tensor of shape (F, 3) containing the vertex indices of each face
Returns:

2-element tuple containing - L: Sparse FloatTensor of shape (V,V) for the Laplacian matrix.

Here, L[i, j] = cot a_ij + cot b_ij iff (i, j) is an edge in meshes. See the description above for more clarity.

  • inv_areas: FloatTensor of shape (V,) containing the inverse of sum of

    face areas containing each vertex

pytorch3d.ops.laplacian(verts: torch.Tensoredges: torch.Tensor) → torch.Tensor[source]

Computes the laplacian matrix. The definition of the laplacian is L[i, j] = -1 , if i == j L[i, j] = 1 / deg(i) , if (i, j) is an edge L[i, j] = 0 , otherwise where deg(i) is the degree of the i-th vertex in the graph.

Parameters:
  • verts – tensor of shape (V, 3) containing the vertices of the graph
  • edges – tensor of shape (E, 2) containing the vertex indices of each edge
Returns:

L – Sparse FloatTensor of shape (V, V)

pytorch3d.ops.norm_laplacian(verts: torch.Tensoredges: torch.Tensoreps: float = 1e-12) → torch.Tensor[source]

Norm laplacian computes a variant of the laplacian matrix which weights each affinity with the normalized distance of the neighboring nodes. More concretely, L[i, j] = 1. / wij where wij = ||vi - vj|| if (vi, vj) are neighboring nodes

Parameters:
  • verts – tensor of shape (V, 3) containing the vertices of the graph
  • edges – tensor of shape (E, 2) containing the vertex indices of each edge
Returns:

L – Sparse FloatTensor of shape (V, V)

7. ICP算法

pytorch3d.ops.iterative_closest_point(X: Union[torch.Tensor, Pointclouds], Y: Union[torch.Tensor, Pointclouds], init_transform: Optional[pytorch3d.ops.points_alignment.SimilarityTransform] = None, max_iterations: int = 100, relative_rmse_thr: float = 1e-06, estimate_scale: bool = False, allow_reflection: bool = False, verbose: bool = False) → pytorch3d.ops.points_alignment.ICPSolution[source]

Executes the iterative closest point (ICP) algorithm [1, 2] in order to find a similarity transformation (rotation R, translation T, and optionally scale s) between two given differently-sized sets of d-dimensional points X and Y, such that:

pytorch3d学习之pytorch3d.ops相关推荐

  1. Pytorch3d学习记录

    Cameras照相机 Camera Coordinate Systems 相机坐标系统 世界坐标 (Y指向上方,X指向左方,Z指向里面) 相机视图坐标(相机坐标) Camera view coordi ...

  2. Pytorch学习之torch----Reduction Ops

    1. torch.cumprod(input, dim, out=None) 说明: 返回输入沿指定维度的累积积.如果输入是一个N元向量,则结果也是一个N元向量,第i个输出元素值为 yi=x1∗x2∗ ...

  3. Facebook 开源 3D 深度学习函数库 PyTorch3D,也可用于二维场景

    渲染是计算机图形学中的核心内容,它可将 3D 模型转换为 2D 图像.这也是在 3D 场景属性(scene properties)和 2D 图像像素之间建立桥接的常规手段.不过传统渲染引擎无法进行微分 ...

  4. FaceBook开源PyTorch3D:基于PyTorch的新3D计算机视觉库

    关注上方"深度学习技术前沿",选择"星标公众号", 资源干货,第一时间送达! PyTorch 进军三维计算机视觉了,现在,你的神经网络可以更轻松地和 3D 数据 ...

  5. pytorch3d在linux下安装

    首先安装虚拟环境和依赖 conda create -n pytorch3d python=3.8 conda activate pytorch3d conda install -c pytorch p ...

  6. anaconda环境更改gcc版本并编译Pytorch3D 0.4.0

    项目需要编译pytorch3D 0.4.0且需要gcc 7以上且8以下的版本(尝试了5.4.0和12.2.0均报错),所以打算安装7.3.0版本的gcc,但是服务器没有root权限,所以只能在cond ...

  7. 在Ubuntu20.04系统anaconda3的环境下安装pytorch3d+opencv

    原来的pytorch3d和opencv的编程环境莫名崩掉了,装了很久都没重新装成功,这次记录下来,以后再有问题就翻翻笔记. Preliminaries 由于后续要用到cuda,所以首先查看当前的cud ...

  8. 安装pytorch3d 遇到的问题,以及解决方案

    安装pytorch3d 遇到的问题,以及解决方案 遇到的问题 ImportError: /usr/lib/libcudart.so.10.1: version `libcudart.so.10.1' ...

  9. ubuntu20.04配置FrankMocap实现3D人体姿态估计

    一.初始环境配置 1.ubuntu20.04配置显卡驱动 以我的这篇文章为例子,显卡RTX2060及以下的都可以使用我的方法快速完成配置,RTX2060以上的我尚未进行尝试,请自行斟酌尝试. 联想拯救 ...

最新文章

  1. 技术图文:如何改进算法的运行效率?
  2. FlashDevelop+aswing开发AS2程序
  3. IT职场最受欢迎的十大晋升秘决
  4. 理论基础 —— 索引 —— 稠密索引
  5. MySQL中查询字段为空或者为null方法
  6. SQL Serevr 2012 安装教程
  7. 如何修复win7蓝牙服务器,快速解决win7系统蓝牙驱动的修复方法
  8. SharePoint 2019 图文安装教程
  9. win10系统无打印机服务器,Print Spooler服务未在Windows 10中运行
  10. 整理了一份嵌入式软件工具清单!
  11. android mt4 macd,超准确的4小时MACD交易策略
  12. 波形图控件html,[转载]LabVIEW中的波形图(Waveform Chart)详解
  13. 软件测试面试宝典【测试流程、数据库、Linux、测试工具、自动化、性能测试】
  14. JETT(五)-支持Excel公式
  15. css画心形原理,CSS画心形的三种方法
  16. 最短路径--狄克斯特拉(Dijkstra)算法
  17. 工作积累⑨——从丁香医生增长看地推的重要性
  18. [ 华为云 ] 云计算中Region、VPC、AZ 是什么,他们又是什么关系,应该如何抉择
  19. java服务器开发心得
  20. java提出word和pdf等文件的信息

热门文章

  1. JSP中动态添加或删除table的行
  2. OpenJudge Tian Ji -- The Horse Racing
  3. Android进阶之路 - 拉伸的弹簧效果
  4. symbian与uiq开发教程
  5. D - Silver Cow Party J - Invitation Cards 最短路
  6. 少年: Nginx了解下
  7. 架构师的 36 项修炼1 开篇词:7分钟Get技术人进阶技巧
  8. NVR(网络视频录像机)介绍
  9. 艾兰岛逻辑-触发区域
  10. PHP调用ZPL斑马指令 打印二维码标签