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

I got error on dataset.py. Sizes of tensors must match except in dimension 0. Expected size 4 but got size 5 for tensor number 1 in the list. #126

Closed
ysmreg opened this issue Mar 28, 2023 · 2 comments

Comments

@ysmreg
Copy link

ysmreg commented Mar 28, 2023

i got one error. I am using 17 512*512 images and masks. I ran it with a batch size of 10, but it stopped with an error that the tensor size was wrong. I would like to know how to solve

@ysmreg
Copy link
Author

ysmreg commented Mar 28, 2023

error message
`Config / Flags:

config configs/kyara_rescaled.json
iter 5000
batch 10
spp 1
layers 1
train_res [512, 512]
display_res [512, 512]
texture_res [2048, 2048]
display_interval 0
save_interval 100
learning_rate [0.03, 0.01]
min_roughness 0.08
custom_mip False
random_textures True
background white
loss logl1
out_dir out/kyara
ref_mesh data/nerd/kyara
base_mesh None
validate True
mtl_override None
dmtet_grid 64
mesh_scale 2.5
env_scale 1.0
envmap None
display [{'bsdf': 'kd'}, {'bsdf': 'ks'}, {'bsdf': 'normal'}]
camera_space_light True
lock_light False
lock_pos False
sdf_regularizer 0.2
laplace relative
laplace_scale 10000.0
pre_load True
kd_min [0.03, 0.03, 0.03]
kd_max [0.8, 0.8, 0.8]
ks_min [0, 0.08, 0]
ks_max [0, 1.0, 1.0]
nrm_min [-1.0, -1.0, 0.0]
nrm_max [1.0, 1.0, 1.0]
cam_near_far [0.1, 1000.0]
learn_light True
local_rank 0
multi_gpu False

DatasetLLFF: 17 images with shape [512, 512]
DatasetLLFF: auto-centering at [-0.41304994 2.6057422 8.97906 ]
DatasetLLFF: 17 images with shape [512, 512]
DatasetLLFF: auto-centering at [-0.41304994 2.6057422 8.97906 ]
Encoder output: 32 dims
Traceback (most recent call last):
File "train.py", line 594, in
geometry, mat = optimize_mesh(glctx, geometry, mat, lgt, dataset_train, dataset_validate,
File "train.py", line 381, in optimize_mesh
for it, target in enumerate(dataloader_train):
File "/home/user/torch/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 521, in next
data = self._next_data()
File "/home/user/torch/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 561, in _next_data
data = self._dataset_fetcher.fetch(index) # may raise StopIteration
File "/home/user/torch/lib/python3.9/site-packages/torch/utils/data/_utils/fetch.py", line 52, in fetch
return self.collate_fn(data)
File "/home/user/torchtest/nvdiffrec/dataset/dataset.py", line 31, in collate
'img' : torch.cat(list([item['img'] for item in batch]), dim=0)
RuntimeError: Sizes of tensors must match except in dimension 0. Expected size 4 but got size 5 for tensor number 1 in the list.`

@ysmreg
Copy link
Author

ysmreg commented Mar 28, 2023

It worked after correcting the bit depth

@ysmreg ysmreg closed this as completed Mar 28, 2023
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

1 participant