zju3dv / DetectorFreeSfM

Code for "Detector-Free Structure from Motion", CVPR 2024
Apache License 2.0
575 stars 31 forks source link

Dear author, thanks for you perfect code ,but I missed a problem when I try to run it on my device. I beg you advices! #35

Open Yuanjia-Cao opened 3 months ago

Yuanjia-Cao commented 3 months ago

NameError: name 'torchmetrics' is not defined The specific situation is list as follows Traceback (most recent call last): File "/media/yjc/G/DetectorFreeSfM/eval_dataset.py", line 13, in <module> import torchmetrics File "/home/yjc/miniconda3/envs/detectorfreesfm/lib/python3.9/site-packages/torchmetrics/init.py", line 26, in <module> from torchmetrics import functional # noqa: E402 File "/home/yjc/miniconda3/envs/detectorfreesfm/lib/python3.9/site-packages/torchmetrics/functional/init.py", line 14, in <module> from torchmetrics.functional.audio._deprecated import _permutation_invariant_training as permutation_invariant_training File "/home/yjc/miniconda3/envs/detectorfreesfm/lib/python3.9/site-packages/torchmetrics/functional/audio/init.py", line 14, in <module> from torchmetrics.functional.audio.pit import permutation_invariant_training, pit_permutate File "/home/yjc/miniconda3/envs/detectorfreesfm/lib/python3.9/site-packages/torchmetrics/functional/audio/pit.py", line 22, in <module> from torchmetrics.utilities import rank_zero_warn File "/home/yjc/miniconda3/envs/detectorfreesfm/lib/python3.9/site-packages/torchmetrics/utilities/init.py", line 14, in <module> from torchmetrics.utilities.checks import check_forward_full_state_property File "/home/yjc/miniconda3/envs/detectorfreesfm/lib/python3.9/site-packages/torchmetrics/utilities/checks.py", line 25, in <module> from torchmetrics.metric import Metric File "/home/yjc/miniconda3/envs/detectorfreesfm/lib/python3.9/site-packages/torchmetrics/metric.py", line 30, in <module> from torchmetrics.utilities.data import ( File "/home/yjc/miniconda3/envs/detectorfreesfm/lib/python3.9/site-packages/torchmetrics/utilities/data.py", line 38, in <module> def dim_zero_sum(x: Tensor) -> torchmetrics.utilities.dataTensor: NameError: name 'torchmetrics' is not defined

hxy-123 commented 3 months ago

It seems that the torchmetrics module is required by the omegaconf module, where we forgot to include it in the requirements. You can try out the command pip install torchmetrics==0.6.0. We have also added it to the requirements.txt.

Yuanjia-Cao commented 3 months ago

yeah! You are greate! But I missed a new question with colmap, what should I do next? Best wishes to you! 2024-05-31 14:10:36.460 | INFO | main:eval_core:35 - Worker: 0 will process: ['/media/yjc/G/DetectorFreeSfM/SfM_dataset/example_dataset/example_scene'], total: 1 scenes 0%| | 0/1 [00:00<?, ?it/s]2024-05-31 14:10:36.462 | INFO | src.construct_pairs.pairs_exhaustive:exhaustive_all_pairs:11 - Total:28 pairs 2024-05-31 14:10:39.399 | WARNING | src.dataset.coarse_sfm_refinement_dataset:init:69 - COLMAP is not valid, current COLMAP path: /media/yjc/G/DetectorFreeSfM/SfM_dataset/example_dataset/example_scene/DetectorFreeSfM_loftr_official_coarse_only__scratch_no_intrin/colmap_coarse/-1 2024-05-31 14:10:39.399 | WARNING | src.post_optimization.post_optimization:post_optimization:142 - Build colmap coarse dataset fail! colmap point3D or images or cameras is empty!

hxy-123 commented 3 months ago

The message thrown by the code shows that the coarse SfM failed. It seems that you are running our demo data, which has been tested working well by us. You can try out setting neuralsfm.redo_all=True and re-run the code to make sure the coarse matching has been performed.

Yuanjia-Cao commented 3 months ago

The message thrown by the code shows that the coarse SfM failed. It seems that you are running our demo data, which has been tested working well by us. You can try out setting neuralsfm.redo_all=True and re-run the code to make sure the coarse matching has been performed.

I create the environment in a new ubuntu system , and it encounter a new question.

Processing /media/yuanjia/Y/code/detectorfreesfm/third_party/RoIAlign.pytorch Preparing metadata (setup.py) ... error error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [8 lines of output] Traceback (most recent call last): File "<string>", line 2, in <module> File "<pip-setuptools-caller>", line 34, in <module> File "/media/yuanjia/Y/code/detectorfreesfm/third_party/RoIAlign.pytorch/setup.py", line 3, in <module> from torch.utils.cpp_extension import BuildExtension, CUDAExtension, CppExtension File "/home/yuanjia/miniconda3/envs/detectorfreesfm/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 23, in <module> from pkg_resources import packaging # type: ignore ImportError: cannot import name 'packaging' from 'pkg_resources' (/home/yuanjia/miniconda3/envs/detectorfreesfm/lib/python3.9/site-packages/pkg_resources/init.py) [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed

× Encountered error while generating package metadata. ╰─> See above for output.

note: This is an issue with the package mentioned above, not pip. hint: See above for details.

Osierddr commented 2 months ago

The message thrown by the code shows that the coarse SfM failed. It seems that you are running our demo data, which has been tested working well by us. You can try out setting neuralsfm.redo_all=True and re-run the code to make sure the coarse matching has been performed.

I create the environment in a new ubuntu system , and it encounter a new question.

Processing /media/yuanjia/Y/code/detectorfreesfm/third_party/RoIAlign.pytorch Preparing metadata (setup.py) ... error error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [8 lines of output] Traceback (most recent call last): File "", line 2, in File "", line 34, in File "/media/yuanjia/Y/code/detectorfreesfm/third_party/RoIAlign.pytorch/setup.py", line 3, in from torch.utils.cpp_extension import BuildExtension, CUDAExtension, CppExtension File "/home/yuanjia/miniconda3/envs/detectorfreesfm/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 23, in from pkg_resources import packaging # type: ignore ImportError: cannot import name 'packaging' from 'pkg_resources' (/home/yuanjia/miniconda3/envs/detectorfreesfm/lib/python3.9/site-packages/pkg_resources/init.py) [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed

× Encountered error while generating package metadata. ╰─> See above for output.

note: This is an issue with the package mentioned above, not pip. hint: See above for details.

It can be seen from https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/15863#issue-2309947152 CHECK your version of setupotools, if >70.0.0, just degrade

Starlit404 commented 2 months ago

The message thrown by the code shows that the coarse SfM failed. It seems that you are running our demo data, which has been tested working well by us. You can try out setting neuralsfm.redo_all=True and re-run the code to make sure the coarse matching has been performed.

I create the environment in a new ubuntu system , and it encounter a new question.

Processing /media/yuanjia/Y/code/detectorfreesfm/third_party/RoIAlign.pytorch Preparing metadata (setup.py) ... error error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [8 lines of output] Traceback (most recent call last): File "", line 2, in File "", line 34, in File "/media/yuanjia/Y/code/detectorfreesfm/third_party/RoIAlign.pytorch/setup.py", line 3, in from torch.utils.cpp_extension import BuildExtension, CUDAExtension, CppExtension File "/home/yuanjia/miniconda3/envs/detectorfreesfm/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 23, in from pkg_resources import packaging # type: ignore ImportError: cannot import name 'packaging' from 'pkg_resources' (/home/yuanjia/miniconda3/envs/detectorfreesfm/lib/python3.9/site-packages/pkg_resources/init.py) [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed

× Encountered error while generating package metadata. ╰─> See above for output.

note: This is an issue with the package mentioned above, not pip. hint: See above for details.

same question, do you have any solutions yet bro

Starlit404 commented 1 month ago

The message thrown by the code shows that the coarse SfM failed. It seems that you are running our demo data, which has been tested working well by us. You can try out setting neuralsfm.redo_all=True and re-run the code to make sure the coarse matching has been performed.

I create the environment in a new ubuntu system , and it encounter a new question.

Processing /media/yuanjia/Y/code/detectorfreesfm/third_party/RoIAlign.pytorch Preparing metadata (setup.py) ... error error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [8 lines of output] Traceback (most recent call last): File "", line 2, in File "", line 34, in File "/media/yuanjia/Y/code/detectorfreesfm/third_party/RoIAlign.pytorch/setup.py", line 3, in from torch.utils.cpp_extension import BuildExtension, CUDAExtension, CppExtension File "/home/yuanjia/miniconda3/envs/detectorfreesfm/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 23, in from pkg_resources import packaging # type: ignore ImportError: cannot import name 'packaging' from 'pkg_resources' (/home/yuanjia/miniconda3/envs/detectorfreesfm/lib/python3.9/site-packages/pkg_resources/init.py) [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed

× Encountered error while generating package metadata. ╰─> See above for output.

note: This is an issue with the package mentioned above, not pip. hint: See above for details.

finally i tried out the successful way to solve this problem, it is because of the version of setuptools, you can try to downgrade it to lower version like 69.5.1