facebookresearch / pytorch3d /海豚教程

问题描述

Deform a source mesh to form a target mesh using 3D loss functions

运行的代码

# We read the target 3D model using load_obj
verts,faces,aux = load_obj(trg_obj)

# verts is a FloatTensor of shape (V,3) where V is the number of vertices in the mesh
# faces is an object which contains the following LongTensors: verts_idx,normals_idx and textures_idx
# For this tutorial,normals and textures are ignored.
faces_idx = faces.verts_idx.to(device)
verts = verts.to(device)

# We scale normalize and center the target mesh to fit in a sphere of radius 1 centered at (0,0). 
# (scale,center) will be used to bring the predicted mesh to its original center and scale
# Note that normalizing the target mesh,speeds up the optimization but is not necessary!
center = verts.mean(0)
verts = verts - center
scale = max(verts.abs().max(0)[0])
verts = verts / scale

# We construct a Meshes structure for the target mesh
trg_mesh = Meshes(verts=[verts],faces=[faces_idx])

和我得到的错误: -------------------------------------------------- ------------------------- NameError回溯(最近通话最后一个) 在 () 1#我们读取使用load_obj目标3D模型 ----> 2绿党,面孔,AUX = load_obj(trg_obj) 3 4名#绿党是形状的FloatTensor(V,3),其中V是在网格顶点的数量 5个#面是包含以下LongTensors的对象:verts_idx,normals_idx和textures_idx

NameError: name 'load_obj' is not defined

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)