pytorch3d定义的mesh结构在pytorch3d.structures.meshes源码中可以看到。
首先,meshes数据可能包含多个 mesh结构,每个mesh可能又不同的顶点数和面数。pytorch3d的meshes结构在load obj 或plt文件中的数据后,给出了三种不同的数据格式,分别是:verts_list, verts_packed, verts_padded。
- def verts_list(self): 与输入相同,未处理
- def verts_packed(self): 为方便用于深度学习,pytorch3d有针对mesh结构的batch dimension,为保持每个数据长度一致,它将每个mesh填充找到最多点数的mesh,该点数为max(V_n),并将其它mesh点数填充到max(V_n)
def verts_packed(self):
"""
Get the packed representation of the vertices.
Returns:
tensor of vertices of shape (sum(V_n), 3).
"""
self._compute_packed()
return self._verts_packed
- def verts_padded(self):packed是将点数压缩存储的一种形式,它没有batch dimension,但有额外的信息来存储每个mesh的相应点。
def verts_padded(self):
"""
Get the padded repre