zju3dv / pvnet-rendering

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

Custom Dataset #43

Closed KatharinaSchmidt closed 4 years ago

KatharinaSchmidt commented 4 years ago

Hello everyone,

I try to use this repo to synthesize a dataset for keypoint extraction like pvnet. I've got .ply-models from my objects and wanted to cumstomize the code to use my own models instead of LINEMOD. So I changed the follwing: linemod_cls_names in fuse.py to my own obejct classes cfg.BLENDER_PATH in config.py to my blender path cfg.linemod_cls_names in config.py to my own object classes

Furthermore I downloaded the recommended SUN-Dataset with background images and placed it in /pvnet-rendering/data/, I also placed my .ply-model in an order-structure similar to the recommended LINEMOD-Dataset-Structure in /pvnet-rendering/data/LINEMOD.

If I try to run pvnet-rendering with the command python run.py --type fuse I get the following errors: Traceback (most recent call last): File "run.py", line 24, in globals()['run_' + args.type]() File "run.py", line 20, in run_fuse run() File "D:\Masterarbeit\NN\pvnet-rendering\fuse\fuse.py", line 337, in run prepare_dataset_parallel(output_dir, linemod_dir, linemod_orig_dir, fuse_num, background_dir, cache_dir, worker_num) File "D:\Masterarbeit\NN\pvnet-rendering\fuse\fuse.py", line 210, in prepare_dataset_parallel randomly_read_background(background_dir,cache_dir) File "D:\Masterarbeit\NN\pvnet-rendering\fuse\fuse.py", line 201, in randomly_read_background return imread(fns[np.random.randint(0,len(fns))]) File "mtrand.pyx", line 741, in numpy.random.mtrand.RandomState.randint File "_bounded_integers.pyx", line 1353, in numpy.random._bounded_integers._rand_int32 ValueError: low >= high

Can you tell me, what I am missing in my customization? Or why this error occurs? Thanks in advance :)

pengsida commented 4 years ago

Make sure that the background path is correct: https://github.com/zju3dv/pvnet-rendering/blob/7c36dfa5575dbb587fe766a88bb5dd1e517d725c/fuse/fuse.py#L332

KatharinaSchmidt commented 4 years ago

I didn't change that path. After downloading SUN2012pascalformat as you described,I just unpacked and copied the folder "SUN2012pascalformat" to /pvnet-rendering/data and renamed it to "SUN". But this folder still contains the "JPEGImages" folder with the backgroundimages. If I open the "JPEGImages" folder in /pvnet-rendering/data/SUN I can see all the images, which are stored in there. So the images are at the rigt place I think and I didn't change the path description in the code.

KatharinaSchmidt commented 4 years ago

I think I solved the problem with the background bath. I cloned the repo again and just changed the path to blender. Then I created the softlinks with mklink /d <link> <target> because I'm working with a windows system. But I get these errors: concurrent.futures.process._RemoteTraceback: """ Traceback (most recent call last): File "C:\Users\katha\AppData\Local\Programs\Python\Python38\lib\concurrent\futures\process.py", line 239, in _process_worker r = call_item.fn(*call_item.args, **call_item.kwargs) File "D:\Masterarbeit\NN\pvnet-rendering\fuse\fuse.py", line 230, in prepare_dataset_single rgb, mask, begin, pose=randomly_sample_foreground(image_dbs[cls_id], linemod_dir) File "D:\Masterarbeit\NN\pvnet-rendering\fuse\fuse.py", line 269, in randomly_sample_foreground idx=np.random.randint(0,len(image_db)) File "mtrand.pyx", line 741, in numpy.random.mtrand.RandomState.randint File "_bounded_integers.pyx", line 1353, in numpy.random._bounded_integers._rand_int32 ValueError: low >= high """

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "run.py", line 24, in globals()['run_' + args.type] () File "run.py", line 20, in run_fuse run() File "D:\Masterarbeit\NN\pvnet-rendering\fuse\fuse.py", line 338, in run prepare_dataset_parallel(output_dir, linemod_dir, linemod_orig_dir, fuse_num, background_dir, cache_dir, worker_num) File "D:\Masterarbeit\NN\pvnet-rendering\fuse\fuse.py", line 218, in prepare_dataset_parallel f.result() File "C:\Users\katha\AppData\Local\Programs\Python\Python38\lib\concurrent\futures_base.py", line 439, in result return self.get_result() File "C:\Users\katha\AppData\Local\Programs\Python\Python38\lib\concurrent\futures_base.py", line 388, in get_result raise self._exception ValueError: low >= high

That's the folder structure of my object structure: grafik The folders JPEGImages, labels, mask and pose are empty, the .txt-Files test train and val are also empty. I just tried to copy the strcture of LINEMOD as example.

Do you know what I did wrong? Where is the mistake, if I didn't change the code?

pengsida commented 4 years ago

It is a path problem. You could debug to find why image_db is empty.

KatharinaSchmidt commented 4 years ago

Thanks for the hint. I think I solved the path problem, now it seems to work with LINEMOD-Dataset as an example. But I still have problems with my own object classes. I integrated a folder with the .ply-Model of my own object in the LINEMOD-folder and added the class in the cfg.linemod_cls_names (in cfg.py) and in linemod_cls_names (fuse.py). But i get a new error, I think the reason might be a missing information about my object class. What else besides the .ply-Model do I have to provide in my custom dataset?

Hope you can help me again :)

pengsida commented 4 years ago

Please provide the error message.

KatharinaSchmidt commented 4 years ago

That's the error message I get:

Traceback (most recent call last): File "run.py", line 24, in globals()['run_' + args.type] () File "run.py", line 20, in run_fuse run() File "D:\Masterarbeit\NN\pvnet-rendering\fuse\fuse.py", line 338, in run prepare_dataset_parallel(output_dir, linemod_dir, linemod_orig_dir, fuse_num, background_dir, cache_dir, worker_num) File "D:\Masterarbeit\NN\pvnet-rendering\fuse\fuse.py", line 218, in prepare_dataset_parallel f.result() File "C:\Users\katha\AppData\Local\Programs\Python\Python38\lib\concurrent\futures_base.py", line 439, in result return self.get_result() File "C:\Users\katha\AppData\Local\Programs\Python\Python38\lib\concurrent\futures_base.py", line 388, in get_result raise self._exception ValueError: low >= high

pengsida commented 4 years ago

You could debug to find why image_db is empty.