otaheri / GrabNet

GrabNet: A Generative model to generate realistic 3D hands grasping unseen objects (ECCV2020)
https://grab.is.tue.mpg.de
Other
238 stars 30 forks source link

FileNotFoundError: [Errno 2] No such file or directory: 'data/grabnet_data/meshes.pt' in Google Colab demo #3

Closed monacv closed 3 years ago

monacv commented 3 years ago

Hi Omid,

Thanks a lot for the amazing research work.

So I tried this for my own wine_bottle.obj file that has ~800 faces. Then all the cells before this one ran correctly.

How should I fix this one?

# run to see all grasps in one view

meshes = torch.load('data/grabnet_data/meshes.pt')
N = len(meshes)
col = int(5*np.sqrt(N/15))

all_meshes = []
bounds = meshes[0][0].bounds[:,:2]

dx = np.linalg.norm(bounds,axis=1).sum()
dx = .15

for i in range(N):

    obj = meshes[i][0]
    hand = meshes[i][1]

    a = i%col
    b = i//col

    offset = np.array([a*dx, b*dx, 0])*2.

    obj.vertices[:] += offset
    hand.vertices[:] += offset

    hand.set_vertex_colors(vc=[245, 191, 177])

    def_color = np.array([[102, 102, 102, 255]])
    if hasattr(obj.visual, 'vertex_colors') and (obj.visual.vertex_colors == np.repeat(def_color, obj.vertices.shape[0], axis=0)).all():
        obj.set_vertex_colors(vc=name_to_rgb['yellow'])

    all_meshes.append(obj)
    all_meshes.append(hand)

all_meshes = Mesh.concatenate_meshes(all_meshes)
all_meshes.show()

Error is:

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-20-90bd36258bb9> in <module>()
      1 # run to see all grasps in one view
      2 
----> 3 meshes = torch.load('data/grabnet_data/meshes.pt')
      4 N = len(meshes)
      5 col = int(5*np.sqrt(N/15))

2 frames
/usr/local/lib/python3.7/dist-packages/torch/serialization.py in __init__(self, name, mode)
    209 class _open_file(_opener):
    210     def __init__(self, name, mode):
--> 211         super(_open_file, self).__init__(open(name, mode))
    212 
    213     def __exit__(self, *args):

FileNotFoundError: [Errno 2] No such file or directory: 'data/grabnet_data/meshes.pt'

Screenshot from 2021-04-13 17-49-56

Screenshot from 2021-04-13 17-50-18 Screenshot from 2021-04-13 17-51-36

otaheri commented 3 years ago

Hi Mona, thanks for your interest. I just tried it on one of my meshes again and it works. Does it work with my meshes for you? If you send me your mesh I can try to figure it out.

monacv commented 3 years ago

thanks for your response. Really my bad. I uploaded obj. I converted it to ply in meshlab and now it worked. :)

otaheri commented 3 years ago

Great, I will make sure to add support for obj files as well later.