diff --git a/.github/workflows/pr_test_cpu.yml b/.github/workflows/pr_test_cpu.yml index b997f16947..b5d31f99a5 100644 --- a/.github/workflows/pr_test_cpu.yml +++ b/.github/workflows/pr_test_cpu.yml @@ -25,24 +25,24 @@ jobs: - os: 'MacOS-latest' pytorch-dtype: 'float64' - uses: kornia/workflows/.github/workflows/tests.yml@v1.6.0 + uses: kornia/workflows/.github/workflows/tests.yml@v1.8.1 with: os: ${{ matrix.os }} python-version: '["3.8", "3.11"]' - pytorch-version: '["1.9.1", "2.2.0"]' + pytorch-version: '["1.9.1", "2.2.2"]' pytorch-dtype: ${{ matrix.pytorch-dtype }} coverage: - uses: kornia/workflows/.github/workflows/coverage.yml@v1.6.0 + uses: kornia/workflows/.github/workflows/coverage.yml@v1.8.1 typing: - uses: kornia/workflows/.github/workflows/mypy.yml@v1.6.0 + uses: kornia/workflows/.github/workflows/mypy.yml@v1.8.1 tutorials: - uses: kornia/workflows/.github/workflows/tutorials.yml@v1.6.0 + uses: kornia/workflows/.github/workflows/tutorials.yml@v1.8.1 docs: - uses: kornia/workflows/.github/workflows/docs.yml@v1.6.0 + uses: kornia/workflows/.github/workflows/docs.yml@v1.8.1 collector: needs: [coverage, tests-cpu, tutorials, typing, docs] @@ -63,7 +63,7 @@ jobs: os: ['Ubuntu-latest', 'Windows-latest'] #, 'MacOS-latest'] add it when https://github.com/pytorch/pytorch/pull/89262 be merged pytorch-dtype: ['float32', 'float64'] - uses: kornia/workflows/.github/workflows/tests.yml@v1.6.0 + uses: kornia/workflows/.github/workflows/tests.yml@v1.8.1 with: os: ${{ matrix.os }} pytorch-version: '["nightly"]' diff --git a/.github/workflows/scheduled_test_cpu.yml b/.github/workflows/scheduled_test_cpu.yml index a045916615..9fa1a9cf84 100644 --- a/.github/workflows/scheduled_test_cpu.yml +++ b/.github/workflows/scheduled_test_cpu.yml @@ -18,11 +18,11 @@ jobs: # os: ['Ubuntu-latest', 'Windows-latest', 'MacOS-latest'] pytorch-dtype: ['float32', 'float64'] - uses: kornia/workflows/.github/workflows/tests.yml@v1.6.0 + uses: kornia/workflows/.github/workflows/tests.yml@v1.8.1 with: os: 'Ubuntu-latest' python-version: '["3.8", "3.9", "3.10", "3.11"]' - pytorch-version: '["1.9.1", "1.10.2", "1.11.0", "1.12.1", "1.13.1", "2.0.1", "2.1.2", "2.2.0"]' + pytorch-version: '["1.9.1", "1.10.2", "1.11.0", "1.12.1", "1.13.1", "2.0.1", "2.1.2", "2.2.2"]' pytorch-dtype: ${{ matrix.pytorch-dtype }} pytest-extra: '--runslow' @@ -34,11 +34,11 @@ jobs: matrix: pytorch-dtype: ['float32', 'float64'] - uses: kornia/workflows/.github/workflows/tests.yml@v1.6.0 + uses: kornia/workflows/.github/workflows/tests.yml@v1.8.1 with: os: 'Windows-latest' python-version: '["3.11"]' - pytorch-version: '["1.9.1", "2.2.0"]' + pytorch-version: '["1.9.1", "2.2.2"]' pytorch-dtype: ${{ matrix.pytorch-dtype }} tests-cpu-mac: @@ -47,19 +47,19 @@ jobs: matrix: pytorch-dtype: ['float32', 'float64'] - uses: kornia/workflows/.github/workflows/tests.yml@v1.6.0 + uses: kornia/workflows/.github/workflows/tests.yml@v1.8.1 with: os: 'MacOS-latest' pytorch-dtype: ${{ matrix.pytorch-dtype }} coverage: - uses: kornia/workflows/.github/workflows/coverage.yml@v1.6.0 + uses: kornia/workflows/.github/workflows/coverage.yml@v1.8.1 typing: - uses: kornia/workflows/.github/workflows/mypy.yml@v1.6.0 + uses: kornia/workflows/.github/workflows/mypy.yml@v1.8.1 tutorials: - uses: kornia/workflows/.github/workflows/tutorials.yml@v1.6.0 + uses: kornia/workflows/.github/workflows/tutorials.yml@v1.8.1 docs: - uses: kornia/workflows/.github/workflows/docs.yml@v1.6.0 + uses: kornia/workflows/.github/workflows/docs.yml@v1.8.1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c0c7ff52d3..6c01fed951 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,12 +15,12 @@ repos: exclude: ^$|.devcontainer - repo: https://github.com/tox-dev/pyproject-fmt - rev: "1.7.0" + rev: "1.8.0" hooks: - id: pyproject-fmt - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.3.7 + rev: v0.4.1 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] diff --git a/docs/source/conf.py b/docs/source/conf.py index 4bb6b40e62..96f19d814f 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -2,6 +2,7 @@ import inspect import os import sys +from datetime import datetime, timezone # readthedocs generated the whole documentation in an isolated environment # by cloning the git repo. Thus, any on-the-fly operation will not effect @@ -71,7 +72,7 @@ # General information about the project. project = "Kornia" author = f"{project} developers" -copyright = f"2019, {author}" +copyright = f"{datetime.now(tz=timezone.utc).year}, {author}" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -168,7 +169,6 @@ html_css_files = ["css/main.css"] html_js_files = ["js/custom.js"] - # Configure viewcode extension. # based on https://github.com/readthedocs/sphinx-autoapi/issues/202 code_url = "https://github.com/kornia/kornia/blob/main" @@ -233,14 +233,12 @@ def linkcode_resolve(domain, info): # author, documentclass [howto, manual, or own class]). latex_documents = [(master_doc, "kornia.tex", "Kornia", "manual")] - # -- Options for manual page output --------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [(master_doc, "Kornia", "Kornia Documentation", [author], 1)] - # -- Options for Texinfo output ------------------------------------------- # Grouping the document tree into Texinfo files. List of tuples @@ -258,7 +256,6 @@ def linkcode_resolve(domain, info): ) ] - # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = { "python": ("https://docs.python.org/3/", None), diff --git a/kornia/feature/dedode/dedode.py b/kornia/feature/dedode/dedode.py index e2eb3c97d6..90c35d41d3 100644 --- a/kornia/feature/dedode/dedode.py +++ b/kornia/feature/dedode/dedode.py @@ -17,6 +17,7 @@ "L-upright": "https://github.com/Parskatt/DeDoDe/releases/download/dedode_pretrained_models/dedode_detector_L.pth", "L-C4": "https://github.com/georg-bn/rotation-steerers/releases/download/release-2/dedode_detector_C4.pth", "L-SO2": "https://github.com/georg-bn/rotation-steerers/releases/download/release-2/dedode_detector_SO2.pth", + "L-C4-v2": "https://github.com/Parskatt/DeDoDe/releases/download/v2/dedode_detector_L_v2.pth", }, "descriptor": { "B-upright": "https://github.com/Parskatt/DeDoDe/releases/download/dedode_pretrained_models/dedode_descriptor_B.pth", @@ -41,7 +42,7 @@ class DeDoDe(Module): amp_dtype: The automatic mixed precision desired. Example: - >>> dedode = DeDoDe.from_pretrained(detector_weights="L-upright", descriptor_weights="B-upright") + >>> dedode = DeDoDe.from_pretrained(detector_weights="L-C4-v2", descriptor_weights="B-upright") >>> images = torch.randn(1, 3, 256, 256) >>> keypoints, scores = dedode.detect(images) >>> descriptions = dedode.describe(images, keypoints = keypoints) @@ -168,22 +169,22 @@ def describe( @classmethod def from_pretrained( cls, - detector_weights: str = "L-upright", + detector_weights: str = "L-C4-v2", descriptor_weights: str = "G-upright", amp_dtype: torch.dtype = torch.float16, ) -> Module: r"""Loads a pretrained model. - Depth model was trained using depth map supervision and is slightly more precise but biased to detect keypoints - only where SfM depth is available. Epipolar model was trained using epipolar geometry supervision and - is less precise but detects keypoints everywhere where they are matchable. The difference is especially - pronounced on thin structures and on edges of objects. - Args: - detector_weights: The weights to load for the detector. One of 'L-upright', 'L-C4', 'L-SO2'. + detector_weights: The weights to load for the detector. + One of 'L-upright' (original paper, https://arxiv.org/abs/2308.08479), + 'L-C4', 'L-SO2' (from steerers, better for rotations, https://arxiv.org/abs/2312.02152), + 'L-C4-v2' (from dedode v2, better at rotations, less clustering, https://arxiv.org/abs/2404.08928) + Default is 'L-C4-v2', but perhaps it should be 'L-C4-v2'? descriptor_weights: The weights to load for the descriptor. - One of 'B-upright', 'B-C4', 'B-SO2', 'G-upright', 'G-C4'. - checkpoint: The checkpoint to load. One of 'depth' or 'epipolar'. + One of 'B-upright','G-upright' (original paper, https://arxiv.org/abs/2308.08479), + 'B-C4', 'B-SO2', 'G-C4' (from steerers, better for rotations, https://arxiv.org/abs/2312.02152). + Default is 'G-upright'. amp_dtype: the dtype to use for the model. One of torch.float16 or torch.float32. Default is torch.float16, suitable for CUDA. Use torch.float32 for CPU or MPS diff --git a/tests/feature/test_dedode.py b/tests/feature/test_dedode.py index f27f9042f1..be6af1016c 100644 --- a/tests/feature/test_dedode.py +++ b/tests/feature/test_dedode.py @@ -42,7 +42,7 @@ def test_smoke_amp_fp16(self, dtype, device, descriptor_model, detector_model): assert descriptions.shape == (shape[0], n, 256) @pytest.mark.slow - @pytest.mark.parametrize("detector_weights", ["L-upright", "L-C4", "L-SO2"]) + @pytest.mark.parametrize("detector_weights", ["L-upright", "L-C4", "L-SO2", "L-C4-v2"]) @pytest.mark.parametrize("descriptor_weights", ["B-upright", "B-C4", "B-SO2", "G-upright", "G-C4"]) def test_pretrained(self, dtype, device, descriptor_weights, detector_weights): if "G" in descriptor_weights and device.type != "cuda" and dtype == torch.float16: