phuang17 / DeepMVS

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

Run test.py without gpu #4

Closed aditya9211 closed 5 years ago

aditya9211 commented 6 years ago

not able to run

python python/test.py --load_bin --image_path path/to/images --sparse_path path/to/sparse --output_path path/to/output/directory

image

parser.add_argument("--no_gpu", dest = "use_gpu", action = "store_false", default = True, help = "Disable use of GPU.")

So how to run it with CPU, as I have tried all these things mentioned yet no sucess

aditya9211 commented 6 years ago

python python/test.py --image_path project_clean/dense/images/ --sparse_path project_clean/dense/sparse/ --output_path project_clean/ --no_gpu False usage: test.py [-h] [--image_width IMAGE_WIDTH] [--image_height IMAGE_HEIGHT] [--patch_width PATCH_WIDTH] [--patch_height PATCH_HEIGHT] [--stride_width STRIDE_WIDTH] [--stride_height STRIDE_HEIGHT] [--num_depths NUM_DEPTHS] [--max_num_neighbors MAX_NUM_NEIGHBORS] [--no_gpu] --image_path IMAGE_PATH --sparse_path SPARSE_PATH --output_path OUTPUT_PATH [--load_bin LOAD_BIN] [--model_path MODEL_PATH] [--overwrite] [--log_file LOG_FILE] test.py: error: unrecognized arguments: False

phuang17 commented 6 years ago

Did you try adding --no_gpu and NOT --no_gpu False?

aditya9211 commented 6 years ago

Yes I have tried that also

AttributeError: 'module' object has no attribute '_cuda_getDevice'

Kindly see to it that you have defined CPU executing function call

‌ [image: Mailtrack] https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4& Sender notified by Mailtrack https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4&

On Mon, May 21, 2018 at 12:58 PM, Po-Han Huang notifications@github.com wrote:

Did you try adding --no_gpu and NOT --no_gpu False?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/phuang17/DeepMVS/issues/4#issuecomment-390575440, or mute the thread https://github.com/notifications/unsubscribe-auth/AVPgjmGxpupJsRcTjne8iqp0Y6ro3k7Jks5t0mySgaJpZM4UGFmj .

phuang17 commented 6 years ago

Could you send me a screenshot of the error message when --no_gpu is added? The codes seem to work on my machine, though.

aditya9211 commented 6 years ago

Look into the GPU code, it's default is True.

I have changed this also but there also no success

‌ [image: Mailtrack] https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4& Sender notified by Mailtrack https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4&

On Mon, May 21, 2018 at 1:22 PM, Po-Han Huang notifications@github.com wrote:

Could you send me a screenshot of the error message when --no_gpu is added? The codes seem to work on my machine, though.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/phuang17/DeepMVS/issues/4#issuecomment-390580648, or mute the thread https://github.com/notifications/unsubscribe-auth/AVPgjovILcHn_kHrrBQq3djgrR069qpQks5t0nJFgaJpZM4UGFmj .

phuang17 commented 6 years ago

Sorry, I cannot see your screenshots. Could you provide an external link to them? Or upload it using GitHub website instead of email?

aditya9211 commented 6 years ago

@PFA

  1. no_gpu error
  2. use_gpu code as written in test.py file

[image: Mailtrack] https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4& Sender notified by Mailtrack https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4&

On Mon, May 21, 2018 at 2:06 PM, Po-Han Huang notifications@github.com wrote:

Sorry, I cannot see your screenshots. Could you provide an external link to them? Or upload it using GitHub website instead of email?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/phuang17/DeepMVS/issues/4#issuecomment-390590298, or mute the thread https://github.com/notifications/unsubscribe-auth/AVPgjl1755k7UXMAVPPRYrLF6JMZsrC2ks5t0nyqgaJpZM4UGFmj .

phuang17 commented 6 years ago

Hi I still cannot see the screenshots. Can you upload them to https://imgur.com/ and copy the link back to here. Thanks.

aditya9211 commented 6 years ago

https://drive.google.com/open?id=1vb2mt12y8-gi9iFBRmNzhA0ZpNEkCKgo

‌ [image: Mailtrack] https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4& Sender notified by Mailtrack https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4&

On Mon, May 21, 2018 at 2:17 PM, Po-Han Huang notifications@github.com wrote:

Hi I still cannot see the screenshots. Can you upload them to https://imgur.com/ and copy the link back to here. Thanks.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/phuang17/DeepMVS/issues/4#issuecomment-390592779, or mute the thread https://github.com/notifications/unsubscribe-auth/AVPgjqrdHRkTaXrYDXk8JbgWay_3L0h8ks5t0n8hgaJpZM4UGFmj .

aditya9211 commented 6 years ago

https://drive.google.com/open?id=1wvNW2XXr8XvdUdebwtgieWvKAlWUZXBA

‌ [image: Mailtrack] https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4& Sender notified by Mailtrack https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4&

On Mon, May 21, 2018 at 2:25 PM, Aditya Sharma < aditya.suzuki.sharma@gmail.com> wrote:

https://drive.google.com/open?id=1vb2mt12y8-gi9iFBRmNzhA0ZpNEkCKgo

‌ [image: Mailtrack] https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4& Sender notified by Mailtrack https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4&

On Mon, May 21, 2018 at 2:17 PM, Po-Han Huang notifications@github.com wrote:

Hi I still cannot see the screenshots. Can you upload them to https://imgur.com/ and copy the link back to here. Thanks.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/phuang17/DeepMVS/issues/4#issuecomment-390592779, or mute the thread https://github.com/notifications/unsubscribe-auth/AVPgjqrdHRkTaXrYDXk8JbgWay_3L0h8ks5t0n8hgaJpZM4UGFmj .

phuang17 commented 6 years ago

Ok, I found that the root cause seems to be: https://discuss.pytorch.org/t/on-a-cpu-device-how-to-load-checkpoint-saved-on-gpu-device/349/5 I will update the codes next week. For now, please change line 90 in test.py from model.load_state_dict(torch.load(os.path.join(model_path))) to model.load_state_dict(torch.load(os.path.join(model_path), map_location=lambda storage, loc: storage)).

aditya9211 commented 6 years ago

Still the same error https://drive.google.com/open?id=1FEEw1JuNq1HvTvrKDnFFE8n8queI191C

Loading the trained model... Traceback (most recent call last): File "python/test.py", line 89, in model = DeepMVS(num_depths, use_gpu) File "/home/delhivery/Downloads/DepthMap/DeepMVS/python/model.py", line 173, in init self.layer_0 = self.layer_0.cuda() File "/home/delhivery/Downloads/DepthMap/py2-stereo-img/local/lib/python2.7/site-packages/torch/nn/modules/module.py", line 249, in cuda return self._apply(lambda t: t.cuda(device)) File "/home/delhivery/Downloads/DepthMap/py2-stereo-img/local/lib/python2.7/site-packages/torch/nn/modules/module.py", line 176, in _apply module._apply(fn) File "/home/delhivery/Downloads/DepthMap/py2-stereo-img/local/lib/python2.7/site-packages/torch/nn/modules/module.py", line 182, in _apply param.data = fn(param.data) File "/home/delhivery/Downloads/DepthMap/py2-stereo-img/local/lib/python2.7/site-packages/torch/nn/modules/module.py", line 249, in return self._apply(lambda t: t.cuda(device)) RuntimeError: torch.cuda.FloatTensor is not enabled.

‌ [image: Mailtrack] https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4& Sender notified by Mailtrack https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4&

On Tue, May 22, 2018 at 11:40 AM, Po-Han Huang notifications@github.com wrote:

Ok, I found that the root cause seems to be: https://discuss.pytorch.org/t/on-a-cpu-device-how-to-load- checkpoint-saved-on-gpu-device/349/5 I will update the codes next week. For now, please change line 90 in test.py from model.load_state_dict(torch.load(os.path.join(model_path))) to model.load_state_dict(torch.load(os.path.join(model_path), map_location=lambda storage, loc: storage)).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/phuang17/DeepMVS/issues/4#issuecomment-390874234, or mute the thread https://github.com/notifications/unsubscribe-auth/AVPgjsXpUUSELEgngZx17_zU_UQAQiZdks5t06vogaJpZM4UGFmj .

phuang17 commented 6 years ago

You forgot to add --no_gpu flag.

phuang17 commented 5 years ago

Close as there has been no update.