alexstoken / image-matching-models

Code to easily try 30 (and growing) different image matching methods
https://earthloc-and-earthmatch.github.io/
BSD 3-Clause "New" or "Revised" License
262 stars 17 forks source link

Issue while Running the main_matcher.py #11

Closed paidiakileswar closed 1 month ago

paidiakileswar commented 1 month ago

While running the script i am getting to stop here , Please let me know how to solve this ->

(pytorch) ubuntu@ml-ultra-high-spot-04:~/workdir/akil/image-matching-models$ python main_matcher.py --matcher loftr --device cuda --out_dir ./outputs/loftr/ --input pairs_dup.txt

Traceback (most recent call last):
  File "/home/ubuntu/workdir/akil/image-matching-models/main_matcher.py", line 13, in <module>
    from matching.utils import get_image_pairs_paths
  File "/home/ubuntu/workdir/akil/image-matching-models/matching/__init__.py", line 9, in <module>
    from .utils import supress_stdout
  File "/home/ubuntu/workdir/akil/image-matching-models/matching/utils.py", line 36, in <module>
    def to_numpy(x: torch.Tensor | np.ndarray | dict | list) -> np.ndarray:
TypeError: unsupported operand type(s) for |: 'torch._C._TensorMeta' and 'type'

I tried with cpu but it didnt works.. My server nvidia a100 GPU

Cuda version 11.8

Torch version

>>> print(torch.__version__)
2.4.0+cu118

My python version -> Python 3.9.19

Steps I done ->

git clone --recursive https://github.com/gmberton/image-matching-models
cd image-matching-models
pip install -r requirements.txt 
python -m pip install -e .

All are installed successfully

paidiakileswar commented 1 month ago

Solved when using

python 3.10 version

Also -> Add this if helpful while running with eloftr =>

python -m pip install pytorch-lightning
alexstoken commented 1 month ago

Hi,

As you discovered, this type hint style was part of the python 3.10 update. I have added python3.10 as a minimum requirement for now, and we can consider changing this to typing.Optional in a future update (like here).

I've also updated the install instructions after merging #12 . It includes the eloftr hint you mentioned as well, as an optional dependency in the pyproject.toml.

Happy matching! Closing as resolved, feel free to reopen if you find any other issues.