Shao-Kui / 3DScenePlatform

GNU General Public License v3.0
41 stars 12 forks source link

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

Open sawyer7246 opened 3 years ago

sawyer7246 commented 3 years ago

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~

Shao-Kui commented 3 years ago

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

sawyer7246 commented 3 years ago

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?

Shao-Kui commented 3 years ago

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...

sawyer7246 commented 3 years ago

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 commented 3 years ago

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
Shao-Kui commented 3 years ago

Hi @sawyer7246, could you try again?

sawyer7246 commented 3 years ago

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'
Shao-Kui commented 3 years ago

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

sawyer7246 commented 3 years ago

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'
Shao-Kui commented 3 years ago

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

sawyer7246 commented 3 years ago

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

Shao-Kui commented 3 years ago

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?

sawyer7246 commented 3 years ago

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
Shao-Kui commented 3 years ago

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? zhangsk18@mails.tsinghua.edu.cn

sawyer7246 commented 3 years ago

Checked.

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