3DScenePlatform icon indicating copy to clipboard operation
3DScenePlatform copied to clipboard

Any detail for converting 3D-FRONT to SK-Format?

Open sawyer7246 opened this issue 4 years ago • 15 comments

Hi, I am trying to convert 3D-FRONT to your specific format according to the manual mentioned in the README, but I do not find any runnable functions in this script. And I still can not run the main.py, some errors popping up says FileNotFoundError: [Errno 2] No such file or directory: './dataset/objCatListAliv2.json'

pls help~

sawyer7246 avatar Feb 19 '21 06:02 sawyer7246

Hi, thanks for being interested in our platform!

We updated the file dependencies. Please try pulling the project first. It should be able to run with no error.

The link to the script is modified. It should be '3dfuture2suncg.py' in the asset folder. Sorry for the mistake.

Do tell us if you encounter other problems!

Shao-Kui

Shao-Kui avatar Feb 21 '21 04:02 Shao-Kui

Thank you for answering my question. I have run the main.py with your updates, but it still does not work. The related error is like this: FileNotFoundError: [Errno 2] No such file or directory: './latentspace/four_points_xz.pt'

Or, should I do the converting task beforehand?

sawyer7246 avatar Feb 22 '21 03:02 sawyer7246

Hi @sawyer7246, could you try pulling the entire project and re-run it?

There are lots of unnecessary dependencies...

I hope this commit could run with no error...

Shao-Kui avatar Feb 22 '21 04:02 Shao-Kui

sorry, I still meet with this error

File "3dfuture2suncg.py", line 43, in <module>
   with open('../latentspace/obj_coarse_semantic.json') as f:
FileNotFoundError: [Errno 2] No such file or directory: '../latentspace/obj_coarse_semantic.json' 

sawyer7246 avatar Feb 22 '21 08:02 sawyer7246

Another miss directory error when runing main.py:

/furniture_arrangement/furniture_arrangement/paper/3DScenePlatform/sketch_retrival/models/Model.py", line 32, in load
    raise IOError("{} directory does not exist in {}".format(self.name, path))
OSError: MVCNN directory does not exist in ./sketch_retrival/MVCNN_stage_1

sawyer7246 avatar Feb 22 '21 09:02 sawyer7246

Hi @sawyer7246, could you try again?

Shao-Kui avatar Feb 22 '21 09:02 Shao-Kui

I found the variable args.FRONT_path is overwritten by filenames

After I fix that, another error still pops:

Traceback (most recent call last):
  File "3dfuture2suncg.py", line 411, in <module>
    main(args)
  File "3dfuture2suncg.py", line 178, in main
    os.mkdir(os.path.join(args.save_path,"backgroundobj",filename[:-5]))
FileNotFoundError: [Errno 2] No such file or directory: '../dataset/backgroundobj/1db2e62e-6516-47da-bc4d-6469ba619d2f'

sawyer7246 avatar Feb 22 '21 09:02 sawyer7246

Hi @sawyer7246, the current version should be already fixed. The code is our debug version. Have you tried pulling first?

Shao-Kui avatar Feb 22 '21 09:02 Shao-Kui

It's weird, I believe I have pulled the latest version of the master branch. Because I tried git pull, it says 'Already up to date.' And I check the wrongly overwritten filenames, it's still there.

P.s. The backgroundobj problem is caused by using os.mkdir() to make new files but without intermediate directories existed. So, I solve this by manually add backgroundobj folder into dataset or change the os.mkdir() to os.makedirs(). It works for me. Unfortunately, I still encounter another error

Traceback (most recent call last):
  File "3dfuture2suncg.py", line 411, in <module>
    main(args)
  File "3dfuture2suncg.py", line 203, in main
    normal = np.reshape(mesh['normal'],(-1,3))
KeyError: 'normal'

sawyer7246 avatar Feb 22 '21 10:02 sawyer7246

It's weird to occur a KeyError at this line because "normal" is a necessary key for each mesh in 3D-FRONT dataset. For example, here's the screenshot of the scene "000ecb5b-b877-4f9a-ab6f-90f385931658.json", and you can find each mesh dictionary has its "normal" key. image

Shao-Kui avatar Feb 22 '21 11:02 Shao-Kui

Actually, it does happen. See this file: 131fb697-ef09-458a-b28d-df6f10798fb2.json then search: "uid": "1593653892257/0"

sawyer7246 avatar Feb 22 '21 12:02 sawyer7246

Hi, @sawyer7246, it seems our version of 3D-Front does not contain a file called '131fb697-ef09-458a-b28d-df6f10798fb2.json'...

I don't know if other files are converted correctly?

Shao-Kui avatar Feb 23 '21 03:02 Shao-Kui

Weird thing again :joy: Maybe we just have two different copies of 3D-FRONT?

I don't know if other files are converted correctly?

Actually, the converting keeps running after I suppress the above 'normal' issue, until it pops:

Traceback (most recent call last):
  File "3dfuture2suncg.py", line 416, in <module>
    main(args)
  File "3dfuture2suncg.py", line 287, in main
    Objs.append(trimesh.Trimesh(vertices=vs,faces=face,vertex_normals=normal,vertex_colors=uv))
  File "/root/miniconda3/envs/dev_3.6/lib/python3.6/site-packages/trimesh/base.py", line 147, in __init__
    self.vertex_normals = vertex_normals
  File "/root/miniconda3/envs/dev_3.6/lib/python3.6/site-packages/trimesh/base.py", line 498, in vertex_normals
    if values.ptp() < tol.merge:
  File "/root/miniconda3/envs/dev_3.6/lib/python3.6/site-packages/numpy/core/_methods.py", line 230, in _ptp
    umr_maximum(a, axis, None, out, keepdims),
ValueError: zero-size array to reduction operation maximum which has no identity

sawyer7246 avatar Feb 23 '21 03:02 sawyer7246

Okay... I don't know whether this issue is due to specific versions of trimesh. Our version when running this script is '3.7.14'.

In general, this code is to generate normals of wall meshes. This script is written by my colleague and I forwarded it to him. He will answer you as soon as possible if this does not fix the issue.

Could you also e-mail us the '.json' file when this error occurs? [email protected]

Shao-Kui avatar Feb 23 '21 04:02 Shao-Kui

Checked.

>>> import trimesh
>>> print(trimesh.__version__)
3.7.14

sawyer7246 avatar Feb 23 '21 04:02 sawyer7246