clferrari / FacePartsSwap

8 stars 0 forks source link

KeyError: "Unable to open object (object 'Tnew' doesn't exist)" #5

Open jinhee-hub opened 1 year ago

jinhee-hub commented 1 year ago

@clferrari Hello Thank you for sharing the code. I tried to run your code but sometimes got errors.

  File "h5py\_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
  File "h5py\_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
  File "C:\Users\kator\AppData\Local\Programs\Python\Python38\lib\site-packages\h5py\_hl\group.py", line 288, in __getitem__
    oid = h5o.open(self.id, self._e(name), lapl=self._lapl)
  File "h5py\_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
  File "h5py\_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
  File "h5py\h5o.pyx", line 190, in h5py.h5o.open
KeyError: "Unable to open object (object 'Tnew' doesn't exist)"

Process finished with exit code 1

or

KeyError: "Unable to open object (object 'idxm' doesn't exist)

Could you give me some comments? Thank you!

clferrari commented 1 year ago

Hi @jinhee-hub

those missing objects refer to the 3D model used to fit the face image. Did you download the auxiliary 3D data before running the code? It can be found here (https://drive.google.com/file/d/1ZL66ZWivvNKZ-gcBIDmjbmzpMf_gimOi/view).

Let me know if that works. Best, Claudio

jinhee-hub commented 1 year ago

Thank you for reply.

Unfortunately, I got same error again.
I'd like to make my custom 3D data files for my project. could you give me some tips for me?

clferrari commented 1 year ago

Hi @jinhee-hub

Sorry that you still get this error. The 3D data provided in the gdrive are actually MATLAB files (.mat), which I opened in python using the hp5py library.

If that does not work for you, perhaps you can try a different library or, if you have MATLAB, open them in MATLAB and then save them as txt files. That should work by simply using the 'ASCII" flag when saving the files in MATLAB as save('variable','filename.txt','ASCII'). It is fine doing so since 3D data is stored as pointclouds (so a list of x,y,z coordinate) and their related triangulation (Tnew.mat). Saving them as txt might solve your issue since then you can read them in python using a text parser.

Please remember that triangulation file stores indices of point to be joined together to form triangles. Since the triangulation has been computed in MATLAB, if you read them in python you should subtract 1 to make the 1-based indexing of matlab to match the 0-based indexing in python.

Let me know if you have any further questions.