phuang17 / DeepMVS

DeepMVS: Learning Multi-View Stereopsis
https://phuang17.github.io/DeepMVS/index.html
BSD 2-Clause "Simplified" License
337 stars 85 forks source link

RuntimeError: inconsistent tensor size #12

Closed fasogbon closed 5 years ago

fasogbon commented 5 years ago

Please, do you have any idea why I can run into problem of RuntimeError: inconsistent tensor size, expected tensor [100 x 3 x 128 x 128] and src [100 x 3 x 112 x 128] to have the same number of elements, but got 4915200 and 4300800 elements. I am new to this field. See below :

Reloaded modules: colmap_helpers, generate_volume_test, model <ipykernel.iostream.OutStream object at 0x0000024E05AE5438> Loading the trained model... <ipykernel.iostream.OutStream object at 0x0000024E05AE5438> Successfully loaded the trained model. <ipykernel.iostream.OutStream object at 0x0000024E05AE5438> Loading the sparse model... <ipykernel.iostream.OutStream object at 0x0000024E05AE5438> Successfully loaded the sparse model. <ipykernel.iostream.OutStream object at 0x0000024E05AE5438> Creating VGG model... <ipykernel.iostream.OutStream object at 0x0000024E05AE5438> Successfully created VGG model. <ipykernel.iostream.OutStream object at 0x0000024E05AE5438> Start working on image 0/3. <ipykernel.iostream.OutStream object at 0x0000024E05AE5438> Working on patch at row = 0/3 col = 0/4 <ipykernel.iostream.OutStream object at 0x0000024E05AE5438> Working on patch at row = 0/3 col = 1/4 <ipykernel.iostream.OutStream object at 0x0000024E05AE5438> Working on patch at row = 0/3 col = 2/4 <ipykernel.iostream.OutStream object at 0x0000024E05AE5438> Working on patch at row = 0/3 col = 3/4 <ipykernel.iostream.OutStream object at 0x0000024E05AE5438> Working on patch at row = 1/3 col = 0/4 <ipykernel.iostream.OutStream object at 0x0000024E05AE5438> Working on patch at row = 1/3 col = 1/4 <ipykernel.iostream.OutStream object at 0x0000024E05AE5438> Working on patch at row = 1/3 col = 2/4 <ipykernel.iostream.OutStream object at 0x0000024E05AE5438> Working on patch at row = 1/3 col = 3/4 <ipykernel.iostream.OutStream object at 0x0000024E05AE5438> Working on patch at row = 2/3 col = 0/4 Traceback (most recent call last):

File "", line 1, in runfile('C:/Users/.../Desktop/DeepMVS-master/python/test.py', wdir='C:/Users/..../Desktop/DeepMVS-master/python')

File "C:\Users....\deepMVS2\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 668, in runfile execfile(filename, namespace)

File "C:\Users....\deepMVS2\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 108, in execfile exec(compile(f.read(), filename, 'exec'), namespace)

File "C:/Users/..../Desktop/DeepMVS-master/python/test.py", line 253, in data_in_tensor[0, 0, :, 0, ...] = ref_img_tensor.expand(num_depths, -1, -1, -1)

RuntimeError: inconsistent tensor size, expected tensor [100 x 3 x 128 x 128] and src [100 x 3 x 112 x 128] to have the same number of elements, but got 4915200 and 4300800 elements respectively at c:\anaconda2\conda-bld\pytorch_1519492996300\work\torch\lib\th\generic/THTensorCopy.c:86

fasogbon commented 5 years ago

Or can you please provide a test examples (with the txt file exports from colmap) thanks

phuang17 commented 5 years ago

Can you print out image_width and image_height in test.py? Do they match the actual image size?

fasogbon commented 5 years ago

See the attached images, i dont see any issue with the image_width and image_height error1 error2

phuang17 commented 5 years ago

That's strange.... Can you also print out start_x, start_y, next_start_x, and next_start_y?

fasogbon commented 5 years ago

err3

Yes its strange! see theattached screenshot

fasogbon commented 5 years ago
fasogbon commented 5 years ago

Thank you for your feedback. My problem is eventually solved.

phuang17 commented 5 years ago

Glad that you resolved it! And yes, my codes are for Python 2.7. Sorry about this limitation.