Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I do inference using just 4 images? #51

Open
shit6333 opened this issue Sep 15, 2024 · 3 comments
Open

How can I do inference using just 4 images? #51

shit6333 opened this issue Sep 15, 2024 · 3 comments

Comments

@shit6333
Copy link

Hi, thanks for the great work! But I have some questions.
I have 4 images from different views that I want to use for inference (only four).
However, when I execute run.py, I encounter the following error:

0%|                                                                                                                 | 0/4 [00:02<?, ?it/s]
Traceback (most recent call last):
  File "run.py", line 98, in <module>
    globals()['run_' + args.type]()
  File "run.py", line 59, in run_evaluate
    for batch in tqdm.tqdm(data_loader):
  File "C:\Users\kk\miniconda3\envs\ddpm\lib\site-packages\tqdm\std.py", line 1178, in __iter__
    for obj in iterable:
  File "C:\Users\kk\miniconda3\envs\ddpm\lib\site-packages\torch\utils\data\dataloader.py", line 630, in __next__
    data = self._next_data()
  File "C:\Users\kk\miniconda3\envs\ddpm\lib\site-packages\torch\utils\data\dataloader.py", line 1344, in _next_data
    return self._process_data(data)
  File "C:\Users\kk\miniconda3\envs\ddpm\lib\site-packages\torch\utils\data\dataloader.py", line 1370, in _process_data
    data.reraise()
  File "C:\Users\kk\miniconda3\envs\ddpm\lib\site-packages\torch\_utils.py", line 706, in reraise
    raise exception
ValueError: Caught ValueError in DataLoader worker process 0.
Original Traceback (most recent call last):
  File "C:\Users\kk\miniconda3\envs\ddpm\lib\site-packages\torch\utils\data\_utils\worker.py", line 309, in _worker_loop
    data = fetcher.fetch(index)  # type: ignore[possibly-undefined]
  File "C:\Users\kk\miniconda3\envs\ddpm\lib\site-packages\torch\utils\data\_utils\fetch.py", line 52, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "C:\Users\kk\miniconda3\envs\ddpm\lib\site-packages\torch\utils\data\_utils\fetch.py", line 52, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "E:\code\3D\real_time_3d\MVSGaussian\lib\datasets\colmap\mvsgs.py", line 98, in __getitem__
    src_inps, src_exts, src_ixts = self.read_src(scene_info, src_views)
  File "E:\code\3D\real_time_3d\MVSGaussian\lib\datasets\colmap\mvsgs.py", line 185, in read_src
    return np.stack(imgs), np.stack(exts), np.stack(ixts)
  File "<__array_function__ internals>", line 200, in stack
  File "C:\Users\kk\miniconda3\envs\ddpm\lib\site-packages\numpy\core\shape_base.py", line 460, in stack
    raise ValueError('need at least one array to stack')
ValueError: need at least one array to stack

It seems like there is an issue with reading the dataset. Do you have any suggestions on how to solve this?
Looking forward to your response. Thank you!

@TQTQliu
Copy link
Owner

TQTQliu commented Sep 16, 2024

Hi, you can modify here:

# render_ids = [j for j in range(img_len//8, img_len, img_len//4)] 
# train_ids = [j for j in range(img_len) if j not in render_ids]
train_ids = list(range(img_len))
render_ids = train_ids

@shit6333
Copy link
Author

Thanks, it works!
I have another question. If I want to save the .ply files, I need to provide the per-camera parameters and depth information in here. Where can I save or obtain such files?

@TQTQliu
Copy link
Owner

TQTQliu commented Sep 17, 2024

Please refer here.
Run

python run.py --type evaluate --cfg_file configs/mvsgs/colmap_eval.yaml test_dataset.data_root examples/scene1 save_ply True dir_ply <path to save ply>

The point cloud will be saved in <path to save ply>/scene1/scene1.ply. Camera parameters and depth information can also be found in the folder <path to save ply>/scene1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants