zju3dv / pvnet-rendering

render images for pvnet training
Apache License 2.0
183 stars 46 forks source link

Not generating blender dataset #81

Open tensarflow opened 1 year ago

tensarflow commented 1 year ago

Hello there! Thanks for sharing your work!

I'm trying to reproduce the dataset generation. I succeeded to generate the fuse data, but unfortunately, the blender data is not being generated. Also I don't get any error message. Am I missing something? I would really appreciate it if you could sign me to the right direction.

Thanks

run.py

from config import cfg
import torch
import argparse

parser = argparse.ArgumentParser()
parser.add_argument('--type', action='store', dest='type', type=str)
args = parser.parse_args()

def run_rendering():
    from blender.render_utils import Renderer, YCBRenderer
    # YCBRenderer.multi_thread_render()
    # renderer = YCBRenderer('037_scissors')
    renderer=Renderer('cat')
    renderer.run()

def run_fuse():
    from fuse.fuse import run
    run()

if __name__ == '__main__':
    globals()['run_' + args.type]()

config.py


from easydict import EasyDict
import os
import sys
import numpy as np

cfg = EasyDict()

"""
Path settings
"""
cfg.ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
cfg.DATA_DIR = os.path.join(cfg.ROOT_DIR, 'data')
cfg.MODEL_DIR = os.path.join(cfg.DATA_DIR, 'model')
cfg.REC_DIR = os.path.join(cfg.DATA_DIR, 'record')
cfg.FIGURE_DIR = os.path.join(cfg.ROOT_DIR, 'figure')
cfg.BLENDER_DIR = os.path.join(cfg.ROOT_DIR, "blender")

def add_path():
    for key, value in cfg.items():
        if 'DIR' in key:
            sys.path.insert(0, value)

add_path()
sys.path.extend([".", ".."])

"""
Data settings
"""
cfg.LINEMOD = os.path.join(cfg.DATA_DIR, 'LINEMOD')
cfg.LINEMOD_ORIG = os.path.join(cfg.DATA_DIR, 'LINEMOD_ORIG')
cfg.OCCLUSION_LINEMOD = os.path.join(cfg.DATA_DIR, 'OCCLUSION_LINEMOD')
cfg.YCB = os.path.join(cfg.DATA_DIR, 'YCB')
cfg.SUN = os.path.join(cfg.DATA_DIR, "SUN")

"""
Rendering setting
"""
cfg.BLENDER_PATH = '/home/daimia/blender-2.79a-linux-glibc219-x86_64/blender'
cfg.NUM_SYN = 10000
cfg.WIDTH = 640
cfg.HEIGHT = 480
cfg.low_azi = 0
cfg.high_azi = 360
cfg.low_ele = -15
cfg.high_ele = 40
cfg.low_theta = 10
cfg.high_theta = 40
cfg.cam_dist = 0.5
cfg.MIN_DEPTH = 0
cfg.MAX_DEPTH = 2

cfg.render_K=np.array([[700., 0., 320.],
                       [0., 700., 240.],
                       [0., 0., 1.]],np.float32)

cfg.linemod_K=np.array([[572.41140,0.       ,325.26110],
                        [0.       ,573.57043,242.04899],
                        [0.       ,0.       ,1.       ]],np.float32)

cfg.linemod_cls_names=['ape','cam','cat','duck','glue','iron','phone',
                       'benchvise','can','driller','eggbox','holepuncher','lamp']
cfg.occ_linemod_cls_names=['ape','can','cat','driller','duck','eggbox','glue','holepuncher']
cfg.linemod_plane=['can']

cfg.symmetry_linemod_cls_names=['glue','eggbox']

'''
pascal 3d +
'''
cfg.PASCAL = os.path.join(cfg.DATA_DIR, 'PASCAL3D')
cfg.pascal_cls_names=['aeroplane','bicycle','boat','bottle','bus','car',
                      'chair','diningtable','motorbike','sofa','train','tvmonitor']
cfg.pascal_size=128

'''
YCB
'''
cfg.ycb_sym_cls=[21,20,19,16,13] # foam_brick extra_large_clamp large_clamp wood_block bowl
cfg.ycb_class_num=21
tensarflow commented 1 year ago

Terminal output:


(pvnet-rendering) daimia@daimia-ws:~/pvnet-rendering$ python run.py --type rendering
found bundled python: /home/daimia/blender-2.79a-linux-glibc219-x86_64/2.79/python
Read blend: /home/daimia/pvnet-rendering/data/blank.blend

Successfully imported '/home/daimia/pvnet-rendering/data/LINEMOD/cat/cat.ply' in 1.010 sec
cost 1.0468323230743408 s

Blender quit
tensarflow commented 1 year ago

Okay, I solved it by removing the /renders folder inside the LINEMOD folder you provided.

monajalal commented 9 months ago

@tensarflow could you please share which version of Ubuntu you are using?

tensarflow commented 9 months ago

Ubuntu 22.4

monajalal commented 9 months ago

@tensarflow Could you please share your packages version using environment.yml or requirements.txt? I have the same version of Ubuntu and I really appreciate it if you could assist me. Thank you

monajalal commented 9 months ago

@tensarflow

To give you an idea, this is an error i get:

(pvnet-rendering) (base) mona@ada:~/pvnet-rendering$ pip install easydict
Exception:
Traceback (most recent call last):
  File "/home/mona/pvnet-rendering/pvnet-rendering/lib/python3.5/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/home/mona/pvnet-rendering/pvnet-rendering/lib/python3.5/site-packages/pip/commands/install.py", line 272, in run
    with self._build_session(options) as session:
  File "/home/mona/pvnet-rendering/pvnet-rendering/lib/python3.5/site-packages/pip/basecommand.py", line 69, in _build_session
    if options.cache_dir else None
  File "/home/mona/blender-2.79a-linux-glibc219-x86_64/2.79/python/lib/python3.5/posixpath.py", line 89, in join
    genericpath._check_arg_types('join', a, *p)
  File "/home/mona/blender-2.79a-linux-glibc219-x86_64/2.79/python/lib/python3.5/genericpath.py", line 143, in _check_arg_types
    (funcname, s.__class__.__name__)) from None
TypeError: join() argument must be str or bytes, not 'int'
Traceback (most recent call last):
  File "/home/mona/pvnet-rendering/pvnet-rendering/bin/pip", line 11, in <module>
    sys.exit(main())
  File "/home/mona/pvnet-rendering/pvnet-rendering/lib/python3.5/site-packages/pip/__init__.py", line 233, in main
    return command.main(cmd_args)
  File "/home/mona/pvnet-rendering/pvnet-rendering/lib/python3.5/site-packages/pip/basecommand.py", line 251, in main
    timeout=min(5, options.timeout)) as session:
  File "/home/mona/pvnet-rendering/pvnet-rendering/lib/python3.5/site-packages/pip/basecommand.py", line 69, in _build_session
    if options.cache_dir else None
  File "/home/mona/blender-2.79a-linux-glibc219-x86_64/2.79/python/lib/python3.5/posixpath.py", line 89, in join
    genericpath._check_arg_types('join', a, *p)
  File "/home/mona/blender-2.79a-linux-glibc219-x86_64/2.79/python/lib/python3.5/genericpath.py", line 143, in _check_arg_types
    (funcname, s.__class__.__name__)) from None
TypeError: join() argument must be str or bytes, not 'int'

more here https://stackoverflow.com/questions/77664085/installing-easydict-in-bundled-python-3-5-in-blender-2-79a-in-ubuntu-22-04-using