Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update: rename common -> ui #47

Merged
merged 3 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
- 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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!

Expand Down
4 changes: 2 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
@@ -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()
Expand All @@ -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()
Expand Down
6 changes: 3 additions & 3 deletions format.sh
Original file line number Diff line number Diff line change
@@ -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
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
4 changes: 2 additions & 2 deletions hloc/matchers/imp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
)
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]}
Expand Down
6 changes: 3 additions & 3 deletions test_app_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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)
2 changes: 1 addition & 1 deletion third_party/pram
Submodule pram updated 1 files
+5 −4 nets/gml.py
File renamed without changes.
2 changes: 1 addition & 1 deletion common/api.py → ui/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion common/app_class.py → ui/app_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions common/config.yaml → ui/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
File renamed without changes.
File renamed without changes.
Loading