chensjtu / GaussianObject

GaussianObject: High-Quality 3D Object Reconstruction from Four Views with Gaussian Splatting (SIGGRAPH Asia 2024, TOG)
914 stars 56 forks source link

visual_hull.py error #34

Open TXSevenXT opened 5 months ago

TXSevenXT commented 5 months ago

Hi there!

Thank you very much for this great work :)

I haven't managed to take advantage of the code for my own data yet, but I'm planning to =D

I end up with the following error code at the “visual_hull.py” command:

(GO) xsevenx@PC:~/GaussianObject$ python visual_hull.py --sparse_id 9 --data_dir "/home/xsevenx/segment-anything/data/Cascade_dense_02/" --not_vis Using resized images in /home/xsevenx/segment-anything/data/Cascade_dense_02/images... Reading camera 29/29 Generating ellipse path from 29 camera infos ... theta[0] 0.0 the sparse id is 9, with 9 frames the camera center is: tensor([ 0.1372, 0.0131, -0.0067], device='cuda:0') Traceback (most recent call last): File "/home/xsevenx/GaussianObject/visual_hull.py", line 223, in pcd, bbox = get_visual_hull(args.voxel_num, init_bbox, scene_info, cam_center) File "/home/xsevenx/GaussianObject/visual_hull.py", line 85, in get_visual_hull new_masks.append(simple_resize_image(mask, img_size)) File "/home/xsevenx/GaussianObject/visual_hull.py", line 66, in simple_resize_image return transforms.Resize(size, antialias=True)(img) File "/home/xsevenx/anaconda3/envs/GO/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl return forward_call(*args, kwargs) File "/home/xsevenx/anaconda3/envs/GO/lib/python3.10/site-packages/torchvision/transforms/transforms.py", line 361, in forward return F.resize(img, self.size, self.interpolation, self.maxsize, self.antialias) File "/home/xsevenx/anaconda3/envs/GO/lib/python3.10/site-packages/torchvision/transforms/functional.py", line 476, in resize , image_height, image_width = get_dimensions(img) File "/home/xsevenx/anaconda3/envs/GO/lib/python3.10/site-packages/torchvision/transforms/functional.py", line 78, in get_dimensions return F_pil.get_dimensions(img) File "/home/xsevenx/anaconda3/envs/GO/lib/python3.10/site-packages/torchvision/transforms/_functional_pil.py", line 31, in get_dimensions raise TypeError(f"Unexpected type {type(img)}") TypeError: Unexpected type <class 'NoneType'>**

I don't know if this has anything to do with the “sparse_9.txt” I created manually?

I couldn't find a way to output this txt file in an optimized and automatic way :( If it's coming from there, what's the most appropriate way to output these files?

Thank you very much for your help and your time

XSevenX

GaussianObject commented 5 months ago

Thank you for your interest in our project!

The sparse_9.txt file you mentioned is supposed to contain the indices of images used for training, starting from 0. If your intention is to use all 29 cameras for your computation, you should set the --sparse_id to 29 with

python visual_hull.py --sparse_id 29 --data_dir "/home/xsevenx/segment-anything/data/Cascade_dense_02/" --not_vis

Additionally, you'll need to create a sparse_29.txt file in your data directory (/home/xsevenx/segment-anything/data/Cascade_dense_02/). This file should list the indices from 0 to 28 as

0
1
2
...
28

Let us know if this resolves your issue or if there's anything else we can help with!

FanYaning commented 4 months ago

@GaussianObject 我测试的如下脚本,也出现了类似问题。请问是什么原因。 python visual_hull.py --data_dir data/human3 --reso=-1 --not_vis

我使用的自己拍摄的图片,然后colmap生成的数据集,结构如下:

human3 
|---images
|       |---<image 0>
|       |---<image 1>
|       |---...
|---sparse
        |---0
            |---cameras.bin
            |---images.bin
            |---points3D.bin
use original resolution images
Reading camera 261/261
Generating ellipse path from 261 camera infos ...
theta[0] 0.0
the camera center is: tensor([-0.0071, -0.0084,  0.0100], device='cuda:0')
Traceback (most recent call last):
  File "/data1/fanyn_data/GaussianObject/visual_hull.py", line 223, in <module>
    pcd, bbox = get_visual_hull(args.voxel_num, init_bbox, scene_info, cam_center)
  File "/data1/fanyn_data/GaussianObject/visual_hull.py", line 85, in get_visual_hull
    new_masks.append(simple_resize_image(mask, img_size))
  File "/data1/fanyn_data/GaussianObject/visual_hull.py", line 66, in simple_resize_image
    return transforms.Resize(size, antialias=True)(img)
  File "/home/appadmin/anaconda3/envs/3dgaussian/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/home/appadmin/anaconda3/envs/3dgaussian/lib/python3.10/site-packages/torchvision/transforms/transforms.py", line 361, in forward
    return F.resize(img, self.size, self.interpolation, self.max_size, self.antialias)
  File "/home/appadmin/anaconda3/envs/3dgaussian/lib/python3.10/site-packages/torchvision/transforms/functional.py", line 476, in resize
    _, image_height, image_width = get_dimensions(img)
  File "/home/appadmin/anaconda3/envs/3dgaussian/lib/python3.10/site-packages/torchvision/transforms/functional.py", line 78, in get_dimensions
    return F_pil.get_dimensions(img)
  File "/home/appadmin/anaconda3/envs/3dgaussian/lib/python3.10/site-packages/torchvision/transforms/_functional_pil.py", line 31, in get_dimensions
    raise TypeError(f"Unexpected type {type(img)}")
TypeError: Unexpected type <class 'NoneType'>
FanYaning commented 4 months ago

应该是我没有生成masks文件夹导致的,get_visual_hull方法中 的masks = scene_info.masks,masks 值是None masks is the object mask generated with segment-anything.