cvg / glue-factory

Training library for local feature detection and matching
Apache License 2.0
722 stars 90 forks source link

errors when evaling on datasets #7

Closed kajo-kurisu closed 11 months ago

kajo-kurisu commented 11 months ago

when i run this command python -m gluefactory.eval.hpatches --conf superpoint+lightglue-official --overwrite the following error appears


Running benchmark: hpatches
Experiment tag: superpoint+lightglue-official
Config:
{'checkpoint': None,
 'data': {'batch_size': 1,
          'name': 'hpatches',
          'num_workers': 16,
          'preprocessing': {'resize': 480, 'side': 'short'}},
 'eval': {'estimator': 'opencv', 'ransac_th': 0.5},
 'model': {'extractor': {'detection_threshold': 0.0,
                         'max_num_keypoints': 1024,
                         'name': 'gluefactory_nonfree.superpoint',
                         'nms_radius': 3},
           'ground_truth': {'name': None},
           'matcher': {'depth_confidence': -1,
                       'features': 'superpoint',
                       'filter_threshold': 0.1,
                       'name': 'matchers.lightglue_pretrained',
                       'width_confidence': -1},
           'name': 'two_view_pipeline'}}
Traceback (most recent call last):
  File "/media/sy/data2/anaconda3/envs/torch1.13/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/media/sy/data2/anaconda3/envs/torch1.13/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/sy/sy/glue-factory/gluefactory/eval/hpatches.py", line 190, in <module>
    s, f, r = pipeline.run(
  File "/home/sy/sy/glue-factory/gluefactory/eval/eval_pipeline.py", line 83, in run
    pred_file = self.get_predictions(
  File "/home/sy/sy/glue-factory/gluefactory/eval/hpatches.py", line 83, in get_predictions
    model = load_model(self.conf.model, self.conf.checkpoint)
  File "/home/sy/sy/glue-factory/gluefactory/eval/io.py", line 91, in load_model
    model = get_model("two_view_pipeline")(model_conf).eval()
  File "/home/sy/sy/glue-factory/gluefactory/models/base_model.py", line 84, in __init__
    self._init(conf)
  File "/home/sy/sy/glue-factory/gluefactory/models/two_view_pipeline.py", line 49, in _init
    self.matcher = get_model(conf.matcher.name)(to_ctr(conf.matcher))
  File "/home/sy/sy/glue-factory/gluefactory/models/base_model.py", line 84, in __init__
    self._init(conf)
  File "/home/sy/sy/glue-factory/gluefactory/models/matchers/lightglue_pretrained.py", line 20, in _init
    self.net = LightGlue_(dconf.pop("features"), **dconf).cuda()
TypeError: __init__() got an unexpected keyword argument 'name'

and when i run this command python -m gluefactory.eval.megadepth1500 --conf aliked+lightglue_megadepth it gives the following result

AUC {0.5: [0.0, 0.0, 0.0]}
mAA {0.5: 0.0}
best threshold = 0.5
{'mepi_prec@1e-3': nan,
 'mepi_prec@1e-4': nan,
 'mepi_prec@5e-4': nan,
 'mnum_keypoints': 2048.0,
 'mnum_matches': 0.0,
 'mransac_inl': 0.0,
 'mransac_inl%': 0.0,
 'mrel_pose_error': nan,
 'rel_pose_error@10°': 0.0,
 'rel_pose_error@20°': 0.0,
 'rel_pose_error@5°': 0.0,
 'rel_pose_error_mAA': 0.0}
sarlinpe commented 11 months ago
  1. The HPatches command runs fine on my end. Can you make sure that your LightGLue dependency is up to date?
    python -m pip install --upgrade git+https://github.com/cvg/LightGlue.git
  2. This second commands requires that you have first trained a LightGlue model for ALIKED, as we have not yet release the corresponding model (but will do so in the next days). The code should indeed fail here - we'll fix it.
kajo-kurisu commented 11 months ago
  1. i run this command python -m pip install --upgrade git+https://github.com/cvg/LightGlue.git and it seems my dependency is satisfied
    
    Collecting git+https://github.com/cvg/LightGlue.git
    Cloning https://github.com/cvg/LightGlue.git to /tmp/pip-req-build-gbldimh9
    Running command git clone --filter=blob:none --quiet https://github.com/cvg/LightGlue.git /tmp/pip-req-build-gbldimh9
    Resolved https://github.com/cvg/LightGlue.git to commit 94443d0a76cc76b38c4f044e88b5bc3bb238f175
    Preparing metadata (setup.py) ... done
    Requirement already satisfied: torch>=1.9.1 in /media/sy/data2/anaconda3/envs/torch2.1/lib/python3.8/site-packages (from lightglue==0.0) (2.1.0)
    Requirement already satisfied: torchvision>=0.3 in /media/sy/data2/anaconda3/envs/torch2.1/lib/python3.8/site-packages (from lightglue==0.0) (0.16.0)
    Requirement already satisfied: numpy in /media/sy/data2/anaconda3/envs/torch2.1/lib/python3.8/site-packages (from lightglue==0.0) (1.24.4)
    Requirement already satisfied: opencv-python in /home/sy/.local/lib/python3.8/site-packages (from lightglue==0.0) (4.7.0.72)
    Requirement already satisfied: matplotlib in /media/sy/data2/anaconda3/envs/torch2.1/lib/python3.8/site-packages (from lightglue==0.0) (3.7.3)
    Requirement already satisfied: kornia>=0.6.11 in /media/sy/data2/anaconda3/envs/torch2.1/lib/python3.8/site-packages (from lightglue==0.0) (0.7.0)
    Requirement already satisfied: packaging in /home/sy/.local/lib/python3.8/site-packages (from kornia>=0.6.11->lightglue==0.0) (23.1)
    Requirement already satisfied: filelock in /media/sy/data2/anaconda3/envs/torch2.1/lib/python3.8/site-packages (from torch>=1.9.1->lightglue==0.0) (3.12.4)
    Requirement already satisfied: typing-extensions in /home/sy/.local/lib/python3.8/site-packages (from torch>=1.9.1->lightglue==0.0) (4.6.1)
    Requirement already satisfied: sympy in /media/sy/data2/anaconda3/envs/torch2.1/lib/python3.8/site-packages (from torch>=1.9.1->lightglue==0.0) (1.12)
    Requirement already satisfied: networkx in /home/sy/.local/lib/python3.8/site-packages (from torch>=1.9.1->lightglue==0.0) (2.8.8)
    Requirement already satisfied: jinja2 in /home/sy/.local/lib/python3.8/site-packages (from torch>=1.9.1->lightglue==0.0) (3.1.2)
    Requirement already satisfied: fsspec in /media/sy/data2/anaconda3/envs/torch2.1/lib/python3.8/site-packages (from torch>=1.9.1->lightglue==0.0) (2023.9.2)
    Requirement already satisfied: nvidia-cuda-nvrtc-cu12==12.1.105 in /media/sy/data2/anaconda3/envs/torch2.1/lib/python3.8/site-packages (from torch>=1.9.1->lightglue==0.0) (12.1.105)
    Requirement already satisfied: nvidia-cuda-runtime-cu12==12.1.105 in /media/sy/data2/anaconda3/envs/torch2.1/lib/python3.8/site-packages (from torch>=1.9.1->lightglue==0.0) (12.1.105)
    Requirement already satisfied: nvidia-cuda-cupti-cu12==12.1.105 in /media/sy/data2/anaconda3/envs/torch2.1/lib/python3.8/site-packages (from torch>=1.9.1->lightglue==0.0) (12.1.105)
    Requirement already satisfied: nvidia-cudnn-cu12==8.9.2.26 in /media/sy/data2/anaconda3/envs/torch2.1/lib/python3.8/site-packages (from torch>=1.9.1->lightglue==0.0) (8.9.2.26)
    Requirement already satisfied: nvidia-cublas-cu12==12.1.3.1 in /media/sy/data2/anaconda3/envs/torch2.1/lib/python3.8/site-packages (from torch>=1.9.1->lightglue==0.0) (12.1.3.1)
    Requirement already satisfied: nvidia-cufft-cu12==11.0.2.54 in /media/sy/data2/anaconda3/envs/torch2.1/lib/python3.8/site-packages (from torch>=1.9.1->lightglue==0.0) (11.0.2.54)
    Requirement already satisfied: nvidia-curand-cu12==10.3.2.106 in /media/sy/data2/anaconda3/envs/torch2.1/lib/python3.8/site-packages (from torch>=1.9.1->lightglue==0.0) (10.3.2.106)
    Requirement already satisfied: nvidia-cusolver-cu12==11.4.5.107 in /media/sy/data2/anaconda3/envs/torch2.1/lib/python3.8/site-packages (from torch>=1.9.1->lightglue==0.0) (11.4.5.107)
    Requirement already satisfied: nvidia-cusparse-cu12==12.1.0.106 in /media/sy/data2/anaconda3/envs/torch2.1/lib/python3.8/site-packages (from torch>=1.9.1->lightglue==0.0) (12.1.0.106)
    Requirement already satisfied: nvidia-nccl-cu12==2.18.1 in /media/sy/data2/anaconda3/envs/torch2.1/lib/python3.8/site-packages (from torch>=1.9.1->lightglue==0.0) (2.18.1)
    Requirement already satisfied: nvidia-nvtx-cu12==12.1.105 in /media/sy/data2/anaconda3/envs/torch2.1/lib/python3.8/site-packages (from torch>=1.9.1->lightglue==0.0) (12.1.105)
    Requirement already satisfied: triton==2.1.0 in /media/sy/data2/anaconda3/envs/torch2.1/lib/python3.8/site-packages (from torch>=1.9.1->lightglue==0.0) (2.1.0)
    Requirement already satisfied: nvidia-nvjitlink-cu12 in /media/sy/data2/anaconda3/envs/torch2.1/lib/python3.8/site-packages (from nvidia-cusolver-cu12==11.4.5.107->torch>=1.9.1->lightglue==0.0) (12.2.140)
    Requirement already satisfied: requests in /home/sy/.local/lib/python3.8/site-packages (from torchvision>=0.3->lightglue==0.0) (2.31.0)
    Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in /media/sy/data2/anaconda3/envs/torch2.1/lib/python3.8/site-packages (from torchvision>=0.3->lightglue==0.0) (10.0.1)
    Requirement already satisfied: contourpy>=1.0.1 in /media/sy/data2/anaconda3/envs/torch2.1/lib/python3.8/site-packages (from matplotlib->lightglue==0.0) (1.1.1)
    Requirement already satisfied: cycler>=0.10 in /media/sy/data2/anaconda3/envs/torch2.1/lib/python3.8/site-packages (from matplotlib->lightglue==0.0) (0.12.1)
    Requirement already satisfied: fonttools>=4.22.0 in /media/sy/data2/anaconda3/envs/torch2.1/lib/python3.8/site-packages (from matplotlib->lightglue==0.0) (4.43.1)
    Requirement already satisfied: kiwisolver>=1.0.1 in /media/sy/data2/anaconda3/envs/torch2.1/lib/python3.8/site-packages (from matplotlib->lightglue==0.0) (1.4.5)
    Requirement already satisfied: pyparsing>=2.3.1 in /media/sy/data2/anaconda3/envs/torch2.1/lib/python3.8/site-packages (from matplotlib->lightglue==0.0) (3.1.1)
    Requirement already satisfied: python-dateutil>=2.7 in /home/sy/.local/lib/python3.8/site-packages (from matplotlib->lightglue==0.0) (2.8.2)
    Requirement already satisfied: importlib-resources>=3.2.0 in /home/sy/.local/lib/python3.8/site-packages (from matplotlib->lightglue==0.0) (6.1.0)
    Requirement already satisfied: zipp>=3.1.0 in /media/sy/data2/anaconda3/envs/torch2.1/lib/python3.8/site-packages (from importlib-resources>=3.2.0->matplotlib->lightglue==0.0) (3.17.0)
    Requirement already satisfied: six>=1.5 in /media/sy/data2/anaconda3/envs/torch2.1/lib/python3.8/site-packages (from python-dateutil>=2.7->matplotlib->lightglue==0.0) (1.16.0)
    Requirement already satisfied: MarkupSafe>=2.0 in /home/sy/.local/lib/python3.8/site-packages (from jinja2->torch>=1.9.1->lightglue==0.0) (2.1.3)
    Requirement already satisfied: charset-normalizer<4,>=2 in /home/sy/.local/lib/python3.8/site-packages (from requests->torchvision>=0.3->lightglue==0.0) (3.1.0)
    Requirement already satisfied: idna<4,>=2.5 in /media/sy/data2/anaconda3/envs/torch2.1/lib/python3.8/site-packages (from requests->torchvision>=0.3->lightglue==0.0) (3.4)
    Requirement already satisfied: urllib3<3,>=1.21.1 in /media/sy/data2/anaconda3/envs/torch2.1/lib/python3.8/site-packages (from requests->torchvision>=0.3->lightglue==0.0) (2.0.6)
    Requirement already satisfied: certifi>=2017.4.17 in /media/sy/data2/anaconda3/envs/torch2.1/lib/python3.8/site-packages (from requests->torchvision>=0.3->lightglue==0.0) (2023.7.22)
    Requirement already satisfied: mpmath>=0.19 in /media/sy/data2/anaconda3/envs/torch2.1/lib/python3.8/site-packages (from sympy->torch>=1.9.1->lightglue==0.0) (1.3.0)
    Building wheels for collected packages: lightglue
    Building wheel for lightglue (setup.py) ... done
    Created wheel for lightglue: filename=lightglue-0.0-py3-none-any.whl size=24430 sha256=ecf7f7b8ce744684a2d30279637b49f28fc8492d039754ae5a88973685ae36f8
    Stored in directory: /tmp/pip-ephem-wheel-cache-y1w6iehb/wheels/02/66/84/f22739c829e327be2f244d338cbb11d48a81cf22cc1996d8c3
    Successfully built lightglue
    Installing collected packages: lightglue
    Successfully installed lightglue-0.0

but when i run  python -m gluefactory.eval.hpatches --conf superpoint+lightglue-official --overwrite again,the same error occurres.
then i change my torch version to torch1.13, the error still exists.

2. looking forward to ur nice work, thank u 
sarlinpe commented 11 months ago

It is very clear that this issue could only occur with an outdated version of LightGlue. You might be updating it in a different environment than you are running gluefactory. You might first try to uninstall LightGlue completely.

kajo-kurisu commented 11 months ago

problem fixed, appreciate it.