facebookresearch / vggsfm

VGGSfM: Visual Geometry Grounded Deep Structure From Motion
Other
855 stars 56 forks source link

Error when trying to rum python test.py #3

Closed danzel-crazy closed 3 months ago

danzel-crazy commented 4 months ago

These are the error message that I received from the terminal , but I don't know how to fix it

Aborted at 1715943039 (unix time) try "date -d @1715943039" if you are using GNU date @ 0x7ffeb53f0ef5 _seh_filter_exe @ 0x7ff743362698 OPENSSL_Applink @ 0x7ffeaad9f73f C_specific_handler @ 0x7ffeb74f247f chkstk @ 0x7ffeb74a14b4 RtlRaiseException @ 0x7ffeb74f0f8e KiUserExceptionDispatcher @ 0x7ffe710d264e void cdecl ExceptionPtrRethrow(void const * ptr64) @ 0x7ffe6ec1113f (unknown) @ 0x7ffe6ec1ffdc public: struct c10::ivalue::Object & ptr64 cdecl c10::ivalue::Object::operator=(struct c10::ivalue::Object && ptr64) __ptr64 @ 0x7ffe4dfbd6a5 (unknown) @ 0x7ffe4e4ef9e9 PyInit_pycolmap @ 0x7ffe91e21080 (unknown) @ 0x7ffe91e226a5 __NLG_Return2 @ 0x7ffeb74f17e6 RtlCaptureContext2 @ 0x7ffe4dfc0194 (unknown) @ 0x7ffe59e26f90 _PyMethodDef_RawFastCallKeywords @ 0x7ffe59e25f56 _PyObject_MakeTpCall @ 0x7ffe59e3269b PyWrapper_New @ 0x7ffe59e6e37a _PyObject_GenericGetAttrWithDict @ 0x7ffe59e6d969 PyObject_GetAttrString @ 0x7ffe4dff575e PyInit_pycolmap @ 0x7ffe4e04d9d6 PyInit_pycolmap @ 0x7ffe4e027384 PyInit_pycolmap @ 0x7ffe4dfe4842 (unknown) @ 0x7ffe4dff0a07 PyInit_pycolmap @ 0x7ffe4dff02fe PyInit_pycolmap @ 0x7ffe59f321fd PyImport_AppendInittab @ 0x7ffe59f318c6 PyImport_Import @ 0x7ffe59e694e5 _PyCFunction_DebugMallocStats @ 0x7ffe59e2609e PyVectorcall_Call @ 0x7ffe59f03a50 PyEval_GetFuncDesc @ 0x7ffe59f005a1 _PyEval_EvalFrameDefault

jytime commented 4 months ago

Hey it looks some errors related to pycolmap. Can you try "import pycolmap" to see if it works well?

danzel-crazy commented 4 months ago

I add import pycolmap but end up same error

jytime commented 4 months ago

Yes my wild guess it there is something wrong with your pycolmap installation, because it says "@ 0x7ffe4e4ef9e9 PyInit_pycolmap". It indicates pycolmap cannot be initialised. It is quite possible that (a) you have installed pycolmap before and there is some version conflict or (b) it is a compiling problem. It would be best to check if your environment can run something like below to check if your pycolmap works well :

import pycolmap

pycolmap.Reconstruction()

ransac_options = pycolmap.RANSACOptions( max_error=4.0,  # for example the reprojection error in pixels min_inlier_ratio=0.01, confidence=0.9999, min_num_trials=1000, max_num_trials=100000, )

If you have checked the environment is good, please share the full error message and I am happy to have a look. Or you can share your images and I can try to run over them.

danzel-crazy commented 4 months ago

Thanks for help me for solving the error I am an university cs student who trys to do some cv reasearch

Below is the full error of running test.py

\anaconda3\envs\vggsfm\lib\site-packages\torchvision\io\image.py:13: UserWarning: Failed to load image Python extension: '[WinError 127] 找不到指定的程序。'If you don't plan on using image functionality from torchvision.io, you can ignore this warning. Otherwise, there might be something wrong with your environment. Did you have libjpeg or libpng installed before building torchvision from source? warn( test.py:36: UserWarning: The version_base parameter is not specified. Please specify a compatability version level, or None. Will assume defaults for version 1.1 @hydra.main(config_path="cfgs/", config_name="test") C:\Users\ricky\anaconda3\envs\vggsfm\lib\site-packages\hydra_internal\hydra.py:119: UserWarning: Future Hydra versions will no longer change working directory at job runtime by default. See https://hydra.cc/docs/1.2/upgrades/1.1_to_1.2/changes_to_job_working_dir/ for more information. ret = run_job( Model Config: seed: 0 debug: false use_bf16: false query_frame_num: 3 imc_scene_eight: false return_in_pt3d: true IMC_DIR: /cv_kaggle/vggsfm/phototourism resume_ckpt: /cv_kaggle/vggsfm/vggsfm_v102.bin MODEL: target: vggsfm.models.VGGSfM TRACK: target: vggsfm.models.TrackerPredictor efficient_corr: false COARSE: stride: 4 down_ratio: 2 FEATURENET: target: vggsfm.models.BasicEncoder PREDICTOR: target: vggsfm.models.BaseTrackerPredictor FINE: FEATURENET: target: vggsfm.models.ShallowEncoder PREDICTOR: target: vggsfm.models.BaseTrackerPredictor depth: 4 corr_levels: 3 corr_radius: 3 latent_dim: 32 hidden_size: 256 fine: true use_spaceatt: false CAMERA: target: vggsfm.models.CameraPredictor TRIANGULAE: target: vggsfm.models.Triangulator Distributed environment: NO Num processes: 1 Process index: 0 Local process index: 0 Device: cpu

Mixed precision type: no

----------Seed is set to 0 now---------- Using cache found in C:\Users\ricky/.cache\torch\hub\facebookresearch_dinov2_main C:\Users\ricky/.cache\torch\hub\facebookresearch_dinov2_main\dinov2\layers\swiglu_ffn.py:51: UserWarning: xFormers is not available (SwiGLU) warnings.warn("xFormers is not available (SwiGLU)") C:\Users\ricky/.cache\torch\hub\facebookresearch_dinov2_main\dinov2\layers\attention.py:33: UserWarning: xFormers is not available (Attention) warnings.warn("xFormers is not available (Attention)") C:\Users\ricky/.cache\torch\hub\facebookresearch_dinov2_main\dinov2\layers\block.py:40: UserWarning: xFormers is not available (Block) warnings.warn("xFormers is not available (Block)") [2024-05-18 00:20:43,363][dinov2][INFO] - using MLP layer as FFN IMC_DIR is /cv_kaggle/vggsfm/phototourism Following error occured when loading h5 file /cv_kaggle\calibration/calibration_44607396_3564517896.h5: [Errno 2] Unable to synchronously open file (unable to open file: name = '/cv_kaggle\calibration/calibration_44607396_3564517896.h5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0) Error executing job with overrides: [] Traceback (most recent call last): File "test.py", line 316, in test_fn() File "C:\Users\ricky\anaconda3\envs\vggsfm\lib\site-packages\hydra\main.py", line 94, in decorated_main _run_hydra( File "C:\Users\ricky\anaconda3\envs\vggsfm\lib\site-packages\hydra_internal\utils.py", line 394, in _run_hydra
_run_app( File "C:\Users\ricky\anaconda3\envs\vggsfm\lib\site-packages\hydra_internal\utils.py", line 457, in _run_app
run_and_report( File "C:\Users\ricky\anaconda3\envs\vggsfm\lib\site-packages\hydra_internal\utils.py", line 223, in run_and_report raise ex File "C:\Users\ricky\anaconda3\envs\vggsfm\lib\site-packages\hydra_internal\utils.py", line 220, in run_andreport return func() File "C:\Users\ricky\anaconda3\envs\vggsfm\lib\site-packages\hydra_internal\utils.py", line 458, in
lambda: hydra.run( File "C:\Users\ricky\anaconda3\envs\vggsfm\lib\site-packages\hydra_internal\hydra.py", line 132, in run
= ret.return_value File "C:\Users\ricky\anaconda3\envs\vggsfm\lib\site-packages\hydra\core\utils.py", line 260, in return_value
raise self._return_value File "C:\Users\ricky\anaconda3\envs\vggsfm\lib\site-packages\hydra\core\utils.py", line 186, in run_job ret.return_value = task_function(task_cfg) File "test.py", line 60, in test_fn test_dataset = IMCDataset(IMC_DIR=cfg.IMC_DIR, split="test", img_size=1024, normalize_cameras=False, cfg=cfg) File "C:\cv_kaggle\vggsfm\vggsfm\datasets\imc.py", line 82, in init intri = torch.from_numpy(np.copy(calib["K"])) KeyError: 'K'

jytime commented 4 months ago

Well first it looks you are running it on Windows, which is much more tricky than Linux. I would recommend to use Linux if possible. Besides, it seems the problem comes from the data loading process. Probably you can make a pdb at this line to see if the calib file exists and if it has all the keys as it should. You need to do something like:

import pdb;pdb.set_trace()
calib_dict = load_calib([calib_file]) 

for the code at: https://github.com/facebookresearch/vggsfm/blob/f490bc11b3eb68c1aa832fcd2e230ffacbf575fd/vggsfm/datasets/imc.py#L79

danzel-crazy commented 4 months ago

Ok, I will try to run on windows wsl2, maybe it will make the implement much easier