diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index bfabd5f..cca3e1f 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -19,6 +19,6 @@ jobs: cache: 'pip' - run: python -m pip install --upgrade pip - run: python -m pip install .[dev] - - run: python -m flake8 common/*.py hloc/*.py hloc/matchers/*.py hloc/extractors/*.py - - run: python -m isort common/*.py hloc/*.py hloc/matchers/*.py hloc/extractors/*.py --check-only --diff - - run: python -m black common/*.py hloc/*.py hloc/matchers/*.py hloc/extractors/*.py --check --diff \ No newline at end of file + - run: python -m flake8 ui/*.py hloc/*.py hloc/matchers/*.py hloc/extractors/*.py + - run: python -m isort ui/*.py hloc/*.py hloc/matchers/*.py hloc/extractors/*.py --check-only --diff + - run: python -m black ui/*.py hloc/*.py hloc/matchers/*.py hloc/extractors/*.py --check --diff \ No newline at end of file diff --git a/README.md b/README.md index c789192..bd02d4b 100644 --- a/README.md +++ b/README.md @@ -101,7 +101,7 @@ then open http://localhost:7860 in your browser. ### Add your own feature / matcher -I provide an example to add local feature in [hloc/extractors/example.py](hloc/extractors/example.py). Then add feature settings in `confs` in file [hloc/extract_features.py](hloc/extract_features.py). Last step is adding some settings to `matcher_zoo` in file [common/config.yaml](common/config.yaml). +I provide an example to add local feature in [hloc/extractors/example.py](hloc/extractors/example.py). Then add feature settings in `confs` in file [hloc/extract_features.py](hloc/extract_features.py). Last step is adding some settings to `matcher_zoo` in file [ui/config.yaml](ui/config.yaml). ## Contributions welcome! diff --git a/app.py b/app.py index f567dc8..b168e26 100644 --- a/app.py +++ b/app.py @@ -1,6 +1,6 @@ import argparse from pathlib import Path -from common.app_class import ImageMatchingApp +from ui.app_class import ImageMatchingApp if __name__ == "__main__": parser = argparse.ArgumentParser() @@ -19,7 +19,7 @@ parser.add_argument( "--config", type=str, - default=Path(__file__).parent / "common/config.yaml", + default=Path(__file__).parent / "ui/config.yaml", help="config file", ) args = parser.parse_args() diff --git a/format.sh b/format.sh index 278a456..377f041 100644 --- a/format.sh +++ b/format.sh @@ -1,3 +1,3 @@ -python -m flake8 common/*.py hloc/*.py hloc/matchers/*.py hloc/extractors/*.py -python -m isort common/*.py hloc/*.py hloc/matchers/*.py hloc/extractors/*.py -python -m black common/*.py hloc/*.py hloc/matchers/*.py hloc/extractors/*.py \ No newline at end of file +python -m flake8 ui/*.py hloc/*.py hloc/matchers/*.py hloc/extractors/*.py +python -m isort ui/*.py hloc/*.py hloc/matchers/*.py hloc/extractors/*.py +python -m black ui/*.py hloc/*.py hloc/matchers/*.py hloc/extractors/*.py \ No newline at end of file diff --git a/hloc/matchers/imp.py b/hloc/matchers/imp.py index b79e21a..ca64980 100644 --- a/hloc/matchers/imp.py +++ b/hloc/matchers/imp.py @@ -4,7 +4,7 @@ import torch -from .. import device, logger +from .. import DEVICE, logger from ..utils.base_model import BaseModel pram_path = Path(__file__).parent / "../../third_party/pram" @@ -34,7 +34,7 @@ class IMP(BaseModel): def _init(self, conf): self.conf = {**self.default_conf, **conf} weight_path = pram_path / "weights" / self.conf["model_name"] - self.net = GML(self.conf).eval().to(device) + self.net = GML(self.conf).eval().to(DEVICE) self.net.load_state_dict( torch.load(weight_path, map_location="cpu")["model"], strict=True ) diff --git a/pyproject.toml b/pyproject.toml index 4e77a75..2d4c90b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,10 +20,10 @@ dynamic = ["dependencies"] dev = ["black", "flake8", "isort"] [tool.setuptools.packages.find] -include = ["hloc*", "common",] +include = ["hloc*", "ui",] [tool.setuptools.package-data] -common = ["*.yaml"] +ui = ["*.yaml"] [tool.setuptools.dynamic] dependencies = {file = ["requirements.txt"]} diff --git a/test_app_cli.py b/test_app_cli.py index e9ca772..12dd8f5 100644 --- a/test_app_cli.py +++ b/test_app_cli.py @@ -3,13 +3,13 @@ import numpy as np from pathlib import Path from hloc import logger -from common.utils import ( +from ui.utils import ( get_matcher_zoo, load_config, DEVICE, ROOT, ) -from common.api import ImageMatchingAPI +from ui.api import ImageMatchingAPI def test_all(config: dict = None): @@ -109,6 +109,6 @@ def test_one(): if __name__ == "__main__": - config = load_config(ROOT / "common/config.yaml") + config = load_config(ROOT / "ui/config.yaml") test_one() test_all(config) diff --git a/third_party/pram b/third_party/pram index 7135cb9..96929f8 160000 --- a/third_party/pram +++ b/third_party/pram @@ -1 +1 @@ -Subproject commit 7135cb9590df9c1d0de13e5ebc18bdd1a2384833 +Subproject commit 96929f8c7f10b158036e078f7cc5363c4a2dcbcb diff --git a/common/__init__.py b/ui/__init__.py similarity index 100% rename from common/__init__.py rename to ui/__init__.py diff --git a/common/api.py b/ui/api.py similarity index 99% rename from common/api.py rename to ui/api.py index c56503d..bcbd697 100644 --- a/common/api.py +++ b/ui/api.py @@ -289,5 +289,5 @@ def visualize( if __name__ == "__main__": - config = load_config(ROOT / "common/config.yaml") + config = load_config(ROOT / "ui/config.yaml") api = ImageMatchingAPI(config) diff --git a/common/app_class.py b/ui/app_class.py similarity index 99% rename from common/app_class.py rename to ui/app_class.py index ebba28a..50917a7 100644 --- a/common/app_class.py +++ b/ui/app_class.py @@ -4,7 +4,7 @@ import gradio as gr import numpy as np -from common.utils import ( +from ui.utils import ( GRADIO_VERSION, gen_examples, generate_warp_images, diff --git a/common/config.yaml b/ui/config.yaml similarity index 100% rename from common/config.yaml rename to ui/config.yaml index 1160ddd..dff927f 100644 --- a/common/config.yaml +++ b/ui/config.yaml @@ -370,11 +370,11 @@ matcher_zoo: display: true sfd2+imp: + enable: false + skip_ci: true matcher: imp feature: sfd2 - enable: false dense: false - skip_ci: true info: name: SFD2+IMP #dispaly name source: "CVPR 2023" @@ -384,11 +384,11 @@ matcher_zoo: display: true sfd2+mnn: + enable: false + skip_ci: true matcher: NN-mutual feature: sfd2 - enable: false dense: false - skip_ci: true info: name: SFD2+MNN #dispaly name source: "CVPR 2023" diff --git a/common/utils.py b/ui/utils.py similarity index 100% rename from common/utils.py rename to ui/utils.py diff --git a/common/viz.py b/ui/viz.py similarity index 100% rename from common/viz.py rename to ui/viz.py