Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

[docs] revamp the documentation site (#4155)

Jian Shi4dd3cdc0171d
diff --git a/.gitignore b/.gitignore
index 248d615a1..3593e710e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,6 +22,8 @@ docs/source/_static/*jpg
docs/source/_static/img/*jpg
docs/source/_static/scripts/*
docs/source/get-started/performance.rst
+docs/source/community/adoption.rst
+docs/source/_generated/
*DS_Store
*jpg
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 01c238f96..266485799 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased
+### Added
+
+* The documentation site was rebuilt on `pydata-sphinx-theme` with a top navigation bar
+ (Learn / API / Models plus Ecosystem, About and Support menus), a redesigned landing page, a
+ restructured API reference with per-topic subpages, and a long list of fixed doc examples and
+ removed dead interactive demos. Old deep links into the split module pages
+ (e.g. `augmentation.module.html#kornia.augmentation.RandomAffine`) are forwarded to the subpage
+ that now documents the object, so existing links keep resolving. The previous furo layout remains
+ available with `KORNIA_DOCS_THEME=furo`. (#4155)
+* An **Adoption** page (`community/adoption`) listing the most-starred GitHub repositories and
+ packages that depend on kornia, rendered at build time from `docs/source/_data/dependents.json`;
+ `docs/fetch_dependents.py` refreshes that snapshot from GitHub's dependency graph. (#4155)
+
### Breaking changes
* `extract_patches_from_pyramid` now samples ordinary-sized inputs once from a packed pyramid atlas instead of
diff --git a/docs/fetch_dependents.py b/docs/fetch_dependents.py
new file mode 100644
index 000000000..d68cbd646
--- /dev/null
+++ b/docs/fetch_dependents.py
@@ -0,0 +1,189 @@
+# LICENSE HEADER MANAGED BY add-license-header
+#
+# Copyright 2018 Kornia Team
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+"""Collect kornia's dependents from GitHub's dependency graph into docs/source/_data/dependents.json.
+
+GitHub shows "Used by" on the repository page and lists every dependent at
+``github.com/kornia/kornia/network/dependents``, but exposes neither through the REST or GraphQL
+API. This script walks that HTML listing -- one page of 30 per request, cursor-paginated -- for
+repositories and for packages, and stores the exact totals plus the most-starred entries.
+
+Run it by hand and commit the refreshed JSON -- for instance before a release; there is deliberately
+no scheduled job for it. ``generate_adoption.py`` renders the file into the Adoption page at
+docs-build time::
+
+ python docs/fetch_dependents.py # full crawl (~330 requests, ~10 min)
+ python docs/fetch_dependents.py --max-pages 5 # quick refresh of the totals
+
+A partial crawl (``--max-pages`` or a network failure) merges into the existing file, so the totals
+are always current and the ranking only ever gets more complete.
+"""
+
+from __future__ import annotations
+
+import argparse
+import html
+import json
+import re
+import sys
+import time
+import urllib.error
+import urllib.request
+from datetime import UTC, datetime
+from pathlib import Path
+
+REPO = Path(__file__).resolve().parents[1]
+OUT = REPO / "docs" / "source" / "_data" / "dependents.json"
+
+DEPENDENTS_URL = "https://github.com/kornia/kornia/network/dependents"
+USER_AGENT = "kornia-docs-dependents/1.0 (+https://github.com/kornia/kornia)"
+KEEP_TOP = 300 # entries stored per kind, ranked by stars
+DELAY_S = 1.0 # between requests; GitHub serves this page without auth but rate-limits bursts
+
+_COUNT_RE = {
+ "repositories": re.compile(r">\s*([\d,]+)\s*Repositor(?:y|ies)\s*<"), # codespell:ignore repositor
+ "packages": re.compile(r">\s*([\d,]+)\s*Packages?\s*<"),
+}
+_ROW_SPLIT_RE = re.compile(r'<div class="Box-row[^"]*"')
+_REPO_RE = re.compile(r'data-hovercard-type="repository"[^>]*href="/([^/"]+/[^/"]+)"')
+_NUMBER_RE = re.compile(r"</svg>\s*([\d,]+)\s*</span>")
+_NEXT_RE = re.compile(r'href="[^"]*dependents_after=([A-Za-z0-9_=-]+)[^"]*"[^>]*>\s*Next\s*<')
+
+
+def _get(url: str, retries: int = 5) -> str:
+ """Fetch a page, backing off on rate limiting and transient server errors."""
+ if not url.startswith("https://github.com/"):
+ raise ValueError(f"refusing to fetch {url!r}: only GitHub HTTPS pages are crawled")
+ delay = 30.0
+ for attempt in range(retries):
+ request = urllib.request.Request(url, headers={"User-Agent": USER_AGENT}) # noqa: S310 - scheme checked above
+ try:
+ with urllib.request.urlopen(request, timeout=60) as response: # noqa: S310
+ return response.read().decode("utf-8", errors="replace")
+ except urllib.error.HTTPError as exc:
+ if exc.code not in (429, 500, 502, 503, 504) or attempt == retries - 1:
+ raise
+ wait = float(exc.headers.get("Retry-After") or delay)
+ except (urllib.error.URLError, TimeoutError):
+ if attempt == retries - 1:
+ raise
+ wait = delay
+ print(f" {url}: retrying in {wait:.0f}s", file=sys.stderr)
+ time.sleep(wait)
+ delay *= 2
+ raise RuntimeError("unreachable")
+
+
+def parse_page(page: str) -> tuple[dict[str, int], list[dict], str | None]:
+ """Return (totals, rows, next_cursor) from one dependents page."""
+ totals = {}
+ for kind, pattern in _COUNT_RE.items():
+ match = pattern.search(page)
+ if match:
+ totals[kind] = int(match.group(1).replace(",", ""))
+
+ rows = []
+ for chunk in _ROW_SPLIT_RE.split(page)[1:]:
+ repo = _REPO_RE.search(chunk)
+ if not repo:
+ continue
+ numbers = [int(n.replace(",", "")) for n in _NUMBER_RE.findall(chunk)[:2]]
+ stars, forks = (numbers + [0, 0])[:2]
+ rows.append({"name": html.unescape(repo.group(1)), "stars": stars, "forks": forks})
+
+ next_match = _NEXT_RE.search(page)
+ return totals, rows, next_match.group(1) if next_match else None
+
+
+def crawl(kind: str, max_pages: int) -> tuple[int | None, list[dict], bool]:
+ """Walk one listing. Returns (total, rows, complete); a network failure ends the walk early."""
+ dependent_type = "REPOSITORY" if kind == "repositories" else "PACKAGE"
+ url = f"{DEPENDENTS_URL}?dependent_type={dependent_type}"
+ total, rows, cursor, pages = None, [], None, 0
+ while True:
+ page_url = url if cursor is None else f"{url}&dependents_after={cursor}"
+ try:
+ totals, page_rows, cursor = parse_page(_get(page_url))
+ except (urllib.error.URLError, TimeoutError) as exc:
+ print(f" {kind}: stopping after {pages} pages: {exc!r}", file=sys.stderr)
+ return total, rows, False
+ total = totals.get(kind, total)
+ rows.extend(page_rows)
+ pages += 1
+ if pages % 50 == 0:
+ print(f" {kind}: {pages} pages, {len(rows)} rows", file=sys.stderr)
+ if cursor is None:
+ return total, rows, True
+ if max_pages and pages >= max_pages:
+ return total, rows, False
+ time.sleep(DELAY_S)
+
+
+def load_existing() -> dict:
+ if OUT.exists():
+ return json.loads(OUT.read_text())
+ return {}
+
+
+def merge(existing: dict, kind: str, total: int | None, rows: list[dict], complete: bool) -> dict:
+ """Replace the stored ranking after a complete crawl; extend it after a partial one."""
+ previous = existing.get(kind, {})
+ items = {} if complete else {item["name"]: item for item in previous.get("items", [])}
+ for row in rows:
+ items[row["name"]] = row
+ ranked = sorted(items.values(), key=lambda item: (-item["stars"], item["name"].lower()))
+ # GitHub's listing stops paginating well before its own total (about 9,700 of 17,500 repositories
+ # in 2026), so ``complete`` means "walked to the end of what GitHub serves", and ``listed`` says
+ # how many rows that was.
+ listed = len(rows) if complete else max(previous.get("listed", 0), len(rows))
+ return {
+ "count": total if total is not None else previous.get("count", 0),
+ "items": ranked[:KEEP_TOP],
+ "complete": complete,
+ "listed": listed,
+ }
+
+
+def main(argv: list[str] | None = None) -> int:
+ parser = argparse.ArgumentParser(description=__doc__.split("\n\n")[0])
+ parser.add_argument("--max-pages", type=int, default=0, help="stop each listing after N pages (0 = all)")
+ parser.add_argument("--kind", choices=["repositories", "packages"], action="append", help="limit to one listing")
+ parser.add_argument("--out", type=Path, default=OUT)
+ args = parser.parse_args(argv)
+
+ data = load_existing()
+ for kind in args.kind or ["repositories", "packages"]:
+ print(f"crawling {kind}...", file=sys.stderr)
+ total, rows, complete = crawl(kind, args.max_pages)
+ if total is None and not rows:
+ continue # nothing new; keep the previous entry untouched
+ data[kind] = merge(data, kind, total, rows, complete)
+ print(
+ f" {kind}: {data[kind]['count']:,} total, {len(rows)} rows fetched, complete={complete}",
+ file=sys.stderr,
+ )
+
+ data["generated_at"] = datetime.now(UTC).strftime("%Y-%m-%d")
+ data["source"] = DEPENDENTS_URL
+ args.out.parent.mkdir(parents=True, exist_ok=True)
+ args.out.write_text(json.dumps(data, indent=2, sort_keys=True) + "\n")
+ print(f"wrote {args.out}", file=sys.stderr)
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/docs/generate_adoption.py b/docs/generate_adoption.py
new file mode 100644
index 000000000..0235c63c0
--- /dev/null
+++ b/docs/generate_adoption.py
@@ -0,0 +1,188 @@
+# LICENSE HEADER MANAGED BY add-license-header
+#
+# Copyright 2018 Kornia Team
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+"""Render docs/source/community/adoption.rst from docs/source/_data/dependents.json.
+
+The JSON is refreshed by running ``fetch_dependents.py`` by hand and committing the result; this
+module turns it into the Adoption page at docs-build time, the same way ``generate_benchmarks.py``
+renders the Performance page. ``load_counts()`` also feeds the numbers into ``rst_epilog``
+substitutions (``|count-dependents|`` and friends) so other pages can quote them without a second copy.
+"""
+
+from __future__ import annotations
+
+import json
+from pathlib import Path
+
+REPO = Path(__file__).resolve().parents[1]
+DATA = REPO / "docs" / "source" / "_data" / "dependents.json"
+OUT = REPO / "docs" / "source" / "community" / "adoption.rst"
+
+TOP_REPOSITORIES = 30
+TOP_PACKAGES = 30
+
+
+def load_data() -> dict:
+ return json.loads(DATA.read_text())
+
+
+def load_counts(data: dict | None = None) -> dict[str, int | str]:
+ """Numbers other pages quote: exact counts, a rounded headline figure, and the snapshot date."""
+ data = data or load_data()
+ repositories = int(data.get("repositories", {}).get("count", 0))
+ packages = int(data.get("packages", {}).get("count", 0))
+ return {
+ "repositories": repositories,
+ "packages": packages,
+ # rows GitHub's listing exposes; it stops paginating before its own total (see fetch_dependents.merge)
+ "repositories_listed": int(data.get("repositories", {}).get("listed", 0)),
+ "packages_listed": int(data.get("packages", {}).get("listed", 0)),
+ "repositories_rounded": _round_headline(repositories),
+ "generated_at": str(data.get("generated_at", "")),
+ }
+
+
+def _round_headline(count: int) -> str:
+ """17,565 -> '17K'; 1,234 -> '1.2K'; 987 -> '987'. Never rounds up past the real figure."""
+ if count >= 10_000:
+ return f"{count // 1000}K"
+ if count >= 1_000:
+ return f"{count / 1000:.1f}K".replace(".0K", "K")
+ return str(count)
+
+
+def _table(items: list[dict], limit: int) -> str:
+ rows = [" * - Repository", " - Stars", " - Forks"]
+ for item in items[:limit]:
+ name = item["name"]
+ rows += [
+ f" * - `{name} <https://github.com/{name}>`__",
+ f" - {item['stars']:,}",
+ f" - {item['forks']:,}",
+ ]
+ return "\n".join(rows)
+
+
+def render_page(data: dict) -> str:
+ counts = load_counts(data)
+ repos = data.get("repositories", {})
+ packages = data.get("packages", {})
+ repo_items = repos.get("items", [])
+ package_items = packages.get("items", [])
+ date = counts["generated_at"]
+ description = (
+ f"Who uses Kornia: {counts['repositories']:,} public GitHub repositories and {counts['packages']:,} "
+ "packages depend on it, according to GitHub's dependency graph."
+ )
+
+ return f"""\
+.. This page is generated at build time by docs/generate_adoption.py from
+ docs/source/_data/dependents.json. Edit those, not this file.
+
+Adoption
+========
+
+.. meta::
+ :description: {description}
+
+.. grid:: 1 2 2 2
+ :gutter: 3
+ :class-container: kornia-cards kornia-adoption
+
+ .. grid-item-card::
+ :link: adoption-packages
+ :link-type: ref
+ :class-card: kornia-adoption-card
+
+ .. rst-class:: kornia-adoption-count
+
+ {counts["packages"]:,}
+
+ **packages** built on Kornia
+
+ .. grid-item-card::
+ :link: adoption-repositories
+ :link-type: ref
+ :class-card: kornia-adoption-card
+
+ .. rst-class:: kornia-adoption-count
+
+ {counts["repositories"]:,}
+
+ **repositories** depend on Kornia
+
+**{counts["repositories"]:,} public repositories** and **{counts["packages"]:,} packages** on GitHub
+declare kornia as a dependency, according to GitHub's dependency graph on {date}.
+
+The figures come from the `Used by <{data.get("source", "https://github.com/kornia/kornia/network/dependents")}>`__
+listing of the kornia repository. They count projects that name ``kornia`` in a manifest GitHub can
+read -- ``requirements.txt``, ``pyproject.toml``, ``setup.py``, ``environment.yml`` and the like --
+so private repositories, Docker images, notebooks and copied source are not included. A script in
+the repository, ``docs/fetch_dependents.py``, walks that listing and the snapshot it takes is
+committed; this page is rendered from it whenever the documentation is built.
+
+If kornia is part of your research, please also :doc:`cite the paper </get-started/about>`.
+
+.. _adoption-packages:
+
+Packages built on kornia
+------------------------
+
+Libraries and tools that build on kornia and are themselves published as packages -- the
+{min(TOP_PACKAGES, len(package_items))} most-starred:
+
+.. list-table::
+ :header-rows: 1
+ :widths: 70 15 15
+ :class: kornia-adoption-table
+
+{_table(package_items, TOP_PACKAGES)}
+
+.. _adoption-repositories:
+
+Most-starred dependent repositories
+-----------------------------------
+
+Public repositories that declare kornia as a dependency -- the {min(TOP_REPOSITORIES, len(repo_items))}
+most-starred:
+
+.. list-table::
+ :header-rows: 1
+ :widths: 70 15 15
+ :class: kornia-adoption-table
+
+{_table(repo_items, TOP_REPOSITORIES)}
+
+Add your project
+----------------
+
+These lists are generated from GitHub's dependency graph and ranked by stars -- nothing to submit; a
+project appears once it declares kornia as a dependency and the snapshot is next refreshed. If your
+project depends on kornia and you would like it featured here
+or elsewhere in the documentation, write to `[email protected] <mailto:[email protected]>`__ with a link
+and a line about what it does.
+"""
+
+
+def main() -> dict[str, int | str]:
+ data = load_data()
+ OUT.write_text(render_page(data))
+ return load_counts(data)
+
+
+if __name__ == "__main__":
+ print(main())
diff --git a/docs/generate_benchmarks.py b/docs/generate_benchmarks.py
index f2f036ba8..99a4aabaf 100644
--- a/docs/generate_benchmarks.py
+++ b/docs/generate_benchmarks.py
@@ -15,20 +15,38 @@
# limitations under the License.
#
-"""Render docs/source/get-started/performance.rst from benchmarks/results/**.json."""
+"""Render docs/source/get-started/performance.rst from benchmarks/results/**.json.
+
+The same result files feed the landing page: ``render_hero_svg`` draws the CPU-vs-accelerator bar
+chart in the hero's "GPU-accelerated" tab, so the figures there are read from the committed run
+rather than typed in.
+"""
from __future__ import annotations
import json
import re
import sys
+from html import escape
from pathlib import Path
REPO = Path(__file__).resolve().parents[1]
RESULTS = REPO / "benchmarks" / "results"
OUT = REPO / "docs" / "source" / "get-started" / "performance.rst"
+HERO_OUT = REPO / "docs" / "source" / "_generated" / "hero-benchmark.html"
LLMS_FULL = REPO / "docs" / "source" / "_extra" / "llms-full.txt"
+# The one comparison the landing page draws: a kornia op at one batch size, CPU against the
+# accelerator of the same machine. ``machine`` is a preference; any machine with both a CPU and an
+# accelerator result set for the latest version is used when that one is absent.
+HERO = {
+ "suite": "augmentation",
+ "machine": "apple-m1",
+ "op": "RandomGaussianBlur",
+ "batch": 32,
+ "backend": "kornia (eager)",
+}
+
BEGIN, END = "<!-- BENCH:BEGIN -->", "<!-- BENCH:END -->"
INTRO = """\
@@ -108,6 +126,93 @@ def render_page(results_root: Path) -> str:
return "\n".join(parts)
+def _throughput(payload: dict, op: str, batch: int, backend: str) -> float | None:
+ for row in payload["results"]:
+ if row["op"] == op and row["batch"] == batch and row["backend"] == backend:
+ value = row.get("throughput_per_s")
+ return float(value) if isinstance(value, (int, float)) else None
+ return None
+
+
+def hero_figures(results_root: Path) -> dict | None:
+ """CPU and accelerator throughput of the ``HERO`` op from the latest committed result set.
+
+ Returns ``None`` when no machine has both measurements, so the caller can leave the chart out.
+ """
+ data = load_results(results_root)
+ if not data:
+ return None
+ version = latest_version(list(data))
+ by_machine: dict[str, dict[str, dict]] = {}
+ for fname, payload in data[version].items():
+ suite, slug, device = fname[:-5].split("--")
+ if suite == HERO["suite"]:
+ by_machine.setdefault(slug, {})[device] = payload
+ machines = sorted(by_machine, key=lambda slug: (slug != HERO["machine"], slug))
+ for slug in machines:
+ devices = by_machine[slug]
+ accelerators = sorted(device for device in devices if device != "cpu")
+ if "cpu" not in devices or not accelerators:
+ continue
+ cpu = _throughput(devices["cpu"], HERO["op"], HERO["batch"], HERO["backend"])
+ gpu = _throughput(devices[accelerators[0]], HERO["op"], HERO["batch"], HERO["backend"])
+ if cpu is None or gpu is None or cpu <= 0:
+ continue
+ meta = devices[accelerators[0]]["metadata"]
+ return {
+ "machine": slug.replace("-", " ").title(), # "apple-m1" -> "Apple M1"
+ "device": accelerators[0],
+ "cpu": cpu,
+ "gpu": gpu,
+ "speedup": gpu / cpu,
+ "kornia": meta["kornia"],
+ "torch": meta["torch"],
+ }
+ return None
+
+
+def render_hero_svg(results_root: Path) -> str:
+ """The landing page's CPU-vs-accelerator bar chart, as an HTML fragment; empty when there is no data."""
+ fig = hero_figures(results_root)
+ if fig is None:
+ return ""
+ full, left = 516, 80 # the longer bar spans the chart; the other is scaled to it
+ longest = max(fig["cpu"], fig["gpu"])
+
+ def bar(y: int, value: float, text: str, fill: str, text_class: str) -> str:
+ width = round(full * value / longest)
+ rect = f'<rect x="{left}" y="{y}" width="{width}" height="32" rx="6" class="{fill}"/>'
+ if width == full: # no room to the right: print the value inside the bar, right-aligned
+ anchor = f'x="{left + width - 12}" y="{y + 23}" class="illo-value {text_class}" text-anchor="end"'
+ else:
+ anchor = f'x="{left + width + 12}" y="{y + 23}" class="illo-value"'
+ return f"{rect}\n <text {anchor}>{text}</text>"
+
+ faster = "GPU" if fig["gpu"] >= fig["cpu"] else "CPU"
+ ratio = max(fig["gpu"], fig["cpu"]) / min(fig["gpu"], fig["cpu"])
+ speedup = f" Β· {ratio:.1f}\N{MULTIPLICATION SIGN} faster"
+ cpu_text = f"{fig['cpu']:,.0f} img/s" + (speedup if faster == "CPU" else "")
+ gpu_text = f"{fig['gpu']:,.0f} img/s" + (speedup if faster == "GPU" else "")
+ title = escape(f"{HERO['op']} Β· batch {HERO['batch']} Β· {fig['machine']}")
+ label = escape(
+ f"{HERO['op']} at batch {HERO['batch']} on an {fig['machine']}: {fig['cpu']:,.0f} images per second on "
+ f"the CPU, {fig['gpu']:,.0f} on the GPU"
+ )
+ note = escape(f"items/s, eager mode β€” committed benchmark run, kornia {fig['kornia']} / torch {fig['torch']}")
+ return f"""\
+<div class="kornia-tab-visual">
+ <svg class="kornia-illo" viewBox="0 0 640 220" role="img" aria-label="{label}">
+ <text x="24" y="36" class="illo-title">{title}</text>
+ <text x="24" y="90" class="illo-label">CPU</text>
+ {bar(68, fig["cpu"], cpu_text, "illo-muted", "")}
+ <text x="24" y="152" class="illo-label">GPU</text>
+ {bar(130, fig["gpu"], gpu_text, "illo-primary", "illo-on-primary")}
+ <text x="24" y="204" class="illo-note">{note}</text>
+ </svg>
+</div>
+"""
+
+
def _digest(results_root: Path) -> str:
data = load_results(results_root)
if not data:
@@ -145,6 +250,8 @@ def refresh_llms(llms_path: Path, results_root: Path) -> None:
def main() -> None:
OUT.write_text(render_page(RESULTS))
+ HERO_OUT.parent.mkdir(exist_ok=True)
+ HERO_OUT.write_text(render_hero_svg(RESULTS))
if __name__ == "__main__":
diff --git a/docs/generate_examples.py b/docs/generate_examples.py
index 6c0e5bef5..a67542aba 100644
--- a/docs/generate_examples.py
+++ b/docs/generate_examples.py
@@ -119,6 +119,7 @@ def main():
"https://github.com/kornia/data/raw/main/kornia_banner_pixie.png"
)
MASK_IMAGE_URL2: str = "https://raw.githubusercontent.com/kornia/data/main/simba_mask.png"
+ BASE_IMAGE_URL_CROWD: str = "https://raw.githubusercontent.com/kornia/data/main/crowd.jpg" # face detection
OUTPUT_PATH = Path(__file__).absolute().parent / "source/_static/img"
@@ -746,6 +747,23 @@ def main():
sig = f"{fn_name}({', '.join([str(a) for a in args])})"
print(f"Generated image example for response function {fn_name}")
+ # Face detection with the pretrained YuNet model, for the landing-page "models" card. The
+ # checkpoint is ~400 KB, so this stays cheap in the docs build. ``img_crowd`` is BGR like the
+ # other tensors here; the detector gets RGB and the boxes are drawn onto the BGR copy for cv2.
+ img_crowd = read_img_from_url(BASE_IMAGE_URL_CROWD, (480, 736))
+ face_detector = K.contrib.FaceDetector().eval()
+ with torch.no_grad():
+ detections = face_detector(K.color.bgr_to_rgb(img_crowd) * 255.0)[0]
+ faces = [K.contrib.FaceDetectorResult(d) for d in detections]
+ boxes = torch.stack([torch.cat([f.top_left, f.bottom_right]) for f in faces if f.score > 0.7])[None]
+ out = img_crowd.clone()
+ for pad in (0, 1, 2): # three passes give a 3 px outline
+ out = K.image.draw_rectangle(
+ out, boxes + torch.tensor([-pad, -pad, pad, pad]), color=torch.tensor([0.4, 1.0, 0.2])
+ )
+ cv2.imwrite(str(OUTPUT_PATH / "face_detection.png"), K.image.tensor_to_image((out[0] * 255.0).byte()))
+ print(f"Generated image example for FaceDetector. {boxes.shape[1]} faces")
+
if __name__ == "__main__":
main()
diff --git a/docs/source/_data/dependents.json b/docs/source/_data/dependents.json
new file mode 100644
index 000000000..7362cdc08
--- /dev/null
+++ b/docs/source/_data/dependents.json
@@ -0,0 +1,2463 @@
+{
+ "generated_at": "2026-09-02",
+ "packages": {
+ "complete": true,
+ "count": 321,
+ "items": [
+ {
+ "forks": 7640,
+ "name": "fastai/fastai",
+ "stars": 28130
+ },
+ {
+ "forks": 2968,
+ "name": "invoke-ai/InvokeAI",
+ "stars": 28113
+ },
+ {
+ "forks": 3603,
+ "name": "NVIDIA-NeMo/Speech",
+ "stars": 18376
+ },
+ {
+ "forks": 1070,
+ "name": "lucidrains/DALLE2-pytorch",
+ "stars": 11302
+ },
+ {
+ "forks": 2854,
+ "name": "open-mmlab/mmsegmentation",
+ "stars": 9939
+ },
+ {
+ "forks": 1150,
+ "name": "roboflow/rf-detr",
+ "stars": 9140
+ },
+ {
+ "forks": 962,
+ "name": "modelscope/modelscope",
+ "stars": 9121
+ },
+ {
+ "forks": 795,
+ "name": "lucidrains/imagen-pytorch",
+ "stars": 8425
+ },
+ {
+ "forks": 471,
+ "name": "brycedrennan/imaginAIry",
+ "stars": 8179
+ },
+ {
+ "forks": 1010,
+ "name": "kyegomez/swarms",
+ "stars": 7117
+ },
+ {
+ "forks": 1340,
+ "name": "Trusted-AI/adversarial-robustness-toolbox",
+ "stars": 6213
+ },
+ {
+ "forks": 977,
+ "name": "open-edge-platform/anomalib",
+ "stars": 6110
+ },
+ {
+ "forks": 582,
+ "name": "torchgeo/torchgeo",
+ "stars": 4166
+ },
+ {
+ "forks": 225,
+ "name": "TencentARC/T2I-Adapter",
+ "stars": 3801
+ },
+ {
+ "forks": 582,
+ "name": "lucidrains/stylegan2-pytorch",
+ "stars": 3783
+ },
+ {
+ "forks": 397,
+ "name": "catalyst-team/catalyst",
+ "stars": 3382
+ },
+ {
+ "forks": 297,
+ "name": "henrywoo/pyllama",
+ "stars": 2778
+ },
+ {
+ "forks": 260,
+ "name": "georgia-tech-db/evadb",
+ "stars": 2672
+ },
+ {
+ "forks": 400,
+ "name": "crowsonkb/k-diffusion",
+ "stars": 2600
+ },
+ {
+ "forks": 518,
+ "name": "Lightning-AI/torchmetrics",
+ "stars": 2465
+ },
+ {
+ "forks": 248,
+ "name": "lucidrains/byol-pytorch",
+ "stars": 1902
+ },
+ {
+ "forks": 211,
+ "name": "Lightning-Universe/lightning-flash",
+ "stars": 1722
+ },
+ {
+ "forks": 267,
+ "name": "takuseno/d3rlpy",
+ "stars": 1684
+ },
+ {
+ "forks": 219,
+ "name": "lucidrains/lightweight-gan",
+ "stars": 1682
+ },
+ {
+ "forks": 221,
+ "name": "WecoAI/aideml",
+ "stars": 1498
+ },
+ {
+ "forks": 166,
+ "name": "gradslam/gradslam",
+ "stars": 1423
+ },
+ {
+ "forks": 142,
+ "name": "huggingface/finetrainers",
+ "stars": 1359
+ },
+ {
+ "forks": 477,
+ "name": "open-edge-platform/geti",
+ "stars": 1325
+ },
+ {
+ "forks": 128,
+ "name": "Vincentqyw/image-matching-webui",
+ "stars": 1301
+ },
+ {
+ "forks": 119,
+ "name": "plemeri/transparent-background",
+ "stars": 1287
+ },
+ {
+ "forks": 208,
+ "name": "qualcomm/ai-hub-models",
+ "stars": 1195
+ },
+ {
+ "forks": 80,
+ "name": "gmberton/vismatch",
+ "stars": 910
+ },
+ {
+ "forks": 212,
+ "name": "deepinv/deepinv",
+ "stars": 799
+ },
+ {
+ "forks": 262,
+ "name": "weecology/DeepForest",
+ "stars": 769
+ },
+ {
+ "forks": 110,
+ "name": "computational-cell-analytics/micro-sam",
+ "stars": 716
+ },
+ {
+ "forks": 197,
+ "name": "kornia/kornia-rs",
+ "stars": 699
+ },
+ {
+ "forks": 34,
+ "name": "lucidrains/magvit2-pytorch",
+ "stars": 668
+ },
+ {
+ "forks": 95,
+ "name": "greentfrapp/lucent",
+ "stars": 664
+ },
+ {
+ "forks": 77,
+ "name": "3DOM-FBK/deep-image-matching",
+ "stars": 546
+ },
+ {
+ "forks": 36,
+ "name": "JalaliLabUCLA/phycv",
+ "stars": 526
+ },
+ {
+ "forks": 76,
+ "name": "nodetool-ai/nodetool",
+ "stars": 509
+ },
+ {
+ "forks": 24,
+ "name": "KohakuBlueleaf/PixelOE",
+ "stars": 489
+ },
+ {
+ "forks": 69,
+ "name": "NVlabs/trajdata",
+ "stars": 456
+ },
+ {
+ "forks": 88,
+ "name": "argoverse/av2-api",
+ "stars": 414
+ },
+ {
+ "forks": 28,
+ "name": "Auto1111SDK/Auto1111SDK",
+ "stars": 414
+ },
+ {
+ "forks": 95,
+ "name": "cosanlab/py-feat",
+ "stars": 385
+ },
+ {
+ "forks": 43,
+ "name": "aristoteleo/spateo-release",
+ "stars": 343
+ },
+ {
+ "forks": 55,
+ "name": "paninski-lab/lightning-pose",
+ "stars": 319
+ },
+ {
+ "forks": 58,
+ "name": "galilai-group/stable-pretraining",
+ "stars": 306
+ },
+ {
+ "forks": 50,
+ "name": "eigenvivek/DiffDRR",
+ "stars": 289
+ },
+ {
+ "forks": 27,
+ "name": "lucidrains/pixel-level-contrastive-learning",
+ "stars": 267
+ },
+ {
+ "forks": 39,
+ "name": "instanseg/instanseg",
+ "stars": 237
+ },
+ {
+ "forks": 67,
+ "name": "MathOnco/valis",
+ "stars": 236
+ },
+ {
+ "forks": 24,
+ "name": "lightning-uq-box/lightning-uq-box",
+ "stars": 229
+ },
+ {
+ "forks": 10,
+ "name": "ethanweber/toon3d",
+ "stars": 225
+ },
+ {
+ "forks": 114,
+ "name": "DeepWok/mase",
+ "stars": 204
+ },
+ {
+ "forks": 38,
+ "name": "PyTomography/PyTomography",
+ "stars": 172
+ },
+ {
+ "forks": 35,
+ "name": "fieldsoftheworld/ftw-baselines",
+ "stars": 159
+ },
+ {
+ "forks": 11,
+ "name": "strath-ai/SatelliteCloudGenerator",
+ "stars": 156
+ },
+ {
+ "forks": 15,
+ "name": "lucidrains/transganformer",
+ "stars": 155
+ },
+ {
+ "forks": 16,
+ "name": "lucidrains/ETSformer-pytorch",
+ "stars": 154
+ },
+ {
+ "forks": 13,
+ "name": "lucidrains/contrastive-learner",
+ "stars": 153
+ },
+ {
+ "forks": 11,
+ "name": "apple/ml-pointersect",
+ "stars": 140
+ },
+ {
+ "forks": 34,
+ "name": "adobe/trustmark",
+ "stars": 138
+ },
+ {
+ "forks": 19,
+ "name": "nmichlo/disent",
+ "stars": 136
+ },
+ {
+ "forks": 8,
+ "name": "cnulab/HiAD",
+ "stars": 135
+ },
+ {
+ "forks": 31,
+ "name": "constantinpape/torch-em",
+ "stars": 128
+ },
+ {
+ "forks": 4,
+ "name": "3db/3db",
+ "stars": 126
+ },
+ {
+ "forks": 38,
+ "name": "jbohnslav/deepethogram",
+ "stars": 126
+ },
+ {
+ "forks": 4,
+ "name": "anguelos/tormentor",
+ "stars": 117
+ },
+ {
+ "forks": 21,
+ "name": "rajewsky-lab/openst",
+ "stars": 116
+ },
+ {
+ "forks": 13,
+ "name": "mehta-lab/VisCy",
+ "stars": 102
+ },
+ {
+ "forks": 12,
+ "name": "isaaccorley/pytorch-enhance",
+ "stars": 87
+ },
+ {
+ "forks": 15,
+ "name": "Unity-Technologies/datasetinsights",
+ "stars": 86
+ },
+ {
+ "forks": 20,
+ "name": "WildlifeDatasets/wildlife-tools",
+ "stars": 78
+ },
+ {
+ "forks": 7,
+ "name": "warner-benjamin/fastxtend",
+ "stars": 74
+ },
+ {
+ "forks": 6,
+ "name": "spencerwooo/torchattack",
+ "stars": 72
+ },
+ {
+ "forks": 20,
+ "name": "Haidra-Org/hordelib",
+ "stars": 70
+ },
+ {
+ "forks": 6,
+ "name": "facebookresearch/textseal",
+ "stars": 68
+ },
+ {
+ "forks": 1,
+ "name": "Knowledgator/LiqFit",
+ "stars": 68
+ },
+ {
+ "forks": 7,
+ "name": "kyegomez/StarlightVision",
+ "stars": 64
+ },
+ {
+ "forks": 5,
+ "name": "arnab39/equiadapt",
+ "stars": 61
+ },
+ {
+ "forks": 9,
+ "name": "Helmholtz-AI-Energy/HyDe",
+ "stars": 60
+ },
+ {
+ "forks": 6,
+ "name": "moverseai/moai",
+ "stars": 57
+ },
+ {
+ "forks": 3,
+ "name": "orobix/quadra",
+ "stars": 51
+ },
+ {
+ "forks": 14,
+ "name": "MICS-Lab/thunder",
+ "stars": 50
+ },
+ {
+ "forks": 6,
+ "name": "crp94/textile",
+ "stars": 49
+ },
+ {
+ "forks": 13,
+ "name": "IMSY-DKFZ/htc",
+ "stars": 49
+ },
+ {
+ "forks": 7,
+ "name": "graphbookai/graphbook",
+ "stars": 48
+ },
+ {
+ "forks": 0,
+ "name": "adam-mehdi/MuarAugment",
+ "stars": 47
+ },
+ {
+ "forks": 11,
+ "name": "predict-idlab/landmarker",
+ "stars": 47
+ },
+ {
+ "forks": 5,
+ "name": "CielAl/torch-staintools",
+ "stars": 46
+ },
+ {
+ "forks": 9,
+ "name": "angelolab/Nimbus-Inference",
+ "stars": 45
+ },
+ {
+ "forks": 5,
+ "name": "Qiyuan-Ge/PaintMind",
+ "stars": 41
+ },
+ {
+ "forks": 13,
+ "name": "RichieHakim/ROICaT",
+ "stars": 40
+ },
+ {
+ "forks": 1,
+ "name": "ducha-aiki/kornia_moons",
+ "stars": 37
+ },
+ {
+ "forks": 11,
+ "name": "bnnr-team/bnnr",
+ "stars": 35
+ },
+ {
+ "forks": 9,
+ "name": "lygitdata/GarmentIQ",
+ "stars": 34
+ },
+ {
+ "forks": 5,
+ "name": "easydiffusion/stable-diffusion",
+ "stars": 29
+ },
+ {
+ "forks": 15,
+ "name": "DeepTrackAI/deeplay",
+ "stars": 28
+ },
+ {
+ "forks": 7,
+ "name": "kornia/limbus",
+ "stars": 28
+ },
+ {
+ "forks": 2,
+ "name": "facebookresearch/distseal",
+ "stars": 27
+ },
+ {
+ "forks": 2,
+ "name": "novitalabs/litelama",
+ "stars": 26
+ },
+ {
+ "forks": 4,
+ "name": "bkntr/brainways",
+ "stars": 24
+ },
+ {
+ "forks": 5,
+ "name": "franioli/icepy4d",
+ "stars": 24
+ },
+ {
+ "forks": 5,
+ "name": "WanluLiuLab/SpatialMETA",
+ "stars": 24
+ },
+ {
+ "forks": 2,
+ "name": "dsgoficial/pytorch_segmentation_models_trainer",
+ "stars": 21
+ },
+ {
+ "forks": 0,
+ "name": "lgvaz/faststyle",
+ "stars": 21
+ },
+ {
+ "forks": 10,
+ "name": "talmolab/sleap-nn",
+ "stars": 21
+ },
+ {
+ "forks": 2,
+ "name": "chanzuckerberg/saber",
+ "stars": 19
+ },
+ {
+ "forks": 3,
+ "name": "core-ml/coreml",
+ "stars": 19
+ },
+ {
+ "forks": 6,
+ "name": "radionets-project/radionets",
+ "stars": 19
+ },
+ {
+ "forks": 0,
+ "name": "thegeniverse/geniverse",
+ "stars": 18
+ },
+ {
+ "forks": 3,
+ "name": "ducha-aiki/pixelstitch",
+ "stars": 17
+ },
+ {
+ "forks": 0,
+ "name": "chenoly/CRMark",
+ "stars": 16
+ },
+ {
+ "forks": 5,
+ "name": "IBM/heart-library",
+ "stars": 15
+ },
+ {
+ "forks": 7,
+ "name": "plstcharles/thelper",
+ "stars": 15
+ },
+ {
+ "forks": 1,
+ "name": "neggles/neurosis",
+ "stars": 14
+ },
+ {
+ "forks": 3,
+ "name": "QTIM-Lab/EyeLiner",
+ "stars": 14
+ },
+ {
+ "forks": 33,
+ "name": "db0/nataili",
+ "stars": 13
+ },
+ {
+ "forks": 3,
+ "name": "dell-research-harvard/efficient_ocr",
+ "stars": 12
+ },
+ {
+ "forks": 0,
+ "name": "DIYer22/calibdiff",
+ "stars": 12
+ },
+ {
+ "forks": 0,
+ "name": "Haidra-Org/hordelib_old",
+ "stars": 11
+ },
+ {
+ "forks": 0,
+ "name": "RViMLab/endoscopy",
+ "stars": 9
+ },
+ {
+ "forks": 1,
+ "name": "tum-pbs/ReViT",
+ "stars": 9
+ },
+ {
+ "forks": 1,
+ "name": "andesdatacube/satalign",
+ "stars": 8
+ },
+ {
+ "forks": 2,
+ "name": "arubique/STAI-tuned",
+ "stars": 8
+ },
+ {
+ "forks": 0,
+ "name": "Kitware/geowatch",
+ "stars": 8
+ },
+ {
+ "forks": 3,
+ "name": "BenjaminDev/courtvision",
+ "stars": 7
+ },
+ {
+ "forks": 2,
+ "name": "chfc-cmi/misas",
+ "stars": 7
+ },
+ {
+ "forks": 4,
+ "name": "convml/convml-tt",
+ "stars": 7
+ },
+ {
+ "forks": 1,
+ "name": "dkackman/diffusers-workflow",
+ "stars": 7
+ },
+ {
+ "forks": 1,
+ "name": "emaballarin/foveatorch",
+ "stars": 7
+ },
+ {
+ "forks": 1,
+ "name": "indzhykulianlab/hcat",
+ "stars": 7
+ },
+ {
+ "forks": 0,
+ "name": "RamailoTech/msu_unlearningalgorithm",
+ "stars": 7
+ },
+ {
+ "forks": 6,
+ "name": "RichieHakim/basic_neural_processing_modules",
+ "stars": 7
+ },
+ {
+ "forks": 0,
+ "name": "TeamEpochGithub/epochlib",
+ "stars": 7
+ },
+ {
+ "forks": 1,
+ "name": "chenoly/watermarklab",
+ "stars": 6
+ },
+ {
+ "forks": 0,
+ "name": "chrishamblin7/faccent",
+ "stars": 6
+ },
+ {
+ "forks": 1,
+ "name": "ducha-aiki/local_feature_tutorial",
+ "stars": 6
+ },
+ {
+ "forks": 1,
+ "name": "nathandecaux/labelprop",
+ "stars": 6
+ },
+ {
+ "forks": 2,
+ "name": "rotarzen/ToonCrafterSimple",
+ "stars": 5
+ },
+ {
+ "forks": 1,
+ "name": "samedii/perceptor",
+ "stars": 5
+ },
+ {
+ "forks": 2,
+ "name": "sign/image-to-human-avatar",
+ "stars": 5
+ },
+ {
+ "forks": 0,
+ "name": "simon-schaefer/torram",
+ "stars": 5
+ },
+ {
+ "forks": 1,
+ "name": "TidalPaladin/combustion",
+ "stars": 5
+ },
+ {
+ "forks": 0,
+ "name": "uni-medical/BioMaker",
+ "stars": 5
+ },
+ {
+ "forks": 0,
+ "name": "birdortyedi/grayness-index-python",
+ "stars": 4
+ },
+ {
+ "forks": 0,
+ "name": "bkntr/brainways-reg-model",
+ "stars": 4
+ },
+ {
+ "forks": 3,
+ "name": "kornia/limbus-components",
+ "stars": 4
+ },
+ {
+ "forks": 0,
+ "name": "cozy-creator/ostris-ai-toolkit",
+ "stars": 3
+ },
+ {
+ "forks": 1,
+ "name": "danieledema/synaesthesia",
+ "stars": 3
+ },
+ {
+ "forks": 0,
+ "name": "gorkaerana/meddle",
+ "stars": 3
+ },
+ {
+ "forks": 1,
+ "name": "IMSY-DKFZ/mml",
+ "stars": 3
+ },
+ {
+ "forks": 0,
+ "name": "justincdavis/oakutils",
+ "stars": 3
+ },
+ {
+ "forks": 0,
+ "name": "LEE-pyt/fhailib",
+ "stars": 3
+ },
+ {
+ "forks": 2,
+ "name": "Voyles-Group/ElectronCounting",
+ "stars": 3
+ },
+ {
+ "forks": 3,
+ "name": "xubiker/petroscope",
+ "stars": 3
+ },
+ {
+ "forks": 0,
+ "name": "Advanced-Vision-and-Learning-Lab/SARIAD",
+ "stars": 2
+ },
+ {
+ "forks": 0,
+ "name": "manbehindthemadness/modern-craft",
+ "stars": 2
+ },
+ {
+ "forks": 1,
+ "name": "RaphaelHaddad/3D_reconstruction_Tsinghua_2023",
+ "stars": 2
+ },
+ {
+ "forks": 1,
+ "name": "tnfru/unsupervised-on-policy",
+ "stars": 2
+ },
+ {
+ "forks": 0,
+ "name": "alexanderbrodko/sprite-pipeline",
+ "stars": 1
+ },
+ {
+ "forks": 3,
+ "name": "carbonscott/speckleNN",
+ "stars": 1
+ },
+ {
+ "forks": 1,
+ "name": "DeltaMod/DMU",
+ "stars": 1
+ },
+ {
+ "forks": 0,
+ "name": "EsdenRun/DIRAC",
+ "stars": 1
+ },
+ {
+ "forks": 6,
+ "name": "jlevy44/PathPretrain",
+ "stars": 1
+ },
+ {
+ "forks": 0,
+ "name": "kangig94/ffhq-align",
+ "stars": 1
+ },
+ {
+ "forks": 0,
+ "name": "m-pektas/IdentitySimilarity",
+ "stars": 1
+ },
+ {
+ "forks": 0,
+ "name": "PeterCalifano/pyTorchAutoForge",
+ "stars": 1
+ },
+ {
+ "forks": 0,
+ "name": "3db/threedboard",
+ "stars": 0
+ },
+ {
+ "forks": 0,
+ "name": "ayasyrev/imgread_benchmark",
+ "stars": 0
+ },
+ {
+ "forks": 0,
+ "name": "binarycode11/visidex",
+ "stars": 0
+ },
+ {
+ "forks": 0,
+ "name": "bthek1/FastAI_course",
+ "stars": 0
+ },
+ {
+ "forks": 1,
+ "name": "cwza/deep_t2i",
+ "stars": 0
+ },
+ {
+ "forks": 0,
+ "name": "jshirota/glidergun",
+ "stars": 0
+ },
+ {
+ "forks": 0,
+ "name": "kamilisjon/self-supervised",
+ "stars": 0
+ },
+ {
+ "forks": 0,
+ "name": "khanhduy1407/kdpy-imagen",
+ "stars": 0
+ },
+ {
+ "forks": 0,
+ "name": "M-106/Image-to-Image",
+ "stars": 0
+ },
+ {
+ "forks": 0,
+ "name": "mrfitzpa/emicroml",
+ "stars": 0
+ },
+ {
+ "forks": 0,
+ "name": "Murkyy/mmsegmentation-building",
+ "stars": 0
+ },
+ {
+ "forks": 1,
+ "name": "NKI-AI/ahcore-old",
+ "stars": 0
+ },
+ {
+ "forks": 0,
+ "name": "peterrenshaw/tw",
+ "stars": 0
+ },
+ {
+ "forks": 0,
+ "name": "shalusingh-tech/lightweight-gan",
+ "stars": 0
+ },
+ {
+ "forks": 0,
+ "name": "sharosoo/comfyui",
+ "stars": 0
+ },
+ {
+ "forks": 1,
+ "name": "tamchamchi/pysvgenius",
+ "stars": 0
+ },
+ {
+ "forks": 0,
+ "name": "tanimutomo/watermark-distortions",
+ "stars": 0
+ },
+ {
+ "forks": 0,
+ "name": "VTCSML/mrftools",
+ "stars": 0
+ },
+ {
+ "forks": 0,
+ "name": "wamitw/torch-hog",
+ "stars": 0
+ }
+ ],
+ "listed": 197
+ },
+ "repositories": {
+ "complete": true,
+ "count": 17565,
+ "items": [
+ {
+ "forks": 30560,
+ "name": "AUTOMATIC1111/stable-diffusion-webui",
+ "stars": 164769
+ },
+ {
+ "forks": 15447,
+ "name": "Comfy-Org/ComfyUI",
+ "stars": 131156
+ },
+ {
+ "forks": 21590,
+ "name": "vllm-project/vllm",
+ "stars": 90765
+ },
+ {
+ "forks": 8466,
+ "name": "google-research/google-research",
+ "stars": 38678
+ },
+ {
+ "forks": 3199,
+ "name": "chenfei-wu/TaskMatrix",
+ "stars": 33994
+ },
+ {
+ "forks": 2968,
+ "name": "invoke-ai/InvokeAI",
+ "stars": 28113
+ },
+ {
+ "forks": 3106,
+ "name": "Stability-AI/generative-models",
+ "stars": 27279
+ },
+ {
+ "forks": 11667,
+ "name": "spmallick/learnopencv",
+ "stars": 23114
+ },
+ {
+ "forks": 3603,
+ "name": "NVIDIA-NeMo/Speech",
+ "stars": 18376
+ },
+ {
+ "forks": 1525,
+ "name": "Tencent-Hunyuan/Hunyuan3D-2",
+ "stars": 14723
+ },
+ {
+ "forks": 5455,
+ "name": "unifyai/ivy",
+ "stars": 14170
+ },
+ {
+ "forks": 2692,
+ "name": "OpenTalker/SadTalker",
+ "stars": 14060
+ },
+ {
+ "forks": 5364,
+ "name": "github-linguist/linguist",
+ "stars": 13672
+ },
+ {
+ "forks": 1339,
+ "name": "zai-org/CogVideo",
+ "stars": 12993
+ },
+ {
+ "forks": 1610,
+ "name": "YaoFANGUK/video-subtitle-remover",
+ "stars": 12677
+ },
+ {
+ "forks": 1510,
+ "name": "ostris/ai-toolkit",
+ "stars": 11879
+ },
+ {
+ "forks": 1070,
+ "name": "lucidrains/DALLE2-pytorch",
+ "stars": 11302
+ },
+ {
+ "forks": 6959,
+ "name": "aws/amazon-sagemaker-examples",
+ "stars": 10983
+ },
+ {
+ "forks": 621,
+ "name": "Acly/krita-ai-diffusion",
+ "stars": 10534
+ },
+ {
+ "forks": 1060,
+ "name": "zyddnys/manga-image-translator",
+ "stars": 10382
+ },
+ {
+ "forks": 1080,
+ "name": "advimman/lama",
+ "stars": 10238
+ },
+ {
+ "forks": 850,
+ "name": "AIGC-Audio/AudioGPT",
+ "stars": 10168
+ },
+ {
+ "forks": 2854,
+ "name": "open-mmlab/mmsegmentation",
+ "stars": 9939
+ },
+ {
+ "forks": 962,
+ "name": "modelscope/modelscope",
+ "stars": 9121
+ },
+ {
+ "forks": 770,
+ "name": "ashawkey/stable-dreamfusion",
+ "stars": 8853
+ },
+ {
+ "forks": 795,
+ "name": "lucidrains/imagen-pytorch",
+ "stars": 8425
+ },
+ {
+ "forks": 471,
+ "name": "brycedrennan/imaginAIry",
+ "stars": 8179
+ },
+ {
+ "forks": 857,
+ "name": "Sygil-Dev/sygil-webui",
+ "stars": 7868
+ },
+ {
+ "forks": 660,
+ "name": "geekyutao/Inpaint-Anything",
+ "stars": 7704
+ },
+ {
+ "forks": 2758,
+ "name": "rocketride-org/rocketride-server",
+ "stars": 7631
+ },
+ {
+ "forks": 1052,
+ "name": "OpenTalker/video-retalking",
+ "stars": 7285
+ },
+ {
+ "forks": 554,
+ "name": "threestudio-project/threestudio",
+ "stars": 7062
+ },
+ {
+ "forks": 1720,
+ "name": "openMVG/openMVG",
+ "stars": 6549
+ },
+ {
+ "forks": 509,
+ "name": "Stability-AI/StableCascade",
+ "stars": 6537
+ },
+ {
+ "forks": 1340,
+ "name": "Trusted-AI/adversarial-robustness-toolbox",
+ "stars": 6213
+ },
+ {
+ "forks": 977,
+ "name": "open-edge-platform/anomalib",
+ "stars": 6109
+ },
+ {
+ "forks": 978,
+ "name": "bytedance/LatentSync",
+ "stars": 6046
+ },
+ {
+ "forks": 528,
+ "name": "Doubiiu/ToonCrafter",
+ "stars": 6008
+ },
+ {
+ "forks": 1472,
+ "name": "open-mmlab/OpenPCDet",
+ "stars": 5697
+ },
+ {
+ "forks": 475,
+ "name": "Fanghua-Yu/SUPIR",
+ "stars": 5649
+ },
+ {
+ "forks": 321,
+ "name": "facebookresearch/sapiens",
+ "stars": 5421
+ },
+ {
+ "forks": 535,
+ "name": "philz1337x/clarity-upscaler",
+ "stars": 5122
+ },
+ {
+ "forks": 413,
+ "name": "AILab-CVC/VideoCrafter",
+ "stars": 5073
+ },
+ {
+ "forks": 382,
+ "name": "robbyant-research/CoDeF",
+ "stars": 4846
+ },
+ {
+ "forks": 449,
+ "name": "UX-Decoder/Segment-Everything-Everywhere-All-At-Once",
+ "stars": 4794
+ },
+ {
+ "forks": 587,
+ "name": "ParisNeo/lollms-webui",
+ "stars": 4785
+ },
+ {
+ "forks": 562,
+ "name": "cvg/LightGlue",
+ "stars": 4750
+ },
+ {
+ "forks": 404,
+ "name": "NVlabs/neuralangelo",
+ "stars": 4616
+ },
+ {
+ "forks": 480,
+ "name": "sensity-ai/dot",
+ "stars": 4585
+ },
+ {
+ "forks": 363,
+ "name": "Tencent-Hunyuan/HunyuanDiT",
+ "stars": 4292
+ },
+ {
+ "forks": 388,
+ "name": "Picsart-AI-Research/Text2Video-Zero",
+ "stars": 4243
+ },
+ {
+ "forks": 582,
+ "name": "torchgeo/torchgeo",
+ "stars": 4166
+ },
+ {
+ "forks": 321,
+ "name": "ZhengPeng7/BiRefNet",
+ "stars": 4129
+ },
+ {
+ "forks": 131,
+ "name": "edenaion/EZ-CorridorKey",
+ "stars": 4126
+ },
+ {
+ "forks": 494,
+ "name": "Lightricks/ComfyUI-LTXVideo",
+ "stars": 4112
+ },
+ {
+ "forks": 385,
+ "name": "hustvl/4DGaussians",
+ "stars": 3908
+ },
+ {
+ "forks": 374,
+ "name": "MrForExample/ComfyUI-3D-Pack",
+ "stars": 3855
+ },
+ {
+ "forks": 225,
+ "name": "TencentARC/T2I-Adapter",
+ "stars": 3801
+ },
+ {
+ "forks": 582,
+ "name": "lucidrains/stylegan2-pytorch",
+ "stars": 3783
+ },
+ {
+ "forks": 576,
+ "name": "NVIDIA/Model-Optimizer",
+ "stars": 3688
+ },
+ {
+ "forks": 458,
+ "name": "ml-tooling/ml-workspace",
+ "stars": 3543
+ },
+ {
+ "forks": 129,
+ "name": "MashiroSaber03/Saber-Translator",
+ "stars": 3542
+ },
+ {
+ "forks": 526,
+ "name": "NVlabs/FoundationPose",
+ "stars": 3531
+ },
+ {
+ "forks": 534,
+ "name": "Kedreamix/Linly-Talker",
+ "stars": 3443
+ },
+ {
+ "forks": 202,
+ "name": "sail-sg/EditAnything",
+ "stars": 3422
+ },
+ {
+ "forks": 543,
+ "name": "luigifreda/pyslam",
+ "stars": 3404
+ },
+ {
+ "forks": 397,
+ "name": "catalyst-team/catalyst",
+ "stars": 3382
+ },
+ {
+ "forks": 371,
+ "name": "cocktailpeanut/fluxgym",
+ "stars": 3250
+ },
+ {
+ "forks": 526,
+ "name": "JoePenna/Dreambooth-Stable-Diffusion",
+ "stars": 3212
+ },
+ {
+ "forks": 233,
+ "name": "OpenGVLab/InternGPT",
+ "stars": 3205
+ },
+ {
+ "forks": 204,
+ "name": "chflame163/ComfyUI_LayerStyle",
+ "stars": 3149
+ },
+ {
+ "forks": 221,
+ "name": "cvlab-columbia/zero123",
+ "stars": 3058
+ },
+ {
+ "forks": 558,
+ "name": "TradeMaster-NTU/TradeMaster",
+ "stars": 3056
+ },
+ {
+ "forks": 357,
+ "name": "deepseek-ai/DreamCraft3D",
+ "stars": 3023
+ },
+ {
+ "forks": 242,
+ "name": "Doubiiu/DynamiCrafter",
+ "stars": 3007
+ },
+ {
+ "forks": 421,
+ "name": "zju3dv/LoFTR",
+ "stars": 2952
+ },
+ {
+ "forks": 407,
+ "name": "deforum/sd-webui-deforum",
+ "stars": 2859
+ },
+ {
+ "forks": 145,
+ "name": "UX-Decoder/Semantic-SAM",
+ "stars": 2854
+ },
+ {
+ "forks": 303,
+ "name": "TMElyralab/MuseV",
+ "stars": 2848
+ },
+ {
+ "forks": 206,
+ "name": "jina-ai/dalle-flow",
+ "stars": 2829
+ },
+ {
+ "forks": 458,
+ "name": "kwea123/nerf_pl",
+ "stars": 2804
+ },
+ {
+ "forks": 1015,
+ "name": "Kaggle/docker-python",
+ "stars": 2733
+ },
+ {
+ "forks": 129,
+ "name": "hgmzhn/manga-translator-ui",
+ "stars": 2709
+ },
+ {
+ "forks": 170,
+ "name": "IceClear/StableSR",
+ "stars": 2669
+ },
+ {
+ "forks": 213,
+ "name": "aigc3d/LHM",
+ "stars": 2664
+ },
+ {
+ "forks": 291,
+ "name": "yerfor/GeneFace",
+ "stars": 2659
+ },
+ {
+ "forks": 416,
+ "name": "nerdyrodent/VQGAN-CLIP",
+ "stars": 2647
+ },
+ {
+ "forks": 400,
+ "name": "crowsonkb/k-diffusion",
+ "stars": 2600
+ },
+ {
+ "forks": 216,
+ "name": "Tencent-Hunyuan/HY-World-2.0",
+ "stars": 2594
+ },
+ {
+ "forks": 497,
+ "name": "yfeng95/DECA",
+ "stars": 2518
+ },
+ {
+ "forks": 149,
+ "name": "bilibili/Index-anisora",
+ "stars": 2504
+ },
+ {
+ "forks": 518,
+ "name": "Lightning-AI/torchmetrics",
+ "stars": 2465
+ },
+ {
+ "forks": 280,
+ "name": "nv-tlabs/3dgrut",
+ "stars": 2406
+ },
+ {
+ "forks": 124,
+ "name": "kijai/ComfyUI-SUPIR",
+ "stars": 2308
+ },
+ {
+ "forks": 252,
+ "name": "spla-tam/SplaTAM",
+ "stars": 2188
+ },
+ {
+ "forks": 172,
+ "name": "Mukosame/Anime2Sketch",
+ "stars": 2129
+ },
+ {
+ "forks": 360,
+ "name": "visomaster/VisoMaster",
+ "stars": 2062
+ },
+ {
+ "forks": 481,
+ "name": "shanglianlm0525/PyTorch-Networks",
+ "stars": 2055
+ },
+ {
+ "forks": 343,
+ "name": "Zz-ww/SadTalker-Video-Lip-Sync",
+ "stars": 2010
+ },
+ {
+ "forks": 94,
+ "name": "showlab/Show-o",
+ "stars": 1975
+ },
+ {
+ "forks": 106,
+ "name": "lucidrains/gigagan-pytorch",
+ "stars": 1942
+ },
+ {
+ "forks": 155,
+ "name": "starik222/BooruDatasetTagManager",
+ "stars": 1937
+ },
+ {
+ "forks": 272,
+ "name": "d8ahazard/sd_dreambooth_extension",
+ "stars": 1887
+ },
+ {
+ "forks": 100,
+ "name": "YangLing0818/RPG-DiffusionMaster",
+ "stars": 1844
+ },
+ {
+ "forks": 252,
+ "name": "yerfor/GeneFacePlusPlus",
+ "stars": 1810
+ },
+ {
+ "forks": 78,
+ "name": "zju3dv/4K4D",
+ "stars": 1806
+ },
+ {
+ "forks": 258,
+ "name": "openai/mle-bench",
+ "stars": 1729
+ },
+ {
+ "forks": 211,
+ "name": "Lightning-Universe/lightning-flash",
+ "stars": 1722
+ },
+ {
+ "forks": 233,
+ "name": "verlab/accelerated_features",
+ "stars": 1721
+ },
+ {
+ "forks": 103,
+ "name": "One-2-3-45/One-2-3-45",
+ "stars": 1718
+ },
+ {
+ "forks": 131,
+ "name": "cvlab-columbia/viper",
+ "stars": 1716
+ },
+ {
+ "forks": 143,
+ "name": "omerbt/TokenFlow",
+ "stars": 1707
+ },
+ {
+ "forks": 267,
+ "name": "takuseno/d3rlpy",
+ "stars": 1684
+ },
+ {
+ "forks": 221,
+ "name": "YuliangXiu/ICON",
+ "stars": 1675
+ },
+ {
+ "forks": 127,
+ "name": "Stability-AI/stable-virtual-camera",
+ "stars": 1656
+ },
+ {
+ "forks": 96,
+ "name": "mhamilton723/FeatUp",
+ "stars": 1655
+ },
+ {
+ "forks": 80,
+ "name": "JIA-Lab-research/ControlNeXt",
+ "stars": 1647
+ },
+ {
+ "forks": 157,
+ "name": "Picsart-AI-Research/StreamingT2V",
+ "stars": 1629
+ },
+ {
+ "forks": 99,
+ "name": "guochengqian/Magic123",
+ "stars": 1622
+ },
+ {
+ "forks": 56,
+ "name": "Drexubery/ViewCrafter",
+ "stars": 1587
+ },
+ {
+ "forks": 93,
+ "name": "FoundationVision/Infinity",
+ "stars": 1587
+ },
+ {
+ "forks": 100,
+ "name": "zju3dv/EasyVolcap",
+ "stars": 1587
+ },
+ {
+ "forks": 308,
+ "name": "ai-forever/ghost",
+ "stars": 1582
+ },
+ {
+ "forks": 43,
+ "name": "thu-ml/prolificdreamer",
+ "stars": 1562
+ },
+ {
+ "forks": 154,
+ "name": "tin2tin/Pallaidium",
+ "stars": 1523
+ },
+ {
+ "forks": 84,
+ "name": "TencentARC/MotionCtrl",
+ "stars": 1500
+ },
+ {
+ "forks": 221,
+ "name": "WecoAI/aideml",
+ "stars": 1498
+ },
+ {
+ "forks": 73,
+ "name": "buaacyw/GaussianEditor",
+ "stars": 1457
+ },
+ {
+ "forks": 166,
+ "name": "gradslam/gradslam",
+ "stars": 1423
+ },
+ {
+ "forks": 169,
+ "name": "NVlabs/BundleSDF",
+ "stars": 1411
+ },
+ {
+ "forks": 108,
+ "name": "zju3dv/street_gaussians",
+ "stars": 1389
+ },
+ {
+ "forks": 142,
+ "name": "huggingface/finetrainers",
+ "stars": 1359
+ },
+ {
+ "forks": 55,
+ "name": "lxtGH/OMG-Seg",
+ "stars": 1354
+ },
+ {
+ "forks": 161,
+ "name": "microsoft/X-Decoder",
+ "stars": 1345
+ },
+ {
+ "forks": 77,
+ "name": "wenqsun/DimensionX",
+ "stars": 1333
+ },
+ {
+ "forks": 477,
+ "name": "open-edge-platform/geti",
+ "stars": 1325
+ },
+ {
+ "forks": 111,
+ "name": "sjtuytc/UnboundedNeRFPytorch",
+ "stars": 1323
+ },
+ {
+ "forks": 128,
+ "name": "Vincentqyw/image-matching-webui",
+ "stars": 1301
+ },
+ {
+ "forks": 138,
+ "name": "Parskatt/RoMa",
+ "stars": 1295
+ },
+ {
+ "forks": 96,
+ "name": "huanngzh/MV-Adapter",
+ "stars": 1289
+ },
+ {
+ "forks": 119,
+ "name": "plemeri/transparent-background",
+ "stars": 1287
+ },
+ {
+ "forks": 150,
+ "name": "kwea123/ngp_pl",
+ "stars": 1286
+ },
+ {
+ "forks": 92,
+ "name": "Stable-X/Stable3DGen",
+ "stars": 1275
+ },
+ {
+ "forks": 157,
+ "name": "ziyc/drivestudio",
+ "stars": 1256
+ },
+ {
+ "forks": 110,
+ "name": "Linketic/CityGaussian",
+ "stars": 1251
+ },
+ {
+ "forks": 61,
+ "name": "alibaba/Tora",
+ "stars": 1241
+ },
+ {
+ "forks": 116,
+ "name": "YuliangXiu/ECON",
+ "stars": 1207
+ },
+ {
+ "forks": 208,
+ "name": "qualcomm/ai-hub-models",
+ "stars": 1195
+ },
+ {
+ "forks": 62,
+ "name": "ali-vilab/UniAnimate",
+ "stars": 1189
+ },
+ {
+ "forks": 157,
+ "name": "visual-openllm/visual-openllm",
+ "stars": 1186
+ },
+ {
+ "forks": 61,
+ "name": "chongzhou96/EdgeSAM",
+ "stars": 1173
+ },
+ {
+ "forks": 116,
+ "name": "wladradchenko/wunjo.wladradchenko.ru",
+ "stars": 1170
+ },
+ {
+ "forks": 149,
+ "name": "mchong6/GANsNRoses",
+ "stars": 1148
+ },
+ {
+ "forks": 157,
+ "name": "cvg/glue-factory",
+ "stars": 1143
+ },
+ {
+ "forks": 70,
+ "name": "Kiteretsu77/APISR",
+ "stars": 1136
+ },
+ {
+ "forks": 144,
+ "name": "CASIA-LMC-Lab/AnomalyGPT",
+ "stars": 1132
+ },
+ {
+ "forks": 70,
+ "name": "yu-takagi/StableDiffusionReconstruction",
+ "stars": 1127
+ },
+ {
+ "forks": 127,
+ "name": "FutureUniant/Tailor",
+ "stars": 1117
+ },
+ {
+ "forks": 71,
+ "name": "HITsz-TMG/Uni-MoE",
+ "stars": 1116
+ },
+ {
+ "forks": 131,
+ "name": "yerfor/Real3DPortrait",
+ "stars": 1091
+ },
+ {
+ "forks": 50,
+ "name": "comet-ml/kangas",
+ "stars": 1077
+ },
+ {
+ "forks": 101,
+ "name": "Wangt-CN/DisCo",
+ "stars": 1072
+ },
+ {
+ "forks": 134,
+ "name": "Fannovel16/ComfyUI-Frame-Interpolation",
+ "stars": 1069
+ },
+ {
+ "forks": 60,
+ "name": "yeates/PromptFix",
+ "stars": 1069
+ },
+ {
+ "forks": 105,
+ "name": "aigc3d/LAM",
+ "stars": 1050
+ },
+ {
+ "forks": 50,
+ "name": "liuyuan-pal/SyncDreamer",
+ "stars": 1045
+ },
+ {
+ "forks": 113,
+ "name": "zju3dv/EfficientLoFTR",
+ "stars": 1044
+ },
+ {
+ "forks": 73,
+ "name": "lkeab/gaussian-grouping",
+ "stars": 1042
+ },
+ {
+ "forks": 128,
+ "name": "pixray/pixray",
+ "stars": 1042
+ },
+ {
+ "forks": 342,
+ "name": "pytorch/benchmark",
+ "stars": 1041
+ },
+ {
+ "forks": 85,
+ "name": "zju3dv/OnePose",
+ "stars": 1010
+ },
+ {
+ "forks": 47,
+ "name": "banodoco/Steerable-Motion",
+ "stars": 975
+ },
+ {
+ "forks": 82,
+ "name": "patientx/ComfyUI-Zluda",
+ "stars": 971
+ },
+ {
+ "forks": 395,
+ "name": "luxonis/oak-examples",
+ "stars": 970
+ },
+ {
+ "forks": 128,
+ "name": "intel/AI-Playground",
+ "stars": 969
+ },
+ {
+ "forks": 149,
+ "name": "tum-vision/tandem",
+ "stars": 955
+ },
+ {
+ "forks": 142,
+ "name": "YeWR/EfficientZero",
+ "stars": 944
+ },
+ {
+ "forks": 91,
+ "name": "baal-org/baal",
+ "stars": 934
+ },
+ {
+ "forks": 80,
+ "name": "gmberton/vismatch",
+ "stars": 910
+ },
+ {
+ "forks": 64,
+ "name": "cvg/GeoCalib",
+ "stars": 907
+ },
+ {
+ "forks": 61,
+ "name": "OpenDriveLab/Vista",
+ "stars": 895
+ },
+ {
+ "forks": 61,
+ "name": "stepfun-ai/Step1X-3D",
+ "stars": 886
+ },
+ {
+ "forks": 52,
+ "name": "OpenDCAI/OpenWorldLib",
+ "stars": 864
+ },
+ {
+ "forks": 53,
+ "name": "IrisRainbowNeko/DreamArtist-stable-diffusion",
+ "stars": 863
+ },
+ {
+ "forks": 28,
+ "name": "ZiyuGuo99/Image-Generation-CoT",
+ "stars": 862
+ },
+ {
+ "forks": 99,
+ "name": "vimalabs/VIMA",
+ "stars": 858
+ },
+ {
+ "forks": 60,
+ "name": "gojasper/LBM",
+ "stars": 854
+ },
+ {
+ "forks": 49,
+ "name": "gsgen3d/gsgen",
+ "stars": 845
+ },
+ {
+ "forks": 76,
+ "name": "SkyTNT/anime-segmentation",
+ "stars": 837
+ },
+ {
+ "forks": 108,
+ "name": "yerfor/MimicTalk",
+ "stars": 831
+ },
+ {
+ "forks": 49,
+ "name": "hustvl/GaussianDreamer",
+ "stars": 830
+ },
+ {
+ "forks": 55,
+ "name": "taichi-dev/taichi-nerfs",
+ "stars": 828
+ },
+ {
+ "forks": 100,
+ "name": "Shilin-LU/TF-ICON",
+ "stars": 814
+ },
+ {
+ "forks": 41,
+ "name": "CodeGoat24/UnifiedReward",
+ "stars": 808
+ },
+ {
+ "forks": 102,
+ "name": "eps696/aphantasia",
+ "stars": 789
+ },
+ {
+ "forks": 87,
+ "name": "NVlabs/CF-3DGS",
+ "stars": 789
+ },
+ {
+ "forks": 88,
+ "name": "plemeri/InSPyReNet",
+ "stars": 783
+ },
+ {
+ "forks": 55,
+ "name": "AILab-CVC/GPT4Tools",
+ "stars": 772
+ },
+ {
+ "forks": 198,
+ "name": "replicate/cog-comfyui",
+ "stars": 770
+ },
+ {
+ "forks": 49,
+ "name": "KovenYu/WonderJourney",
+ "stars": 769
+ },
+ {
+ "forks": 262,
+ "name": "weecology/DeepForest",
+ "stars": 769
+ },
+ {
+ "forks": 51,
+ "name": "MyNiuuu/MOFA-Video",
+ "stars": 766
+ },
+ {
+ "forks": 46,
+ "name": "IDEA-Research/OpenSeeD",
+ "stars": 764
+ },
+ {
+ "forks": 53,
+ "name": "zju3dv/DetectorFreeSfM",
+ "stars": 761
+ },
+ {
+ "forks": 59,
+ "name": "ali-vilab/MangaNinjia",
+ "stars": 740
+ },
+ {
+ "forks": 39,
+ "name": "cvlab-kaist/3DFuse",
+ "stars": 735
+ },
+ {
+ "forks": 77,
+ "name": "KoljaB/LocalAIVoiceChat",
+ "stars": 732
+ },
+ {
+ "forks": 76,
+ "name": "AkshitIreddy/Interactive-LLM-Powered-NPCs",
+ "stars": 719
+ },
+ {
+ "forks": 55,
+ "name": "zsyOAOA/DifFace",
+ "stars": 709
+ },
+ {
+ "forks": 82,
+ "name": "chflame163/ComfyUI_LayerStyle_Advance",
+ "stars": 708
+ },
+ {
+ "forks": 38,
+ "name": "GRVYDEV/S.A.T.U.R.D.A.Y",
+ "stars": 705
+ },
+ {
+ "forks": 34,
+ "name": "zju3dv/NeuralRecon-W",
+ "stars": 703
+ },
+ {
+ "forks": 106,
+ "name": "microsoft/BiomedParse",
+ "stars": 699
+ },
+ {
+ "forks": 87,
+ "name": "bes-dev/MobileStyleGAN.pytorch",
+ "stars": 697
+ },
+ {
+ "forks": 33,
+ "name": "kijai/ComfyUI-DynamiCrafterWrapper",
+ "stars": 680
+ },
+ {
+ "forks": 66,
+ "name": "facebookresearch/silk",
+ "stars": 679
+ },
+ {
+ "forks": 57,
+ "name": "LSXI7/MINIMA",
+ "stars": 672
+ },
+ {
+ "forks": 34,
+ "name": "lucidrains/magvit2-pytorch",
+ "stars": 668
+ },
+ {
+ "forks": 40,
+ "name": "theialab/radfoam",
+ "stars": 665
+ },
+ {
+ "forks": 95,
+ "name": "greentfrapp/lucent",
+ "stars": 664
+ },
+ {
+ "forks": 68,
+ "name": "LordLiang/DrawingSpinUp",
+ "stars": 659
+ },
+ {
+ "forks": 84,
+ "name": "OpenTalker/StyleHEAT",
+ "stars": 656
+ },
+ {
+ "forks": 48,
+ "name": "facebookresearch/pippo",
+ "stars": 650
+ },
+ {
+ "forks": 80,
+ "name": "GradientSpaces/WildGS-SLAM",
+ "stars": 648
+ },
+ {
+ "forks": 88,
+ "name": "cvg/DeepLSD",
+ "stars": 646
+ },
+ {
+ "forks": 32,
+ "name": "pengHTYX/Era3D",
+ "stars": 645
+ },
+ {
+ "forks": 31,
+ "name": "youquanl/Segment-Any-Point-Cloud",
+ "stars": 637
+ },
+ {
+ "forks": 59,
+ "name": "filliptm/ComfyUI_Fill-Nodes",
+ "stars": 634
+ },
+ {
+ "forks": 57,
+ "name": "Zhaozixiang1228/MMIF-CDDFuse",
+ "stars": 634
+ },
+ {
+ "forks": 73,
+ "name": "ivcylc/OpenMusic",
+ "stars": 631
+ },
+ {
+ "forks": 43,
+ "name": "VectorSpaceLab/Video-XL",
+ "stars": 627
+ },
+ {
+ "forks": 37,
+ "name": "jiawei-ren/dreamgaussian4d",
+ "stars": 620
+ },
+ {
+ "forks": 29,
+ "name": "catcathh/UltraPixel",
+ "stars": 617
+ },
+ {
+ "forks": 66,
+ "name": "liuzhao1225/YouDub",
+ "stars": 616
+ },
+ {
+ "forks": 32,
+ "name": "frank-xwang/InstanceDiffusion",
+ "stars": 615
+ },
+ {
+ "forks": 30,
+ "name": "Arlo0o/UniScene-Unified-Occupancy-centric-Driving-Scene-Generation",
+ "stars": 611
+ },
+ {
+ "forks": 55,
+ "name": "jina-ai/agentchain",
+ "stars": 611
+ },
+ {
+ "forks": 28,
+ "name": "Zj-BinXia/DiffIR",
+ "stars": 611
+ },
+ {
+ "forks": 79,
+ "name": "3dlg-hcvc/plan2scene",
+ "stars": 610
+ },
+ {
+ "forks": 112,
+ "name": "YanWenKun/ComfyUI-Windows-Portable",
+ "stars": 598
+ },
+ {
+ "forks": 62,
+ "name": "mv-lab/AISP",
+ "stars": 595
+ },
+ {
+ "forks": 79,
+ "name": "cvg/SOLD2",
+ "stars": 593
+ },
+ {
+ "forks": 34,
+ "name": "SkyworkAI/Vitron",
+ "stars": 576
+ },
+ {
+ "forks": 98,
+ "name": "lhoyer/DAFormer",
+ "stars": 574
+ },
+ {
+ "forks": 30,
+ "name": "alibaba-damo-academy/Uni3C",
+ "stars": 568
+ },
+ {
+ "forks": 53,
+ "name": "AssafSinger94/dino-tracker",
+ "stars": 568
+ },
+ {
+ "forks": 37,
+ "name": "TQTQliu/MVSGaussian",
+ "stars": 565
+ },
+ {
+ "forks": 58,
+ "name": "yeungchenwa/FontDiffuser",
+ "stars": 557
+ },
+ {
+ "forks": 30,
+ "name": "VideoVerses/VideoTuna",
+ "stars": 553
+ },
+ {
+ "forks": 97,
+ "name": "cliport/cliport",
+ "stars": 549
+ },
+ {
+ "forks": 29,
+ "name": "liming-ai/ControlNet_Plus_Plus",
+ "stars": 547
+ },
+ {
+ "forks": 77,
+ "name": "3DOM-FBK/deep-image-matching",
+ "stars": 546
+ },
+ {
+ "forks": 26,
+ "name": "UX-Decoder/DINOv",
+ "stars": 544
+ },
+ {
+ "forks": 55,
+ "name": "youngLBW/HRN",
+ "stars": 544
+ },
+ {
+ "forks": 51,
+ "name": "bytedance/X-Portrait",
+ "stars": 541
+ },
+ {
+ "forks": 35,
+ "name": "maitrix-org/Pandora",
+ "stars": 538
+ },
+ {
+ "forks": 62,
+ "name": "Xiaojiu-z/Stable-Hair",
+ "stars": 537
+ },
+ {
+ "forks": 32,
+ "name": "kylesargent/ZeroNVS",
+ "stars": 535
+ },
+ {
+ "forks": 69,
+ "name": "microsoft/causica",
+ "stars": 534
+ },
+ {
+ "forks": 14,
+ "name": "FoundationVision/UniTok",
+ "stars": 530
+ },
+ {
+ "forks": 59,
+ "name": "instantX-research/InstantIR",
+ "stars": 530
+ },
+ {
+ "forks": 47,
+ "name": "torch-uncertainty/torch-uncertainty",
+ "stars": 527
+ },
+ {
+ "forks": 36,
+ "name": "JalaliLabUCLA/phycv",
+ "stars": 526
+ },
+ {
+ "forks": 69,
+ "name": "facebookresearch/stable_signature",
+ "stars": 525
+ },
+ {
+ "forks": 14,
+ "name": "pals-ttic/sjc",
+ "stars": 523
+ },
+ {
+ "forks": 34,
+ "name": "Visionary-Laboratory/visionary",
+ "stars": 523
+ },
+ {
+ "forks": 19,
+ "name": "heheyas/V3D",
+ "stars": 521
+ },
+ {
+ "forks": 63,
+ "name": "borglab/gtsfm",
+ "stars": 516
+ },
+ {
+ "forks": 107,
+ "name": "apocas/restai",
+ "stars": 512
+ },
+ {
+ "forks": 66,
+ "name": "microsoft/robustlearn",
+ "stars": 509
+ },
+ {
+ "forks": 10,
+ "name": "baaivision/GeoDream",
+ "stars": 499
+ },
+ {
+ "forks": 54,
+ "name": "EPFL-VILAB/omnidata",
+ "stars": 493
+ },
+ {
+ "forks": 51,
+ "name": "ximinng/PyTorch-SVGRender",
+ "stars": 493
+ },
+ {
+ "forks": 44,
+ "name": "alvinliu0/HumanGaussian",
+ "stars": 492
+ },
+ {
+ "forks": 18,
+ "name": "zc-alexfan/hold",
+ "stars": 492
+ },
+ {
+ "forks": 109,
+ "name": "Holasyb918/HeyGem-Linux-Python-Hack",
+ "stars": 491
+ },
+ {
+ "forks": 74,
+ "name": "JiawangBian/sc_depth_pl",
+ "stars": 489
+ },
+ {
+ "forks": 24,
+ "name": "KohakuBlueleaf/PixelOE",
+ "stars": 489
+ },
+ {
+ "forks": 36,
+ "name": "jjihwan/FIFO-Diffusion_public",
+ "stars": 486
+ },
+ {
+ "forks": 12,
+ "name": "facebookresearch/4DGT",
+ "stars": 482
+ },
+ {
+ "forks": 41,
+ "name": "InternLandMark/LandMark",
+ "stars": 482
+ },
+ {
+ "forks": 41,
+ "name": "Parskatt/DKM",
+ "stars": 482
+ },
+ {
+ "forks": 23,
+ "name": "modelscope/richdreamer",
+ "stars": 478
+ },
+ {
+ "forks": 47,
+ "name": "huanngzh/ComfyUI-MVAdapter",
+ "stars": 475
+ },
+ {
+ "forks": 55,
+ "name": "baidu-baige/LoongFlow",
+ "stars": 474
+ },
+ {
+ "forks": 14,
+ "name": "vislearn/ControlNet-XS",
+ "stars": 472
+ },
+ {
+ "forks": 83,
+ "name": "zhangchuheng123/Reinforcement-Implementation",
+ "stars": 472
+ },
+ {
+ "forks": 37,
+ "name": "PJLab-ADG/DriveArena",
+ "stars": 470
+ },
+ {
+ "forks": 41,
+ "name": "jinyeying/night-enhancement",
+ "stars": 465
+ },
+ {
+ "forks": 7,
+ "name": "RunpeiDong/DreamLLM",
+ "stars": 462
+ },
+ {
+ "forks": 56,
+ "name": "SamKhoze/ComfyUI-DeepFuze",
+ "stars": 461
+ },
+ {
+ "forks": 33,
+ "name": "pengHTYX/PSHuman",
+ "stars": 460
+ },
+ {
+ "forks": 60,
+ "name": "afiaka87/clip-guided-diffusion",
+ "stars": 459
+ },
+ {
+ "forks": 53,
+ "name": "zju3dv/OnePose_Plus_Plus",
+ "stars": 458
+ },
+ {
+ "forks": 69,
+ "name": "NVlabs/trajdata",
+ "stars": 456
+ },
+ {
+ "forks": 14,
+ "name": "wbhu/Tri-MipRF",
+ "stars": 456
+ },
+ {
+ "forks": 54,
+ "name": "jjw-DL/OpenPCDet-Noted",
+ "stars": 454
+ },
+ {
+ "forks": 51,
+ "name": "OpenTalker/DPE",
+ "stars": 453
+ },
+ {
+ "forks": 77,
+ "name": "XiSHEN0220/RANSAC-Flow",
+ "stars": 451
+ },
+ {
+ "forks": 99,
+ "name": "SoccerNet/sn-gamestate",
+ "stars": 447
+ }
+ ],
+ "listed": 9669
+ },
+ "source": "https://github.com/kornia/kornia/network/dependents"
+}
diff --git a/docs/source/_static/css/main.css b/docs/source/_static/css/main.css
index 92dc2a0cb..cbff9b922 100644
--- a/docs/source/_static/css/main.css
+++ b/docs/source/_static/css/main.css
@@ -1,13 +1,36 @@
+/* Kornia docs: small overrides on top of the furo theme. */
+
.sidebar-logo {
max-width: 30%;
}
-/* TODO: make sure it works for all the browsers */
-body{
- font-family: 'Montserrat', sans-serif;
+/* Section captions in the sidebar toctree ("GET STARTED", "API REFERENCE", ...). A translucent
+ overlay reads well on both the light (blue) and dark sidebar backgrounds. */
+.sidebar-scroll p.caption {
+ background-color: rgba(0, 0, 0, 0.18);
+ border-radius: 4px;
+ margin: 0.75rem 0.5rem 0.25rem;
+ padding: 0.35rem 0.75rem;
+ letter-spacing: 0.04em;
+}
+
+/* Wide benchmark and support tables scroll inside their own box instead of the whole page. */
+.table-wrapper {
+ overflow-x: auto;
+}
+
+/* Landing-page module cards (sphinx-design). */
+.kornia-cards .sd-card {
+ border-radius: 8px;
+ transition: transform 120ms ease-in-out, box-shadow 120ms ease-in-out;
+}
+
+.kornia-cards .sd-card:hover {
+ transform: translateY(-2px);
+ box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}
-/* The section headers in the toc tree */
-.sidebar-scroll p.caption{
- background-color: #4d59ff;
+.kornia-cards .sd-card-title {
+ font-family: var(--font-stack--monospace);
+ font-size: 0.95rem;
}
diff --git a/docs/source/_static/css/pydata.css b/docs/source/_static/css/pydata.css
new file mode 100644
index 000000000..90858a95b
--- /dev/null
+++ b/docs/source/_static/css/pydata.css
@@ -0,0 +1,978 @@
+/* Kornia docs: overrides for the pydata-sphinx-theme layout. */
+
+html {
+ --pst-color-primary: #3980f5;
+ --pst-color-link: #2f6fe0;
+ --pst-color-link-hover: #1f4fb0;
+}
+
+html[data-theme="dark"] {
+ --pst-color-primary: #6aa3ff;
+ --pst-color-link: #8ab8ff;
+ --pst-color-link-hover: #b5d1ff;
+}
+
+.navbar-brand img {
+ height: 2rem;
+}
+
+/* Landing-page module cards (sphinx-design). */
+.kornia-cards .sd-card {
+ border-radius: 8px;
+ transition: transform 120ms ease-in-out, box-shadow 120ms ease-in-out;
+}
+
+.kornia-cards .sd-card:hover {
+ transform: translateY(-2px);
+ box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
+}
+
+.kornia-cards .sd-card-title {
+ font-family: var(--pst-font-family-monospace);
+ font-size: 0.95rem;
+}
+
+/* Sponsor box at the end of the left sidebar. */
+.kornia-sponsors {
+ margin-top: 1.5rem;
+ padding: 0.75rem 0.9rem;
+ border: 1px solid var(--pst-color-border);
+ border-radius: 8px;
+ font-size: 0.85rem;
+ line-height: 1.4;
+}
+
+.kornia-sponsors p {
+ margin: 0 0 0.5rem;
+}
+
+.kornia-sponsors p:last-child {
+ margin-bottom: 0;
+}
+
+.kornia-sponsors__title {
+ font-weight: 600;
+ text-transform: uppercase;
+ letter-spacing: 0.05em;
+ font-size: 0.75rem;
+ color: var(--pst-color-text-muted);
+}
+
+/* Task / licence badges under model titles. */
+.kornia-badges {
+ margin: -0.5rem 0 1.25rem;
+}
+
+/* "name \hfill note" sidebar entries (wrapped by custom.js): note pushed to the right, muted.
+ Rows with a collapse chevron already end 30px early (the theme reserves that margin), so leaf
+ rows reserve the same width β€” the notes line up in one column either way. */
+.bd-sidebar-primary a.has-sidebar-note {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ gap: 0.75rem;
+}
+
+.bd-sidebar-primary li:not(.has-children) > a.has-sidebar-note {
+ margin-right: calc(30px + 0.1875rem);
+}
+
+.bd-sidebar-primary .sidebar-note {
+ color: var(--pst-color-text-muted);
+ font-size: 0.78em;
+ text-align: right;
+}
+
+/* The theme's "Section Navigation" heading adds nothing; the navbar already names the section. */
+.bd-links__title {
+ display: none;
+}
+
+/* ---------------- Landing page hero ---------------- */
+
+/* Two-column split: copy + install command on the left, the "Why Kornia?" tabs on the right.
+ sphinx-design renders `.. grid::` as a Bootstrap row; the column classes come from index.rst. */
+.kornia-hero {
+ margin: 2.5rem 0 0;
+}
+
+.kornia-hero > .sd-row {
+ align-items: center;
+}
+
+.kornia-hero-copy {
+ /* sphinx-design makes grid items flex columns; keep the pill and buttons at their own width. */
+ align-items: flex-start;
+ text-align: left;
+ padding-right: 1.5rem;
+}
+
+.kornia-pip {
+ display: inline-flex;
+ align-items: center;
+ gap: 0.6rem;
+ margin: 0 0 2.25rem;
+ padding: 0.35rem 0.5rem 0.35rem 0.9rem;
+ border: 1px solid var(--pst-color-border);
+ border-radius: 999px;
+ background: var(--pst-color-surface);
+ font-family: var(--pst-font-family-monospace);
+ font-size: 0.92rem;
+}
+
+.kornia-pip__prompt {
+ color: var(--pst-color-primary);
+ font-weight: 700;
+ user-select: none;
+}
+
+.kornia-pip__cmd {
+ background: transparent;
+ border: none;
+ padding: 0;
+ color: var(--pst-color-text-base);
+ font-size: inherit;
+}
+
+.kornia-pip__copy {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ width: 1.9rem;
+ height: 1.9rem;
+ border: none;
+ border-radius: 50%;
+ background: transparent;
+ color: var(--pst-color-text-muted);
+ cursor: pointer;
+}
+
+.kornia-pip__copy:hover,
+.kornia-pip__copy:focus-visible {
+ background: var(--pst-color-background);
+ color: var(--pst-color-primary);
+}
+
+.kornia-pip__copy.is-copied {
+ color: var(--pst-color-success);
+}
+
+.kornia-hero__title {
+ font-size: 2.4rem;
+ line-height: 1.1;
+ font-weight: 800;
+ letter-spacing: -0.02em;
+ margin: 0 0 1.5rem;
+}
+
+.kornia-accent {
+ color: var(--pst-color-primary);
+}
+
+.kornia-hero-actions {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 0.75rem;
+ margin: 1.5rem 0 0;
+}
+
+.kornia-hero-actions p {
+ margin: 0;
+}
+
+.kornia-hero-actions a.sd-btn {
+ padding: 0.55rem 1.3rem;
+ font-size: 1rem;
+}
+
+/* Qualified with the grid-item class so it beats sphinx-design's ``.sd-sphinx-override p`` reset. */
+.kornia-hero-copy .kornia-hero__links {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 0.4rem 1.5rem;
+ margin: 1.75rem 0 0;
+ font-size: 0.92rem;
+}
+
+.kornia-hero__links a {
+ color: var(--pst-color-text-muted);
+ text-decoration: none;
+}
+
+.kornia-hero__links a:hover {
+ color: var(--pst-color-primary);
+ text-decoration: underline;
+}
+
+.kornia-hero__links i {
+ margin-right: 0.3rem;
+}
+
+/* Small uppercase label over the right panel's tabs. */
+.kornia-hero__eyebrow {
+ margin: 0 0 0.6rem;
+ font-size: 0.78rem;
+ font-weight: 700;
+ letter-spacing: 0.12em;
+ text-transform: uppercase;
+ color: var(--pst-color-text-muted);
+}
+
+/* "Why Kornia?" tabs as a segmented pill row above one card. The card has a fixed height so
+ switching tabs never moves the page; each tab's content is written to fit inside it. */
+.kornia-hero-demo .sd-tab-set {
+ margin: 0;
+ display: flex;
+ flex-wrap: wrap;
+ gap: 0.35rem;
+}
+
+.bd-content .kornia-hero-demo .sd-tab-set > label,
+.bd-content .kornia-hero-demo .sd-tab-set > input:checked + label,
+.bd-content .kornia-hero-demo .sd-tab-set > input:focus-visible + label,
+.bd-content .kornia-hero-demo .sd-tab-set > input:not(:checked, :focus-visible) + label:hover {
+ top: 0;
+ margin: 0;
+ padding: 0.45rem 0.9rem;
+ border: 1px solid transparent;
+ border-radius: 999px;
+ background-color: transparent;
+ color: var(--pst-color-text-muted);
+ font-size: 0.9rem;
+ font-weight: 500;
+ white-space: nowrap;
+}
+
+.bd-content .kornia-hero-demo .sd-tab-set > input:not(:checked, :focus-visible) + label:hover {
+ background-color: var(--pst-color-surface);
+ color: var(--pst-color-text-base);
+}
+
+.bd-content .kornia-hero-demo .sd-tab-set > input:focus-visible + label {
+ border-color: var(--pst-color-accent);
+}
+
+.bd-content .kornia-hero-demo .sd-tab-set > input:checked + label {
+ position: relative;
+ overflow: hidden;
+ background-color: var(--pst-color-primary);
+ color: #fff;
+}
+
+/* While custom.js cycles the tabs, the selected pill carries a thin progress line that fills over
+ one period (``--kornia-tab-period`` is set by the script). The pseudo-element is recreated each
+ time the selection moves, so the animation restarts with it. */
+.bd-content .kornia-hero-demo .sd-tab-set.is-autoplaying > input:checked + label::after {
+ content: "";
+ position: absolute;
+ left: 0;
+ bottom: 0;
+ height: 3px;
+ width: 100%;
+ background: rgba(255, 255, 255, 0.55);
+ transform-origin: left;
+ animation: kornia-tab-progress var(--kornia-tab-period, 7000ms) linear forwards;
+}
+
+.bd-content .kornia-hero-demo .sd-tab-set.is-autoplaying.is-paused > input:checked + label::after {
+ animation-play-state: paused;
+}
+
+@keyframes kornia-tab-progress {
+ from { transform: scaleX(0); }
+ to { transform: scaleX(1); }
+}
+
+.bd-content .kornia-hero-demo .sd-tab-set > label .octicon {
+ margin-right: 0.15rem;
+}
+
+/* The card: illustration bleeds to the edges, then a compact footer with the one-liner, the claim
+ on the left and the link on the right. */
+.bd-content .kornia-hero-demo .sd-tab-set .sd-tab-content {
+ width: 100%;
+ height: 24rem;
+ margin-top: 0.85rem;
+ padding: 0;
+ grid-template-columns: 1fr auto;
+ grid-auto-rows: max-content;
+ align-content: start;
+ column-gap: 1.25rem;
+ border: 1px solid var(--pst-color-border);
+ border-radius: 0.9rem;
+ overflow: hidden;
+}
+
+/* Only the selected pane is laid out; sphinx-design hides the others with display: none. */
+.bd-content .kornia-hero-demo .sd-tab-set > input:checked + label + .sd-tab-content {
+ display: grid;
+}
+
+.kornia-hero-demo .sd-tab-content > .kornia-tab-visual,
+.kornia-hero-demo .sd-tab-content > div.highlight-python {
+ grid-column: 1 / -1;
+}
+
+.kornia-hero-demo .sd-tab-content > div.highlight-python {
+ margin: 0 1.25rem;
+}
+
+.kornia-hero-demo .sd-tab-content > p {
+ margin: 0.9rem 0 0 1.25rem;
+}
+
+.kornia-hero-demo .sd-tab-content > p:last-child {
+ margin: 0.9rem 1.25rem 0 0;
+ align-self: start;
+ white-space: nowrap;
+}
+
+/* The differentiable tab has no code line; the claim then follows the visual directly. */
+.kornia-hero-demo .sd-tab-content > .kornia-tab-visual + p {
+ margin-top: 1.1rem;
+}
+
+/* Per-tab illustration: a fixed-height frame, so the four tabs line up. */
+.kornia-tab-visual {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ height: 15rem;
+ padding: 0.75rem 1rem;
+ margin-bottom: 1rem;
+ border-bottom: 1px solid var(--pst-color-border);
+ background: var(--pst-color-surface);
+ overflow: hidden;
+}
+
+.kornia-tab-visual--image {
+ justify-content: flex-start;
+ gap: 1.5rem;
+ padding: 0;
+ background: #000;
+ color: #e6e6e6;
+}
+
+.kornia-tab-visual img {
+ flex: 0 0 auto;
+ max-width: 55%;
+ max-height: 100%;
+ object-fit: contain;
+}
+
+.kornia-tab-visual__aside {
+ display: flex;
+ flex-direction: column;
+ gap: 0.35rem;
+ min-width: 0;
+ padding-right: 1rem;
+ font-size: 0.78rem;
+}
+
+.kornia-tab-visual__aside code {
+ padding: 0;
+ border: none;
+ background: transparent;
+ color: #e6e6e6;
+ font-size: 0.78rem;
+ white-space: nowrap;
+}
+
+.kornia-tab-visual__eyebrow {
+ margin: 0;
+ font-size: 0.7rem;
+ font-weight: 700;
+ letter-spacing: 0.1em;
+ text-transform: uppercase;
+ color: var(--pst-color-primary);
+}
+
+/* Inline SVG illustrations pick their colours up from the theme. */
+.kornia-illo {
+ width: 100%;
+ height: 100%;
+ font-family: var(--pst-font-family-base);
+}
+
+.kornia-illo text {
+ fill: var(--pst-color-text-base);
+ font-size: 15px;
+}
+
+.kornia-illo .illo-title {
+ font-size: 16px;
+ font-weight: 700;
+}
+
+.kornia-illo .illo-label,
+.kornia-illo .illo-note {
+ fill: var(--pst-color-text-muted);
+ font-size: 13px;
+}
+
+.kornia-illo .illo-mono {
+ font-family: var(--pst-font-family-monospace);
+ font-size: 12.5px;
+}
+
+.kornia-illo .illo-primary {
+ fill: var(--pst-color-primary);
+}
+
+.kornia-illo .illo-muted {
+ fill: var(--pst-color-border);
+}
+
+.kornia-illo .illo-box {
+ fill: var(--pst-color-background);
+ stroke: var(--pst-color-border);
+ stroke-width: 1.5;
+}
+
+.kornia-illo .illo-pill {
+ fill: var(--pst-color-background);
+ stroke: var(--pst-color-border);
+ stroke-width: 1.5;
+}
+
+.kornia-illo .illo-pill-text {
+ font-size: 12.5px;
+ font-weight: 600;
+}
+
+.kornia-illo .illo-line {
+ fill: none;
+ stroke: var(--pst-color-border);
+ stroke-width: 2;
+}
+
+.kornia-illo .illo-arrowhead {
+ fill: var(--pst-color-border);
+}
+
+.kornia-illo .illo-on-primary {
+ fill: #fff;
+ font-weight: 600;
+}
+
+.kornia-hero-demo .highlight pre {
+ padding: 0.55rem 0.8rem;
+ font-size: 0.8rem;
+ line-height: 1.45;
+}
+
+@media (max-width: 991.98px) {
+ .kornia-hero {
+ margin-top: 1.5rem;
+ }
+
+ .kornia-hero-copy {
+ padding-right: 0;
+ margin-bottom: 1.5rem;
+ }
+
+ .kornia-hero__title {
+ font-size: 2.1rem;
+ }
+
+ .bd-content .kornia-hero-demo .sd-tab-set .sd-tab-content {
+ height: auto;
+ }
+
+ .kornia-hero-demo .sd-tab-content > p:last-child {
+ grid-column: 1 / -1;
+ margin: 0.6rem 1.25rem 1rem;
+ }
+}
+
+/* Adoption page: two count cards at the top, each jumping to its table. */
+.kornia-adoption {
+ margin-bottom: 1.75rem;
+}
+
+.kornia-adoption .sd-card-body {
+ display: flex;
+ align-items: center;
+ gap: 1.1rem;
+ padding: 0.8rem 1.25rem;
+}
+
+.kornia-adoption .sd-card-text {
+ margin: 0;
+ font-size: 0.92rem;
+ line-height: 1.4;
+ color: var(--pst-color-text-muted);
+}
+
+.kornia-adoption .sd-card-text strong {
+ font-size: 1.25rem;
+ font-weight: 700;
+ color: var(--pst-color-text-base);
+}
+
+.kornia-adoption .kornia-adoption-count {
+ /* Fixed width and right alignment keep the two figures' last digits in one column; wide
+ enough for a five-digit figure with its thousands separator ("17,565"). */
+ flex: 0 0 8rem;
+ text-align: right;
+ font-size: 2.1rem;
+ font-weight: 800;
+ letter-spacing: -0.02em;
+ line-height: 1;
+ color: var(--pst-color-primary);
+ font-variant-numeric: tabular-nums;
+}
+
+/* One-paragraph lead under a section heading. */
+.kornia-section-lead {
+ max-width: 60rem;
+ margin: -0.4rem 0 1.4rem;
+ font-size: 0.98rem;
+ color: var(--pst-color-text-muted);
+}
+
+/* "Features": uniform before/after thumbnails plus a count-and-link footer. */
+.kornia-gallery .sd-card-img-top {
+ aspect-ratio: 640 / 234;
+ object-fit: cover;
+ border-radius: 8px 8px 0 0;
+}
+
+.kornia-gallery .sd-card-title {
+ font-family: var(--pst-font-family-base);
+ font-size: 1rem;
+ font-weight: 700;
+}
+
+.kornia-gallery .sd-card-text {
+ font-size: 0.88rem;
+ line-height: 1.5;
+ color: var(--pst-color-text-muted);
+}
+
+.kornia-gallery .sd-card-footer {
+ padding: 0.5rem 1rem 0.75rem;
+ border-top: 0;
+ background: transparent;
+ font-size: 0.82rem;
+ font-weight: 600;
+ color: var(--pst-color-primary);
+}
+
+.kornia-gallery .sd-card-footer p {
+ margin: 0;
+}
+
+.kornia-gallery .sd-card-footer code {
+ color: inherit;
+ background: transparent;
+ padding: 0;
+ font-size: 0.95em;
+}
+
+.kornia-learn-more {
+ margin-top: 1.5rem;
+ font-size: 0.92rem;
+}
+
+/* ---------------- Component restyling: tables, tabs ---------------- */
+
+/* Tables: card-like container, quiet borders, hover highlight. */
+.bd-article .pst-scrollable-table-container {
+ border: 1px solid var(--pst-color-border);
+ border-radius: 12px;
+ box-shadow: 0 4px 14px rgba(20, 30, 60, 0.05);
+ margin: 1.25rem 0;
+}
+
+.bd-article table.table {
+ margin: 0;
+ border: none;
+ font-size: 0.95rem;
+}
+
+.bd-article table.table thead th {
+ background: var(--pst-color-surface);
+ border-bottom: 1px solid var(--pst-color-border);
+ padding: 0.7rem 1rem;
+ font-size: 0.8rem;
+ font-weight: 700;
+ text-transform: uppercase;
+ letter-spacing: 0.05em;
+ color: var(--pst-color-text-muted);
+ text-align: left;
+}
+
+.bd-article table.table td,
+.bd-article table.table tbody th {
+ padding: 0.65rem 1rem;
+ border-top: 1px solid var(--pst-color-border-muted, var(--pst-color-border));
+ border-bottom: none;
+ vertical-align: top;
+}
+
+.bd-article table.table tbody tr:first-child td,
+.bd-article table.table tbody tr:first-child th {
+ border-top: none;
+}
+
+.bd-article table.table tbody tr:hover {
+ background: rgba(57, 128, 245, 0.06);
+}
+
+/* Tabs (sphinx-design): Bootstrap 5 nav-tabs. The pydata theme ships its own sphinx-design
+ tab skin under ".bd-content .sd-tab-set" (teal 2px borders, 2px radius, translateY on click);
+ every selector here carries the same prefix so these rules actually win the cascade. */
+.bd-content .sd-tab-set {
+ margin: 2rem 0;
+ border-radius: 0;
+}
+
+.bd-content .sd-tab-set > label,
+.bd-content .sd-tab-set > label:active,
+.bd-content .sd-tab-set > input:checked + label {
+ transform: none !important;
+ line-height: 1.5;
+}
+
+.bd-content .sd-tab-set > label {
+ position: relative;
+ z-index: 2;
+ top: 1px;
+ margin: 0 0.25rem -1px 0;
+ padding: 1rem;
+ border: 1px solid transparent;
+ border-radius: 0.5rem 0.5rem 0 0;
+ background-color: transparent;
+ color: var(--pst-color-link);
+ font-size: 0.95rem;
+ font-weight: 500;
+ transition: color 120ms ease-in-out, border-color 120ms ease-in-out;
+}
+
+html[data-theme="dark"] .bd-content .sd-tab-set > label {
+ background-color: transparent;
+}
+
+.bd-content .sd-tab-set > input:not(:checked, :focus-visible) + label:hover {
+ color: var(--pst-color-link-hover);
+ border-color: var(--pst-color-border) var(--pst-color-border) transparent;
+ text-decoration-line: none;
+}
+
+.bd-content .sd-tab-set > input:focus + label {
+ outline: none;
+}
+
+.bd-content .sd-tab-set > input:focus-visible + label {
+ background-color: transparent;
+ border: 1px solid var(--pst-color-accent);
+ border-radius: 0.5rem 0.5rem 0 0;
+ color: var(--pst-color-link);
+}
+
+.bd-content .sd-tab-set > input:checked + label {
+ background-color: var(--pst-color-background);
+ border-style: solid;
+ border-width: 1px;
+ border-color: var(--pst-color-border) var(--pst-color-border) var(--pst-color-background);
+ border-radius: 0.5rem 0.5rem 0 0;
+ color: var(--pst-color-text-base);
+ box-shadow: none;
+}
+
+/* Bordered pane: its top border is the tab row's baseline; the active tab's background and
+ transparent bottom border open the notch. Rounded everywhere except where the tabs attach. */
+.bd-content .sd-tab-set .sd-tab-content {
+ position: relative;
+ z-index: 1;
+ border: 1px solid var(--pst-color-border);
+ background-color: transparent;
+ border-radius: 0 0.5rem 0.5rem 0.5rem;
+ box-shadow: none;
+ padding: 1rem;
+}
+
+html[data-theme="dark"] .bd-content .sd-tab-set .sd-tab-content {
+ background-color: transparent;
+}
+
+.bd-content .sd-tab-set .sd-tab-content div.highlight {
+ border-radius: 8px;
+}
+
+/* No underline on the navbar logo, in any state. */
+.navbar-brand,
+.navbar-brand:hover,
+.navbar-brand:focus {
+ text-decoration: none !important;
+}
+
+/* Guide landing: the three steps as full-width horizontal rows (number/title left, text right). */
+.kornia-steps .sd-card {
+ border-radius: 10px;
+}
+
+.kornia-steps .sd-card-body {
+ display: flex;
+ align-items: baseline;
+ gap: 1.5rem;
+ padding: 1rem 1.25rem;
+}
+
+.kornia-steps .sd-card-title {
+ flex: 0 0 14rem;
+ margin: 0;
+ font-size: 1.05rem;
+}
+
+.kornia-steps .sd-card-text {
+ margin: 0;
+}
+
+@media (max-width: 720px) {
+ .kornia-steps .sd-card-body {
+ flex-direction: column;
+ gap: 0.4rem;
+ }
+}
+
+/* Landing page: pre-footer link board. */
+.kornia-linkboard {
+ display: grid;
+ grid-template-columns: repeat(5, 1fr);
+ gap: 1.25rem;
+ margin: 3.5rem 0 1rem;
+ padding-top: 2.25rem;
+ border-top: 1px solid var(--pst-color-border);
+}
+
+.kornia-linkboard a {
+ display: block;
+ padding: 0.18rem 0;
+ font-size: 0.9rem;
+ color: var(--pst-color-text-muted);
+ text-decoration: none;
+}
+
+.kornia-linkboard a:hover {
+ color: var(--pst-color-primary);
+ text-decoration: underline;
+}
+
+@media (max-width: 720px) {
+ .kornia-linkboard {
+ grid-template-columns: repeat(2, 1fr);
+ }
+}
+
+.kornia-linkboard__title {
+ font-size: 0.78rem;
+ font-weight: 700;
+ text-transform: uppercase;
+ letter-spacing: 0.06em;
+ color: var(--pst-color-text-base);
+ margin-bottom: 0.5rem;
+}
+
+/* Sponsor notice under the Why Kornia tabs. */
+.kornia-sponsor-notice {
+ text-align: center;
+ font-size: 0.88rem;
+ color: var(--pst-color-text-muted);
+ margin: 2.5rem 0 0;
+ padding-top: 1.25rem;
+ border-top: 1px solid var(--pst-color-border);
+}
+
+/* Non-link footer entries (e.g. the newsletter placeholder). */
+.kornia-linkboard__soon {
+ display: block;
+ padding: 0.18rem 0;
+ font-size: 0.9rem;
+ color: var(--pst-color-text-muted);
+ opacity: 0.65;
+}
+
+/* Navbar: keep the right-hand cluster tight. */
+.bd-navbar-elements.navbar-header-items__end {
+ gap: 0.75rem;
+}
+
+/* Navbar search next to the logo: keep it compact so the nav links get the space. */
+.navbar-header-items__start .search-button-field,
+.bd-header .navbar-header-items__start .search-button__wrapper {
+ max-width: 13rem;
+}
+
+.navbar-header-items__start {
+ gap: 1rem;
+}
+
+/* The header's middle wrapper grows to fill the row; push the nav/switcher/icons cluster
+ to its right edge so a flexible space separates it from the logo + search. */
+.bd-header .navbar-header-items__end {
+ margin-left: auto;
+}
+
+/* Function/class entries injected into the right sidebar by custom.js. */
+.kornia-object-toc a.nav-link {
+ font-family: var(--pst-font-family-monospace);
+ font-size: 0.78rem;
+ padding-left: 1rem;
+}
+
+/* Navbar "Support" dropdown (items injected by custom.js). */
+.kornia-navbar-dropdown {
+ position: relative;
+}
+
+.kornia-navbar-dropdown__menu {
+ display: none;
+ position: absolute;
+ top: 100%;
+ right: 0;
+ min-width: 10rem;
+ margin: 0;
+ padding: 0.4rem;
+ list-style: none;
+ background: var(--pst-color-background);
+ border: 1px solid var(--pst-color-border);
+ border-radius: 10px;
+ box-shadow: 0 10px 30px rgba(20, 30, 60, 0.15);
+ z-index: 1060;
+}
+
+.kornia-navbar-dropdown:hover .kornia-navbar-dropdown__menu,
+.kornia-navbar-dropdown:focus-within .kornia-navbar-dropdown__menu {
+ display: block;
+}
+
+.kornia-navbar-dropdown__menu a.nav-link {
+ display: block;
+ padding: 0.4rem 0.9rem;
+ border-radius: 6px;
+ white-space: nowrap;
+}
+
+.kornia-navbar-dropdown__menu a.nav-link:hover {
+ background: var(--pst-color-surface);
+ color: var(--pst-color-primary);
+}
+
+.kornia-navbar-dropdown__caret {
+ font-size: 0.6rem;
+ margin-left: 0.35rem;
+ opacity: 0.7;
+ transition: transform 120ms ease-in-out;
+}
+
+.kornia-navbar-dropdown:hover .kornia-navbar-dropdown__caret {
+ transform: rotate(180deg);
+}
+
+/* Ecosystem: multi-column panel; group titles; inert "coming soon" entries. */
+.kornia-navbar-dropdown__menu--mega {
+ display: none;
+ min-width: 13rem;
+ padding: 0.6rem 0.4rem;
+}
+
+.kornia-navbar-dropdown:hover .kornia-navbar-dropdown__menu--mega,
+.kornia-navbar-dropdown:focus-within .kornia-navbar-dropdown__menu--mega {
+ display: block;
+}
+
+.kornia-navbar-dropdown__menu--mega > div + div {
+ margin-top: 0.6rem;
+ border-top: 1px solid var(--pst-color-border);
+ padding-top: 0.5rem;
+}
+
+.kornia-navbar-dropdown__menu--mega ul {
+ display: block;
+ position: static;
+ margin: 0;
+ padding: 0;
+ list-style: none;
+ border: none;
+ box-shadow: none;
+ background: transparent;
+}
+
+/* Primary-sidebar copy of the nav (narrow viewports). The nav sits in ``navbar_end`` (conf.py), so
+ pydata lays its sidebar copy out in one row with the theme switcher and icon links, squeezing the
+ links into a third of the width; stack the row into a column instead. */
+.bd-sidebar-primary .sidebar-header-items__end {
+ flex-direction: column;
+ align-items: stretch;
+ row-gap: 0.75rem;
+}
+
+.bd-sidebar-primary .sidebar-header-items__end > .navbar-item {
+ width: 100%;
+}
+
+.bd-sidebar-primary .sidebar-header-items__end .navbar-icon-links {
+ padding-left: 0.25rem;
+}
+
+/* Menus are plain nested lists, always open. */
+.kornia-navbar-dropdown--inline .kornia-navbar-dropdown__menu,
+.kornia-navbar-dropdown--inline .kornia-navbar-dropdown__menu--mega {
+ display: block;
+ position: static;
+ min-width: 0;
+ padding: 0 0 0.25rem 0.75rem;
+ border: none;
+ border-radius: 0;
+ box-shadow: none;
+ background: transparent;
+}
+
+.kornia-navbar-dropdown--inline .kornia-navbar-dropdown__menu a.nav-link {
+ white-space: normal;
+ padding: 0.3rem 0.6rem;
+ font-size: 0.95em;
+}
+
+.kornia-navbar-dropdown--inline .kornia-navbar-dropdown__group {
+ padding-left: 0.6rem;
+}
+
+.kornia-navbar-dropdown--inline .kornia-navbar-dropdown__caret {
+ display: none;
+}
+
+.kornia-navbar-dropdown__group {
+ font-size: 0.72rem;
+ font-weight: 700;
+ text-transform: uppercase;
+ letter-spacing: 0.06em;
+ color: var(--pst-color-text-muted);
+ margin: 0 0 0.25rem;
+ padding: 0.3rem 0.9rem 0;
+}
+
+
+/* Breathing room between navbar tabs. */
+.bd-header ul.navbar-nav {
+ column-gap: 1em;
+}
+
+/* Outbound icon on external-link buttons (appended by custom.js as a FontAwesome element). */
+.kornia-external-icon,
+svg.kornia-external-icon {
+ font-size: 0.65em;
+ margin-left: 0.4em;
+ opacity: 0.65;
+}
+
+/* No page footer. */
+footer.bd-footer {
+ display: none;
+}
+
+.kornia-navbar-dropdown__inert {
+ cursor: default;
+}
diff --git a/docs/source/_static/js/custom.js b/docs/source/_static/js/custom.js
index 03f76e15c..ce05d910b 100644
--- a/docs/source/_static/js/custom.js
+++ b/docs/source/_static/js/custom.js
@@ -1,3 +1,29 @@
+// Deep-link compatibility: the module landing pages (color.html, feature.html, ...) used to hold
+// every object of their module and now spread them over per-topic subpages. conf.py embeds a
+// {docname: [object names]} map of the moved objects on those pages; a fragment that names one of
+// them is forwarded to its new page, fragment intact. This runs as soon as the script is parsed so
+// the old page is replaced before it renders; fragments not in the map are left alone.
+(function () {
+ const el = document.getElementById("kornia-anchor-redirects");
+ if (!el || !location.hash) return;
+ let name, moved;
+ try {
+ name = decodeURIComponent(location.hash.slice(1));
+ moved = JSON.parse(el.textContent);
+ } catch (e) {
+ return;
+ }
+ if (document.getElementById(name)) return; // present on this page after all
+ for (const docname in moved) {
+ if (moved[docname].indexOf(name) !== -1) {
+ const root = document.documentElement.getAttribute("data-content_root") || "";
+ location.replace(root + docname + ".html" + location.hash);
+ return;
+ }
+ }
+})();
+
+
// Based on https://github.com/huggingface/transformers/blob/master/docs/source/_static/js/custom.js
// TODO (Jian): probably update this by the latest https://buttons.github.io/, which added dark and light mode to align furo theme.
@@ -12,7 +38,8 @@ function addGithubButton() {
</a>
</div>
`;
- document.querySelector(".sidebar-brand").insertAdjacentHTML('afterend', div);
+ const brand = document.querySelector(".sidebar-brand"); // furo only; pydata has its own GitHub link
+ if (brand) brand.insertAdjacentHTML("afterend", div);
}
/*!
@@ -33,10 +60,238 @@ function onLoad() {
window.addEventListener("load", onLoad);
+
+// pydata theme: split "name β€” note" sidebar entries into a flex row with the note pushed
+// to the right edge in a muted color (name \hfill note).
+document.addEventListener("DOMContentLoaded", function () {
+ document.querySelectorAll(".bd-sidebar-primary a.reference.internal").forEach(function (link) {
+ const text = link.textContent;
+ const idx = text.indexOf(" β€” ");
+ if (idx === -1) return;
+ link.classList.add("has-sidebar-note");
+ link.textContent = text.slice(0, idx);
+ const note = document.createElement("span");
+ note.className = "sidebar-note";
+ note.textContent = text.slice(idx + 3);
+ link.appendChild(note);
+ });
+});
+
+
+// pydata theme: Sphinx already lists the documented objects of a page in the right
+// "On this page" sidebar. Pages that only carry autosummary link tables (e.g. the
+// color-conversion overview) have no objects of their own, so list the table entries there.
+document.addEventListener("DOMContentLoaded", function () {
+ const tocRoot = document.querySelector("#pst-page-toc-nav > ul");
+ if (!tocRoot) return;
+
+ function entriesFor(sectionEl) {
+ if (sectionEl.querySelector("dl[class*='py'] > dt[id]")) return []; // native TOC covers it
+ const items = [];
+ sectionEl.querySelectorAll(":scope .autosummary tr > td:first-child a.reference.internal").forEach(function (a) {
+ items.push([a.getAttribute("href"), a.textContent.trim()]);
+ });
+ return items;
+ }
+
+ document.querySelectorAll(".bd-article section[id]").forEach(function (sec) {
+ const tocLink = tocRoot.querySelector('a[href="#' + sec.id + '"]');
+ if (!tocLink) return;
+ const items = entriesFor(sec);
+ if (!items.length) return;
+ const ul = document.createElement("ul");
+ ul.className = "nav section-nav flex-column kornia-object-toc";
+ items.forEach(function (pair) {
+ const li = document.createElement("li");
+ li.className = "toc-h3 nav-item toc-entry";
+ const a = document.createElement("a");
+ a.className = "reference internal nav-link";
+ a.href = pair[0];
+ a.textContent = pair[1];
+ li.appendChild(a);
+ ul.appendChild(li);
+ });
+ tocLink.parentElement.appendChild(ul);
+ });
+});
+
+
+// pydata theme: navbar dropdowns, defined by NAVBAR_MENUS in conf.py and embedded in every page
+// as JSON. "Support" and "About" become hover/focus dropdowns; an "Ecosystem" item with a grouped
+// panel is inserted before "About". pydata renders the header nav twice -- in the header and, for
+// narrow viewports, in the primary sidebar -- so both copies are decorated; the sidebar copy shows
+// the menus inline, since there is nothing to hover on a phone.
document.addEventListener("DOMContentLoaded", function () {
- if (typeof iFrameResize === "function") {
- iFrameResize({}, "#augmentation-tester");
- } else {
- console.error("iFrameResize function is not available");
+ // Sphinx stamps the path back to the doc root on every page.
+ const root = document.documentElement.getAttribute("data-content_root") || "";
+ const href = (h) => (h.indexOf("://") !== -1 ? h : root + h + ".html");
+
+ function externalIcon() {
+ const i = document.createElement("i");
+ i.className = "fa-solid fa-arrow-up-right-from-square kornia-external-icon";
+ return i;
+ }
+
+ // Hero buttons that leave the site get the same outbound icon.
+ document.querySelectorAll(".kornia-hero-actions a.sd-btn[href^='http']").forEach(function (a) {
+ a.appendChild(externalIcon());
+ });
+
+ // Landing-page install command: copy on click, flash a check mark for a moment.
+ document.querySelectorAll(".kornia-pip__copy[data-copy]").forEach(function (button) {
+ const icon = button.querySelector("i");
+ button.addEventListener("click", function () {
+ if (!navigator.clipboard) return;
+ navigator.clipboard.writeText(button.getAttribute("data-copy")).then(function () {
+ button.classList.add("is-copied");
+ if (icon) icon.className = "fa-solid fa-check";
+ setTimeout(function () {
+ button.classList.remove("is-copied");
+ if (icon) icon.className = "fa-regular fa-copy";
+ }, 1500);
+ });
+ });
+ });
+
+ // "Why Kornia?" tabs advance on their own like a carousel until the visitor takes over: hovering
+ // or focusing the tab set pauses the cycle, choosing a tab stops it for good. Nothing moves for
+ // visitors who asked for reduced motion, and ticks are skipped while the page is hidden.
+ document.querySelectorAll(".kornia-why-tabs").forEach(function (tabSet) {
+ const inputs = Array.from(tabSet.querySelectorAll(":scope > input[type='radio']"));
+ if (inputs.length < 2 || window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
+ const PERIOD_MS = 7000;
+ tabSet.style.setProperty("--kornia-tab-period", PERIOD_MS + "ms");
+ let timer = null;
+ let startedAt = 0;
+ let remaining = PERIOD_MS;
+ let paused = false;
+
+ function advance() {
+ if (document.hidden) {
+ remaining = PERIOD_MS;
+ schedule();
+ return;
+ }
+ const current = inputs.findIndex((input) => input.checked);
+ inputs[(current + 1) % inputs.length].checked = true;
+ remaining = PERIOD_MS;
+ schedule();
+ }
+ function schedule() {
+ startedAt = Date.now();
+ timer = setTimeout(advance, remaining);
+ }
+ function pause() {
+ if (paused || timer === null) return;
+ paused = true;
+ clearTimeout(timer);
+ remaining = Math.max(200, remaining - (Date.now() - startedAt));
+ tabSet.classList.add("is-paused");
+ }
+ function resume() {
+ if (!paused) return;
+ paused = false;
+ tabSet.classList.remove("is-paused");
+ schedule();
+ }
+ function stop() {
+ clearTimeout(timer);
+ timer = null;
+ tabSet.classList.remove("is-autoplaying", "is-paused");
+ }
+
+ tabSet.addEventListener("pointerenter", pause);
+ tabSet.addEventListener("pointerleave", resume);
+ tabSet.addEventListener("focusin", pause);
+ tabSet.addEventListener("focusout", function (e) {
+ if (!tabSet.contains(e.relatedTarget)) resume();
+ });
+ // Setting ``checked`` from script fires no ``change``; a real click or arrow key does.
+ inputs.forEach((input) => input.addEventListener("change", stop));
+ tabSet.classList.add("is-autoplaying");
+ schedule();
+ });
+
+ const menusEl = document.getElementById("kornia-navbar-menus");
+ if (!menusEl) return;
+ let MENUS;
+ try {
+ MENUS = JSON.parse(menusEl.textContent);
+ } catch (e) {
+ return;
}
+
+ function decorate(li, link, inline) {
+ li.classList.add("kornia-navbar-dropdown");
+ if (inline) li.classList.add("kornia-navbar-dropdown--inline");
+ const caret = document.createElement("i");
+ caret.className = "fa-solid fa-chevron-down kornia-navbar-dropdown__caret";
+ link.appendChild(caret);
+ }
+
+ function menuFrom(items) {
+ const menu = document.createElement("ul");
+ menu.className = "kornia-navbar-dropdown__menu";
+ items.forEach(function (pair) {
+ const item = document.createElement("li");
+ const a = document.createElement("a");
+ a.className = "nav-link";
+ a.textContent = pair[0];
+ if (pair[1]) {
+ a.href = href(pair[1]);
+ if (pair[1].indexOf("://") !== -1) a.appendChild(externalIcon());
+ } else {
+ // no href: renders like its siblings but never gains :visited/:active styling
+ a.textContent = pair[0] + " (coming soon)";
+ a.classList.add("kornia-navbar-dropdown__inert");
+ }
+ item.appendChild(a);
+ menu.appendChild(item);
+ });
+ return menu;
+ }
+
+ function megaPanel(groups) {
+ const panel = document.createElement("div");
+ panel.className = "kornia-navbar-dropdown__menu kornia-navbar-dropdown__menu--mega";
+ Object.keys(groups).forEach(function (name) {
+ const col = document.createElement("div");
+ const title = document.createElement("p");
+ title.className = "kornia-navbar-dropdown__group";
+ title.textContent = name;
+ col.appendChild(title);
+ col.appendChild(menuFrom(groups[name]));
+ panel.appendChild(col);
+ });
+ return panel;
+ }
+
+ document.querySelectorAll("ul.bd-navbar-elements.navbar-nav").forEach(function (nav) {
+ const inline = nav.closest(".bd-sidebar-primary") !== null;
+ let aboutLi = null;
+ nav.querySelectorAll(":scope > li.nav-item > a.nav-link").forEach(function (link) {
+ const name = link.textContent.trim();
+ if (name === "About") aboutLi = link.parentElement;
+ const items = MENUS[name];
+ if (!Array.isArray(items)) return;
+ const li = link.parentElement;
+ decorate(li, link, inline);
+ li.appendChild(menuFrom(items));
+ });
+
+ // Ecosystem has no page of its own: a grouped panel, inserted before About.
+ if (aboutLi && MENUS.Ecosystem) {
+ const li = document.createElement("li");
+ li.className = "nav-item";
+ const link = document.createElement("a");
+ link.className = "nav-link";
+ link.href = "#";
+ link.textContent = "Ecosystem";
+ link.addEventListener("click", (e) => e.preventDefault());
+ li.appendChild(link);
+ decorate(li, link, inline);
+ li.appendChild(megaPanel(MENUS.Ecosystem));
+ aboutLi.parentElement.insertBefore(li, aboutLi);
+ }
+ });
});
diff --git a/docs/source/_templates/sponsors.html b/docs/source/_templates/sponsors.html
new file mode 100644
index 000000000..a59f273e7
--- /dev/null
+++ b/docs/source/_templates/sponsors.html
@@ -0,0 +1,6 @@
+<div class="kornia-sponsors">
+ <p class="kornia-sponsors__title">Sponsors</p>
+ <p>Your logo can be here β€” we welcome sponsors who help keep Kornia free and maintained.</p>
+ <p>You may <a href="https://opencollective.com/kornia">directly sponsor</a> or contact us through
+ <a href="mailto:[email protected]">[email protected]</a>.</p>
+</div>
diff --git a/docs/source/about.rst b/docs/source/about.rst
new file mode 100644
index 000000000..fa0d02843
--- /dev/null
+++ b/docs/source/about.rst
@@ -0,0 +1,38 @@
+About
+=====
+
+.. meta::
+ :description: About the Kornia project: frequently asked questions, the team and governance, the community guide, the code of conduct, how to cite the library, and the API stability policy.
+
+Kornia is an open-source project maintained by the non-profit Kornia AI organization and a worldwide
+community of contributors.
+
+.. list-table::
+ :widths: 30 70
+
+ * - :doc:`FAQ <community/faqs>`
+ - Frequently asked questions about the project and its history.
+ * - :doc:`Team <get-started/governance>`
+ - Governance, maintainers and the Kornia AI organization.
+ * - :doc:`Community Guide <community/community>`
+ - Where the community lives: Discord, GitHub, social channels and the Chinese community.
+ * - `Code of Conduct <https://github.com/kornia/kornia/blob/main/CODE_OF_CONDUCT.md>`__
+ - The standards every community space is held to.
+ * - :doc:`Citing Kornia <get-started/about>`
+ - The papers to cite when Kornia supports your research.
+ * - :doc:`Adoption <community/adoption>`
+ - |count-dependents| public repositories and |count-dependent-packages| packages on GitHub depend on
+ Kornia β€” and the most-starred of them.
+ * - :doc:`API Stability Policy <get-started/stability>`
+ - What you can rely on, tier by tier, and how deprecations work.
+
+.. toctree::
+ :hidden:
+
+ FAQ <community/faqs>
+ Team <get-started/governance>
+ Community Guide <community/community>
+ Code of Conduct <https://github.com/kornia/kornia/blob/main/CODE_OF_CONDUCT.md>
+ Citing Kornia <get-started/about>
+ Adoption <community/adoption>
+ API Stability Policy <get-started/stability>
diff --git a/docs/source/api.rst b/docs/source/api.rst
new file mode 100644
index 000000000..765b9e2ec
--- /dev/null
+++ b/docs/source/api.rst
@@ -0,0 +1,133 @@
+API reference
+=============
+
+.. meta::
+ :description: Reference documentation for every public Kornia module: augmentation, color, contrib, core, enhance, feature, filters, geometry, sensors, io, image, losses, models, metrics, morphology, onnx and tracking.
+
+One page per ``kornia`` module, grouped by what you are trying to do. Image operators take batched
+``(B, C, H, W)`` float tensors in ``[0, 1]`` and follow the :doc:`conventions </get-started/conventions>`
+(points, boxes, local features and camera matrices have their own layouts, documented on their pages);
+most functions also have an ``nn.Module`` counterpart.
+
+Image processing
+----------------
+
+.. list-table::
+ :widths: 28 72
+
+ * - :doc:`kornia.color <color>`
+ - Color space conversions, color maps and Bayer RAW processing.
+ * - :doc:`kornia.filters <filters>`
+ - Blurring, edge detection, thresholding and custom kernels.
+ * - :doc:`kornia.enhance <enhance>`
+ - Intensity adjustments, histogram equalization, normalization and a differentiable JPEG codec.
+ * - :doc:`kornia.morphology <morphology>`
+ - Dilation, erosion, opening, closing, gradient, top hat and bottom hat.
+
+Geometry & 3D
+-------------
+
+.. list-table::
+ :widths: 28 72
+
+ * - :doc:`kornia.geometry <geometry>`
+ - Warps, camera models, conversions, epipolar geometry, Lie groups, RANSAC and more.
+ * - :doc:`kornia.sensors <sensors>`
+ - Experimental camera model API.
+
+Training
+--------
+
+.. list-table::
+ :widths: 28 72
+
+ * - :doc:`kornia.augmentation <augmentation>`
+ - Random and deterministic augmentations for images, masks, boxes, keypoints and video, with transform tracking and inversion.
+ * - :doc:`kornia.losses <losses>`
+ - Reconstruction, segmentation, distribution and morphology losses.
+ * - :doc:`kornia.metrics <metrics>`
+ - Classification, segmentation, detection, image quality, flow, stereo and pose metrics.
+
+Features & matching
+-------------------
+
+.. list-table::
+ :widths: 28 72
+
+ * - :doc:`kornia.feature <feature>`
+ - Local feature detectors, descriptors and matchers, classical and learned.
+
+Models
+------
+
+.. list-table::
+ :widths: 28 72
+
+ * - :doc:`kornia.models <models>`
+ - Builders for the pretrained detection, edge detection, segmentation and tracking models.
+ * - :doc:`kornia.contrib <contrib>`
+ - Experimental operators and model wrappers: face detection, object detection, visual prompting, image stitching, KMeans.
+ * - :doc:`kornia.tracking <tracking>`
+ - Homography tracking.
+
+Data & deployment
+-----------------
+
+.. list-table::
+ :widths: 28 72
+
+ * - :doc:`kornia.io <io>`
+ - Load and save images as tensors.
+ * - :doc:`kornia.image <image>`
+ - Image container, drawing, tensor/NumPy conversion.
+ * - :doc:`kornia.onnx <onnx>`
+ - Run and chain ONNX models with ONNX Runtime.
+ * - :doc:`kornia.core <core>`
+ - Tensor wrapper and shared utilities.
+
+.. toctree::
+ :caption: Image processing
+ :hidden:
+
+ kornia.color β€” color spaces <color>
+ kornia.filters β€” blur & edges <filters>
+ kornia.enhance β€” intensity & histograms <enhance>
+ kornia.morphology β€” dilate & erode <morphology>
+
+.. toctree::
+ :caption: Geometry & 3D
+ :hidden:
+
+ kornia.geometry β€” warps, cameras, 3D <geometry>
+ kornia.sensors β€” camera models <sensors>
+
+.. toctree::
+ :caption: Training
+ :hidden:
+
+ kornia.augmentation β€” transforms & policies <augmentation>
+ kornia.losses β€” training objectives <losses>
+ kornia.metrics β€” evaluation <metrics>
+
+.. toctree::
+ :caption: Features & matching
+ :hidden:
+
+ kornia.feature β€” detect & match <feature>
+
+.. toctree::
+ :caption: Models
+ :hidden:
+
+ kornia.models β€” pretrained builders <models>
+ kornia.contrib β€” experimental <contrib>
+ kornia.tracking β€” homography tracking <tracking>
+
+.. toctree::
+ :caption: Data & deployment
+ :hidden:
+
+ kornia.io β€” read & write images <io>
+ kornia.image β€” image container <image>
+ kornia.onnx β€” ONNX runtime <onnx>
+ kornia.core β€” tensor utilities <core>
diff --git a/docs/source/applications/face_detection.rst b/docs/source/applications/face_detection.rst
index b12ae785e..7d1c3acbc 100644
--- a/docs/source/applications/face_detection.rst
+++ b/docs/source/applications/face_detection.rst
@@ -13,29 +13,29 @@ Learn more: `https://paperswithcode.com/task/face-detection <https://paperswithc
.. youtube:: hzQroGp5FSQ
-Using our API you easily detect faces in images as shown below:
+Using our API you can easily detect faces in images as shown below:
.. code-block:: python
- # select the device
- device = torch.device('cpu')
- if args.cuda and torch.cuda.is_available():
- device = torch.device('cuda:0')
+ import torch
+ import kornia as K
+ from kornia.contrib import FaceDetector, FaceDetectorResult
+ from kornia.io import ImageLoadType
- # load the image and scale
- img_raw = cv2.imread(args.image_file, cv2.IMREAD_COLOR)
- img_raw = scale_image(img_raw, args.image_size)
+ # select the device
+ device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
- # preprocess
- img = K.image_to_tensor(img_raw, keepdim=False).to(device)
- img = K.color.bgr_to_rgb(img.float())
+ # load the image as a (1, 3, H, W) float tensor in [0, 255], the range YuNet expects
+ img = K.io.load_image("image.jpg", ImageLoadType.RGB32, device=device)[None] * 255.0
- # create the detector and find the faces !
+ # create the detector and find the faces
face_detection = FaceDetector().to(device)
with torch.no_grad():
dets = face_detection(img)
dets = [FaceDetectorResult(o) for o in dets[0]]
+ for det in dets:
+ print(det.score, det.top_left, det.bottom_right)
-Play yourself with the detector and generate new images with this `tutorial <https://kornia.github.io/tutorials/nbs/face_detection.html>`_.
+Play with the detector yourself and generate new images with this `tutorial <https://kornia.github.io/tutorials/nbs/face_detection.html>`_.
diff --git a/docs/source/applications/image_augmentations.rst b/docs/source/applications/image_augmentations.rst
index 326c096c1..884479d26 100644
--- a/docs/source/applications/image_augmentations.rst
+++ b/docs/source/applications/image_augmentations.rst
@@ -21,123 +21,147 @@ and other advanced containers such as
:py:class:`~kornia.augmentation.container.PatchSequential` and
:py:class:`~kornia.augmentation.container.VideoSequential`.
-Our augmentations package is highly inspired by torchvision augmentation APIs while our intention is to not replace it.
-Kornia is a library that aligns better to OpenCV functionalities enforcing floating operators to guarantees a better precision
-without any float -> uint8 conversions plus on device acceleration.
+Our augmentation package is highly inspired by the torchvision augmentation API, although our intention is not to replace it.
+Kornia aligns more closely with OpenCV functionality, enforcing floating-point operators to guarantee better precision
+without any float -> uint8 conversions, plus on-device acceleration.
-However, we provide the following guide to migrate kornia <-> torchvision. Please, checkout the `Colab: Kornia Playground <https://colab.research.google.com/drive/1T20UNAG4SdlE2n2wstuhiewve5Q81VpS#revisionId=0B4unZG1uMc-WR3NVeTBDcmRwN0NxcGNNVlUwUldPMVprb1dJPQ>`_.
+Kornia augmentations are ``nn.Module`` instances, so the simplest pipeline is a plain ``nn.Sequential``.
+See also the `Colab: Kornia Playground <https://colab.research.google.com/drive/1T20UNAG4SdlE2n2wstuhiewve5Q81VpS#revisionId=0B4unZG1uMc-WR3NVeTBDcmRwN0NxcGNNVlUwUldPMVprb1dJPQ>`_
+for a hands-on comparison with torchvision.
.. code-block:: python
- import kornia.augmentation as K
+ import torch
import torch.nn as nn
+ import kornia.augmentation as K
transform = nn.Sequential(
K.RandomAffine(360),
- K.ColorJiggle(0.2, 0.3, 0.2, 0.3)
+ K.ColorJiggle(0.2, 0.3, 0.2, 0.3),
)
+ images = torch.rand(8, 3, 64, 64) # (B, C, H, W) in [0, 1]
+ out = transform(images)
Best Practices 1: Image Augmentation
++++++++++++++++++++++++++++++++++++
-Kornia augmentations provides simple on-device augmentation framework with the support of various syntax sugars
-(e.g. return transformation matrix, inverse geometric transform). Therefore, we provide advanced augmentation
-container :py:class:`~kornia.augmentation.container.AugmentationSequential` to ease the pain of building augmenation pipelines. This API would also provide predefined routines
-for automating the processing of masks, bounding boxes, and keypoints.
+Kornia augmentations provide a simple on-device augmentation framework with a number of conveniences
+(e.g. returning the transformation matrix, or inverting a geometric transform). On top of that, the
+:py:class:`~kornia.augmentation.container.AugmentationSequential` container eases the pain of building augmentation
+pipelines: it applies the same sampled transform to images, masks, bounding boxes and keypoints, and can invert it.
.. code-block:: python
+ import torch
import kornia.augmentation as K
aug = K.AugmentationSequential(
K.ColorJiggle(0.1, 0.1, 0.1, 0.1, p=1.0),
K.RandomAffine(360, [0.1, 0.1], [0.7, 1.2], [30., 50.], p=1.0),
K.RandomPerspective(0.5, p=1.0),
- data_keys=["input", "bbox", "keypoints", "mask"], # Just to define the future input here.
- return_transform=False,
+ data_keys=["input", "bbox", "keypoints", "mask"], # declares the order of the inputs below
same_on_batch=False,
)
+ img_tensor = torch.rand(1, 3, 64, 64)
+ bbox = torch.tensor([[[10.0, 10.0], [40.0, 10.0], [40.0, 40.0], [10.0, 40.0]]]) # (B, 4, 2) corners
+ keypoints = torch.tensor([[[16.0, 16.0], [48.0, 32.0]]]) # (B, N, 2) in (x, y)
+ mask = (torch.rand(1, 1, 64, 64) > 0.5).float()
+
# forward the operation
out_tensors = aug(img_tensor, bbox, keypoints, mask)
- # Inverse the operation
- out_tensor_inv = aug.inverse(*out_tensor)
+ # invert the geometric part of the operation
+ out_tensors_inv = aug.inverse(*out_tensors)
.. image:: https://discuss.pytorch.org/uploads/default/optimized/3X/2/4/24bb0f4520f547d3a321440293c1d44921ecadf8_2_690x119.jpeg
+ :alt: Original, augmented and inverted images
-From left to right: the original image, the transformed image, and the inversed image.
+From left to right: the original image, the transformed image, and the inverted image.
Best Practices 2: Video Augmentation
++++++++++++++++++++++++++++++++++++
-Video data is a special case of 3D volumetric data that contains both spatial and temporal information, which can be referred as 2.5D than 3D.
-In most applications, augmenting video data requires a static temporal dimension to have the same augmentations are performed for each frame.
-Thus, :py:class:`~kornia.augmentation.container.VideoSequential` can be used to do such trick as same as `nn.Sequential`.
-Currently, :py:class:`~kornia.augmentation.container.VideoSequential` supports data format like :math:`(B, C, T, H, W)` and :math:`(B, T, C, H, W)`.
+Video data is a special case of 3D volumetric data that contains both spatial and temporal information, which is
+sometimes referred to as 2.5D rather than 3D. In most applications, augmenting video data requires the same
+augmentation, with the same parameters, to be applied to every frame of a clip.
+:py:class:`~kornia.augmentation.container.VideoSequential` does exactly that, with the same interface as `nn.Sequential`,
+and supports the :math:`(B, C, T, H, W)` and :math:`(B, T, C, H, W)` data formats.
.. code-block:: python
+ import torch
import kornia.augmentation as K
transform = K.VideoSequential(
K.RandomAffine(360),
K.RandomGrayscale(p=0.5),
- K.RandomAffine(p=0.5)
+ K.RandomHorizontalFlip(p=0.5),
data_format="BCTHW",
- same_on_frame=True
+ same_on_frame=True,
)
+ clip = torch.rand(2, 3, 8, 64, 64) # 2 clips of 8 RGB frames
+ out = transform(clip)
.. image:: https://user-images.githubusercontent.com/17788259/101993516-4625ca80-3c89-11eb-843e-0b87dca6e2b8.png
+ :alt: Video augmentation applied consistently across frames
Customization
+++++++++++++
-Kornia augmentation implementations have two additional parameters compare to TorchVision,
-``return_transform`` and ``same_on_batch``. The former provides the ability of undoing one geometry
-transformation while the latter can be used to control the randomness for a batched transformation.
-To enable those behaviour, you may simply set the flags to True.
+Compared to torchvision, Kornia augmentations expose two extra controls: the ``same_on_batch`` flag, which
+applies the same random parameters to every element of the batch, and the sampled parameters themselves, which
+every augmentation stores in ``_params`` after a call and accepts back through the ``params`` argument.
+Geometric augmentations additionally expose the ``(B, 3, 3)`` matrix of the last call as ``transform_matrix``.
.. code-block:: python
+ import torch
+ import torch.nn as nn
import kornia.augmentation as K
class MyAugmentationPipeline(nn.Module):
def __init__(self) -> None:
- super(MyAugmentationPipeline, self).__init__()
- self.aff = K.RandomAffine(
- 360, return_transform=True, same_on_batch=True
- )
- self.jit = K.ColorJiggle(0.2, 0.3, 0.2, 0.3, same_on_batch=True)
+ super().__init__()
+ self.aff = K.RandomAffine(360, same_on_batch=True, p=1.0)
+ self.jit = K.ColorJiggle(0.2, 0.3, 0.2, 0.3, same_on_batch=True, p=1.0)
def forward(self, input):
- input, transform = self.aff(input)
- input, transform = self.jit((input, transform))
- return input, transform
+ out = self.aff(input)
+ transform = self.aff.transform_matrix # (B, 3, 3), reusable to undo the warp
+ out = self.jit(out)
+ return out, transform
+
+ out, transform = MyAugmentationPipeline()(torch.rand(4, 3, 64, 64))
-Example for semantic segmentation using low-level randomness control:
+Example for semantic segmentation using low-level randomness control, re-applying the parameters
+sampled for the image to its mask:
.. code-block:: python
+ import torch
+ import torch.nn as nn
import kornia.augmentation as K
class MyAugmentationPipeline(nn.Module):
def __init__(self) -> None:
- super(MyAugmentationPipeline, self).__init__()
- self.aff = K.RandomAffine(360)
- self.jit = K.ColorJiggle(0.2, 0.3, 0.2, 0.3)
+ super().__init__()
+ self.aff = K.RandomAffine(360, p=1.0)
+ self.jit = K.ColorJiggle(0.2, 0.3, 0.2, 0.3, p=1.0)
def forward(self, input, mask):
- assert input.shape == mask.shape,
- f"Input shape should be consistent with mask shape, "
- f"while got {input.shape}, {mask.shape}"
-
- aff_params = self.aff.forward_parameters(input.shape)
- input = self.aff(input, aff_params)
- mask = self.aff(mask, aff_params)
-
- jit_params = self.jit.forward_parameters(input.shape)
- input = self.jit(input, jit_params)
- mask = self.jit(mask, jit_params)
- return input, mask
+ assert input.shape[-2:] == mask.shape[-2:], (
+ f"Input and mask should have the same spatial size, got {input.shape} and {mask.shape}"
+ )
+ aff_params = self.aff.forward_parameters(input.shape)
+ input = self.aff(input, aff_params)
+ mask = self.aff(mask, aff_params) # same geometric transform as the image
+
+ input = self.jit(input) # color jitter is applied to the image only
+ return input, mask
+
+ image, mask = MyAugmentationPipeline()(torch.rand(4, 3, 64, 64), torch.rand(4, 1, 64, 64))
+
+For pipelines with masks, boxes or keypoints, prefer
+:py:class:`~kornia.augmentation.container.AugmentationSequential`, which does this bookkeeping for you.
diff --git a/docs/source/applications/image_denoising.rst b/docs/source/applications/image_denoising.rst
index 84968be17..fedcdfc0f 100644
--- a/docs/source/applications/image_denoising.rst
+++ b/docs/source/applications/image_denoising.rst
@@ -1,8 +1,23 @@
Image Denoising
===============
+Image denoising removes noise from an image while preserving its structure. Because every Kornia operator is
+differentiable, a classic variational approach such as total-variation denoising can be written as a few lines of
+optimization with :func:`kornia.losses.total_variation`:
+.. code:: python
-.. raw:: html
+ import torch
+ import kornia
- <gradio-app src="https://kornia-total-variation-denoising.hf.space"></gradio-app>
+ noisy = torch.rand(1, 3, 64, 64)
+ denoised = noisy.clone().requires_grad_(True)
+ optimizer = torch.optim.Adam([denoised], lr=0.01)
+
+ for _ in range(50):
+ optimizer.zero_grad()
+ loss = torch.nn.functional.mse_loss(denoised, noisy) + 1e-4 * kornia.losses.total_variation(denoised).mean()
+ loss.backward()
+ optimizer.step()
+
+Follow the full walk-through in the `total variation denoising tutorial <https://kornia.github.io/tutorials/nbs/total_variation_denoising.html>`_.
diff --git a/docs/source/applications/image_matching.rst b/docs/source/applications/image_matching.rst
index 0083cc2db..7ab782ef5 100644
--- a/docs/source/applications/image_matching.rst
+++ b/docs/source/applications/image_matching.rst
@@ -3,22 +3,111 @@ Image Matching
Image matching is a process of finding pixel and region correspondences between two images of the same scene.
Such correspondences are useful for 3D reconstruction of the scene and relative camera pose estimation.
-It is also known as "Wide baseline stereo" and you can read more about it at `Wide Baseline Stereo Blog <https://ducha-aiki.github.io/wide-baseline-stereo-blog/2021/01/09/wxbs-in-simple-terms.html>`_
+It is also known as "wide baseline stereo"; you can read more about it on the `Wide Baseline Stereo Blog <https://ducha-aiki.github.io/wide-baseline-stereo-blog/2021/01/09/wxbs-in-simple-terms.html>`_.
-We provide many modules and functions for the image matching: from building blocks like `local feature detectors <https://kornia.readthedocs.io/en/latest/feature.html#detectors>`_, `descriptors <https://kornia.readthedocs.io/en/latest/feature.html#descriptors>`_,
-`descriptor matching <https://kornia.readthedocs.io/en/latest/feature.html#matching>`_, `geometric model estimation <https://kornia.readthedocs.io/en/latest/geometry.epipolar.html#fundamental>`_
+We provide many modules and functions for image matching, from building blocks like
+:doc:`local feature detectors, descriptors and descriptor matchers </feature>` to
+:doc:`geometric model estimation </geometry.epipolar>` and :doc:`RANSAC </geometry.ransac>`.
-However we recommend to start with high-level API, such as :py:class:`~kornia.feature.LoFTR` you can use to find correspondence between two images.
+However, we recommend starting with a high-level API such as :py:class:`~kornia.feature.LoFTR`, which finds
+correspondences between two grayscale images in a single call:
.. code:: python
+ import torch
from kornia.feature import LoFTR
+ img1 = torch.rand(1, 1, 480, 640) # (B, 1, H, W) grayscale images in [0, 1]
+ img2 = torch.rand(1, 1, 480, 640)
+
matcher = LoFTR(pretrained="outdoor")
- input = {"image0": img1, "image1": img2}
- correspondences_dict = matcher(input)
+ with torch.inference_mode():
+ correspondences = matcher({"image0": img1, "image1": img2})
+ keypoints0 = correspondences["keypoints0"] # (N, 2) points in img1, (x, y) pixel coordinates
+ keypoints1 = correspondences["keypoints1"] # (N, 2) matching points in img2
+ confidence = correspondences["confidence"] # (N,)
.. image:: https://raw.githubusercontent.com/kornia/data/main/matching/matching_loftr.jpg
+ :alt: LoFTR correspondences between two images
+
+You can also go through our full tutorial using Colab, found `here <https://kornia.github.io/tutorials/nbs/image_matching.html>`_.
+
+Which model should I use?
+-------------------------
+
+Kornia's local-feature stack has three kinds of components, all in :doc:`kornia.feature </feature>`:
+
+1. **Detectors** find keypoints: classical responses (Harris, GFTT, Hessian, DoG) and learned detectors (KeyNet, DISK, DeDoDe, ALIKED).
+2. **Descriptors** describe the patch around each keypoint: SIFT, MKD, HardNet, HyNet, SOSNet, TFeat.
+3. **Matchers** pair descriptors across images: nearest-neighbour and ratio tests, the handcrafted AdaLAM, the
+ learned LightGlue, and LoFTR, which matches densely without a detector at all.
+
+The table below shows their performance on the `IMC2021 benchmark
+<https://www.cs.ubc.ca/research/image-matching-challenge/2021/leaderboard/>`_ (mAA at 10 degrees).
+
+.. list-table:: IMC2021 Benchmark, 8000 features
+ :widths: 50 50 50 50 50
+ :header-rows: 1
+
+ * - Feature name
+ - Stereo mAA @ 10 degrees, PhotoTourism.
+ - Multiview mAA @ 10 degrees, PhotoTourism.
+ - Stereo mAA @ 10 degrees, PragueParks.
+ - Multiview mAA @ 10 degrees, PragueParks.
+ * - DISK-LightGlue
+ - 0.6184
+ - 0.7741
+ - 0.6116
+ - 0.4988
+ * - LoFTR
+ - 0.6090
+ - 0.7609
+ - 0.7546
+ - 0.4711
+ * - OpenCV-DoG-HardNet-LightGlue
+ - 0.5850
+ - 0.7587
+ - 0.6525
+ - 0.4973
+ * - OpenCV-DoG-AffNet-HardNet8-AdaLAM
+ - 0.5502
+ - 0.7522
+ - 0.5998
+ - 0.4712
+ * - Upright SIFT (OpenCV)
+ - 0.5122
+ - 0.6849
+ - 0.6060
+ - 0.4439
+
+.. list-table:: IMC2021 Benchmark, 2048 features
+ :widths: 50 50 50 50 50
+ :header-rows: 1
+
+ * - Feature name
+ - Stereo mAA @ 10 degrees, PhotoTourism.
+ - Multiview mAA @ 10 degrees, PhotoTourism.
+ - Stereo mAA @ 10 degrees, PragueParks.
+ - Multiview mAA @ 10 degrees, PragueParks.
+ * - DISK-LightGlue
+ - 0.5720
+ - 0.7543
+ - 0.5099
+ - 0.4565
+ * - OpenCV-DoG-HardNet-LightGlue
+ - 0.3954
+ - 0.6272
+ - 0.5157
+ - 0.4456
+ * - Upright SIFT (OpenCV)
+ - 0.3827
+ - 0.5545
+ - 0.4136
+ - 0.3607
-You also can go through or full tutorial using Colab found `here <https://kornia.github.io/tutorials/nbs/image_matching.html>`_.
+Rules of thumb: :class:`~kornia.feature.LoFTR` works best for indoor scenes, whereas
+:class:`~kornia.feature.DISK` + :class:`~kornia.feature.LightGlue` and :class:`~kornia.feature.DeDoDe` + LightGlue
+work best outdoors. For domains far from natural photographs, e.g. remote sensing or medical imaging, SIFT or
+SIFT + :class:`~kornia.feature.HardNet` + LightGlue are often the more robust choice. DeDoDe and speed benchmarks
+are coming soon.
diff --git a/docs/source/applications/image_registration.rst b/docs/source/applications/image_registration.rst
index 25e73f2c1..7975544c2 100644
--- a/docs/source/applications/image_registration.rst
+++ b/docs/source/applications/image_registration.rst
@@ -7,27 +7,21 @@ Learn more: `https://paperswithcode.com/task/image-registration <https://papersw
.. youtube:: Re1q6vRfZac
-We provide the :py:class:`~kornia.geometry.transform.image_registrator.ImageRegistrator` API from which you can leverage to align automatically two images by a process of direct optimisation using the PyTorch Autograd differentiability.
+We provide the :py:class:`~kornia.geometry.transform.image_registrator.ImageRegistrator` API, which you can use to
+automatically align two images by direct optimization, leveraging PyTorch autograd.
.. code:: python
+ import torch
from kornia.geometry import ImageRegistrator
+
img_src = torch.rand(1, 1, 32, 32)
img_dst = torch.rand(1, 1, 32, 32)
- registrator = ImageRegistrator('similarity')
- homo = registrator.register(img_src, img_dst)
+ registrator = ImageRegistrator("similarity")
+ homo = registrator.register(img_src, img_dst) # (1, 3, 3) transform that warps img_src onto img_dst
Then, if you want to perform a more sophisticated process:
.. literalinclude:: ../_static/image_registration.py
-To reproduce the same results as in the showed video you can go through or full tutorial using Colab found `here <https://kornia.github.io/tutorials/nbs/image_registration.html>`_ .
-
-Interactive Demo
-----------------
-.. raw:: html
-
- <gradio-app src="https://kornia-image-registration-with-kornia.hf.space"></gradio-app>
-
-
-Visit the `image registration demo on the Hugging Face Spaces <https://huggingface.co/spaces/kornia/image-registration-with-kornia>`_.
+To reproduce the same results as in the video shown above, you can go through our full tutorial using Colab, found `here <https://kornia.github.io/tutorials/nbs/image_registration.html>`_.
diff --git a/docs/source/applications/image_stitching.rst b/docs/source/applications/image_stitching.rst
index 75eb77022..c12697975 100644
--- a/docs/source/applications/image_stitching.rst
+++ b/docs/source/applications/image_stitching.rst
@@ -1,31 +1,30 @@
Image Stitching
-============================
+===============
-Image stitching is the process of combining multiple images with overlapping fields of view to produce a segmented panorama. Here, we provide :py:class:`~kornia.contrib.image_stitching.ImageStitcher` to easily stitch a number of images.
+Image stitching is the process of combining multiple images with overlapping fields of view to produce a panorama. Here, we provide :py:class:`~kornia.contrib.image_stitching.ImageStitcher` to easily stitch a number of images.
.. image:: https://raw.githubusercontent.com/kornia/data/main/matching/stitch_before.png
+ :alt: Input images to be stitched
Learn more: https://paperswithcode.com/task/image-stitching/
.. code:: python
+ import torch
+ import kornia.feature as KF
from kornia.contrib import ImageStitcher
+ from kornia.io import ImageLoadType, load_image
- matcher = KF.LoFTR(pretrained='outdoor')
- IS = ImageStitcher(matcher, estimator='ransac').cuda()
- # NOTE: it would require a large CPU memory if many images.
+ device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
+ imgs = [load_image(p, ImageLoadType.RGB32, device=device)[None] for p in ("left.jpg", "right.jpg")]
+
+ matcher = KF.LoFTR(pretrained="outdoor")
+ stitcher = ImageStitcher(matcher, estimator="ransac").to(device)
+ # NOTE: stitching many images at once can require a lot of memory.
with torch.no_grad():
- out = IS(*imgs)
+ panorama = stitcher(*imgs) # (1, 3, H, W)
.. image:: https://raw.githubusercontent.com/kornia/data/main/panorama/out_panorama.jpg
+ :alt: Stitched panorama
Explore with your data: https://colab.research.google.com/github/kornia/tutorials/blob/master/source/image_stitching.ipynb
-
-
-Interactive Demo
-----------------
-.. raw:: html
-
- <gradio-app src="https://kornia-image-stitching.hf.space"></gradio-app>
-
-Visit the demo on `Hugging Face Spaces <https://huggingface.co/spaces/kornia/Image-Stitching>`_.
diff --git a/docs/source/applications/intro.rst b/docs/source/applications/intro.rst
index 440810c10..5cdd8dce5 100644
--- a/docs/source/applications/intro.rst
+++ b/docs/source/applications/intro.rst
@@ -1,10 +1,14 @@
-Computer Vision Algorithms
-==========================
+:orphan:
-Kornia provides a bottom to top granularity for **CURATED** Computer Vision algorithms.
+Applications
+============
-In this section, we showcase our high-level API in terms of abstraction for common Computer Vision algorithms
-that can be used across different domains such as Robotics, Industrial applications or for the AR/VR industry.
+.. meta::
+ :description: End-to-end Kornia guides that combine several modules: image augmentation, image matching, stitching, registration, face detection, visual prompting with Segment Anything, and image denoising.
+
+Each guide in this section solves a complete task with Kornia's high-level APIs, combining operators from
+several modules. They are the place to start when you know *what* you want to do; the
+:doc:`API reference </api>` documents each building block.
.. tip::
@@ -18,6 +22,6 @@ that can be used across different domains such as Robotics, Industrial applicati
- Object Detection and Tracking
- Image classification
-.. admonition:: We are looking for contributors !!
+.. admonition:: We are looking for contributors!
If you have a suggestion, proposal, or simply want to help, join our `Discord <https://discord.gg/HfnywwpBnD>`_.
diff --git a/docs/source/applications/visual_prompting.rst b/docs/source/applications/visual_prompting.rst
index 7711b6bb4..dcb9b591a 100644
--- a/docs/source/applications/visual_prompting.rst
+++ b/docs/source/applications/visual_prompting.rst
@@ -1,8 +1,9 @@
Visual Prompting
================
-.. image:: https://kornia.github.io/tutorials/nbs/image_prompter_files/figure-html/cell-34-output-1.png
- :width: 20%
+.. image:: https://raw.githubusercontent.com/kornia/tutorials/master/tutorials/assets/visual_prompter.png
+ :alt: SAM masks predicted by VisualPrompter from box prompts, with their confidence scores
+ :width: 100%
Visual Prompting is the task of streamlining computer vision processes by harnessing the power of prompts,
inspired by the breakthroughs of text prompting in NLP. This innovative approach involves using a few visual
@@ -13,10 +14,10 @@ By leveraging large pre-trained vision transformers, Visual Prompting not only e
data labeling but also facilitates the "teaching" of smaller AI systems.
-How Kornia leverages Visual Prompting ?
----------------------------------------
+How Kornia leverages Visual Prompting
+-------------------------------------
-Kornia leverages the Visual Prompting task through the :code:`VisualPrompter`` API, which integrates powerful models like
+Kornia leverages the Visual Prompting task through the :code:`VisualPrompter` API, which integrates powerful models like
the Segment Anything Model (SAM) into its computer vision toolkit. By incorporating SAM and the VisualPrompter API,
developers can harness the efficiency of Visual Prompting for faster segmentation tasks and improved computer vision workflows. This seamless integration allows users to utilize pre-trained vision transformers, significantly reducing manual data labeling efforts and enabling the "teaching" of smaller AI systems. As a result, Kornia users can take advantage of the versatility and adaptability offered by Visual Prompting, unlocking new possibilities for various computer vision applications.
@@ -25,14 +26,18 @@ How to use with Kornia
.. code-block:: python
- from kornia.io import load_image, ImageLoadType
+ import torch
from kornia.contrib.visual_prompter import VisualPrompter
+ from kornia.geometry.keypoints import Keypoints
+ from kornia.io import load_image, ImageLoadType
+
+ device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
# load an image
image = load_image('./example.jpg', ImageLoadType.RGB32, device)
- # Load the prompter
- prompter = VisualPrompter()
+ # Load the prompter (downloads the default SAM ViT-H checkpoint on first use)
+ prompter = VisualPrompter(device=device)
# set the image: This will preprocess the image and already generate the embeddings of it
prompter.set_image(image)
@@ -43,14 +48,13 @@ How to use with Kornia
# For the keypoints label: 1 indicates a foreground point; 0 indicates a background point
keypoints_labels = torch.tensor([[1]], device=device) # BxN
- # Runs the prediction with the kypoints prompts
+ # Runs the prediction with the keypoint prompts
prediction = prompter.predict(
keypoints=keypoints,
keypoints_labels=keypoints_labels,
multimask_output=True,
)
-You also can go through or full tutorial using Colab found `here <https://kornia.github.io/tutorials/nbs/image_prompter.html>`_.
-
+You can also go through our full tutorial using Colab, found `here <https://kornia.github.io/tutorials/nbs/visual_prompter.html>`_.
-Integration with other libraries, fineturning and more examples soon.
+Integration with other libraries, fine-tuning and more examples are coming soon.
diff --git a/docs/source/augmentation.auto.rst b/docs/source/augmentation.auto.rst
index 40f9f53e8..be4538137 100644
--- a/docs/source/augmentation.auto.rst
+++ b/docs/source/augmentation.auto.rst
@@ -2,8 +2,7 @@ Automatic Augmentation Methods
==============================
.. meta::
- :name: description
- :content: "The Automatic Augmentation Methods module in Kornia provides common data augmentation policies like AutoAugment, RandAugment, and TrivialAugment to improve the accuracy of image classification models. It also includes methods for augmentation search."
+ :description: The Automatic Augmentation Methods module in Kornia provides common data augmentation policies like AutoAugment, RandAugment, and TrivialAugment to improve the accuracy of image classification models. It also includes methods for augmentation search.
.. currentmodule:: kornia.augmentation.auto
diff --git a/docs/source/augmentation.base.rst b/docs/source/augmentation.base.rst
index fb9f005a8..19a5811b3 100644
--- a/docs/source/augmentation.base.rst
+++ b/docs/source/augmentation.base.rst
@@ -2,18 +2,16 @@ Base Classes
============
.. meta::
- :name: description
- :content: "The Base Classes module in Kornia provides foundational classes for creating new image transformations. It supports rigid (e.g., affine) and non-rigid (e.g., cut-out) augmentations, with predefined routines for sampling, applying, and reversing transformations."
+ :description: The Base Classes module in Kornia provides foundational classes for creating new image transformations. It supports rigid (e.g., affine) and non-rigid (e.g., cut-out) augmentations, with predefined routines for sampling, applying, and reversing transformations.
.. currentmodule:: kornia.augmentation
-This is the base class for creating a new transform on top the predefined routine of `kornia.augmentation`.
-Specifically, an any given augmentation can be recognized as either rigid (e.g. affine transformations that
-manipulate images with standard transformation matrice), or non-rigid (e.g. cut out a random area). At
-image-level, Kornia supports rigid transformation like `GeometricAugmentationBase2D` that modifies the geometric
-location of image pixels and `IntensityAugmentationBase2D` that preserves the pixel locations, as well as
-generic `AugmentationBase2D` that allows higher freedom for customized augmentation design.
-
+These are the base classes for creating a new transform on top of the predefined routine of `kornia.augmentation`.
+Any given augmentation can be classified as either rigid (e.g. affine transformations that
+manipulate images with a standard transformation matrix) or non-rigid (e.g. cutting out a random area). At the
+image level, Kornia provides `GeometricAugmentationBase2D` for rigid transformations that modify the geometric
+location of image pixels, `IntensityAugmentationBase2D` for transformations that preserve pixel locations, and the
+generic `AugmentationBase2D`, which allows more freedom for customized augmentation design.
The Base-Class Hierarchy
------------------------
@@ -37,31 +35,28 @@ Each level is a distinct, reused axis (sampling, data-key dispatch, 2D vs 3D, ri
intensity vs geometric); the four ``*Base2D`` classes are public API that external code subclasses.
For a custom augmentation, subclass ``IntensityAugmentationBase2D`` or ``GeometricAugmentationBase2D``.
-
The Predefined Augmentation Routine
-----------------------------------
-Kornia augmentation follows the simplest `sample-apply` routine for all the augmentations.
-
-- `sample`: Kornia aims at flexible tensor-level augmentations that augment all images in a tensor with
- different augmentations and probabilities. The sampling operation firstly samples a suite of random
- parameters. Then all the sampled augmentation state (parameters) is stored
- inside `_param` of the augmentation, the users can hereby reproduce the same augmentation results.
-- `apply`: With generated or passed parameters, the augmentation will be performed accordingly.
- Apart from performing image tensor operations, Kornia also supports inverse operations that
- to revert the transform operations. Meanwhile, other data modalities (`datakeys` in Kornia) like
- masks, keypoints, and bounding boxes. Such features are better supported with `AugmentationSequential`.
- Notably, the augmentation pipeline for rigid operations are implemented already without further efforts.
- For non-rigid operations, the user may implement customized inverse and data modality operations, e.g.
- `apply_mask_transform` for applying transformations on mask tensors.
+Kornia augmentation follows a simple `sample-apply` routine for all augmentations.
+- `sample`: Kornia aims at flexible tensor-level augmentations that augment every image in a batch with
+ different parameters and probabilities. The sampling step first draws a set of random
+ parameters. The sampled augmentation state is then stored in the ``_params`` attribute of the augmentation,
+ so users can reproduce the same augmentation results.
+- `apply`: with the generated (or user-provided) parameters, the augmentation is performed accordingly.
+ Apart from transforming image tensors, Kornia also supports inverse operations that revert the transform,
+ and transforms of other data modalities (`data keys` in Kornia) such as masks, keypoints, and bounding boxes.
+ Such features are best used through `AugmentationSequential`. Notably, the full pipeline for rigid
+ operations is already implemented and needs no further effort. For non-rigid operations, the user may implement
+ customized inverse and data-modality operations, e.g. `apply_transform_mask` for transforming mask tensors.
Custom Augmentation Classes
---------------------------
-For rigid transformations, `IntensityAugmentationBase2D` and `GeometricAugmentationBase2D` are sharing the exact same logic
-apart from the transformation matrix computations. Namely, the intensity augmentation always results in
-identity transformation matrices, without changing the geometric location for each pixel.
+For rigid transformations, `IntensityAugmentationBase2D` and `GeometricAugmentationBase2D` share the exact same logic
+apart from the transformation matrix computation. Namely, an intensity augmentation always results in an
+identity transformation matrix, since it does not change the geometric location of any pixel.
If it is a rigid geometric operation, `compute_transformation` and `apply_transform` need to be implemented, as well as
`compute_inverse_transformation` and `inverse_transform` to compute its inverse.
@@ -73,7 +68,6 @@ If it is a rigid geometric operation, `compute_transformation` and `apply_transf
.. automethod:: compute_inverse_transformation
.. automethod:: inverse_transform
-
For `IntensityAugmentationBase2D`, the user only needs to override `apply_transform`.
.. autoclass:: IntensityAugmentationBase2D
@@ -94,7 +88,6 @@ value in `apply_transform`:
from kornia.augmentation import IntensityAugmentationBase2D
from kornia.augmentation import random_generator as rg
-
class RandomAddValue(IntensityAugmentationBase2D):
"""Add a per-sample value drawn uniformly from ``add_range``."""
@@ -125,16 +118,17 @@ For a rigid **geometric** augmentation, also implement `compute_transformation`
``(B, 3, 3)`` transform matrix β€” kornia then applies it, inverts it, and propagates it to masks,
boxes and keypoints:
-
.. code-block:: python
+ from typing import Any, Dict, Optional
+
import torch
- import kornia as K
+ from torch import Tensor
+ import kornia as K
from kornia.augmentation import GeometricAugmentationBase2D
from kornia.augmentation import random_generator as rg
-
class MyRandomTransform(GeometricAugmentationBase2D):
def __init__(
@@ -158,13 +152,10 @@ boxes and keypoints:
factor = params["factor"].to(input).view(-1, 1, 1, 1)
return input * factor
-
For non-rigid augmentations, the user may implement the `apply_transform*` and `apply_non_transform*` APIs
-to meet the needs. Specifically, `apply_transform*` applies to the elements of a tensor that need to be transformed,
-while `apply_non_transform*` applies to the elements of a tensor that are skipped from augmentation. For example,
-a crop operation may change the tensor size partially, while we need to resize the rest to maintain the whole tensor
-as an integrated one with the same size.
-
+as needed. Specifically, `apply_transform*` applies to the elements of a batch that are selected for augmentation,
+while `apply_non_transform*` applies to the elements that are skipped. For example, a crop operation changes the size
+of the selected elements, so the skipped elements must be resized as well to keep the whole batch tensor at one size.
.. autoclass:: AugmentationBase2D
@@ -179,30 +170,26 @@ as an integrated one with the same size.
.. automethod:: apply_transform_class
.. automethod:: apply_non_transform_class
-
-The similar logic applies to 3D augmentations as well.
-
+The same logic applies to 3D augmentations as well.
Some Further Notes
------------------
Probabilities
^^^^^^^^^^^^^
-Kornia supports two types of randomness for element-level randomness `p` and batch-level randomness `p_batch`,
-as in `_BasicAugmentationBase`. Under the hood, operations like `crop`, `resize` are implemented with a fixed
-element-level randomness of `p=1` that only maintains batch-level randomness.
-
+Kornia supports two types of randomness: element-level randomness `p` and batch-level randomness `p_batch`,
+as defined in `_BasicAugmentationBase`. Under the hood, operations like `crop` and `resize` are implemented with a fixed
+element-level probability of `p=1` and only keep the batch-level randomness.
Random Generators
^^^^^^^^^^^^^^^^^
-For automatically generating the corresponding ``__repr__`` with full customized parameters, you may need to
-implement ``_param_generator`` by inheriting ``RandomGeneratorBase`` for generating random parameters and
-put all static parameters inside ``self.flags``. You may take the advantage of ``PlainUniformGenerator`` to
+To get an automatically generated ``__repr__`` that lists all custom parameters, implement
+``_param_generator`` by inheriting from ``RandomGeneratorBase`` to generate the random parameters, and
+put all static parameters inside ``self.flags``. You can take advantage of ``PlainUniformGenerator`` to
generate simple uniform parameters with less boilerplate code.
-
Random Reproducibility
^^^^^^^^^^^^^^^^^^^^^^
-Plain augmentation base class without the functionality of transformation matrix calculations.
-By default, the random computations will be happened on CPU with ``torch.get_default_dtype()``.
-To change this behaviour, please use ``set_rng_device_and_dtype``.
+By default, the random parameters are sampled on the CPU with ``torch.get_default_dtype()``, independently of the
+device of the input, so a seeded run gives the same parameters on CPU and GPU.
+To change this behaviour, use ``set_rng_device_and_dtype``.
diff --git a/docs/source/augmentation.container.rst b/docs/source/augmentation.container.rst
index 853023216..a7aaad25b 100644
--- a/docs/source/augmentation.container.rst
+++ b/docs/source/augmentation.container.rst
@@ -2,8 +2,7 @@ Augmentation Containers
=======================
.. meta::
- :name: description
- :content: "The Augmentation Containers module in Kornia provides advanced frameworks for building augmentation pipelines. It includes classes like AugmentationSequential, ManyToManyAugmentationDispatcher, and VideoSequential for managing data formats such as images, videos, and temporal data. It also supports processing masks, bounding boxes, and keypoints in augmentation workflows."
+ :description: The Augmentation Containers module in Kornia provides advanced frameworks for building augmentation pipelines. It includes classes like AugmentationSequential, ManyToManyAugmentationDispatcher, and VideoSequential for managing data formats such as images, videos, and temporal data. It also supports processing masks, bounding boxes, and keypoints in augmentation workflows.
.. currentmodule:: kornia.augmentation.container
@@ -13,10 +12,10 @@ The classes in this section are containers for augmenting different data formats
Augmentation Sequential
-----------------------
-Kornia augmentations provides simple on-device augmentation framework with the support of various syntax sugars
-(e.g. return transformation matrix, inverse geometric transform). Therefore, we provide advanced augmentation
-container to ease the pain of building augmenation pipelines. This API would also provide predefined routines
-for automating the processing of masks, bounding boxes, and keypoints.
+Kornia augmentations provide a simple on-device augmentation framework with a number of conveniences
+(e.g. returning the transformation matrix, or inverting a geometric transform). On top of that, we provide an
+advanced augmentation container to ease the pain of building augmentation pipelines. This API also provides
+predefined routines that automate the processing of masks, bounding boxes, and keypoints.
.. autoclass:: AugmentationSequential
@@ -28,9 +27,12 @@ for automating the processing of masks, bounding boxes, and keypoints.
Augmentation Dispatchers
------------------------
Kornia supports two types of augmentation dispatching, namely many-to-many and many-to-one. The former wraps
-different augmentations into one group and allows user to input multiple inputs in align with the number of
-augmentations. The latter aims at performing different augmentations for one input that to obtain a list of
-various transformed data.
+different augmentations into one group and lets the user pass as many inputs as there are augmentations, applying
+each augmentation to the corresponding input. The latter applies different augmentations to a single input in order
+to obtain a list of differently transformed outputs.
+
+.. note::
+ The class names below keep their historical spelling (``Dispather``) for backward compatibility.
.. autoclass:: ManyToManyAugmentationDispather
@@ -46,9 +48,9 @@ various transformed data.
ImageSequential
---------------
-Kornia augmentations provides simple on-device augmentation framework with the support of various syntax sugars
-(e.g. return transformation matrix, inverse geometric transform). Additionally, ImageSequential supports the
-mix usage of both image processing and augmentation modules.
+``ImageSequential`` is a lightweight container that, in addition to augmentation modules, accepts arbitrary
+image processing ``nn.Module`` instances (e.g. the modules in :mod:`kornia.filters`, :mod:`kornia.color` or
+:mod:`kornia.enhance`), so both kinds of operations can be mixed in a single pipeline.
.. autoclass:: ImageSequential
@@ -75,7 +77,7 @@ pipelines.
- The pipeline only processes image tensors without auxiliary spatial targets.
- The workflow combines augmentation modules with general image processing
- operations (gaussian blur, edge detection, color transforms).
+ modules (Gaussian blur, edge detection, color transforms).
- A lightweight container is preferred without the overhead of multi-target
synchronization logic.
@@ -84,13 +86,13 @@ Example using ``ImageSequential``::
import torch
import kornia.augmentation as K
from kornia.augmentation.container import ImageSequential
- from kornia.filters import gaussian_blur2d
+ from kornia.filters import GaussianBlur2d
img = torch.rand(1, 3, 256, 256)
seq = ImageSequential(
K.RandomHorizontalFlip(p=1.0),
- gaussian_blur2d, # arbitrary differentiable ops can be inserted
+ GaussianBlur2d((3, 3), (1.5, 1.5)), # any differentiable nn.Module can be inserted
)
out = seq(img)
@@ -128,21 +130,25 @@ PatchSequential
Video Data Augmentation
-----------------------
-Video data is a special case of 3D volumetric data that contains both spatial and temporal information, which can be referred as 2.5D than 3D.
-In most applications, augmenting video data requires a static temporal dimension to have the same augmentations are performed for each frame.
-Thus, `VideoSequential` can be used to do such trick as same as `nn.Sequential`.
-Currently, `VideoSequential` supports data format like :math:`(B, C, T, H, W)` and :math:`(B, T, C, H, W)`.
+Video data is a special case of 3D volumetric data that contains both spatial and temporal information, which is
+sometimes referred to as 2.5D rather than 3D. In most applications, augmenting video data requires the same
+augmentation, with the same parameters, to be applied to every frame of a clip. `VideoSequential` does exactly that,
+with the same interface as `nn.Sequential`. It supports the :math:`(B, C, T, H, W)` and :math:`(B, T, C, H, W)`
+data formats.
.. code-block:: python
+ import torch
import kornia.augmentation as K
transform = K.VideoSequential(
K.RandomAffine(360),
K.ColorJiggle(0.2, 0.3, 0.2, 0.3),
data_format="BCTHW",
- same_on_frame=True
+ same_on_frame=True,
)
+ clip = torch.rand(2, 3, 8, 64, 64) # 2 clips of 8 RGB frames
+ out = transform(clip)
.. autoclass:: VideoSequential
diff --git a/docs/source/augmentation.geometric.rst b/docs/source/augmentation.geometric.rst
new file mode 100644
index 000000000..21a4390b8
--- /dev/null
+++ b/docs/source/augmentation.geometric.rst
@@ -0,0 +1,32 @@
+2D geometric transforms
+=======================
+
+.. currentmodule:: kornia.augmentation
+
+Transforms that move pixels. Each one exposes its ``(B, 3, 3)`` transformation matrix, can be inverted, and is
+applied consistently to masks, boxes and keypoints by :class:`~kornia.augmentation.AugmentationSequential`.
+
+.. autoclass:: CenterCrop
+.. autoclass:: PadTo
+.. autoclass:: RandomAffine
+.. autoclass:: RandomCrop
+.. autoclass:: RandomElasticTransform
+.. autoclass:: RandomErasing
+.. autoclass:: RandomFisheye
+.. autoclass:: RandomHorizontalFlip
+.. autoclass:: RandomPerspective
+.. autoclass:: RandomResizedCrop
+.. autoclass:: RandomRotation90
+.. autoclass:: RandomRotation
+.. autoclass:: RandomShear
+.. autoclass:: RandomThinPlateSpline
+.. autoclass:: RandomVerticalFlip
+
+Resize
+------
+
+Deterministic resizing operators, shape-agnostic for 2D and 3D tensors.
+
+.. autoclass:: LongestMaxSize
+.. autoclass:: Resize
+.. autoclass:: SmallestMaxSize
diff --git a/docs/source/augmentation.intensity.rst b/docs/source/augmentation.intensity.rst
new file mode 100644
index 000000000..b6c08d568
--- /dev/null
+++ b/docs/source/augmentation.intensity.rst
@@ -0,0 +1,51 @@
+2D intensity transforms
+=======================
+
+.. currentmodule:: kornia.augmentation
+
+Transforms that change pixel values but keep every pixel where it is, so masks, boxes and keypoints pass through
+unchanged.
+
+.. autoclass:: ColorJiggle
+.. autoclass:: ColorJitter
+.. autoclass:: RandomAutoContrast
+.. autoclass:: RandomBoxBlur
+.. autoclass:: RandomBrightness
+.. autoclass:: RandomChannelDropout
+.. autoclass:: RandomChannelShuffle
+.. autoclass:: RandomClahe
+.. autoclass:: RandomContrast
+.. autoclass:: RandomEqualize
+.. autoclass:: RandomDissolving
+.. autoclass:: RandomGamma
+.. autoclass:: RandomGaussianBlur
+.. autoclass:: RandomGaussianIllumination
+.. autoclass:: RandomGaussianNoise
+.. autoclass:: RandomGrayscale
+.. autoclass:: RandomHue
+.. autoclass:: RandomInvert
+.. autoclass:: RandomJPEG
+.. autoclass:: RandomLinearCornerIllumination
+.. autoclass:: RandomLinearIllumination
+.. autoclass:: RandomMedianBlur
+.. autoclass:: RandomMotionBlur
+.. autoclass:: RandomPlanckianJitter
+.. autoclass:: RandomPlasmaBrightness
+.. autoclass:: RandomPlasmaContrast
+.. autoclass:: RandomPlasmaShadow
+.. autoclass:: RandomPosterize
+.. autoclass:: RandomRain
+.. autoclass:: RandomRGBShift
+.. autoclass:: RandomSaltAndPepperNoise
+.. autoclass:: RandomSaturation
+.. autoclass:: RandomSharpness
+.. autoclass:: RandomSnow
+.. autoclass:: RandomSolarize
+
+Normalization
+-------------
+
+Deterministic normalization operators, shape-agnostic for 2D and 3D tensors.
+
+.. autoclass:: Denormalize
+.. autoclass:: Normalize
diff --git a/docs/source/augmentation.mix.rst b/docs/source/augmentation.mix.rst
new file mode 100644
index 000000000..01e4d4470
--- /dev/null
+++ b/docs/source/augmentation.mix.rst
@@ -0,0 +1,12 @@
+2D mix transforms
+=================
+
+.. currentmodule:: kornia.augmentation
+
+Transforms that combine several images of a batch (and their labels) into new samples.
+
+.. autoclass:: RandomCutMixV2
+.. autoclass:: RandomJigsaw
+.. autoclass:: RandomMixUpV2
+.. autoclass:: RandomMosaic
+.. autoclass:: RandomTransplantation
diff --git a/docs/source/augmentation.module.rst b/docs/source/augmentation.module.rst
index 0a5a1d181..573a74afe 100644
--- a/docs/source/augmentation.module.rst
+++ b/docs/source/augmentation.module.rst
@@ -1,124 +1,25 @@
+:orphan:
+
Image Augmentations
===================
.. meta::
- :name: description
- :content: "The Image Augmentations module in Kornia provides a wide range of 2D and 3D data augmentation transforms. It includes intensity-based augmentations, geometric transformations, mix-based augmentations, and normalization operations for both 2D and 3D image tensors. Key functions include random color shifts, rotations, cropping, elastic transformations, and more."
+ :description: The Image Augmentations module in Kornia provides a wide range of 2D and 3D data augmentation transforms. It includes intensity-based augmentations, geometric transformations, mix-based augmentations, and normalization operations for both 2D and 3D image tensors. Key functions include random color shifts, rotations, cropping, elastic transformations, and more.
.. currentmodule:: kornia.augmentation
-Transforms2D
-------------
-
-Set of operators to perform data augmentation on 2D image tensors.
-
-Intensity
-~~~~~~~~~
-
-.. autoclass:: ColorJiggle
-.. autoclass:: ColorJitter
-.. autoclass:: RandomAutoContrast
-.. autoclass:: RandomBoxBlur
-.. autoclass:: RandomBrightness
-.. autoclass:: RandomChannelDropout
-.. autoclass:: RandomChannelShuffle
-.. autoclass:: RandomClahe
-.. autoclass:: RandomContrast
-.. autoclass:: RandomEqualize
-.. autoclass:: RandomDissolving
-.. autoclass:: RandomGamma
-.. autoclass:: RandomGaussianBlur
-.. autoclass:: RandomGaussianIllumination
-.. autoclass:: RandomGaussianNoise
-.. autoclass:: RandomGrayscale
-.. autoclass:: RandomHue
-.. autoclass:: RandomInvert
-.. autoclass:: RandomJPEG
-.. autoclass:: RandomLinearCornerIllumination
-.. autoclass:: RandomLinearIllumination
-.. autoclass:: RandomMedianBlur
-.. autoclass:: RandomMotionBlur
-.. autoclass:: RandomPlanckianJitter
-.. autoclass:: RandomPlasmaBrightness
-.. autoclass:: RandomPlasmaContrast
-.. autoclass:: RandomPlasmaShadow
-.. autoclass:: RandomPosterize
-.. autoclass:: RandomRain
-.. autoclass:: RandomRGBShift
-.. autoclass:: RandomSaltAndPepperNoise
-.. autoclass:: RandomSaturation
-.. autoclass:: RandomSharpness
-.. autoclass:: RandomSnow
-.. autoclass:: RandomSolarize
-
-
-Geometric
-~~~~~~~~~
-
-.. autoclass:: CenterCrop
-.. autoclass:: PadTo
-.. autoclass:: RandomAffine
-.. autoclass:: RandomCrop
-.. autoclass:: RandomElasticTransform
-.. autoclass:: RandomErasing
-.. autoclass:: RandomFisheye
-.. autoclass:: RandomHorizontalFlip
-.. autoclass:: RandomPerspective
-.. autoclass:: RandomResizedCrop
-.. autoclass:: RandomRotation90
-.. autoclass:: RandomRotation
-.. autoclass:: RandomShear
-.. autoclass:: RandomThinPlateSpline
-.. autoclass:: RandomVerticalFlip
-
-
-Mix
-~~~
-
-.. autoclass:: RandomCutMixV2
-.. autoclass:: RandomJigsaw
-.. autoclass:: RandomMixUpV2
-.. autoclass:: RandomMosaic
-.. autoclass:: RandomTransplantation
-
-Transforms3D
-------------
-
-Set of operators to perform data augmentation on 3D volumetric tensors.
-
-Geometric
-~~~~~~~~~
-
-.. autoclass:: CenterCrop3D
-.. autoclass:: RandomAffine3D
-.. autoclass:: RandomCrop3D
-.. autoclass:: RandomDepthicalFlip3D
-.. autoclass:: RandomHorizontalFlip3D
-.. autoclass:: RandomRotation3D
-.. autoclass:: RandomVerticalFlip3D
-
-Intensity
-~~~~~~~~~
-
-.. autoclass:: RandomEqualize3D
-.. autoclass:: RandomMotionBlur3D
-
-Mix
-~~~
-
-.. autoclass:: RandomTransplantation3D
-
-Normalizations
---------------
-
-Normalization operations are shape-agnostic for both 2D and 3D tensors.
-
-.. autoclass:: Denormalize
-.. autoclass:: Normalize
-
-Image Resize
-------------
-
-.. autoclass:: LongestMaxSize
-.. autoclass:: Resize
-.. autoclass:: SmallestMaxSize
+The augmentation operators, grouped by what they change. All of them accept ``(B, C, H, W)`` float tensors in
+``[0, 1]`` (``(B, C, D, H, W)`` for the 3D transforms), sample independent parameters per batch element, and can
+be combined with :class:`~kornia.augmentation.AugmentationSequential`.
+
+.. list-table::
+ :widths: 30 70
+
+ * - :doc:`augmentation.intensity`
+ - 2D transforms that change pixel values but not their positions: color jitter, blur, noise, illumination, JPEG, weather effects.
+ * - :doc:`augmentation.geometric`
+ - 2D transforms that move pixels: crops, flips, affine, perspective, elastic, thin-plate-spline, erasing.
+ * - :doc:`augmentation.mix`
+ - 2D transforms that combine several images: CutMix, MixUp, Mosaic, Jigsaw, Transplantation.
+ * - :doc:`augmentation.transforms3d`
+ - Geometric, intensity and mix transforms for volumetric ``(B, C, D, H, W)`` data.
diff --git a/docs/source/augmentation.rst b/docs/source/augmentation.rst
index f79ac9ac5..c1b6e69b3 100644
--- a/docs/source/augmentation.rst
+++ b/docs/source/augmentation.rst
@@ -2,20 +2,37 @@ kornia.augmentation
===================
.. meta::
- :name: description
- :content: "The Augmentation module in Kornia provides high-level data augmentation functionalities for computer vision tasks, including random rotations, affine transformations, color intensities, image noise distortion, and more. It supports batch processing, device compatibility, and backpropagation. Additionally, users can retrieve transformation details for more flexibility in complex pipelines."
-
-This module implements in a high level logic. The main features of this module, and similar to the rest of the
-library, is that can it perform data augmentation routines in a batch mode, using any supported device,
-and can be used for backpropagation. Some of the available functionalities which are worth to mention are the
-following: random rotations; affine and perspective transformations; several random color intensities transformations,
-image noise distortion, motion blurring, and many of the different differentiable data augmentation policies.
-In addition, we include a novel feature which is not found in other augmentations frameworks,
-which allows the user to retrieve the applied transformation or chained transformations after each
-call e.g. the generated random rotation matrix which can be used later to undo the image transformation
-itself, or to be applied to additional metadata such as the label images for semantic segmentation,
-in bounding boxes or landmark keypoints for object detection tasks. It gives the user the flexibility to
-perform complex data augmentations pipelines.
+ :description: The Augmentation module in Kornia provides high-level data augmentation functionalities for computer vision tasks, including random rotations, affine transformations, color intensities, image noise distortion, and more. It supports batch processing, device compatibility, and backpropagation. Additionally, users can retrieve transformation details for more flexibility in complex pipelines.
+
+This module implements data augmentation at a high level of abstraction. Like the rest of the library,
+it performs augmentation routines in batch mode, on any supported device, and every operation is
+differentiable, so it can take part in backpropagation. Among the available functionalities are random rotations;
+affine and perspective transformations; several random color and intensity transformations; image noise;
+motion blur; and many differentiable data augmentation policies such as AutoAugment and RandAugment.
+
+In addition, the module includes a feature that is not found in other augmentation frameworks: after each
+call, the user can retrieve the applied transformation, or the chain of transformations, e.g. the sampled
+random rotation matrix. That matrix can later be used to undo the image transformation, or to apply the same
+transformation to additional data such as segmentation masks, bounding boxes or landmark keypoints. This gives
+the user the flexibility to build complex data augmentation pipelines.
+
+.. code-block:: python
+
+ import torch
+ import kornia.augmentation as K
+
+ aug = K.AugmentationSequential(
+ K.RandomAffine(degrees=30.0, p=1.0),
+ K.ColorJiggle(0.1, 0.1, 0.1, 0.1, p=1.0),
+ data_keys=["input", "mask", "keypoints"],
+ )
+ image = torch.rand(2, 3, 64, 64)
+ mask = (torch.rand(2, 1, 64, 64) > 0.5).float()
+ keypoints = torch.tensor([[[16.0, 16.0], [48.0, 32.0]]]).repeat(2, 1, 1)
+
+ img_out, mask_out, kpts_out = aug(image, mask, keypoints) # same random parameters for all three
+ img_back, mask_back, kpts_back = aug.inverse(img_out, mask_out, kpts_out)
+ matrix = aug.transform_matrix # (B, 3, 3) matrix of the last geometric transform
.. note::
**Input format.** Kornia augmentations expect **float tensors with values in** ``[0, 1]`` and shape
@@ -24,18 +41,6 @@ perform complex data augmentations pipelines.
``[0, 255]`` **range does not raise** β€” it is silently treated as ``[0, 1]`` and the output clips at ``1.0``,
which shows up later as degraded model accuracy rather than an exception. Scale first, e.g. ``img.float() / 255``.
-Interactive Demo
-~~~~~~~~~~~~~~~~
-.. raw:: html
-
- <iframe
- id="augmentation-tester"
- src="https://kornia-kornia-augmentations-tester.hf.space"
- frameborder="0"
- width="850"
- height="450"
- ></iframe>
-
Benchmark
---------
@@ -60,7 +65,6 @@ option (torchvision v2 is not differentiable; albumentations is CPU/``uint8``/si
**CPU single-image** throughput, SIMD/NumPy libraries such as albumentations are faster β€” that is
their regime, not kornia's. See ``benchmarks/augmentation/README.md`` for the per-regime breakdown.
-
Deployment: torch.export, torch.compile, ONNX
---------------------------------------------
@@ -94,9 +98,36 @@ Kornia augmentations are plain ``nn.Module`` s and are exportable for deployment
.. currentmodule:: kornia.augmentation
-.. toctree::
+Where to find things
+--------------------
+
+.. list-table::
+ :widths: 30 70
+
+ * - :doc:`Image augmentations <augmentation.module>`
+ - The operators, by category: :doc:`intensity <augmentation.intensity>` (color, blur, noise,
+ illumination, normalization), :doc:`geometric <augmentation.geometric>` (crops, flips, affine,
+ perspective, resize), :doc:`mix <augmentation.mix>` (CutMix, MixUp, Mosaic) and
+ :doc:`3D <augmentation.transforms3d>`.
+ * - :doc:`Containers <augmentation.container>`
+ - :class:`AugmentationSequential` applies one sampled transform to images, masks, boxes and
+ keypoints and can invert it; plus ``ImageSequential``, ``PatchSequential``, ``VideoSequential``
+ and the dispatchers.
+ * - :doc:`Automatic augmentation <augmentation.auto>`
+ - The learned policies: :class:`~kornia.augmentation.auto.AutoAugment`,
+ :class:`~kornia.augmentation.auto.RandAugment` and
+ :class:`~kornia.augmentation.auto.TrivialAugment`.
+ * - :doc:`Base classes <augmentation.base>`
+ - Subclass ``IntensityAugmentationBase2D`` or ``GeometricAugmentationBase2D`` to write your own
+ augmentation, with worked examples.
- augmentation.auto
- augmentation.base
- augmentation.container
- augmentation.module
+.. toctree::
+ :hidden:
+
+ intensity <augmentation.intensity>
+ geometric <augmentation.geometric>
+ mix <augmentation.mix>
+ 3d transforms <augmentation.transforms3d>
+ containers <augmentation.container>
+ automatic policies <augmentation.auto>
+ base classes <augmentation.base>
diff --git a/docs/source/augmentation.transforms3d.rst b/docs/source/augmentation.transforms3d.rst
new file mode 100644
index 000000000..6a77e0a82
--- /dev/null
+++ b/docs/source/augmentation.transforms3d.rst
@@ -0,0 +1,28 @@
+3D transforms
+=============
+
+.. currentmodule:: kornia.augmentation
+
+Operators for volumetric ``(B, C, D, H, W)`` tensors, e.g. medical volumes or video treated as 3D data.
+
+Geometric
+---------
+
+.. autoclass:: CenterCrop3D
+.. autoclass:: RandomAffine3D
+.. autoclass:: RandomCrop3D
+.. autoclass:: RandomDepthicalFlip3D
+.. autoclass:: RandomHorizontalFlip3D
+.. autoclass:: RandomRotation3D
+.. autoclass:: RandomVerticalFlip3D
+
+Intensity
+---------
+
+.. autoclass:: RandomEqualize3D
+.. autoclass:: RandomMotionBlur3D
+
+Mix
+---
+
+.. autoclass:: RandomTransplantation3D
diff --git a/docs/source/color.bgr.rst b/docs/source/color.bgr.rst
new file mode 100644
index 000000000..2427d6f39
--- /dev/null
+++ b/docs/source/color.bgr.rst
@@ -0,0 +1,19 @@
+BGR
+===
+
+.. currentmodule:: kornia.color
+
+.. tip::
+ Learn more: https://en.wikipedia.org/wiki/RGB_color_model
+
+Functions
+---------
+
+.. autofunction:: bgr_to_rgb
+.. autofunction:: bgr_to_rgba
+
+Modules
+-------
+
+.. autoclass:: BgrToRgb
+.. autoclass:: BgrToRgba
diff --git a/docs/source/color.colormap.rst b/docs/source/color.colormap.rst
new file mode 100644
index 000000000..ec2e55f0d
--- /dev/null
+++ b/docs/source/color.colormap.rst
@@ -0,0 +1,25 @@
+Colormap
+========
+
+.. currentmodule:: kornia.color
+
+Render a single-channel image with a color map, e.g. to visualize depth, heat or edge maps.
+
+Functions
+---------
+
+.. autofunction:: apply_colormap
+
+Modules
+-------
+
+.. autoclass:: ApplyColorMap
+.. autoclass:: ColorMap
+.. autoclass:: RGBColor
+
+Color maps available:
+
+.. autoclass:: ColorMapType
+ :members:
+ :undoc-members:
+ :member-order: bysource
diff --git a/docs/source/color.conversions.rst b/docs/source/color.conversions.rst
new file mode 100644
index 000000000..b4689747d
--- /dev/null
+++ b/docs/source/color.conversions.rst
@@ -0,0 +1,68 @@
+Color conversion
+================
+
+.. currentmodule:: kornia.color
+
+Conversions between color spaces, on float image tensors of shape :math:`(*, C, H, W)` with values in
+:math:`[0, 1]`. Every conversion exists as a function and as an ``nn.Module``; each page below documents
+one color scheme.
+
+.. toctree::
+ :maxdepth: 1
+
+ grayscale <color.grayscale>
+ rgb <color.rgb>
+ bgr <color.bgr>
+ rgba <color.rgba>
+ linear rgb <color.linear_rgb>
+ hls <color.hls>
+ hsv <color.hsv>
+ lab <color.lab>
+ luv <color.luv>
+ xyz <color.xyz>
+ ycbcr <color.ycbcr>
+ yuv <color.yuv>
+ bayer raw <color.raw>
+
+All functions
+-------------
+
+.. autosummary::
+ :nosignatures:
+
+ rgb_to_grayscale
+ bgr_to_grayscale
+ grayscale_to_rgb
+ rgb_to_bgr
+ bgr_to_rgb
+ rgb_to_rgb255
+ rgb255_to_rgb
+ rgb255_to_normals
+ normals_to_rgb255
+ rgb_to_rgba
+ bgr_to_rgba
+ rgba_to_rgb
+ rgba_to_bgr
+ rgb_to_linear_rgb
+ linear_rgb_to_rgb
+ rgb_to_hls
+ hls_to_rgb
+ rgb_to_hsv
+ hsv_to_rgb
+ rgb_to_lab
+ lab_to_rgb
+ rgb_to_luv
+ luv_to_rgb
+ rgb_to_xyz
+ xyz_to_rgb
+ rgb_to_ycbcr
+ ycbcr_to_rgb
+ rgb_to_yuv
+ yuv_to_rgb
+ rgb_to_yuv420
+ yuv420_to_rgb
+ rgb_to_yuv422
+ yuv422_to_rgb
+ rgb_to_raw
+ raw_to_rgb
+ raw_to_rgb_2x2_downscaled
diff --git a/docs/source/color.grayscale.rst b/docs/source/color.grayscale.rst
new file mode 100644
index 000000000..3bdaed9bf
--- /dev/null
+++ b/docs/source/color.grayscale.rst
@@ -0,0 +1,21 @@
+Grayscale
+=========
+
+.. currentmodule:: kornia.color
+
+.. tip::
+ Learn more: https://en.wikipedia.org/wiki/Grayscale
+
+Functions
+---------
+
+.. autofunction:: rgb_to_grayscale
+.. autofunction:: bgr_to_grayscale
+.. autofunction:: grayscale_to_rgb
+
+Modules
+-------
+
+.. autoclass:: RgbToGrayscale
+.. autoclass:: BgrToGrayscale
+.. autoclass:: GrayscaleToRgb
diff --git a/docs/source/color.hls.rst b/docs/source/color.hls.rst
new file mode 100644
index 000000000..632eedcf1
--- /dev/null
+++ b/docs/source/color.hls.rst
@@ -0,0 +1,19 @@
+HLS
+===
+
+.. currentmodule:: kornia.color
+
+.. tip::
+ Learn more: https://en.wikipedia.org/wiki/HSL_and_HSV
+
+Functions
+---------
+
+.. autofunction:: rgb_to_hls
+.. autofunction:: hls_to_rgb
+
+Modules
+-------
+
+.. autoclass:: RgbToHls
+.. autoclass:: HlsToRgb
diff --git a/docs/source/color.hsv.rst b/docs/source/color.hsv.rst
new file mode 100644
index 000000000..20d3588cf
--- /dev/null
+++ b/docs/source/color.hsv.rst
@@ -0,0 +1,22 @@
+HSV
+===
+
+.. currentmodule:: kornia.color
+
+.. tip::
+ Learn more: https://en.wikipedia.org/wiki/HSL_and_HSV
+
+.. note::
+ Hue is returned in **radians** in :math:`[0, 2\pi)`; see :doc:`/get-started/conventions`.
+
+Functions
+---------
+
+.. autofunction:: rgb_to_hsv
+.. autofunction:: hsv_to_rgb
+
+Modules
+-------
+
+.. autoclass:: RgbToHsv
+.. autoclass:: HsvToRgb
diff --git a/docs/source/color.lab.rst b/docs/source/color.lab.rst
new file mode 100644
index 000000000..86977cb16
--- /dev/null
+++ b/docs/source/color.lab.rst
@@ -0,0 +1,19 @@
+CIE Lab
+=======
+
+.. currentmodule:: kornia.color
+
+.. tip::
+ Learn more: https://en.wikipedia.org/wiki/CIELAB_color_space
+
+Functions
+---------
+
+.. autofunction:: rgb_to_lab
+.. autofunction:: lab_to_rgb
+
+Modules
+-------
+
+.. autoclass:: RgbToLab
+.. autoclass:: LabToRgb
diff --git a/docs/source/color.linear_rgb.rst b/docs/source/color.linear_rgb.rst
new file mode 100644
index 000000000..4f03e7705
--- /dev/null
+++ b/docs/source/color.linear_rgb.rst
@@ -0,0 +1,19 @@
+Linear RGB
+==========
+
+.. currentmodule:: kornia.color
+
+.. tip::
+ Learn more: https://en.wikipedia.org/wiki/SRGB
+
+Functions
+---------
+
+.. autofunction:: rgb_to_linear_rgb
+.. autofunction:: linear_rgb_to_rgb
+
+Modules
+-------
+
+.. autoclass:: RgbToLinearRgb
+.. autoclass:: LinearRgbToRgb
diff --git a/docs/source/color.luv.rst b/docs/source/color.luv.rst
new file mode 100644
index 000000000..39f4e52cc
--- /dev/null
+++ b/docs/source/color.luv.rst
@@ -0,0 +1,19 @@
+CIE Luv
+=======
+
+.. currentmodule:: kornia.color
+
+.. tip::
+ Learn more: https://en.wikipedia.org/wiki/CIELUV
+
+Functions
+---------
+
+.. autofunction:: rgb_to_luv
+.. autofunction:: luv_to_rgb
+
+Modules
+-------
+
+.. autoclass:: RgbToLuv
+.. autoclass:: LuvToRgb
diff --git a/docs/source/color.raw.rst b/docs/source/color.raw.rst
new file mode 100644
index 000000000..b7c33a6b0
--- /dev/null
+++ b/docs/source/color.raw.rst
@@ -0,0 +1,28 @@
+Bayer RAW
+=========
+
+.. currentmodule:: kornia.color
+
+.. tip::
+ Learn more: https://en.wikipedia.org/wiki/Bayer_filter
+
+.. note::
+ The :class:`CFA` enum selects the color filter array layout.
+
+Functions
+---------
+
+.. autofunction:: rgb_to_raw
+.. autofunction:: raw_to_rgb
+.. autofunction:: raw_to_rgb_2x2_downscaled
+
+Modules
+-------
+
+.. autoclass:: CFA
+ :members:
+ :undoc-members:
+
+.. autoclass:: RgbToRaw
+.. autoclass:: RawToRgb
+.. autoclass:: RawToRgb2x2Downscaled
diff --git a/docs/source/color.rgb.rst b/docs/source/color.rgb.rst
new file mode 100644
index 000000000..9e36d66a6
--- /dev/null
+++ b/docs/source/color.rgb.rst
@@ -0,0 +1,25 @@
+RGB
+===
+
+.. currentmodule:: kornia.color
+
+.. tip::
+ Learn more: https://en.wikipedia.org/wiki/RGB_color_model
+
+Functions
+---------
+
+.. autofunction:: rgb_to_bgr
+.. autofunction:: rgb_to_rgb255
+.. autofunction:: rgb255_to_rgb
+.. autofunction:: rgb255_to_normals
+.. autofunction:: normals_to_rgb255
+
+Modules
+-------
+
+.. autoclass:: RgbToBgr
+.. autoclass:: RgbToRgb255
+.. autoclass:: Rgb255ToRgb
+.. autoclass:: Rgb255ToNormals
+.. autoclass:: NormalsToRgb255
diff --git a/docs/source/color.rgba.rst b/docs/source/color.rgba.rst
new file mode 100644
index 000000000..285ec771a
--- /dev/null
+++ b/docs/source/color.rgba.rst
@@ -0,0 +1,21 @@
+RGBA
+====
+
+.. currentmodule:: kornia.color
+
+.. tip::
+ Learn more: https://en.wikipedia.org/wiki/RGBA_color_model
+
+Functions
+---------
+
+.. autofunction:: rgb_to_rgba
+.. autofunction:: rgba_to_rgb
+.. autofunction:: rgba_to_bgr
+
+Modules
+-------
+
+.. autoclass:: RgbToRgba
+.. autoclass:: RgbaToRgb
+.. autoclass:: RgbaToBgr
diff --git a/docs/source/color.rst b/docs/source/color.rst
index bc8520dc7..7a470b3af 100644
--- a/docs/source/color.rst
+++ b/docs/source/color.rst
@@ -2,234 +2,32 @@ kornia.color
============
.. meta::
- :name: description
- :content: "The Color module in Kornia provides a variety of functions for color space conversions, including RGB, HLS, HSV, Lab, and more. It also offers utilities for color maps and Bayer RAW processing."
+ :description: The Color module in Kornia provides a variety of functions for color space conversions, including RGB, HLS, HSV, Lab, and more. It also offers utilities for color maps and Bayer RAW processing.
.. currentmodule:: kornia.color
-The functions in this section perform various color space conversions.
+Color space conversions on float image tensors of shape :math:`(*, C, H, W)` with values in :math:`[0, 1]`,
+plus color maps and sepia. Every operation exists as a function and as an ``nn.Module``.
.. note::
Check a tutorial for color space conversions `here <https://kornia.github.io/tutorials/nbs/hello_world_tutorial.html>`__.
-
-Grayscale
----------
-
-.. tip::
- Learn more: https://en.wikipedia.org/wiki/Grayscale
-
-.. autofunction:: rgb_to_grayscale
-.. autofunction:: bgr_to_grayscale
-.. autofunction:: grayscale_to_rgb
-.. autofunction:: apply_colormap
- :noindex:
-
-.. autoclass:: GrayscaleToRgb
-.. autoclass:: RgbToGrayscale
-.. autoclass:: BgrToGrayscale
-.. autoclass:: ApplyColorMap
- :noindex:
-
-RGB
----
-
-.. tip::
- Learn more: https://en.wikipedia.org/wiki/RGB_color_model
-
-.. autofunction:: rgb_to_bgr
-.. autofunction:: bgr_to_rgb
-
-.. autofunction:: rgb_to_linear_rgb
-.. autofunction:: linear_rgb_to_rgb
-
-.. autofunction:: rgb_to_rgb255
-.. autofunction:: rgb255_to_rgb
-.. autofunction:: rgb255_to_normals
-.. autofunction:: normals_to_rgb255
-
-.. autoclass:: RgbToBgr
-.. autoclass:: BgrToRgb
-
-.. autoclass:: LinearRgbToRgb
-.. autoclass:: RgbToLinearRgb
-.. autoclass:: Rgb255ToRgb
-.. autoclass:: RgbToRgb255
-.. autoclass:: Rgb255ToNormals
-.. autoclass:: NormalsToRgb255
-
-
-RGBA
-----
-
-.. tip::
- Learn more: https://en.wikipedia.org/wiki/RGBA_color_model
-
-.. autofunction:: bgr_to_rgba
-.. autofunction:: rgb_to_rgba
-.. autofunction:: rgba_to_rgb
-.. autofunction:: rgba_to_bgr
-
-.. autoclass:: RgbToRgba
-.. autoclass:: BgrToRgba
-.. autoclass:: RgbaToRgb
-.. autoclass:: RgbaToBgr
-
-HLS
----
-
-.. tip::
- Learn more: https://en.wikipedia.org/wiki/HSL_and_HSV
-
-.. autofunction:: rgb_to_hls
-.. autofunction:: hls_to_rgb
-
-.. autoclass:: RgbToHls
-.. autoclass:: HlsToRgb
-
-HSV
----
-
-.. tip::
- Learn more: https://en.wikipedia.org/wiki/HSL_and_HSV
-
-.. autofunction:: rgb_to_hsv
-.. autofunction:: hsv_to_rgb
-
-.. autoclass:: RgbToHsv
-.. autoclass:: HsvToRgb
-
-LUV
----
-
-.. tip::
- Learn more: https://en.wikipedia.org/wiki/CIELUV
-
-.. autofunction:: rgb_to_luv
-.. autofunction:: luv_to_rgb
-
-.. autoclass:: RgbToLuv
-.. autoclass:: LuvToRgb
-
-Lab
----
-
-.. tip::
- Learn more: https://en.wikipedia.org/wiki/CIELAB_color_space
-
-.. autofunction:: rgb_to_lab
-.. autofunction:: lab_to_rgb
-
-.. autoclass:: RgbToLab
-.. autoclass:: LabToRgb
-
-YCbCr
------
-
-.. tip::
- Learn more: https://en.wikipedia.org/wiki/YCbCr
-
-.. autofunction:: rgb_to_ycbcr
-.. autofunction:: ycbcr_to_rgb
-
-.. autoclass:: YcbcrToRgb
-.. autoclass:: RgbToYcbcr
-
-YUV
----
-
-.. tip::
- Learn more: https://en.wikipedia.org/wiki/YUV
-
-.. autofunction:: rgb_to_yuv
-.. autofunction:: yuv_to_rgb
-
-.. autoclass:: RgbToYuv
-.. autoclass:: YuvToRgb
-
-YUV420
-------
-
-.. tip::
- Learn more: https://en.wikipedia.org/wiki/YUV
-
-.. tip::
- Learn more: https://en.wikipedia.org/wiki/Chroma_subsampling
-
-.. autofunction:: rgb_to_yuv420
-.. autofunction:: yuv420_to_rgb
-
-.. autoclass:: RgbToYuv420
-.. autoclass:: Yuv420ToRgb
-
-YUV422
-------
-
-.. tip::
- Learn more: https://en.wikipedia.org/wiki/YUV
-
-.. tip::
- Learn more: https://en.wikipedia.org/wiki/Chroma_subsampling
-
-.. autofunction:: rgb_to_yuv422
-.. autofunction:: yuv422_to_rgb
-
-.. autoclass:: RgbToYuv422
-.. autoclass:: Yuv422ToRgb
-
-XYZ
----
-
-.. tip::
- Learn more: https://en.wikipedia.org/wiki/CIELUV
-
-.. autofunction:: rgb_to_xyz
-.. autofunction:: xyz_to_rgb
-
-.. autoclass:: RgbToXyz
-.. autoclass:: XyzToRgb
-
-Bayer RAW
----------
-
-.. tip::
- Learn more: https://en.wikipedia.org/wiki/Bayer_filter
-
-.. autoclass:: CFA
- :members:
- :undoc-members:
-
-.. autofunction:: rgb_to_raw
-.. autofunction:: raw_to_rgb
-.. autofunction:: raw_to_rgb_2x2_downscaled
-
-.. autoclass:: RawToRgb
-.. autoclass:: RgbToRaw
-.. autoclass:: RawToRgb2x2Downscaled
-
-Sepia
------
-
-.. autoclass:: Sepia
-.. autofunction:: sepia
-
-
-Color Maps
-----------
-
-.. autoclass:: ColorMap
-.. autoclass:: RGBColor
-
-
-Color maps available:
-
-.. autoclass:: ColorMapType
- :members:
- :undoc-members:
- :member-order: bysource
-
-
-Functions and modules to use the color maps:
-
-.. autofunction:: apply_colormap
-.. autoclass:: ApplyColorMap
+.. list-table::
+ :widths: 30 70
+
+ * - :doc:`Color conversion <color.conversions>`
+ - Conversions between :doc:`grayscale <color.grayscale>`, :doc:`RGB <color.rgb>`, :doc:`BGR <color.bgr>`,
+ :doc:`RGBA <color.rgba>`, :doc:`linear RGB <color.linear_rgb>`, :doc:`HLS <color.hls>`,
+ :doc:`HSV <color.hsv>`, :doc:`Lab <color.lab>`, :doc:`Luv <color.luv>`, :doc:`XYZ <color.xyz>`,
+ :doc:`YCbCr <color.ycbcr>`, :doc:`YUV <color.yuv>` and :doc:`Bayer RAW <color.raw>`.
+ * - :doc:`Colormap <color.colormap>`
+ - Render single-channel images (depth, heat, edges) with a color map.
+ * - :doc:`Sepia <color.sepia>`
+ - The sepia tone effect.
+
+.. toctree::
+ :hidden:
+
+ color conversion <color.conversions>
+ colormap <color.colormap>
+ sepia <color.sepia>
diff --git a/docs/source/color.sepia.rst b/docs/source/color.sepia.rst
new file mode 100644
index 000000000..5245a2541
--- /dev/null
+++ b/docs/source/color.sepia.rst
@@ -0,0 +1,14 @@
+Sepia
+=====
+
+.. currentmodule:: kornia.color
+
+Functions
+---------
+
+.. autofunction:: sepia
+
+Modules
+-------
+
+.. autoclass:: Sepia
diff --git a/docs/source/color.xyz.rst b/docs/source/color.xyz.rst
new file mode 100644
index 000000000..c99f3bb34
--- /dev/null
+++ b/docs/source/color.xyz.rst
@@ -0,0 +1,19 @@
+CIE XYZ
+=======
+
+.. currentmodule:: kornia.color
+
+.. tip::
+ Learn more: https://en.wikipedia.org/wiki/CIE_1931_color_space
+
+Functions
+---------
+
+.. autofunction:: rgb_to_xyz
+.. autofunction:: xyz_to_rgb
+
+Modules
+-------
+
+.. autoclass:: RgbToXyz
+.. autoclass:: XyzToRgb
diff --git a/docs/source/color.ycbcr.rst b/docs/source/color.ycbcr.rst
new file mode 100644
index 000000000..4f36eb225
--- /dev/null
+++ b/docs/source/color.ycbcr.rst
@@ -0,0 +1,19 @@
+YCbCr
+=====
+
+.. currentmodule:: kornia.color
+
+.. tip::
+ Learn more: https://en.wikipedia.org/wiki/YCbCr
+
+Functions
+---------
+
+.. autofunction:: rgb_to_ycbcr
+.. autofunction:: ycbcr_to_rgb
+
+Modules
+-------
+
+.. autoclass:: RgbToYcbcr
+.. autoclass:: YcbcrToRgb
diff --git a/docs/source/color.yuv.rst b/docs/source/color.yuv.rst
new file mode 100644
index 000000000..f8c14df3b
--- /dev/null
+++ b/docs/source/color.yuv.rst
@@ -0,0 +1,30 @@
+YUV
+===
+
+.. currentmodule:: kornia.color
+
+.. tip::
+ Learn more: https://en.wikipedia.org/wiki/YUV
+
+.. note::
+ Includes the chroma-subsampled 4:2:0 and 4:2:2 layouts.
+
+Functions
+---------
+
+.. autofunction:: rgb_to_yuv
+.. autofunction:: yuv_to_rgb
+.. autofunction:: rgb_to_yuv420
+.. autofunction:: yuv420_to_rgb
+.. autofunction:: rgb_to_yuv422
+.. autofunction:: yuv422_to_rgb
+
+Modules
+-------
+
+.. autoclass:: RgbToYuv
+.. autoclass:: YuvToRgb
+.. autoclass:: RgbToYuv420
+.. autoclass:: Yuv420ToRgb
+.. autoclass:: RgbToYuv422
+.. autoclass:: Yuv422ToRgb
diff --git a/docs/source/community/bibliography.rst b/docs/source/community/bibliography.rst
index 0d21440d0..acb71c31d 100644
--- a/docs/source/community/bibliography.rst
+++ b/docs/source/community/bibliography.rst
@@ -1,4 +1,9 @@
+:orphan:
+
Bibliography
============
+References cited across the API documentation link here.
+
+
.. bibliography::
diff --git a/docs/source/community/community.rst b/docs/source/community/community.rst
new file mode 100644
index 000000000..a0c76c1f0
--- /dev/null
+++ b/docs/source/community/community.rst
@@ -0,0 +1,55 @@
+Community
+=========
+
+.. meta::
+ :description: Join the Kornia community: Discord for chat, GitHub for development, Twitter/X, LinkedIn and YouTube for news, the Chinese community on QQ and Zhihu, and the wider LibreCV ecosystem.
+
+Kornia is built by people who talk to each other in the open. Pick your channel:
+
+.. grid:: 1 2 2 3
+ :gutter: 3
+ :class-container: kornia-cards
+
+ .. grid-item-card:: :octicon:`comment-discussion` Discord
+ :link: https://discord.gg/HfnywwpBnD
+
+ Day-to-day chat with users and maintainers β€” the fastest way to get unstuck.
+
+ .. grid-item-card:: :octicon:`mark-github` GitHub
+ :link: https://github.com/kornia/kornia
+
+ The source of truth: code, issues, discussions and releases.
+
+ .. grid-item-card:: :octicon:`megaphone` Twitter / X
+ :link: https://twitter.com/kornia_foss
+
+ Releases and research news, as they happen.
+
+ .. grid-item-card:: :octicon:`briefcase` LinkedIn
+ :link: https://www.linkedin.com/company/kornia/
+
+ The professional side: announcements and collaborations.
+
+ .. grid-item-card:: :octicon:`video` YouTube
+ :link: https://www.youtube.com/channel/UCI1SE1Ij2Fast5BSKxoa7Ag
+
+ Talks, demos and tutorials in video form.
+
+ .. grid-item-card:: :octicon:`globe` δΈ­ζ–‡η€ΎεŒΊ
+ :link: chinese
+ :link-type: doc
+
+ 加ε…₯ Kornia δΈ­ζ–‡η€ΎεŒΊοΌšQQ 羀与ηŸ₯δΉŽγ€‚
+
+A newsletter is under construction β€” announcements land on the channels above in the meantime.
+
+Kornia is part of a wider open ecosystem: the `LibreCV <https://librecv.org>`_ community,
+`Kornia AI <https://kornia.org>`_ (the non-profit behind the library, see :doc:`the governance page
+</get-started/governance>`), and integrations such as the `OpenCV AI Kit
+<https://docs.luxonis.com/en/latest/pages/tutorials/creating-custom-nn-models/#kornia>`_ and
+:doc:`kornia-rs </get-started/edge>`.
+
+.. toctree::
+ :hidden:
+
+ δΈ­ζ–‡η€ΎεŒΊ <chinese>
diff --git a/docs/source/community/contribute.rst b/docs/source/community/contribute.rst
index ecdd6c833..61cb4d92b 100644
--- a/docs/source/community/contribute.rst
+++ b/docs/source/community/contribute.rst
@@ -1,21 +1,37 @@
-Contribute to kornia
-====================
+Contribute
+==========
-We develop kornia for ourselves and the computer vision community. If the library is
-useful to you, that makes us happy, and you are welcome to help in whatever way suits
-you: report a bug, propose an idea, send code or documentation, answer a question, or
-tell others about the project.
+.. meta::
+ :description: How to contribute to Kornia: report a bug with a reproducible example, ask questions on GitHub Discussions or Discord, and send code or documentation following the contributing guide.
-Maintainers review and respond when they can, but we cannot promise that every issue
-or pull request will be reviewed or merged. Our social contract, development setup,
-and technical guidelines are in the
-`Contributing guide <https://github.com/kornia/kornia/blob/main/CONTRIBUTING.md>`_.
+We develop Kornia for ourselves and the computer vision community. If the library is useful to you, you are
+welcome to help in whatever way suits you β€” every section below is a valid contribution.
-Community links
+Report a bug
+------------
+
+Open an issue on the `GitHub issue tracker <https://github.com/kornia/kornia/issues/new/choose>`_. The most
+useful reports come with a minimal reproducible example and the environment line the bug template asks for
+(kornia, PyTorch and Python versions, OS, device backend). Please preview and redact anything private before
+posting.
+
+Ask questions
+-------------
+
+Usage questions and ideas belong in `GitHub Discussions <https://github.com/kornia/kornia/discussions>`_,
+or on `Discord <https://discord.gg/HfnywwpBnD>`_ if you prefer chat. Check the :doc:`FAQ <faqs>` and the
+:doc:`conventions page </get-started/conventions>` first β€” many "bugs" are convention mismatches.
+
+Contribute code
---------------
-- Ask questions and discuss ideas in `GitHub Discussions <https://github.com/kornia/kornia/discussions>`_.
-- Report bugs and propose concrete changes in `GitHub Issues <https://github.com/kornia/kornia/issues/new/choose>`_.
-- Talk with people who use and develop kornia on `Discord <https://discord.gg/HfnywwpBnD>`_.
-- Support the project through `GitHub Sponsors <https://github.com/sponsors/kornia>`_
- or `Open Collective <https://opencollective.com/kornia>`_.
+Code and documentation contributions go through pull requests on `GitHub
+<https://github.com/kornia/kornia>`_. The `contributing guide
+<https://github.com/kornia/kornia/blob/main/CONTRIBUTING.md>`_ describes the development setup, the social
+contract and the technical guidelines; the repository's ``AGENTS.md`` documents the day-to-day commands
+(tests, lint, docs builds). Maintainers review and respond when they can, but we cannot promise that every
+issue or pull request will be reviewed or merged.
+
+Not sure where to start? Documentation fixes, new tests and issues labeled `"good first issue"
+<https://github.com/kornia/kornia/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22>`_ are the
+friendliest entry points. And if code is not your thing, consider :doc:`sponsoring <sponsor>` instead.
diff --git a/docs/source/community/faqs.rst b/docs/source/community/faqs.rst
index c699e0ac1..de40a386e 100644
--- a/docs/source/community/faqs.rst
+++ b/docs/source/community/faqs.rst
@@ -3,21 +3,21 @@ Frequently Asked Questions
This document contains frequently asked questions.
-Kornia relation to Pytorch Geometry/Geometric
----------------------------------------------
+Kornia's relation to PyTorch Geometry/Geometric
+-----------------------------------------------
This project started as a small differentiable geometric computer
vision package called `PyTorch Geometry <https://pypi.org/project/torchgeometry>`_
released during the PyTorch devcon 2018 (see the presented
`poster <https://drive.google.com/file/d/1xiao1Xj9WzjJ08YY_nYwsthE-wxfyfhG/view?usp=sharing>`_).
-The project evolved to a more generic computer vision library and due to the naming
-conflict between `Pytorch Geometric <https://pytorch-geometric.readthedocs.io/en/latest>`_
-we decided to rename the whole package and focus to more generic vision functionalities.
+The project evolved into a more generic computer vision library and, due to the naming
+conflict with `PyTorch Geometric <https://pytorch-geometric.readthedocs.io/en/latest>`_,
+we decided to rename the whole package and focus on more generic vision functionalities.
-Kornia relation to Other Computer Vision Projects
--------------------------------------------------
+Kornia's relation to other computer vision projects
+---------------------------------------------------
The project mimics some of the functionalities found in OpenCV. Even though
-the project is backed up by the `OpenCV.org <www.opencv.org/>`_, there is no
-intention at all to merge in any form both projects. *Kornia* is meant to
-provide differentiable operators to train nets, while *OpenCV* scope is inference.
+the project is backed by `OpenCV.org <https://opencv.org/>`_, there is no
+intention at all to merge the two projects in any form. *Kornia* is meant to
+provide differentiable operators to train networks, while *OpenCV*'s scope is inference.
diff --git a/docs/source/community/index.rst b/docs/source/community/index.rst
new file mode 100644
index 000000000..f1590510b
--- /dev/null
+++ b/docs/source/community/index.rst
@@ -0,0 +1,34 @@
+Support
+=======
+
+.. meta::
+ :description: Support Kornia and get support: sponsor the project through Open Collective, GitHub Sponsors or [email protected], or contribute bug reports, answers and code.
+
+Kornia is developed in the open by a community of volunteers. Whether you need help or want to give it,
+start here.
+
+.. grid:: 1 1 2 2
+ :gutter: 3
+ :class-container: kornia-cards
+
+ .. grid-item-card:: :octicon:`heart` Sponsor
+ :link: sponsor
+ :link-type: doc
+
+ Fund maintenance, CI and new development β€” on Open Collective, GitHub Sponsors, or with your logo
+ in these docs.
+
+ .. grid-item-card:: :octicon:`git-pull-request` Contribute
+ :link: contribute
+ :link-type: doc
+
+ Report a bug, ask a question, or send code and documentation β€” the guide covers all three.
+
+Looking for the community channels or the FAQ? They live under :doc:`About </about>` and in the
+**Ecosystem** menu in the navigation bar.
+
+.. toctree::
+ :hidden:
+
+ sponsor
+ contribute
diff --git a/docs/source/community/sponsor.rst b/docs/source/community/sponsor.rst
new file mode 100644
index 000000000..8e4ef4d34
--- /dev/null
+++ b/docs/source/community/sponsor.rst
@@ -0,0 +1,43 @@
+Sponsor Kornia
+==============
+
+.. meta::
+ :description: Sponsor Kornia: support the open-source geometric computer vision library for Spatial AI through Open Collective or GitHub Sponsors, or contact [email protected] for logo placement and partnerships.
+
+Kornia is developed and maintained by volunteers and backed by the non-profit Kornia AI organization. It is
+downloaded millions of times every month and used in research and production worldwide β€” and it stays free,
+open and Apache-2.0 licensed. Sponsorship is what keeps that sustainable.
+
+What your sponsorship funds
+---------------------------
+
+- Maintenance: reviewing contributions, fixing bugs, and keeping up with new PyTorch releases.
+- Infrastructure: continuous integration, GPU test runners, documentation hosting and model weight hosting.
+- New development: operators, pretrained models, and the kornia-rs Rust stack for edge devices.
+- Community: tutorials, events, and mentoring new contributors.
+
+How to sponsor
+--------------
+
+.. grid:: 1 1 3 3
+ :gutter: 3
+ :class-container: kornia-cards
+
+ .. grid-item-card:: :octicon:`heart` Open Collective
+ :link: https://opencollective.com/kornia
+
+ Transparent budget and one-off or recurring contributions, as an individual or a company.
+
+ .. grid-item-card:: :octicon:`mark-github` GitHub Sponsors
+ :link: https://github.com/sponsors/kornia
+
+ Sponsor directly through GitHub, alongside your organization's other open-source support.
+
+ .. grid-item-card:: :octicon:`mail` Talk to us
+ :link: mailto:[email protected]
+
+ For logo placement in the documentation, partnerships, or support contracts, write to
+
+Corporate sponsors are acknowledged with their logo in the documentation sidebar and on the project pages.
+Every contribution, of any size, is appreciated β€” thank you for keeping open computer vision alive.
diff --git a/docs/source/conf.py b/docs/source/conf.py
index a59998feb..2b8616ac4 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -16,23 +16,28 @@
#
import builtins
+import html
import importlib.util
import inspect
+import json
import os
+import re
import sys
from datetime import UTC, datetime
# Monkey-patch for PyTorch compatibility with sphinx_autodoc_typehints
# Newer versions of PyTorch removed torch.jit.annotations.compiler_flag
import torch.jit.annotations
+from sphinx.util import logging as sphinx_logging
if not hasattr(torch.jit.annotations, "compiler_flag"):
torch.jit.annotations.compiler_flag = None
-# To add an evnironment variable
+# Let the library know it is being imported by the Sphinx build.
builtins.__sphinx_build__ = True
-# --- Patch sphinx_autodoc_defaultargs to not crash on torchscript/pybind11 callables ---
+logger = sphinx_logging.getLogger(__name__)
+
# --- Patch sphinx_autodoc_defaultargs to not crash on torchscript/pybind11 callables ---
try:
import sphinx_autodoc_defaultargs
@@ -94,6 +99,99 @@ spec.loader.exec_module(generate_benchmarks)
# Pre-generate the benchmark results page
generate_benchmarks.main()
+spec = importlib.util.spec_from_file_location("generate_adoption", "../generate_adoption.py")
+generate_adoption = importlib.util.module_from_spec(spec)
+spec.loader.exec_module(generate_adoption)
+
+# Pre-generate the adoption page from the committed dependents snapshot
+_adoption = generate_adoption.main()
+
+
+def _public_operator_count() -> int:
+ """Public functions and ``nn.Module`` classes defined across kornia's public modules.
+
+ Walks every ``kornia.*`` module without a private path component and counts the functions and
+ ``torch.nn.Module`` subclasses it defines under a public name. Model architecture internals
+ (``kornia.models.*.architecture``), ``kornia.core`` and the transpiler shim are left out so the
+ figure is about operators rather than plumbing.
+ """
+ import contextlib
+ import io
+ import pkgutil
+ import warnings
+
+ import torch
+
+ import kornia
+
+ skip = re.compile(r"^kornia\.(core|transpiler)(\.|$)|\.architecture(\.|$)")
+ seen: set[tuple[str, str]] = set()
+ with (
+ warnings.catch_warnings(),
+ contextlib.redirect_stdout(io.StringIO()),
+ contextlib.redirect_stderr(io.StringIO()),
+ ):
+ warnings.simplefilter("ignore")
+ for info in pkgutil.walk_packages(kornia.__path__, "kornia."):
+ if skip.search(info.name) or any(part.startswith("_") for part in info.name.split(".")[1:]):
+ continue
+ try:
+ module = importlib.import_module(info.name)
+ except Exception as exc: # noqa: BLE001 - an optional dependency is missing; nothing to count there
+ logger.debug("skipping %s while counting operators: %r", info.name, exc)
+ continue
+ for name, obj in vars(module).items():
+ # Type checks first: attribute access on a ``kornia.core.external.LazyLoader`` would
+ # try to import (and offer to install) the optional dependency behind it.
+ if not (inspect.isfunction(obj) or (inspect.isclass(obj) and issubclass(obj, torch.nn.Module))):
+ continue
+ if name.startswith("_") or obj.__name__ != name:
+ continue
+ defined_in = getattr(obj, "__module__", "") or ""
+ if defined_in.startswith("kornia.") and not skip.search(defined_in):
+ seen.add((defined_in, obj.__qualname__))
+ return len(seen)
+
+
+def _landing_page_counts() -> dict[str, str]:
+ """Figures the landing page quotes, derived from the library rather than typed in.
+
+ The public-name counts read the stable-core inventory that ``tests/test_api_surface.py`` pins;
+ ``kornia.feature`` and ``kornia.models`` are outside it, so they are counted from the live
+ package and from the model pages under ``docs/source/models/``. ``operators`` is the
+ library-wide total from :func:`_public_operator_count`, floored to the hundred below it so the
+ page can say "1,000+" and stay true between releases.
+ """
+ with open("../../tests/api_surface.json", encoding="utf-8") as handle:
+ surface = {name: len(names) for name, names in json.load(handle).items()}
+ import kornia.feature
+
+ operators = _public_operator_count()
+ image_processing = sum(
+ surface[name] for name in ("kornia.filters", "kornia.color", "kornia.enhance", "kornia.morphology")
+ )
+ losses_metrics = surface["kornia.losses"] + surface["kornia.metrics"]
+ model_pages = [entry for entry in os.listdir("models") if entry.endswith(".rst") and entry != "index.rst"]
+ return {
+ "geometry": str(surface["kornia.geometry"]),
+ "feature": str(len(kornia.feature.__all__)),
+ "image-processing": str(image_processing),
+ "losses-metrics": str(losses_metrics),
+ "augmentation": str(surface["kornia.augmentation"]),
+ "models": str(len(model_pages)),
+ "operators": f"{operators:,}",
+ "operators-floor": f"{operators // 100 * 100:,}",
+ "dependents": f"{_adoption['repositories']:,}",
+ "dependents-listed": f"{_adoption['repositories_listed']:,}",
+ "dependents-rounded": str(_adoption["repositories_rounded"]),
+ "dependent-packages": f"{_adoption['packages']:,}",
+ "dependents-date": str(_adoption["generated_at"]),
+ }
+
+
+# Substitutions such as |count-geometry| and |count-dependents| for the landing page.
+rst_epilog = "\n".join(f".. |count-{key}| replace:: {value}" for key, value in _landing_page_counts().items())
+
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
@@ -185,7 +283,12 @@ exclude_patterns = ["_build", ".ipynb_checkpoints"]
pygments_style = "friendly"
pygments_dark_style = "monokai"
-html_theme = "furo"
+# The documentation builds on pydata-sphinx-theme (top navbar with Learn / API / Models and the
+# Ecosystem / About / Support dropdowns). ``KORNIA_DOCS_THEME=furo`` selects the previous furo
+# layout, kept as a fallback while the redesign settles.
+DOCS_THEME = os.environ.get("KORNIA_DOCS_THEME", "pydata")
+
+html_theme = "pydata_sphinx_theme" if DOCS_THEME == "pydata" else "furo"
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
@@ -194,15 +297,47 @@ html_theme = "furo"
# TODO(jian): make to work with https://docs.kornia.org
html_baseurl = "https://kornia.readthedocs.io/en/latest/"
+# Git ref that the "view/edit source" links and the ``linkcode`` extension point at.
+rtd_version = os.environ.get("READTHEDOCS_VERSION")
+if rtd_version and rtd_version not in {"latest", "stable"}:
+ code_ref = rtd_version
+else:
+ code_ref = "main"
+
# Changing sidebar title to Kornia
html_title = "Kornia"
-html_theme_options = {
+_GITHUB_ICON_SVG = (
+ '<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16">'
+ '<path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 '
+ "0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 "
+ "1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 "
+ "0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 "
+ "2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 "
+ "3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 "
+ '8c0-4.42-3.58-8-8-8z"></path></svg>'
+)
+
+_FURO_THEME_OPTIONS = {
# 'analytics_id': 'G-RKS4WFXVHJ', # Unsupported by furo theme
"light_logo": "img/kornia_logo_only_light.svg",
"dark_logo": "img/kornia_logo_only_dark.svg",
"sidebar_hide_name": True,
"navigation_with_keys": True,
+ # "View source" / "Edit on GitHub" buttons at the top of every page: the cheapest
+ # way to turn a reader who spotted a typo into a contributor.
+ "source_repository": "https://github.com/kornia/kornia/",
+ "source_branch": code_ref,
+ "source_directory": "docs/source/",
+ "top_of_page_buttons": ["view", "edit"],
+ "footer_icons": [
+ {
+ "name": "GitHub",
+ "url": "https://github.com/kornia/kornia",
+ "html": _GITHUB_ICON_SVG,
+ "class": "",
+ },
+ ],
"light_css_variables": {
"color-sidebar-background": "#3980F5",
"color-sidebar-background-border": "#3980F5",
@@ -227,10 +362,108 @@ html_theme_options = {
# """,
}
+_PYDATA_THEME_OPTIONS = {
+ "logo": {
+ "image_light": "_static/img/kornia_logo_only_light.svg",
+ "image_dark": "_static/img/kornia_logo_only_dark.svg",
+ "text": "Kornia",
+ },
+ # Top navbar: one entry per top-level toctree item of index.rst (Guide / API / Models / Community),
+ # plus the external tutorials site. Each section gets its own left sidebar.
+ # Navbar: logo + search on the left, flexible space, then the nav links,
+ # theme switcher and icon links on the right.
+ "navbar_align": "right",
+ "navbar_start": ["navbar-logo", "search-button-field"],
+ "navbar_center": [],
+ "navbar_end": ["navbar-nav", "theme-switcher", "navbar-icon-links"],
+ "navbar_persistent": [],
+ "header_links_before_dropdown": 6,
+ "icon_links": [
+ {"name": "GitHub", "url": "https://github.com/kornia/kornia", "icon": "fa-brands fa-github"},
+ {"name": "Discord", "url": "https://discord.gg/HfnywwpBnD", "icon": "fa-brands fa-discord"},
+ {"name": "Twitter", "url": "https://twitter.com/kornia_foss", "icon": "fa-brands fa-x-twitter"},
+ ],
+ "use_edit_page_button": True,
+ "show_nav_level": 1,
+ "navigation_depth": 4,
+ "show_toc_level": 2,
+ "collapse_navigation": False,
+ # Right sidebar: page TOC and edit links, with the sponsor box (docs/source/_templates/sponsors.html)
+ # below. The landing page is a designed hero page and carries no right rail at all.
+ "secondary_sidebar_items": {
+ "index": [],
+ "**": ["page-toc", "edit-this-page", "sourcelink", "sponsors"],
+ },
+ "pygments_light_style": "friendly",
+ "pygments_dark_style": "monokai",
+ "footer_start": [],
+ "footer_end": [],
+}
+
+html_theme_options = _PYDATA_THEME_OPTIONS if DOCS_THEME == "pydata" else _FURO_THEME_OPTIONS
+
+# Navbar dropdown menus, rendered by ``_static/js/custom.js``: "Support" and "About" hang off the
+# toctree entries of the same name in index.rst; "Ecosystem" is a grouped panel inserted before
+# "About". Entries are ``[label, target]`` where the target is a docname (checked against the build,
+# so a renamed page fails ``-W`` instead of 404ing from the menu), an external URL, or ``None`` for
+# a "coming soon" placeholder.
+NAVBAR_MENUS = {
+ "Support": [
+ ["Sponsor", "community/sponsor"],
+ ["Contribute", "community/contribute"],
+ ],
+ "About": [
+ ["FAQ", "community/faqs"],
+ ["Team", "get-started/governance"],
+ ["Community Guide", "community/community"],
+ ["Code of Conduct", "https://github.com/kornia/kornia/blob/main/CODE_OF_CONDUCT.md"],
+ ["Citing Kornia", "get-started/about"],
+ ["Adoption", "community/adoption"],
+ ["API Stability Policy", "get-started/stability"],
+ ],
+ "Ecosystem": {
+ "official libs": [
+ ["kornia", "https://github.com/kornia/kornia"],
+ ["kornia-rs", "https://github.com/kornia/kornia-rs"],
+ ],
+ "help": [
+ ["Discord chat", "https://discord.gg/HfnywwpBnD"],
+ ["GitHub discussions", "https://github.com/kornia/kornia/discussions"],
+ ["Issue tracker", "https://github.com/kornia/kornia/issues"],
+ ],
+ "news": [
+ ["Twitter / X", "https://twitter.com/kornia_foss"],
+ ["LinkedIn", "https://www.linkedin.com/company/kornia/"],
+ ["Newsletter", None],
+ ],
+ },
+}
+
+if DOCS_THEME == "pydata":
+ # Feeds the "Edit this page" button and the source links.
+ html_context = {
+ "github_user": "kornia",
+ "github_repo": "kornia",
+ "github_version": code_ref,
+ "doc_path": "docs/source",
+ }
+ # The landing page has its own card grid; a section sidebar next to it would be empty noise.
+ html_sidebars = {"index": []}
+
# html_logo = '_static/img/kornia_logo.svg'
# html_logo = '_static/img/kornia_logo_only.png'
html_favicon = "_static/img/kornia_logo_favicon.png"
+# Show the build date in the footer so readers can tell a stale mirror from the live docs.
+html_last_updated_fmt = "%b %d, %Y"
+
+# sphinx-copybutton: strip ``>>>`` / ``...`` / ``$`` prompts and skip output lines, so the
+# clipboard receives runnable code instead of a transcript.
+copybutton_prompt_text = r">>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: | {5,8}: "
+copybutton_prompt_is_regexp = True
+copybutton_only_copy_prompt_lines = True
+copybutton_line_continuation_character = "\\"
+
# Config the `sphinxcontrib.gtagjs` extension
# NOTE: if this didn't work, we can remove the extension itself
gtagjs_ids = [
@@ -245,21 +478,11 @@ html_extra_path = ["_extra"]
# Output file base name for HTML help builder.
htmlhelp_basename = "Kornia"
-html_css_files = ["css/main.css"]
-html_js_files = [
- "js/custom.js",
- ("https://gradio.s3-us-west-2.amazonaws.com/4.38.1/gradio.js", {"defer": "defer", "type": "module"}),
- "https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.3.2/iframeResizer.min.js",
-]
+html_css_files = ["css/pydata.css" if DOCS_THEME == "pydata" else "css/main.css"]
+html_js_files = ["js/custom.js"]
# Configure viewcode extension.
# based on https://github.com/readthedocs/sphinx-autoapi/issues/202
-rtd_version = os.environ.get("READTHEDOCS_VERSION")
-if rtd_version and rtd_version not in {"latest", "stable"}:
- code_ref = rtd_version
-else:
- code_ref = "main"
-
code_url = f"https://github.com/kornia/kornia/blob/{code_ref}"
@@ -354,9 +577,137 @@ texinfo_documents = [
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
"python": ("https://docs.python.org/3/", None),
- "numpy": ("http://numpy.org/doc/stable/", None),
- "torch": ("http://pytorch.org/docs/stable/", None),
+ "numpy": ("https://numpy.org/doc/stable/", None),
+ "torch": ("https://pytorch.org/docs/stable/", None),
}
# mock these modules and won't try to actually import them
autodoc_mock_imports = ["boxmot", "segmentation_models_pytorch"]
+
+
+# -- Social / SEO metadata --------------------------------------------------
+
+# Used when a page does not declare its own ``.. meta:: :name: description``.
+_DEFAULT_DESCRIPTION = (
+ "Kornia is a differentiable computer vision library for PyTorch: batched, GPU-ready, "
+ "autograd-friendly image transforms, filters, color conversions, camera geometry, augmentations "
+ "and curated deep learning models."
+)
+_SOCIAL_IMAGE = "https://github.com/kornia/data/raw/main/kornia_banner_pixie.png"
+_META_TAG_RE = re.compile(r"<meta\b[^>]*>", re.IGNORECASE)
+_META_ATTR_RE = re.compile(r'(\w+)="([^"]*)"')
+
+
+def _inject_social_metatags(app, pagename, templatename, context, doctree):
+ """Add Open Graph / Twitter card tags (and a fallback description) to every HTML page.
+
+ Search engines and chat apps render these when a docs link is shared; Sphinx and furo emit
+ none of them by default. The description is taken from the page's own ``.. meta::``
+ directive when it has one, so page authors keep control of the snippet.
+ """
+ metatags = context.get("metatags", "") or ""
+ match = None
+ for tag in _META_TAG_RE.findall(metatags):
+ attrs = dict(_META_ATTR_RE.findall(tag))
+ if attrs.get("name", "").lower() == "description" and attrs.get("content"):
+ match = attrs["content"]
+ break
+ description = html.unescape(match).strip().strip('"') if match else _DEFAULT_DESCRIPTION
+ description = " ".join(description.split())
+ if len(description) > 300:
+ description = description[:297].rsplit(" ", 1)[0] + "..."
+ # Sphinx hands the title over already HTML-escaped; unescape so ``esc`` below does not double it.
+ title = html.unescape(context.get("title") or project)
+ if pagename != master_doc:
+ title = f"{title} - {project}"
+ url = f"{html_baseurl}{pagename}.html"
+ esc = html.escape
+
+ extra = []
+ if not match:
+ extra.append(f'<meta name="description" content="{esc(description)}" />')
+ extra += [
+ '<meta property="og:type" content="website" />',
+ f'<meta property="og:site_name" content="{esc(project)}" />',
+ f'<meta property="og:title" content="{esc(title)}" />',
+ f'<meta property="og:description" content="{esc(description)}" />',
+ f'<meta property="og:url" content="{esc(url)}" />',
+ f'<meta property="og:image" content="{_SOCIAL_IMAGE}" />',
+ '<meta name="twitter:card" content="summary_large_image" />',
+ '<meta name="twitter:site" content="@kornia_foss" />',
+ f'<meta name="twitter:title" content="{esc(title)}" />',
+ f'<meta name="twitter:description" content="{esc(description)}" />',
+ f'<meta name="twitter:image" content="{_SOCIAL_IMAGE}" />',
+ ]
+ context["metatags"] = metatags + "\n" + "\n".join(extra)
+
+
+# -- Deep-link compatibility ------------------------------------------------
+
+# Pages that used to hold a whole module's reference and are now section indexes, with the
+# objects spread over per-topic subpages. Years of external links point at anchors on these
+# pages (``augmentation.module.html#kornia.augmentation.RandomAffine``), and a server-side
+# redirect cannot see the fragment. Each of these pages therefore embeds a JSON map from
+# object name to the page that documents it now, and ``_static/js/custom.js`` redirects when
+# the requested fragment is in the map. Map the page to its old ``kornia.<module>`` prefix.
+_SPLIT_INDEX_PAGES = {
+ "augmentation.module": "kornia.augmentation.",
+ "color": "kornia.color.",
+ "enhance": "kornia.enhance.",
+ "feature": "kornia.feature.",
+ "filters": "kornia.filters.",
+ "image": "kornia.image.",
+ "losses": "kornia.losses.",
+ "metrics": "kornia.metrics.",
+}
+
+
+def _inject_anchor_redirects(app, pagename, templatename, context, doctree):
+ """Embed ``{new docname: [object names]}`` on the pages listed in ``_SPLIT_INDEX_PAGES``."""
+ prefix = _SPLIT_INDEX_PAGES.get(pagename)
+ if prefix is None:
+ return
+ moved: dict[str, list[str]] = {}
+ for fullname, entry in app.env.domaindata["py"]["objects"].items():
+ if fullname.startswith(prefix) and entry.docname != pagename:
+ moved.setdefault(entry.docname, []).append(fullname)
+ if not moved:
+ return
+ context["metatags"] = (context.get("metatags", "") or "") + "\n" + _json_script("kornia-anchor-redirects", moved)
+
+
+def _json_script(element_id, data):
+ payload = json.dumps(data, separators=(",", ":")).replace("</", "<\\/")
+ return f'<script type="application/json" id="{element_id}">{payload}</script>'
+
+
+# -- Navbar menus -----------------------------------------------------------
+
+
+def _navbar_menu_entries():
+ for menu in NAVBAR_MENUS.values():
+ groups = menu.values() if isinstance(menu, dict) else [menu]
+ for group in groups:
+ yield from group
+
+
+def _check_navbar_menus(app, env):
+ """Fail the build (under ``-W``) when a menu entry points at a page that no longer exists."""
+ for label, target in _navbar_menu_entries():
+ if target is None or "://" in target:
+ continue
+ if target not in env.found_docs:
+ logger.warning("NAVBAR_MENUS entry %r points at unknown document %r", label, target)
+
+
+def _inject_navbar_menus(app, pagename, templatename, context, doctree):
+ if DOCS_THEME != "pydata":
+ return
+ context["metatags"] = (context.get("metatags", "") or "") + "\n" + _json_script("kornia-navbar-menus", NAVBAR_MENUS)
+
+
+def setup(app):
+ app.connect("html-page-context", _inject_social_metatags)
+ app.connect("html-page-context", _inject_anchor_redirects)
+ app.connect("html-page-context", _inject_navbar_menus)
+ app.connect("env-check-consistency", _check_navbar_menus)
diff --git a/docs/source/contrib.rst b/docs/source/contrib.rst
index b9af9fde3..ed9cc776f 100644
--- a/docs/source/contrib.rst
+++ b/docs/source/contrib.rst
@@ -2,8 +2,7 @@ kornia.contrib
==============
.. meta::
- :name: description
- :content: "The Kornia.contrib module provides models and utilities for deep learning applications, including base models and the EfficientViT architecture. The module offers configurable, efficient Vision Transformer (ViT) models and tools to load and utilize pre-trained checkpoints, designed to be integrated into deep learning pipelines with PyTorch."
+ :description: The Kornia.contrib module provides models and utilities for deep learning applications, including base models and the EfficientViT architecture. The module offers configurable, efficient Vision Transformer (ViT) models and tools to load and utilize pre-trained checkpoints, designed to be integrated into deep learning pipelines with PyTorch.
.. currentmodule:: kornia.contrib
@@ -24,7 +23,6 @@ EfficientViT
:undoc-members:
:special-members: __init__,
-
.. autoclass:: kornia.models.efficient_vit.EfficientViTConfig
:members:
:undoc-members:
@@ -86,15 +84,6 @@ Face Detection
:members:
:undoc-members:
-Interactive Demo
-^^^^^^^^^^^^^^^^
-.. raw:: html
-
- <gradio-app src="https://kornia-face-detection.hf.space"></gradio-app>
-
-Visit the `Kornia face detection demo on the Hugging Face Spaces
-<https://huggingface.co/spaces/kornia/Face-Detection>`_.
-
Object Detection
----------------
diff --git a/docs/source/core.rst b/docs/source/core.rst
index 3d83ce3bc..0fb0d5188 100644
--- a/docs/source/core.rst
+++ b/docs/source/core.rst
@@ -2,8 +2,7 @@ kornia.core
===========
.. meta::
- :name: description
- :content: "The kornia.core module in Kornia provides foundational classes and utilities for tensor manipulation. Key classes like TensorWrapper allow for enhanced handling of image tensors with support for various operations and transformations in computer vision tasks."
+ :description: The kornia.core module in Kornia provides foundational classes and utilities for tensor manipulation. Key classes like TensorWrapper allow for enhanced handling of image tensors with support for various operations and transformations in computer vision tasks.
.. currentmodule:: kornia.core
diff --git a/docs/source/enhance.adjustment.rst b/docs/source/enhance.adjustment.rst
new file mode 100644
index 000000000..3e422bf81
--- /dev/null
+++ b/docs/source/enhance.adjustment.rst
@@ -0,0 +1,34 @@
+Adjustment
+==========
+
+.. currentmodule:: kornia.enhance
+
+Functions
+---------
+
+.. autofunction:: add_weighted
+.. autofunction:: adjust_brightness
+.. autofunction:: adjust_contrast
+.. autofunction:: adjust_contrast_with_mean_subtraction
+.. autofunction:: adjust_gamma
+.. autofunction:: adjust_hue
+.. autofunction:: adjust_saturation
+.. autofunction:: adjust_sigmoid
+.. autofunction:: adjust_log
+.. autofunction:: invert
+.. autofunction:: posterize
+.. autofunction:: sharpness
+.. autofunction:: solarize
+
+Modules
+-------
+
+.. autoclass:: AdjustBrightness
+.. autoclass:: AdjustContrast
+.. autoclass:: AdjustSaturation
+.. autoclass:: AdjustHue
+.. autoclass:: AdjustGamma
+.. autoclass:: AdjustSigmoid
+.. autoclass:: AdjustLog
+.. autoclass:: AddWeighted
+.. autoclass:: Invert
diff --git a/docs/source/enhance.codec.rst b/docs/source/enhance.codec.rst
new file mode 100644
index 000000000..bc6a24743
--- /dev/null
+++ b/docs/source/enhance.codec.rst
@@ -0,0 +1,10 @@
+Codec
+=====
+
+.. currentmodule:: kornia.enhance
+
+A differentiable JPEG codec, useful to simulate compression artifacts inside a training loop.
+
+.. autofunction:: jpeg_codec_differentiable
+
+.. autoclass:: JPEGCodecDifferentiable
diff --git a/docs/source/enhance.equalization.rst b/docs/source/enhance.equalization.rst
new file mode 100644
index 000000000..8d30d7335
--- /dev/null
+++ b/docs/source/enhance.equalization.rst
@@ -0,0 +1,18 @@
+Equalization and histograms
+===========================
+
+.. currentmodule:: kornia.enhance
+
+Equalization
+------------
+
+.. autofunction:: equalize
+.. autofunction:: equalize_clahe
+.. autofunction:: equalize3d
+
+Histograms
+----------
+
+.. autofunction:: histogram
+.. autofunction:: histogram2d
+.. autofunction:: image_histogram2d
diff --git a/docs/source/enhance.normalization.rst b/docs/source/enhance.normalization.rst
new file mode 100644
index 000000000..2d3313a13
--- /dev/null
+++ b/docs/source/enhance.normalization.rst
@@ -0,0 +1,22 @@
+Normalization
+=============
+
+.. currentmodule:: kornia.enhance
+
+Functions
+---------
+
+.. autofunction:: normalize
+.. autofunction:: normalize_min_max
+.. autofunction:: denormalize
+.. autofunction:: zca_mean
+.. autofunction:: zca_whiten
+.. autofunction:: linear_transform
+
+Modules
+-------
+
+.. autoclass:: Normalize
+.. autoclass:: Denormalize
+.. autoclass:: ZCAWhitening
+ :members:
diff --git a/docs/source/enhance.rst b/docs/source/enhance.rst
index 5ce60cc32..0b4e949e7 100644
--- a/docs/source/enhance.rst
+++ b/docs/source/enhance.rst
@@ -2,98 +2,28 @@ kornia.enhance
==============
.. meta::
- :name: description
- :content: "The Kornia.enhance module provides a suite of image enhancement functions including brightness, contrast, hue, saturation adjustments, as well as normalization and equalization techniques. It also features advanced transformations like ZCA whitening and differentiable JPEG codec. Explore interactive demos on Hugging Face Spaces."
+ :description: The Kornia.enhance module provides a suite of image enhancement functions including brightness, contrast, hue, saturation adjustments, as well as normalization and equalization techniques. It also features advanced transformations like ZCA whitening and differentiable JPEG codec.
.. currentmodule:: kornia.enhance
-The functions in this section perform normalisations and intensity transformations.
+Intensity transformations and normalization on batched ``(B, C, H, W)`` tensors.
-Adjustment
-----------
+.. list-table::
+ :widths: 30 70
-.. autofunction:: add_weighted
-.. autofunction:: adjust_brightness
-.. autofunction:: adjust_contrast
-.. autofunction:: adjust_contrast_with_mean_subtraction
-.. autofunction:: adjust_gamma
-.. autofunction:: adjust_hue
-.. autofunction:: adjust_saturation
-.. autofunction:: adjust_sigmoid
-.. autofunction:: adjust_log
-.. autofunction:: invert
-.. autofunction:: posterize
-.. autofunction:: sharpness
-.. autofunction:: solarize
+ * - :doc:`enhance.adjustment`
+ - Brightness, contrast, gamma, hue, saturation, sigmoid and log adjustments; invert, posterize, sharpen and solarize.
+ * - :doc:`enhance.equalization`
+ - Histogram equalization, CLAHE and differentiable histograms.
+ * - :doc:`enhance.normalization`
+ - Mean/std normalization, min-max scaling, ZCA whitening and linear transforms.
+ * - :doc:`enhance.codec`
+ - A differentiable JPEG encoder/decoder.
-Interactive Demo
-~~~~~~~~~~~~~~~~
-.. raw:: html
+.. toctree::
+ :hidden:
- <gradio-app src="https://kornia-kornia-image-enhancement.hf.space"></gradio-app>
-
-Visit the demo on `Hugging Face Spaces <https://huggingface.co/spaces/kornia/kornia-image-enhancement>`__.
-
-Equalization
-------------
-
-.. autofunction:: equalize
-.. autofunction:: equalize_clahe
-.. autofunction:: equalize3d
-
-Interactive Demo
-
-.. raw:: html
-
- <gradio-app src="https://iamabhipandat-kornia-image-equalization.hf.space"></gradio-app>
-
-Visit the demo on `Hugging Face Spaces <https://huggingface.co/spaces/Iamabhipandat/kornia-image-equalization>`__.
-
-
-.. autofunction:: histogram
-.. autofunction:: histogram2d
-.. autofunction:: image_histogram2d
-
-Normalizations
---------------
-
-.. autofunction:: normalize
-.. autofunction:: normalize_min_max
-.. autofunction:: denormalize
-.. autofunction:: zca_mean
-.. autofunction:: zca_whiten
-.. autofunction:: linear_transform
-
-Codec
------
-
-.. autofunction:: jpeg_codec_differentiable
-
-
-Modules
--------
-
-.. autoclass:: Normalize
-.. autoclass:: Denormalize
-.. autoclass:: ZCAWhitening
- :members:
-
-.. autoclass:: AdjustBrightness
-.. autoclass:: AdjustContrast
-.. autoclass:: AdjustSaturation
-.. autoclass:: AdjustHue
-.. autoclass:: AdjustGamma
-.. autoclass:: AdjustSigmoid
-.. autoclass:: AdjustLog
-.. autoclass:: AddWeighted
-
-.. autoclass:: Invert
-
-.. autoclass:: JPEGCodecDifferentiable
-
-
-ZCA Whitening Interactive Demo
-------------------------------
-.. raw:: html
-
- <gradio-app src="https://kornia-zca-whitening.hf.space"></gradio-app>
+ adjustment <enhance.adjustment>
+ equalization <enhance.equalization>
+ normalization <enhance.normalization>
+ codec <enhance.codec>
diff --git a/docs/source/feature.descriptors.rst b/docs/source/feature.descriptors.rst
new file mode 100644
index 000000000..8c8858cfd
--- /dev/null
+++ b/docs/source/feature.descriptors.rst
@@ -0,0 +1,20 @@
+Descriptors
+===========
+
+.. currentmodule:: kornia.feature
+
+.. autoclass:: DenseSIFTDescriptor
+.. autoclass:: SIFTDescriptor
+.. autoclass:: MKDDescriptor
+.. autoclass:: HardNet
+.. autoclass:: HardNet8
+.. autoclass:: HyNet
+.. autoclass:: TFeat
+.. autoclass:: SOSNet
+.. autoclass:: LAFDescriptor
+ :members: forward
+
+.. autoclass:: SOLD2
+ :members: forward
+
+.. autofunction:: get_laf_descriptors
diff --git a/docs/source/feature.detectors.rst b/docs/source/feature.detectors.rst
new file mode 100644
index 000000000..17f302eac
--- /dev/null
+++ b/docs/source/feature.detectors.rst
@@ -0,0 +1,32 @@
+Detectors
+=========
+
+.. currentmodule:: kornia.feature
+
+Response functions
+------------------
+
+.. autofunction:: gftt_response
+.. autofunction:: harris_response
+.. autofunction:: hessian_response
+.. autofunction:: dog_response
+.. autofunction:: dog_response_single
+
+.. autoclass:: BlobHessian
+.. autoclass:: CornerGFTT
+.. autoclass:: CornerHarris
+.. autoclass:: BlobDoG
+.. autoclass:: BlobDoGSingle
+
+Detectors
+---------
+
+.. autoclass:: KeyNet
+.. autoclass:: MultiResolutionDetector
+ :members: forward, remove_borders, detect_features_on_single_level, detect
+
+.. autoclass:: ScaleSpaceDetector
+ :members: forward, detect
+
+.. autoclass:: KeyNetDetector
+ :members: forward
diff --git a/docs/source/feature.laf.rst b/docs/source/feature.laf.rst
new file mode 100644
index 000000000..ae35d3e5f
--- /dev/null
+++ b/docs/source/feature.laf.rst
@@ -0,0 +1,55 @@
+Local affine frames (LAF)
+=========================
+
+.. currentmodule:: kornia.feature
+
+A local affine frame is a :math:`(B, N, 2, 3)` tensor describing, for each keypoint, an affine transformation
+from a canonical patch to the image. Most detectors and descriptors in :mod:`kornia.feature` exchange LAFs.
+
+Functions
+---------
+
+.. autofunction:: extract_patches_from_pyramid
+.. autofunction:: extract_patches_simple
+.. autofunction:: normalize_laf
+.. autofunction:: denormalize_laf
+.. autofunction:: laf_to_boundary_points
+.. autofunction:: ellipse_to_laf
+.. autofunction:: make_upright
+.. autofunction:: scale_laf
+.. autofunction:: get_laf_scale
+.. autofunction:: get_laf_center
+.. autofunction:: rotate_laf
+.. autofunction:: get_laf_orientation
+.. autofunction:: set_laf_orientation
+.. autofunction:: laf_from_center_scale_ori
+.. autofunction:: laf_is_inside_image
+.. autofunction:: laf_is_valid
+.. autofunction:: laf_to_three_points
+.. autofunction:: laf_from_three_points
+.. autofunction:: KORNIA_CHECK_LAF
+.. autofunction:: perspective_transform_lafs
+
+Orientation and affine shape estimation
+---------------------------------------
+
+.. autoclass:: PassLAF
+ :members: forward
+
+.. autoclass:: PatchAffineShapeEstimator
+ :members: forward
+
+.. autoclass:: LAFAffineShapeEstimator
+ :members: forward
+
+.. autoclass:: LAFOrienter
+ :members: forward
+
+.. autoclass:: PatchDominantGradientOrientation
+ :members: forward
+
+.. autoclass:: OriNet
+ :members: forward
+
+.. autoclass:: LAFAffNetShapeEstimator
+ :members: forward
diff --git a/docs/source/feature.layers.rst b/docs/source/feature.layers.rst
new file mode 100644
index 000000000..4ea68a869
--- /dev/null
+++ b/docs/source/feature.layers.rst
@@ -0,0 +1,16 @@
+Layers and other models
+=======================
+
+.. currentmodule:: kornia.feature
+
+Layers
+------
+
+.. autoclass:: FilterResponseNorm2d
+.. autoclass:: TLU
+
+Fast moving objects
+-------------------
+
+.. autoclass:: DeFMO
+ :members: forward
diff --git a/docs/source/feature.local_features.rst b/docs/source/feature.local_features.rst
new file mode 100644
index 000000000..3d752652d
--- /dev/null
+++ b/docs/source/feature.local_features.rst
@@ -0,0 +1,54 @@
+Local features (detector and descriptor together)
+=================================================
+
+.. currentmodule:: kornia.feature
+
+.. autoclass:: LocalFeature
+ :members: forward
+
+.. autoclass:: SOLD2_detector
+ :members: forward
+
+.. autoclass:: ALIKED
+ :members: forward, from_pretrained, forward_laf
+
+.. autoclass:: ALIKEDFeatures
+ :undoc-members:
+ :members: n, to
+
+.. autoclass:: DeDoDe
+ :members: forward, from_pretrained, describe, detect
+
+.. autoclass:: DISK
+ :members: forward, from_pretrained, heatmap_and_dense_descriptors
+
+.. autoclass:: XFeat
+ :members: forward, from_pretrained, detectAndCompute, detectAndComputeDense, match_xfeat, match_xfeat_star
+
+.. autoclass:: XFeatModel
+ :members: forward
+
+.. autoclass:: InterpolateSparse2d
+ :members: forward
+
+.. autoclass:: DISKFeatures
+ :undoc-members:
+ :members: x, y, to
+
+.. autoclass:: SIFTFeature
+ :members: forward
+
+.. autoclass:: SIFTFeatureScaleSpace
+ :members: forward
+
+.. autoclass:: GFTTAffNetHardNet
+ :members: forward
+
+.. autoclass:: HesAffNetHardNet
+ :members: forward
+
+.. autoclass:: KeyNetAffNetHardNet
+ :members: forward
+
+.. autoclass:: KeyNetHardNet
+ :members: forward
diff --git a/docs/source/feature.matching.rst b/docs/source/feature.matching.rst
new file mode 100644
index 000000000..ea3aa1ff4
--- /dev/null
+++ b/docs/source/feature.matching.rst
@@ -0,0 +1,38 @@
+Matching
+========
+
+.. currentmodule:: kornia.feature
+
+Descriptor matching
+-------------------
+
+.. autofunction:: match_nn
+.. autofunction:: match_mnn
+.. autofunction:: match_snn
+.. autofunction:: match_smnn
+.. autofunction:: match_fginn
+.. autofunction:: match_adalam
+
+.. autoclass:: DescriptorMatcher
+ :members: forward
+
+.. autoclass:: GeometryAwareDescriptorMatcher
+ :members: forward
+
+.. autoclass:: LocalFeatureMatcher
+ :members: forward
+
+Learned matchers
+----------------
+
+.. autoclass:: LightGlueMatcher
+ :members: forward
+
+.. autoclass:: LightGlue
+ :members: forward
+
+.. autoclass:: OnnxLightGlue
+ :members: forward
+
+.. autoclass:: LoFTR
+ :members: forward
diff --git a/docs/source/feature.rst b/docs/source/feature.rst
index d75d1fe30..f2882f6f3 100644
--- a/docs/source/feature.rst
+++ b/docs/source/feature.rst
@@ -1,300 +1,37 @@
-Local Features and Image Matching
-=================================
+kornia.feature
+==============
.. meta::
- :name: description
- :content: "The Local Features and Image Matching module in Kornia offers tools to detect, describe, and match local features in images. It includes various detectors, descriptors, and matching algorithms based on classical methods and deep learning models like Harris, SIFT, KeyNet, DISK, and LoFTR. The module also provides tools for working with local affine frames (LAFs), including affine shape and orientation estimation."
-
-This module provides a set of tools to detect and describe local features in images. The module is designed to be
-compatible with the PyTorch ecosystem and provides a set of models and differentiable operations to be used in deep learning
-pipelines.
-
-The module is divided into three main components:
-
-1. **Detectors**: These are models that are used to detect keypoints in images. The module provides a set of detectors that
- are based on different algorithms such as Harris, GFTT, Hessian, and DoG. The module also provides a set of detectors that
- are based on deep learning models such as KeyNet, DISK and DeDoDe.
-2. **Descriptors**: These are models that are used to describe the local features detected by the detectors. The module
- provides a set of descriptors that are based on different algorithms such as SIFT, HardNet, and TFeat. The module also
- provides a set of descriptors that are based on deep learning models such as HyNet, SOSNet, and LAFDescriptor.
-3. **Matching**: These are models that are used to match the local features detected and described by the detectors and
- descriptors. The module provides a set of matching algorithms such as nearest neighbor, mutual nearest neighbor, and
- geometrically aware matching. Besides this, the module also contains AdaLAM hancrafted and LightGlue learned matchers.
- Finally, the module provides LoFTR - detector-less semi-dense image matching model.
-
-Besides this, the module also provides a set of tools to work with local affine frames (LAF) such as extracting patches,
-normalizing, denormalizing, and rotating LAFs. The module also provides a set of models to estimate the affine shape of
-LAFs such as LAFAffineShapeEstimator and PatchAffineShapeEstimator. The module also provides a set of models to estimate
-the orientation of LAFs such as OriNet and LAFOrienter.
-
-
-Finally, kind of addition, module contains a DeFMO model for the task of video frame interpolation, specifically high speed objects debluring.
-
-Benchmarks and recommendations
---------------------------------
-
-The following table shows the performance of the different models on `IMC2021 benchmark <https://www.cs.ubc.ca/research/image-matching-challenge/2021/leaderboard/>`_ .
-
-
-.. list-table:: IMC2021 Benchmark, 8000 features
- :widths: 50 50 50 50 50
- :header-rows: 1
-
- * - Feature name
- - Stereo mAA @ 10 degrees, PhotoTourism.
- - Multiview mAA @ 10 degrees, PhotoTourism.
- - Stereo mAA @ 10 degrees, PragueParks.
- - Multiview mAA @ 10 degrees, PragueParks.
- * - DISK-LightGlue
- - 0.6184
- - 0.7741
- - 0.6116
- - 0.4988
- * - LoFTR
- - 0.6090
- - 0.7609
- - 0.7546
- - 0.4711
- * - OpenCV-DoG-HardNet-LightGlue
- - 0.5850
- - 0.7587
- - 0.6525
- - 0.4973
- * - OpenCV-DoG-AffNet-HardNet8-AdaLAM
- - 0.5502
- - 0.7522
- - 0.5998
- - 0.4712
- * - Upright SIFT (OpenCV)
- - 0.5122
- - 0.6849
- - 0.6060
- - 0.4439
-
-
-.. list-table:: IMC2021 Benchmark, 2048 features
- :widths: 50 50 50 50 50
- :header-rows: 1
-
- * - Feature name
- - Stereo mAA @ 10 degrees, PhotoTourism.
- - Multiview mAA @ 10 degrees, PhotoTourism.
- - Stereo mAA @ 10 degrees, PragueParks.
- - Multiview mAA @ 10 degrees, PragueParks.
- * - DISK-LightGlue
- - 0.5720
- - 0.7543
- - 0.5099
- - 0.4565
- * - OpenCV-DoG-HardNet-LightGlue
- - 0.3954
- - 0.6272
- - 0.5157
- - 0.4456
- * - Upright SIFT (OpenCV)
- - 0.3827
- - 0.5545
- - 0.4136
- - 0.3607
-
-LoFTR works the best for indoor scenes, whereas DISK and DeDoDe + LightGlue work the best for outdoor scenes.
-The DeDoDe and speed benchmarks are coming soon.
-For some other use-cases you may want to use SIFT, or SIFT + HardNet + LightGlue, e.g. for remote sensing or medical imaging.
-
+ :description: The kornia.feature module offers tools to detect, describe, and match local features in images. It includes classical and learned detectors, descriptors and matchers such as Harris, SIFT, KeyNet, DISK, ALIKED, HardNet, LightGlue and LoFTR, and tools for working with local affine frames (LAFs).
.. currentmodule:: kornia.feature
-Detectors
----------
-
-.. autofunction:: gftt_response
-.. autofunction:: harris_response
-.. autofunction:: hessian_response
-.. autofunction:: dog_response
-.. autofunction:: dog_response_single
-.. autoclass:: BlobHessian
-.. autoclass:: CornerGFTT
-.. autoclass:: CornerHarris
-.. autoclass:: BlobDoG
-.. autoclass:: BlobDoGSingle
-.. autoclass:: KeyNet
-.. autoclass:: MultiResolutionDetector
- :members: forward, remove_borders, detect_features_on_single_level, detect
-
-
-.. autoclass:: ScaleSpaceDetector
- :members: forward, detect
-
-.. autoclass:: KeyNetDetector
- :members: forward
-
-Descriptors
------------
-
-.. autoclass:: DenseSIFTDescriptor
-.. autoclass:: SIFTDescriptor
-.. autoclass:: MKDDescriptor
-.. autoclass:: HardNet
-.. autoclass:: HardNet8
-.. autoclass:: HyNet
-.. autoclass:: TFeat
-.. autoclass:: SOSNet
-.. autoclass:: LAFDescriptor
- :members: forward
-
-.. autoclass:: SOLD2
- :members: forward
-
-.. autofunction:: get_laf_descriptors
-
-
-
-Local Features (Detector and Descriptors together)
----------------------------------------------------
-
-
-.. autoclass:: LocalFeature
- :members: forward
-
-.. autoclass:: SOLD2_detector
- :members: forward
-
-.. autoclass:: ALIKED
- :members: forward, from_pretrained, forward_laf
-
-.. autoclass:: ALIKEDFeatures
- :undoc-members:
- :members: n, to
-
-.. autoclass:: DeDoDe
- :members: forward, from_pretrained, describe, detect
-
-.. autoclass:: DISK
- :members: forward, from_pretrained, heatmap_and_dense_descriptors
-
-.. autoclass:: XFeat
- :members: forward, from_pretrained, detectAndCompute, detectAndComputeDense, match_xfeat, match_xfeat_star
-
-.. autoclass:: XFeatModel
- :members: forward
-
-.. autoclass:: InterpolateSparse2d
- :members: forward
-
-.. autoclass:: DISKFeatures
- :undoc-members:
- :members: x, y, to
-
-.. autoclass:: SIFTFeature
- :members: forward
-
-.. autoclass:: SIFTFeatureScaleSpace
- :members: forward
-
-.. autoclass:: GFTTAffNetHardNet
- :members: forward
-
-.. autoclass::HesAffNetHardNet
- :members: forward
-
-.. autoclass:: KeyNetAffNetHardNet
- :members: forward
-
-.. autoclass:: KeyNetHardNet
- :members: forward
-
-
-Matching
---------
-
-.. autofunction:: match_nn
-.. autofunction:: match_mnn
-.. autofunction:: match_snn
-.. autofunction:: match_smnn
-.. autofunction:: match_fginn
-.. autofunction:: match_adalam
-
-.. autoclass:: DescriptorMatcher
- :members: forward
-
-.. autoclass:: GeometryAwareDescriptorMatcher
- :members: forward
-
-.. autoclass:: LocalFeatureMatcher
- :members: forward
-
-.. autoclass:: LightGlueMatcher
- :members: forward
-
-.. autoclass:: LightGlue
- :members: forward
-
-.. autoclass:: LoFTR
- :members: forward
-
-Interactive Demo
-~~~~~~~~~~~~~~~~
-.. raw:: html
-
- <gradio-app src="https://kornia-kornia-loftr.hf.space"></gradio-app>
-
-.. autoclass:: OnnxLightGlue
- :members: forward
-
-
-Local Affine Frames (LAF)
--------------------------
-
-.. autofunction:: extract_patches_from_pyramid
-.. autofunction:: extract_patches_simple
-.. autofunction:: normalize_laf
-.. autofunction:: denormalize_laf
-.. autofunction:: laf_to_boundary_points
-.. autofunction:: ellipse_to_laf
-.. autofunction:: make_upright
-.. autofunction:: scale_laf
-.. autofunction:: get_laf_scale
-.. autofunction:: get_laf_center
-.. autofunction:: rotate_laf
-.. autofunction:: get_laf_orientation
-.. autofunction:: set_laf_orientation
-.. autofunction:: laf_from_center_scale_ori
-.. autofunction:: laf_is_inside_image
-.. autofunction:: laf_is_valid
-.. autofunction:: laf_to_three_points
-.. autofunction:: laf_from_three_points
-.. autofunction:: KORNIA_CHECK_LAF
-.. autofunction:: perspective_transform_lafs
-
-.. autoclass:: PassLAF
- :members: forward
-
-.. autoclass:: PatchAffineShapeEstimator
- :members: forward
-
-.. autoclass:: LAFAffineShapeEstimator
- :members: forward
-
-.. autoclass:: LAFOrienter
- :members: forward
-
-.. autoclass:: PatchDominantGradientOrientation
- :members: forward
-
-.. autoclass:: OriNet
- :members: forward
-
-.. autoclass:: LAFAffNetShapeEstimator
- :members: forward
-
-Layers
-------
-
-.. autoclass:: FilterResponseNorm2d
-.. autoclass:: TLU
-
-Other
-------
-
-.. autoclass:: DeFMO
- :members: forward
+Local feature detection, description and matching, from classical operators to pretrained models, all as
+differentiable PyTorch modules. For guidance on which model to pick, see the
+:doc:`image matching guide </applications/image_matching>`.
+
+.. list-table::
+ :widths: 30 70
+
+ * - :doc:`feature.detectors`
+ - Keypoint detectors: Harris, GFTT, Hessian, DoG responses and the KeyNet, scale-space and multi-resolution detectors.
+ * - :doc:`feature.descriptors`
+ - Patch descriptors: SIFT, MKD, HardNet, HardNet8, HyNet, TFeat, SOSNet, and the SOLD2 line descriptor.
+ * - :doc:`feature.local_features`
+ - Detector + descriptor pipelines: DISK, ALIKED, DeDoDe, XFeat, SIFTFeature, KeyNetAffNetHardNet and friends.
+ * - :doc:`feature.matching`
+ - Nearest-neighbour, mutual, ratio-test, FGINN and AdaLAM matching; LightGlue and LoFTR.
+ * - :doc:`feature.laf`
+ - Local affine frames (LAFs): patch extraction, normalization, orientation and affine shape estimation.
+ * - :doc:`feature.layers`
+ - Building-block layers and the DeFMO fast-moving-object model.
+
+.. toctree::
+ :hidden:
+
+ feature.detectors
+ feature.descriptors
+ feature.local_features
+ feature.matching
+ feature.laf
+ feature.layers
diff --git a/docs/source/filters.blurring.rst b/docs/source/filters.blurring.rst
new file mode 100644
index 000000000..fa6916df9
--- /dev/null
+++ b/docs/source/filters.blurring.rst
@@ -0,0 +1,32 @@
+Blurring
+========
+
+.. currentmodule:: kornia.filters
+
+Functions
+---------
+
+.. autofunction:: bilateral_blur
+.. autofunction:: blur_pool2d
+.. autofunction:: box_blur
+.. autofunction:: gaussian_blur2d
+.. autofunction:: guided_blur
+.. autofunction:: joint_bilateral_blur
+.. autofunction:: max_blur_pool2d
+.. autofunction:: median_blur
+.. autofunction:: motion_blur
+.. autofunction:: unsharp_mask
+
+Modules
+-------
+
+.. autoclass:: BilateralBlur
+.. autoclass:: BlurPool2D
+.. autoclass:: BoxBlur
+.. autoclass:: MaxBlurPool2D
+.. autoclass:: MedianBlur
+.. autoclass:: GaussianBlur2d
+.. autoclass:: GuidedBlur
+.. autoclass:: JointBilateralBlur
+.. autoclass:: MotionBlur
+.. autoclass:: UnsharpMask
diff --git a/docs/source/filters.edge_detection.rst b/docs/source/filters.edge_detection.rst
new file mode 100644
index 000000000..f6a12721f
--- /dev/null
+++ b/docs/source/filters.edge_detection.rst
@@ -0,0 +1,22 @@
+Edge detection
+==============
+
+.. currentmodule:: kornia.filters
+
+Functions
+---------
+
+.. autofunction:: canny
+.. autofunction:: laplacian
+.. autofunction:: sobel
+.. autofunction:: spatial_gradient
+.. autofunction:: spatial_gradient3d
+
+Modules
+-------
+
+.. autoclass:: Laplacian
+.. autoclass:: Sobel
+.. autoclass:: Canny
+.. autoclass:: SpatialGradient
+.. autoclass:: SpatialGradient3d
diff --git a/docs/source/filters.filtering_api.rst b/docs/source/filters.filtering_api.rst
new file mode 100644
index 000000000..ac51fe363
--- /dev/null
+++ b/docs/source/filters.filtering_api.rst
@@ -0,0 +1,10 @@
+Filtering API
+=============
+
+.. currentmodule:: kornia.filters
+
+Convolve an image with your own kernel. These are the primitives the blur and edge operators are built on.
+
+.. autofunction:: filter2d
+.. autofunction:: filter2d_separable
+.. autofunction:: filter3d
diff --git a/docs/source/filters.kernels.rst b/docs/source/filters.kernels.rst
new file mode 100644
index 000000000..4ab606238
--- /dev/null
+++ b/docs/source/filters.kernels.rst
@@ -0,0 +1,16 @@
+Kernels
+=======
+
+.. currentmodule:: kornia.filters
+
+Kernel generators, useful with the :doc:`filters.filtering_api` or to inspect what a filter applies.
+
+.. autofunction:: get_gaussian_kernel1d
+.. autofunction:: get_gaussian_erf_kernel1d
+.. autofunction:: get_gaussian_discrete_kernel1d
+.. autofunction:: get_gaussian_kernel2d
+.. autofunction:: get_hanning_kernel1d
+.. autofunction:: get_hanning_kernel2d
+.. autofunction:: get_laplacian_kernel1d
+.. autofunction:: get_laplacian_kernel2d
+.. autofunction:: get_motion_kernel2d
diff --git a/docs/source/filters.rst b/docs/source/filters.rst
index ce8ac7379..459e62ae1 100644
--- a/docs/source/filters.rst
+++ b/docs/source/filters.rst
@@ -2,100 +2,32 @@ kornia.filters
==============
.. meta::
- :name: description
- :content: "The Kornia filters module provides various image filtering operations such as blurring, edge detection, and noise reduction. It includes functions for bilateral, Gaussian, motion, median, and unsharp mask filtering, as well as pooling operations for blurring. These operations are designed to be differentiable and can be integrated seamlessly into deep learning pipelines."
+ :description: The Kornia filters module provides various image filtering operations such as blurring, edge detection, and noise reduction. It includes functions for bilateral, Gaussian, motion, median, and unsharp mask filtering, as well as pooling operations for blurring. These operations are designed to be differentiable and can be integrated seamlessly into deep learning pipelines.
.. currentmodule:: kornia.filters
-The functions in this sections perform various image filtering operations.
-
-Blurring
---------
-
-.. autofunction:: bilateral_blur
-.. autofunction:: blur_pool2d
-.. autofunction:: box_blur
-.. autofunction:: gaussian_blur2d
-.. autofunction:: guided_blur
-.. autofunction:: joint_bilateral_blur
-.. autofunction:: max_blur_pool2d
-.. autofunction:: median_blur
-.. autofunction:: motion_blur
-.. autofunction:: unsharp_mask
-
-Interactive Demo
-~~~~~~~~~~~~~~~~
-.. raw:: html
-
- <gradio-app src="https://kornia-kornia-image-filtering.hf.space"></gradio-app>
-
-Visit the `Kornia image filtering demo on the Hugging Face Spaces
-<https://huggingface.co/spaces/kornia/kornia-image-filtering>`_.
-
-Edge detection
---------------
-
-.. autofunction:: canny
-.. autofunction:: laplacian
-.. autofunction:: sobel
-.. autofunction:: spatial_gradient
-.. autofunction:: spatial_gradient3d
-
-
-.. autoclass:: Laplacian
-.. autoclass:: Sobel
-.. autoclass:: Canny
-.. autoclass:: SpatialGradient
-.. autoclass:: SpatialGradient3d
-
-
-Interactive Demo
-~~~~~~~~~~~~~~~~
-.. raw:: html
-
- <gradio-app src="https://kornia-edge-detector.hf.space"></gradio-app>
-
-Visit the `Kornia edge detector demo on the Hugging Face Spaces
-<https://huggingface.co/spaces/kornia/edge_detector>`_.
-
-Segmentation
---------------
-
-.. autofunction:: in_range
-.. autoclass:: InRange
-.. autofunction:: otsu_threshold
-.. autoclass:: OtsuThreshold
-
-Filtering API
--------------
-
-.. autofunction:: filter2d
-.. autofunction:: filter2d_separable
-.. autofunction:: filter3d
-
-Kernels
--------
-
-.. autofunction:: get_gaussian_kernel1d
-.. autofunction:: get_gaussian_erf_kernel1d
-.. autofunction:: get_gaussian_discrete_kernel1d
-.. autofunction:: get_gaussian_kernel2d
-.. autofunction:: get_hanning_kernel1d
-.. autofunction:: get_hanning_kernel2d
-.. autofunction:: get_laplacian_kernel1d
-.. autofunction:: get_laplacian_kernel2d
-.. autofunction:: get_motion_kernel2d
-
-Module
-------
-
-.. autoclass:: BilateralBlur
-.. autoclass:: BlurPool2D
-.. autoclass:: BoxBlur
-.. autoclass:: MaxBlurPool2D
-.. autoclass:: MedianBlur
-.. autoclass:: GaussianBlur2d
-.. autoclass:: GuidedBlur
-.. autoclass:: JointBilateralBlur
-.. autoclass:: MotionBlur
-.. autoclass:: UnsharpMask
+Differentiable image filtering on batched ``(B, C, H, W)`` tensors. Every function has an ``nn.Module``
+counterpart on the same page.
+
+.. list-table::
+ :widths: 30 70
+
+ * - :doc:`filters.blurring`
+ - Gaussian, box, median, bilateral, guided and motion blur; blur pooling; unsharp masking.
+ * - :doc:`filters.edge_detection`
+ - Sobel, Laplacian and Canny edge detectors and spatial gradients in 2D and 3D.
+ * - :doc:`Thresholding <filters.segmentation>`
+ - Range thresholding and Otsu's threshold.
+ * - :doc:`filters.filtering_api`
+ - Apply your own 2D, separable or 3D kernels with :func:`filter2d`, :func:`filter2d_separable` and :func:`filter3d`.
+ * - :doc:`filters.kernels`
+ - Gaussian, Hanning, Laplacian and motion kernels used by the filters above.
+
+.. toctree::
+ :hidden:
+
+ blurring <filters.blurring>
+ edge detection <filters.edge_detection>
+ thresholding <filters.segmentation>
+ filtering api <filters.filtering_api>
+ kernels <filters.kernels>
diff --git a/docs/source/filters.segmentation.rst b/docs/source/filters.segmentation.rst
new file mode 100644
index 000000000..50549491a
--- /dev/null
+++ b/docs/source/filters.segmentation.rst
@@ -0,0 +1,13 @@
+Thresholding
+============
+
+.. currentmodule:: kornia.filters
+
+Simple intensity-based segmentation: keep the pixels inside a value range, or split an image at Otsu's threshold.
+
+.. autofunction:: in_range
+
+.. autoclass:: InRange
+.. autofunction:: otsu_threshold
+
+.. autoclass:: OtsuThreshold
diff --git a/docs/source/geometry.bbox.rst b/docs/source/geometry.bbox.rst
index 79661bc47..88f6b8937 100644
--- a/docs/source/geometry.bbox.rst
+++ b/docs/source/geometry.bbox.rst
@@ -2,10 +2,10 @@ kornia.geometry.bbox
====================
.. meta::
- :name: description
- :content: "The kornia.geometry.bbox module in Kornia provides useful functions for manipulating 2D and 3D bounding boxes. It includes tools for creating, transforming, and operating on bounding boxes, making it easier to handle spatial data in computer vision tasks."
+ :description: The kornia.geometry.bbox module in Kornia provides useful functions for manipulating 2D and 3D bounding boxes. It includes tools for creating, transforming, and operating on bounding boxes, making it easier to handle spatial data in computer vision tasks.
-Module with useful functionalities for 2D and 3D bounding boxes manipulation.
+Functional API for 2D and 3D bounding boxes represented as corner tensors of shape :math:`(B, 4, 2)` and :math:`(B, 8, 3)`.
+For an object-oriented interface with format conversions, see :doc:`geometry.boxes`.
.. automodule:: kornia.geometry.bbox
:members:
diff --git a/docs/source/geometry.boxes.rst b/docs/source/geometry.boxes.rst
index 132bd51c7..429246982 100644
--- a/docs/source/geometry.boxes.rst
+++ b/docs/source/geometry.boxes.rst
@@ -2,10 +2,11 @@ kornia.geometry.boxes
=====================
.. meta::
- :name: description
- :content: "The kornia.geometry.boxes module in Kornia provides essential functions for manipulating 2D and 3D bounding boxes. It offers utilities for the creation, transformation, and handling of bounding boxes, which are crucial for spatial data processing in computer vision applications."
+ :description: The kornia.geometry.boxes module in Kornia provides essential functions for manipulating 2D and 3D bounding boxes. It offers utilities for the creation, transformation, and handling of bounding boxes, which are crucial for spatial data processing in computer vision applications.
-Module with useful functionalities for 2D and 3D bounding boxes manipulation.
+Object-oriented API for 2D and 3D bounding boxes: the :class:`~kornia.geometry.boxes.Boxes` and
+:class:`~kornia.geometry.boxes.Boxes3D` classes wrap a tensor of boxes and provide format conversions
+(``xyxy``, ``xywh``, vertices), transformations and padding.
.. automodule:: kornia.geometry.boxes
:members:
diff --git a/docs/source/geometry.calibration.rst b/docs/source/geometry.calibration.rst
index d154876df..7baa3d403 100644
--- a/docs/source/geometry.calibration.rst
+++ b/docs/source/geometry.calibration.rst
@@ -2,14 +2,13 @@ kornia.geometry.calibration
===========================
.. meta::
- :name: description
- :content: "The kornia.geometry.calibration module provides essential functions for camera calibration, including lens distortion modeling, undistortion, and Perspective-n-Point (PnP) solutions. This module supports advanced camera calibration techniques for both pinhole and distorted models, aiding in accurate 3D point projection, distortion correction, and camera pose estimation."
+ :description: The kornia.geometry.calibration module provides essential functions for camera calibration, including lens distortion modeling, undistortion, and Perspective-n-Point (PnP) solutions. This module supports advanced camera calibration techniques for both pinhole and distorted models, aiding in accurate 3D point projection, distortion correction, and camera pose estimation.
.. currentmodule:: kornia.geometry.calibration
Module with useful functionalities for camera calibration.
-The pinhole model is an ideal projection model that not considers lens distortion for the projection of a 3D point :math:`(X, Y, Z)` onto the image plane. To model the distortion of a projected 2D pixel point :math:`(u,v)` with the linear pinhole model, we need first to estimate the normalized 2D points coordinates :math:`(\bar{u}, \bar{v})`. For that, we can use the calibration matrix :math:`\mathbf{K}` with the following expression
+The pinhole model is an ideal projection model that does not consider lens distortion when projecting a 3D point :math:`(X, Y, Z)` onto the image plane. To model the distortion of a 2D pixel point :math:`(u,v)` projected with the linear pinhole model, we first need to estimate the normalized 2D point coordinates :math:`(\bar{u}, \bar{v})`. For that, we can use the calibration matrix :math:`\mathbf{K}` with the following expression
.. math::
\begin{align}
@@ -24,7 +23,7 @@ The pinhole model is an ideal projection model that not considers lens distortio
\end{bmatrix} \enspace,
\end{align}
-which is equivalent to directly using the internal parameters: focals :math:`f_u, f_v` and principal point :math:`(u_0, v_0)` to estimated the normalized coordinates
+which is equivalent to directly using the internal parameters, the focal lengths :math:`f_u, f_v` and the principal point :math:`(u_0, v_0)`, to estimate the normalized coordinates
.. math::
\begin{equation}
@@ -49,7 +48,7 @@ The normalized distorted point :math:`(\bar{u}_d, \bar{v}_d)` is given by
\end{bmatrix} \enspace,
\end{align}
-where :math:`r = \bar{u}^2 + \bar{v}^2`. With this model we consider radial :math:`(k_1, k_2, k_3, k_4, k_4, k_6)`, tangential :math:`(p_1, p_2)`, and thin prism :math:`(s_1, s_2, s_3, s_4)` distortion. If we want to consider tilt distortion :math:`(\tau_x, \tau_y)`, we need an additional step where we estimate a point :math:`(\bar{u}'_d, \bar{v}'_d)`
+where :math:`r^2 = \bar{u}^2 + \bar{v}^2`. With this model we consider radial :math:`(k_1, k_2, k_3, k_4, k_5, k_6)`, tangential :math:`(p_1, p_2)`, and thin prism :math:`(s_1, s_2, s_3, s_4)` distortion. If we also want to consider tilt distortion :math:`(\tau_x, \tau_y)`, we need an additional step where we estimate a point :math:`(\bar{u}'_d, \bar{v}'_d)`
.. math::
\begin{align}
@@ -69,7 +68,7 @@ where :math:`r = \bar{u}^2 + \bar{v}^2`. With this model we consider radial :mat
\end{bmatrix} \enspace,
\end{align}
-where :math:`\mathbf{R}(\tau_x, \tau_y)` is a 3D rotation matrix defined by an :math:`X` and :math:`Y` rotation given by the angles :math:`\tau_x` and :math:`\tau_y`. Furthermore, :math:`\mathbf{R}_{ij}(\tau_x, \tau_y)` represent the :math:`i`-th row and :math:`j`-th column from :math:`\mathbf{R}(\tau_x, \tau_y)` matrix.
+where :math:`\mathbf{R}(\tau_x, \tau_y)` is a 3D rotation matrix defined by rotations about the :math:`X` and :math:`Y` axes by the angles :math:`\tau_x` and :math:`\tau_y`. Furthermore, :math:`\mathbf{R}_{ij}(\tau_x, \tau_y)` denotes the element in the :math:`i`-th row and :math:`j`-th column of the :math:`\mathbf{R}(\tau_x, \tau_y)` matrix.
.. math::
\begin{align}
@@ -86,8 +85,7 @@ where :math:`\mathbf{R}(\tau_x, \tau_y)` is a 3D rotation matrix defined by an :
\end{bmatrix} \enspace.
\end{align}
-
-Finally, we just need to come back to the original (unnormalized) pixel space. For that we can use the intrinsic matrix
+Finally, we just need to go back to the original (unnormalized) pixel space. For that we can use the intrinsic matrix
.. math::
\begin{align}
@@ -102,7 +100,6 @@ Finally, we just need to come back to the original (unnormalized) pixel space. F
\end{bmatrix} \enspace,
\end{align}
-
which is equivalent to
.. math::
@@ -114,7 +111,7 @@ which is equivalent to
Undistortion
------------
-To compensate for lens distortion a set of 2D points, i.e., to estimate the undistorted coordinates for a given set of distorted points, we need to inverse the previously explained distortion model. For the case of undistorting an image, instead of estimating the undistorted location for each pixel, we distort each pixel in the destination image (final undistorted image) to match them with the input image. We finally interpolate the intensity values at each pixel.
+To compensate a set of 2D points for lens distortion, i.e., to estimate the undistorted coordinates of a given set of distorted points, we need to invert the distortion model explained above. When undistorting an image, instead of estimating the undistorted location of each pixel, we distort each pixel of the destination image (the final undistorted image) to find its match in the input image, and then interpolate the intensity values at each pixel.
.. autofunction:: undistort_image
diff --git a/docs/source/geometry.camera.perspective.rst b/docs/source/geometry.camera.perspective.rst
index 45d85148a..2195ca1a2 100644
--- a/docs/source/geometry.camera.perspective.rst
+++ b/docs/source/geometry.camera.perspective.rst
@@ -2,11 +2,9 @@ Perspective Camera
------------------
.. meta::
- :name: description
- :content: "The kornia.geometry.camera.perspective module provides functions for 3D point projection and unprojection in perspective camera models. These functions are essential for transforming 3D world coordinates into 2D image plane coordinates and vice versa, enabling advanced computer vision applications like depth estimation and 3D scene reconstruction."
+ :description: The kornia.geometry.camera.perspective module provides functions for 3D point projection and unprojection in perspective camera models. These functions are essential for transforming 3D world coordinates into 2D image plane coordinates and vice versa, enabling advanced computer vision applications like depth estimation and 3D scene reconstruction.
.. currentmodule:: kornia.geometry.camera.perspective
-
.. autofunction:: project_points
.. autofunction:: unproject_points
diff --git a/docs/source/geometry.camera.pinhole.rst b/docs/source/geometry.camera.pinhole.rst
index 160690dd7..d483769e5 100644
--- a/docs/source/geometry.camera.pinhole.rst
+++ b/docs/source/geometry.camera.pinhole.rst
@@ -2,18 +2,18 @@ Pinhole Camera
--------------
.. meta::
- :name: description
- :content: "The kornia.geometry.camera.pinhole module provides functions and data structures to describe the projection of 3D scene space onto a 2D image plane using the Pinhole Camera model. This model is widely used in computer vision for tasks like camera calibration and 3D scene reconstruction, utilizing the projection of 3D points via perspective transformations."
+ :description: The kornia.geometry.camera.pinhole module provides functions and data structures to describe the projection of 3D scene space onto a 2D image plane using the Pinhole Camera model. This model is widely used in computer vision for tasks like camera calibration and 3D scene reconstruction, utilizing the projection of 3D points via perspective transformations.
.. currentmodule:: kornia.geometry.camera.pinhole
-In this module we have all the functions and data structures needed to describe the projection of a 3D scene space onto a 2D image plane.
+This module contains the functions and data structures needed to describe the projection of a 3D scene onto a 2D image plane.
-In computer vision, we can map between the 3D world and a 2D image using *projective geometry*. The module implements the simplest camera model, the **Pinhole Camera**, which is the most basic model for general projective cameras from the finite cameras group.
+In computer vision, we can map between the 3D world and a 2D image using *projective geometry*. The module implements the simplest camera model, the **pinhole camera**, which is the most basic model for general projective cameras from the finite cameras group.
The Pinhole Camera model is shown in the following figure:
.. image:: data/pinhole_model.png
+ :alt: Pinhole camera model
Using this model, a scene view can be formed by projecting 3D points into the image plane using a perspective transformation.
@@ -42,13 +42,13 @@ or
\end{bmatrix}
where:
- * :math:`M'` is a 3D point in space with coordinates :math:`[X,Y,Z]^T` expressed in an Euclidean coordinate frame known as the *world coordinate system*.
+ * :math:`M'` is a 3D point in space with coordinates :math:`[X,Y,Z]^T` expressed in a Euclidean coordinate frame known as the *world coordinate system*.
* :math:`m'` is the projection of the 3D point :math:`M'` onto the *image plane* with coordinates :math:`[u,v]^T` expressed in pixel units.
- * :math:`K` is the *camera calibration matrix*, also referred as the intrinsic matrix.
- * :math:`C` is the *principal point offset* with coordinates :math:`[u_0, v_0]^T` at the origin in the image plane.
- * :math:`fx, fy` are the focal lengths expressed in pixel units.
+ * :math:`K` is the *camera calibration matrix*, also referred to as the intrinsic matrix.
+ * :math:`C` is the *principal point offset* with coordinates :math:`[u_0, v_0]^T` at the origin of the image plane.
+ * :math:`f_x, f_y` are the focal lengths expressed in pixel units.
-The camera rotation and translation are expressed in terms of an Euclidean coordinate frame known as the *world coordinate system*. These terms are usually expressed by the joint rotation-translation matrix :math:`[R|t]` which is also known as the extrinsic matrix. It is used to describe the camera pose around a static scene and transforms the coordinates of a 3D point :math:`(X,Y,Z)` from the *world coordinate system* to the *camera coordinate system*.
+The camera rotation and translation are expressed in terms of a Euclidean coordinate frame known as the *world coordinate system*. These terms are usually expressed by the joint rotation-translation matrix :math:`[R|t]`, also known as the extrinsic matrix. It describes the camera pose around a static scene and transforms the coordinates of a 3D point :math:`(X,Y,Z)` from the *world coordinate system* to the *camera coordinate system*.
The :class:`PinholeCamera` expects the *intrinsic matrices* and the *extrinsic matrices*
to be of shape `(B, 4, 4)` such that each *intrinsic matrix* has the following format:
@@ -71,7 +71,6 @@ And each *extrinsic matrix* has the following format:
0 & 0 & 0 & 1
\end{bmatrix}
-
.. autoclass:: PinholeCamera
:members:
diff --git a/docs/source/geometry.camera.rst b/docs/source/geometry.camera.rst
index 72b44e7cb..dd3222d7e 100644
--- a/docs/source/geometry.camera.rst
+++ b/docs/source/geometry.camera.rst
@@ -2,8 +2,7 @@ kornia.geometry.camera
======================
.. meta::
- :name: description
- :content: "The kornia.geometry.camera module provides a variety of functions for handling camera projections and distortions. It includes support for projecting 3D points to a 2D image plane, both with perspective and orthographic projections, as well as distortion models like affine and Kannala-Brandt. This module enables robust camera calibration and 3D scene transformations in computer vision applications."
+ :description: The kornia.geometry.camera module provides a variety of functions for handling camera projections and distortions. It includes support for projecting 3D points to a 2D image plane, both with perspective and orthographic projections, as well as distortion models like affine and Kannala-Brandt. This module enables robust camera calibration and 3D scene transformations in computer vision applications.
.. currentmodule:: kornia.geometry.camera
@@ -30,8 +29,8 @@ Distortion
.. autofunction:: dx_distort_points_kannala_brandt
.. toctree::
- :maxdepth: 2
+ :maxdepth: 1
- geometry.camera.pinhole
- geometry.camera.perspective
- geometry.camera.stereo
+ pinhole <geometry.camera.pinhole>
+ perspective <geometry.camera.perspective>
+ stereo camera <geometry.camera.stereo>
diff --git a/docs/source/geometry.camera.stereo.rst b/docs/source/geometry.camera.stereo.rst
index 560a9d355..23d3b7e26 100644
--- a/docs/source/geometry.camera.stereo.rst
+++ b/docs/source/geometry.camera.stereo.rst
@@ -2,12 +2,11 @@ Stereo Camera
-------------
.. meta::
- :name: description
- :content: "The kornia.geometry.camera.stereo module provides functionality for working with a horizontal stereo camera setup. It includes the StereoCamera class, which allows for the conversion of disparity maps into 3D point clouds using the stereo rectification model. This module leverages camera calibration matrices and disparity information to reproject pixels from 2D to 3D space, facilitating tasks such as depth estimation and 3D reconstruction."
+ :description: The kornia.geometry.camera.stereo module provides functionality for working with a horizontal stereo camera setup. It includes the StereoCamera class, which allows for the conversion of disparity maps into 3D point clouds using the stereo rectification model. This module leverages camera calibration matrices and disparity information to reproject pixels from 2D to 3D space, facilitating tasks such as depth estimation and 3D reconstruction.
.. currentmodule:: kornia.geometry.camera.stereo
-In this module we provide the :class:`StereoCamera` that contains functionality for working with a horizontal stereo camera setup.
+This module provides the :class:`StereoCamera` class, which contains functionality for working with a horizontal stereo camera setup.
The horizontal stereo camera setup is assumed to be calibrated and rectified such that the setup can be described by two camera matrices:
@@ -36,13 +35,13 @@ where:
* :math:`cy` is the y-coordinate of the principal point in pixels.
* :math:`tx` is the horizontal baseline in metric units.
-These camera matrices are obtained by calibrating your stereo camera setup which can be done `in OpenCV <https://docs.opencv.org/master/d9/d0c/group__calib3d.html#ga91018d80e2a93ade37539f01e6f07de5>`_.
+These camera matrices are obtained by calibrating your stereo camera setup, which can be done `in OpenCV <https://docs.opencv.org/master/d9/d0c/group__calib3d.html#ga91018d80e2a93ade37539f01e6f07de5>`_.
-The :class:`StereoCamera` allows you to convert disparity maps to the real world 3D geometry represented by a point cloud.
+The :class:`StereoCamera` allows you to convert disparity maps to real-world 3D geometry represented by a point cloud.
This is done by forming the :math:`Q` matrix.
-Using the pinhole camera model to project :math:`[X Y Z 1]` in world coordinates to :math:`uv` pixels in the left and right camera frame respectively:
+Using the pinhole camera model, a point :math:`[X, Y, Z, 1]` in world coordinates projects to pixels :math:`(u, v)` in the left and right camera frames respectively:
.. math::
@@ -69,9 +68,9 @@ Using the pinhole camera model to project :math:`[X Y Z 1]` in world coordinates
1
\end{bmatrix}
-Where :math:`d` is the disparity between pixels in left and right image.
+where :math:`d` is the disparity between the pixels in the left and right images.
-Combining these two expressions let us write it as one matrix multiplication
+Combining these two expressions lets us write them as one matrix multiplication:
.. math::
\begin{bmatrix}
@@ -93,7 +92,7 @@ Combining these two expressions let us write it as one matrix multiplication
1
\end{bmatrix}
-Now subtract the first from the third row and invert the expression and you'll get:
+Subtracting the first row from the third and inverting the expression gives:
.. math::
\begin{bmatrix}
@@ -115,7 +114,7 @@ Now subtract the first from the third row and invert the expression and you'll g
1
\end{bmatrix}
-Where :math:`Q` is
+where :math:`Q` is
.. math::
@@ -126,7 +125,7 @@ Where :math:`Q` is
0 & 0 & -fy & fy * (cx_{left} -cx_{right})
\end{bmatrix}
-Notice here that the x-coordinate for the principal point in the left and right camera :math:`cx` might differ, which is being taken into account here.
+Notice that the x-coordinate of the principal point, :math:`cx`, may differ between the left and right cameras, which is taken into account here.
Assuming :math:`fx = fy` you can further reduce this to:
@@ -135,10 +134,10 @@ Assuming :math:`fx = fy` you can further reduce this to:
1 & 0 & 0 & -cx \\
0 & 1 & 0 & -cy \\
0 & 0 & 0 & fx \\
- 0 & 0 & -1/tx & (cx_{left} -cx_{right} / tx)
+ 0 & 0 & -1/tx & (cx_{left} - cx_{right}) / tx
\end{bmatrix}
-But we'll use the general :math:`Q` matrix.
+but the implementation uses the general :math:`Q` matrix.
Using the :math:`Q` matrix we can obtain the 3D points by:
@@ -152,10 +151,12 @@ Using the :math:`Q` matrix we can obtain the 3D points by:
\begin{bmatrix}
u \\
v \\
- disparity(y, v) \\
- z
+ disparity(u, v) \\
+ 1
\end{bmatrix}
+where the Euclidean 3D point is :math:`(X/W, Y/W, Z/W)`.
+
.. autoclass:: StereoCamera
:members:
diff --git a/docs/source/geometry.conversions.rst b/docs/source/geometry.conversions.rst
index 251f6cddc..cdec975f7 100644
--- a/docs/source/geometry.conversions.rst
+++ b/docs/source/geometry.conversions.rst
@@ -2,8 +2,7 @@ kornia.geometry.conversions
==================================
.. meta::
- :name: description
- :content: "The kornia.geometry.conversions module provides a collection of functions for converting between various geometric representations, such as angles, coordinates, homographies, quaternions, rotation matrices, and Euler angles. This module includes utilities for transforming points between homogeneous and non-homogeneous coordinates, normalizing and denormalizing pixel coordinates, as well as handling pose transformations and quaternion operations for 3D geometry tasks."
+ :description: The kornia.geometry.conversions module provides a collection of functions for converting between various geometric representations, such as angles, coordinates, homographies, quaternions, rotation matrices, and Euler angles. This module includes utilities for transforming points between homogeneous and non-homogeneous coordinates, normalizing and denormalizing pixel coordinates, as well as handling pose transformations and quaternion operations for 3D geometry tasks.
.. currentmodule:: kornia.geometry.conversions
diff --git a/docs/source/geometry.depth.rst b/docs/source/geometry.depth.rst
index cff52147a..9e2217684 100644
--- a/docs/source/geometry.depth.rst
+++ b/docs/source/geometry.depth.rst
@@ -2,8 +2,7 @@ kornia.geometry.depth
=====================
.. meta::
- :name: description
- :content: "The kornia.geometry.depth module provides functions for working with depth-related transformations in 3D vision tasks. Key functionalities include computing depth from disparity, converting depth maps to 3D points, obtaining surface normals from depth data, and unprojecting depth data from mesh grids. Additionally, the module supports depth-based image warping and working with depth through plane equations, enabling advanced geometric operations in computer vision."
+ :description: The kornia.geometry.depth module provides functions for working with depth-related transformations in 3D vision tasks. Key functionalities include computing depth from disparity, converting depth maps to 3D points, obtaining surface normals from depth data, and unprojecting depth data from mesh grids. Additionally, the module supports depth-based image warping and working with depth through plane equations, enabling advanced geometric operations in computer vision.
.. currentmodule:: kornia.geometry.depth
diff --git a/docs/source/geometry.epipolar.rst b/docs/source/geometry.epipolar.rst
index ff876bf7f..69a9a9166 100644
--- a/docs/source/geometry.epipolar.rst
+++ b/docs/source/geometry.epipolar.rst
@@ -2,14 +2,14 @@ kornia.geometry.epipolar
========================
.. meta::
- :name: description
- :content: "The kornia.geometry.epipolar module provides essential tools for working with epipolar geometry, crucial in tasks like Structure from Motion (SfM). It includes functions for computing the essential and fundamental matrices, decomposing them, and deriving relative camera motion. The module also offers various metrics for evaluating epipolar constraints, triangulating 3D points, and handling projection transformations. Additionally, it supports functions for normalizing points and transformations, calculating epipolar distances, and generating camera intrinsics."
+ :description: The kornia.geometry.epipolar module provides essential tools for working with epipolar geometry, crucial in tasks like Structure from Motion (SfM). It includes functions for computing the essential and fundamental matrices, decomposing them, and deriving relative camera motion. The module also offers various metrics for evaluating epipolar constraints, triangulating 3D points, and handling projection transformations. Additionally, it supports functions for normalizing points and transformations, calculating epipolar distances, and generating camera intrinsics.
.. currentmodule:: kornia.geometry.epipolar
-Module with useful functionalities for epipolar geometry used by Structure from Motion
+Functions for epipolar geometry, as used in Structure from Motion (SfM) and two-view pose estimation.
.. image:: data/epipolar_geometry.svg.png
+ :alt: Epipolar geometry between two views
Essential
diff --git a/docs/source/geometry.grid.rst b/docs/source/geometry.grid.rst
index 086427b7d..34021c2d3 100644
--- a/docs/source/geometry.grid.rst
+++ b/docs/source/geometry.grid.rst
@@ -2,8 +2,7 @@ kornia.geometry.grid
====================
.. meta::
- :name: description
- :content: "The kornia.geometry.grid module provides functions for generating coordinate grids for images. It includes functions for creating 2D and 3D mesh grids with optional coordinate normalization, making it easy to work with grid-based transformations and sampling operations in computer vision tasks."
+ :description: The kornia.geometry.grid module provides functions for generating coordinate grids for images. It includes functions for creating 2D and 3D mesh grids with optional coordinate normalization, making it easy to work with grid-based transformations and sampling operations in computer vision tasks.
.. currentmodule:: kornia.geometry.grid
diff --git a/docs/source/geometry.homography.rst b/docs/source/geometry.homography.rst
index 524a9e50d..8c6987224 100644
--- a/docs/source/geometry.homography.rst
+++ b/docs/source/geometry.homography.rst
@@ -2,17 +2,9 @@ kornia.geometry.homography
==========================
.. meta::
- :name: description
- :content: "The kornia.geometry.homography module provides essential tools for manipulating and working with homographies, which describe the transformation between two images of the same scene from different viewpoints. The module includes a variety of functions for computing, applying, and manipulating homographies, making it useful for tasks such as image stitching, object tracking, and perspective warping. The module also offers an interactive demo to explore homography warping in real time."
+ :description: The kornia.geometry.homography module provides essential tools for manipulating and working with homographies, which describe the transformation between two images of the same scene from different viewpoints. The module includes a variety of functions for computing, applying, and manipulating homographies, making it useful for tasks such as image stitching, object tracking, and perspective warping.
-Module with useful functionalities for homographies manipulation.
+Functions to estimate homographies from point or line correspondences and to score them.
.. automodule:: kornia.geometry.homography
:members:
-
-
-Interactive Demo
-----------------
-.. raw:: html
-
- <gradio-app src="https://kornia-homography-warping.hf.space"></gradio-app>
diff --git a/docs/source/geometry.keypoints.rst b/docs/source/geometry.keypoints.rst
index ecd7ff2c1..7d4edf231 100644
--- a/docs/source/geometry.keypoints.rst
+++ b/docs/source/geometry.keypoints.rst
@@ -2,16 +2,15 @@ kornia.geometry.keypoints
=========================
.. meta::
- :name: description
- :content: "The kornia.geometry.keypoints module offers essential functionalities for the manipulation of 2D and 3D keypoints. This module provides tools for working with keypoints in both 2D and 3D space, enabling tasks such as feature detection, matching, and transformation. The module includes the `Keypoints` and `Keypoints3D` classes, which facilitate the management and processing of keypoint data, making it useful for applications like object recognition, tracking, and 3D reconstruction."
+ :description: The kornia.geometry.keypoints module offers essential functionalities for the manipulation of 2D and 3D keypoints. This module provides tools for working with keypoints in both 2D and 3D space, enabling tasks such as feature detection, matching, and transformation. The module includes the `Keypoints` and `Keypoints3D` classes, which facilitate the management and processing of keypoint data, making it useful for applications like object recognition, tracking, and 3D reconstruction.
-Module with useful functionalities for 2D and 3D keypoints manipulation.
+Object-oriented API for 2D and 3D keypoints: the :class:`~kornia.geometry.keypoints.Keypoints` and
+:class:`~kornia.geometry.keypoints.Keypoints3D` classes wrap a tensor of points and provide transformations and padding.
.. autoclass:: kornia.geometry.keypoints.Keypoints
:members:
:undoc-members:
-
.. autoclass:: kornia.geometry.keypoints.Keypoints3D
:members:
:undoc-members:
diff --git a/docs/source/geometry.liegroup.rst b/docs/source/geometry.liegroup.rst
index dd7fdcf53..07192a916 100644
--- a/docs/source/geometry.liegroup.rst
+++ b/docs/source/geometry.liegroup.rst
@@ -2,50 +2,54 @@ kornia.geometry.liegroup
==========================
.. meta::
- :name: description
- :content: "The kornia.geometry.liegroup module provides mathematical tools and operations for working with Lie groups and Lie algebras, which are fundamental in many areas of robotics and computer vision. Lie groups describe smooth manifolds that satisfy group axioms, while Lie algebras represent the tangent space at the identity element of these groups. This module includes key classes for common Lie groups like `SO2`, `SO3`, `SE2`, and `SE3`, and provides functions for performing operations like the exponential and logarithmic maps, which connect Lie algebras and Lie groups."
+ :description: The kornia.geometry.liegroup module provides mathematical tools and operations for working with Lie groups and Lie algebras, which are fundamental in many areas of robotics and computer vision. Lie groups describe smooth manifolds that satisfy group axioms, while Lie algebras represent the tangent space at the identity element of these groups. This module includes key classes for common Lie groups like `SO2`, `SO3`, `SE2`, and `SE3`, and provides functions for performing operations like the exponential and logarithmic maps, which connect Lie algebras and Lie groups.
.. currentmodule:: kornia.geometry.liegroup
-The Lie group encompasses the concepts of `group` and `smooth manifold` in a unique body.
+A Lie group combines the concepts of a *group* and a *smooth manifold* in a single object.
A group is a non-empty set with an operation that satisfies the following constraints: the operation is associative, has an identity element,
and every element of the set has an inverse element.
See more: `Group <https://en.wikipedia.org/wiki/Group_(mathematics)>`_
-A Lie group :math:`G` is a smooth manifold whose elements satisfy the group axioms.You can visualize the idea of manifold like a curved, smooth (hyper)-surface, with no edges or
+A Lie group :math:`G` is a smooth manifold whose elements satisfy the group axioms. You can visualize a manifold as a curved, smooth (hyper-)surface, with no edges or
spikes, embedded in a space of higher dimension.
See more: `Manifold <https://en.wikipedia.org/wiki/Manifold>`_
-In robotics, we say that our state vector evolves on this surface, that is, the manifold describes or is defined by the constraints imposed on
+In robotics, we say that our state vector evolves on this surface; that is, the manifold describes, or is defined by, the constraints imposed on
the state.
-lie algebra
-===========
+Lie algebra
+-----------
.. image:: data/lie.png
+ :alt: A manifold and its tangent space at the identity
-If :math:`M` is the manifold that represents a lie group, the tangent space at the identity is called the Lie algebra of :math:`M`.
+If :math:`M` is the manifold that represents a Lie group, the tangent space at the identity is called the Lie algebra of :math:`M`.
The Lie algebra :math:`m` is a vector space. As such, its elements can be identified with vectors in :math:`R^d`, whose
-dimension :math:`d` is the number of degrees of freedom of :math:`M`. For example :math:`d` would be 3 in the case of lie group :math:`SO3`
+dimension :math:`d` is the number of degrees of freedom of :math:`M`. For example, :math:`d = 3` for the Lie group :math:`SO(3)`.
-lie group and lie algebra
-==========================
+Lie group and Lie algebra
+-------------------------
Every Lie group has an associated Lie algebra. We relate the
-Lie group with its Lie algebra through the following facts
+Lie group to its Lie algebra through the following facts:
#. The Lie algebra :math:`m` is a vector space. As such, its elements can be identified with vectors in :math:`R^d`, whose
dimension :math:`d` is the number of degrees of freedom of :math:`M`.
-#. The exponential map, `exp` : :math:`m` β†’ :math:`M`, exactly converts elements of the Lie algebra into elements of the group.
- The `log` map is the inverse operation.
+#. The exponential map, :math:`\exp : m \rightarrow M`, exactly converts elements of the Lie algebra into elements of the group.
+ The :math:`\log` map is the inverse operation.
.. image:: data/lie_ops.png
+ :alt: The exponential and logarithmic maps between a Lie group and its Lie algebra
+
+Reference: `A micro Lie theory for state estimation in robotics <https://arxiv.org/pdf/1812.01537.pdf>`_
-Reference: `Micro lie theory <https://arxiv.org/pdf/1812.01537.pdf>`_
+Classes
+-------
.. autoclass:: So3
:members:
diff --git a/docs/source/geometry.linalg.rst b/docs/source/geometry.linalg.rst
index cb53b4621..a0c5fb43b 100644
--- a/docs/source/geometry.linalg.rst
+++ b/docs/source/geometry.linalg.rst
@@ -2,8 +2,7 @@ kornia.geometry.linalg
======================
.. meta::
- :name: description
- :content: "The kornia.geometry.linalg module offers essential linear algebra utilities for geometric computations in computer vision and robotics. It includes functions for transforming points, calculating transformations, computing distances, and performing vector operations. Key functions include relative transformation, inverse transformation, point-line distance, squared norm, dot product, and Euclidean distance. These operations are fundamental for tasks such as geometric transformations, distance computations, and vector manipulations."
+ :description: The kornia.geometry.linalg module offers essential linear algebra utilities for geometric computations in computer vision and robotics. It includes functions for transforming points, calculating transformations, computing distances, and performing vector operations. Key functions include relative transformation, inverse transformation, point-line distance, squared norm, dot product, and Euclidean distance. These operations are fundamental for tasks such as geometric transformations, distance computations, and vector manipulations.
.. currentmodule:: kornia.geometry.linalg
diff --git a/docs/source/geometry.line.rst b/docs/source/geometry.line.rst
index 625f5329e..3e4bb7825 100644
--- a/docs/source/geometry.line.rst
+++ b/docs/source/geometry.line.rst
@@ -2,8 +2,7 @@ kornia.geometry.line
====================
.. meta::
- :name: description
- :content: "The kornia.geometry.line module provides functionality for working with lines and line segments in geometric space. It includes classes such as ParametrizedLine for line representation, Hyperplane for handling high-dimensional planes, and functions like fit_line for fitting lines to data points. This module is essential for tasks like line segment matching and line fitting in computer vision and geometric analysis."
+ :description: The kornia.geometry.line module provides functionality for working with lines and line segments in geometric space. It includes classes such as ParametrizedLine for line representation, Hyperplane for handling high-dimensional planes, and functions like fit_line for fitting lines to data points. This module is essential for tasks like line segment matching and line fitting in computer vision and geometric analysis.
.. currentmodule:: kornia.geometry.line
@@ -14,12 +13,3 @@ kornia.geometry.line
.. autofunction:: fit_line
.. autoclass:: Hyperplane
-
-
-Interactive Demo
-----------------
-
-.. raw:: html
-
- <gradio-app src="https://kornia-line-segment-matching.hf.space"></gradio-app>
- <gradio-app src="https://kornia-line-fitting.hf.space"></gradio-app>
diff --git a/docs/source/geometry.pointcloud.rst b/docs/source/geometry.pointcloud.rst
index 31be0b5fc..35b9092a8 100644
--- a/docs/source/geometry.pointcloud.rst
+++ b/docs/source/geometry.pointcloud.rst
@@ -2,8 +2,7 @@ kornia.geometry.pointcloud
==========================
.. meta::
- :name: description
- :content: "The kornia.geometry.pointcloud module provides functionality for loading and saving point clouds in PLY format. It includes functions for reading and writing 3D point cloud data, making it easy to work with point cloud files in computer vision and geometric processing tasks."
+ :description: The kornia.geometry.pointcloud module provides functionality for loading and saving point clouds in PLY format. It includes functions for reading and writing 3D point cloud data, making it easy to work with point cloud files in computer vision and geometric processing tasks.
.. currentmodule:: kornia.geometry.pointcloud
diff --git a/docs/source/geometry.quaternion.rst b/docs/source/geometry.quaternion.rst
index 956639af0..a9dec5782 100644
--- a/docs/source/geometry.quaternion.rst
+++ b/docs/source/geometry.quaternion.rst
@@ -2,8 +2,7 @@ kornia.geometry.quaternion
==========================
.. meta::
- :name: description
- :content: "The kornia.geometry.quaternion module provides tools for working with quaternions, a mathematical concept widely used in 3D geometry and computer vision. The Quaternion class allows for quaternion manipulation, including conversion between different representations like axis-angle and rotation matrices. This module is essential for operations involving 3D rotations and transformations."
+ :description: The kornia.geometry.quaternion module provides tools for working with quaternions, a mathematical concept widely used in 3D geometry and computer vision. The Quaternion class allows for quaternion manipulation, including conversion between different representations like axis-angle and rotation matrices. This module is essential for operations involving 3D rotations and transformations.
.. currentmodule:: kornia.geometry.quaternion
diff --git a/docs/source/geometry.ransac.rst b/docs/source/geometry.ransac.rst
index c7e495ac1..f89e8e50a 100644
--- a/docs/source/geometry.ransac.rst
+++ b/docs/source/geometry.ransac.rst
@@ -2,12 +2,11 @@ kornia.geometry.ransac
======================
.. meta::
- :name: description
- :content: "The kornia.geometry.ransac module implements the RANSAC (Random Sample Consensus) algorithm for robust fitting of models in the presence of outliers. The RANSAC class allows for efficient outlier rejection and model estimation, which is crucial in tasks such as stereo vision, homography estimation, and 3D reconstruction. This module is valuable for geometric computer vision problems."
+ :description: The kornia.geometry.ransac module implements the RANSAC (Random Sample Consensus) algorithm for robust fitting of models in the presence of outliers. The RANSAC class allows for efficient outlier rejection and model estimation, which is crucial in tasks such as stereo vision, homography estimation, and 3D reconstruction. This module is valuable for geometric computer vision problems.
.. currentmodule:: kornia.geometry.ransac
-Module with RANSAC
+Robust model fitting with RANSAC (Random Sample Consensus), used to estimate homographies, fundamental and essential matrices from noisy correspondences.
.. autoclass:: RANSAC
:members: forward
diff --git a/docs/source/geometry.rst b/docs/source/geometry.rst
index 404cea7f5..406b451cd 100644
--- a/docs/source/geometry.rst
+++ b/docs/source/geometry.rst
@@ -2,68 +2,65 @@ kornia.geometry
===============
.. meta::
- :name: description
- :content: "The Kornia.geometry module provides essential geometric transformations for computer vision tasks, including 2D and 3D image manipulation. It includes submodules for image transforms, camera models, coordinate conversions, linear algebra operations, and depth map processing, supporting a wide range of geometric operations for accurate spatial transformations and 3D reconstructions."
+ :description: The Kornia.geometry module provides essential geometric transformations for computer vision tasks, including 2D and 3D image manipulation. It includes submodules for image transforms, camera models, coordinate conversions, linear algebra operations, and depth map processing, supporting a wide range of geometric operations for accurate spatial transformations and 3D reconstructions.
-Geometric image transformations is another key ingredient in computer vision to manipulate images.
-Since geometry operations are typically performed in 2D or 3D, we provide several algorithms to work
-with both cases. This module, the original core of the library, consists of the following submodules:
-transforms, camera, conversions, linalg and depth. We next describe each of them:
+Geometric image transformations are another key ingredient in computer vision for manipulating images.
+Since geometry operations are typically performed in 2D or 3D, we provide algorithms for both cases.
+This module, the original core of the library, consists of the following main submodules:
-- `transforms`: The module provides low level interfaces to manipulate 2D images, with routines for Rotating,
- Scaling, Translating, Shearing; Cropping functions in several modalities such as central crops,
- crop and resize; Flipping transformations in the vertical and horizontal axis; Resizing operations;
- Functions to warp tensors given affine or perspective transformations,
- and utilities to compute the transformation matrices to perform the mentioned operations.
-- `camera`: A set of routines specific to different types of camera representations such as Pinhole
- or Orthographic models containing functionalities such as projecting and unprojecting points from the
- camera to a world frame.
-- `conversions`: Routines to perform conversions between angle representation such as
- radians to degrees, coordinates normalization, and homogeneous to euclidean. Moreover, we include advanced
- conversions for 3D geometry representations such as Quaternion, Axis-Angle, Rotation Matrix, or Rodrigues
- formula.
-- `linalg`: Functions to perform general rigid-body homogeneous transformations. We include implementations to
- transform points between frames and for homogeneous transformations, manipulation such as composition,
- inverse and to compute relative poses.
-- `depth`: A set of layers to manipulate depth maps such as how to compute 3D point clouds given depth maps and
- calibrated cameras; compute surface normals per pixel and warp tensor frames given calibrated cameras setup.
+- :doc:`transform <geometry.transform>`: low-level interfaces to manipulate 2D images, with routines for rotating,
+ scaling, translating and shearing; cropping functions in several modalities such as central crops and
+ crop-and-resize; vertical and horizontal flips; resizing; functions to warp tensors given affine or
+ perspective transformations; and utilities to compute the transformation matrices behind those operations.
+- :doc:`camera <geometry.camera>`: routines specific to different camera representations, such as the pinhole
+ or orthographic models, including projecting and unprojecting points between the camera and the world frame.
+- :doc:`conversions <geometry.conversions>`: conversions between angle representations (radians and degrees),
+ coordinate normalization, and homogeneous to Euclidean coordinates. It also includes conversions between 3D
+ rotation representations: quaternions, axis-angle, rotation matrices and Euler angles.
+- :doc:`linalg <geometry.linalg>`: general rigid-body homogeneous transformations, with functions to
+ transform points between frames and to compose, invert and compute relative transformations.
+- :doc:`depth <geometry.depth>`: layers to manipulate depth maps, such as computing 3D point clouds from depth maps
+ and calibrated cameras, per-pixel surface normals, and warping frames given a calibrated camera setup.
+The remaining submodules, listed below, cover bounding boxes and keypoints, calibration, epipolar geometry,
+homographies, Lie groups, lines, point clouds, quaternions, RANSAC, polynomial solvers and sub-pixel refinement.
-:Resources:
+.. admonition:: About ``align_corners``
- **align_corners**
-
- align_corners is a switch that widely offered in PyTorch geometric transform functions.
+ ``align_corners`` is a switch offered by most PyTorch and Kornia geometric transform functions.
Here is a simple illustration showing how a 4x4 image is upsampled to 8x8, made by
`bkkm16 <https://discuss.pytorch.org/t/what-we-should-use-align-corners-false/22663/9?u=ducha-aiki>`_.
.. image:: https://user-images.githubusercontent.com/4803565/110627988-df8a4d00-81a2-11eb-8e13-06d3f7b09ef1.png
+ :alt: Illustration of align_corners=True versus align_corners=False when upsampling a 4x4 image to 8x8
+
+ - ``align_corners=True``: pixels are arranged as a grid of points. Points at the corners are aligned.
+ - ``align_corners=False``: pixels are arranged as 1x1 areas. Area boundaries, rather than their centers, are aligned.
- - `align_corners=True`, pixels are arranged as a grid of points. Points at the corners are aligned.
- - `align_corners=False`, pixels are arranged as 1x1 areas. Area boundaries, rather than their centers, are aligned.
+ The default is **not** uniform across the library; see the table in :doc:`get-started/conventions`.
.. currentmodule:: kornia.geometry
.. toctree::
- :maxdepth: 3
+ :maxdepth: 2
- geometry.bbox
- geometry.boxes
- geometry.keypoints
- geometry.calibration
- geometry.camera
- geometry.conversions
- geometry.depth
- geometry.epipolar
- geometry.grid
- geometry.homography
- geometry.liegroup
- geometry.linalg
- geometry.line
- geometry.pointcloud
- geometry.quaternion
- geometry.solvers
- geometry.subpix
- geometry.transform
- geometry.ransac
+ transform <geometry.transform>
+ camera <geometry.camera>
+ conversions <geometry.conversions>
+ linalg <geometry.linalg>
+ depth <geometry.depth>
+ epipolar <geometry.epipolar>
+ homography <geometry.homography>
+ ransac <geometry.ransac>
+ calibration <geometry.calibration>
+ liegroup <geometry.liegroup>
+ quaternion <geometry.quaternion>
+ line <geometry.line>
+ bbox <geometry.bbox>
+ boxes <geometry.boxes>
+ keypoints <geometry.keypoints>
+ subpix <geometry.subpix>
+ solvers <geometry.solvers>
+ grid <geometry.grid>
+ pointcloud <geometry.pointcloud>
diff --git a/docs/source/geometry.solvers.rst b/docs/source/geometry.solvers.rst
index 841a57091..d20b3981b 100644
--- a/docs/source/geometry.solvers.rst
+++ b/docs/source/geometry.solvers.rst
@@ -2,12 +2,11 @@ kornia.geometry.solvers
=======================
.. meta::
- :name: description
- :content: "The kornia.geometry.solvers module provides various solvers and optimizers for geometric problems. It includes polynomial solvers for quadratic and cubic equations, as well as functions for multiplying polynomials of different degrees and converting determinants into polynomial forms. These tools are essential for handling geometric transformations, optimizations, and other computational geometry tasks in computer vision."
+ :description: The kornia.geometry.solvers module provides various solvers and optimizers for geometric problems. It includes polynomial solvers for quadratic and cubic equations, as well as functions for multiplying polynomials of different degrees and converting determinants into polynomial forms. These tools are essential for handling geometric transformations, optimizations, and other computational geometry tasks in computer vision.
.. currentmodule:: kornia.geometry.solvers
-Module containing various geometrical solvers/optimizers.
+Polynomial and homogeneous linear solvers used by the geometric estimators.
Homogeneous Solvers
-------------------
diff --git a/docs/source/geometry.subpix.rst b/docs/source/geometry.subpix.rst
index 93cc9ffb2..a22b98321 100644
--- a/docs/source/geometry.subpix.rst
+++ b/docs/source/geometry.subpix.rst
@@ -2,12 +2,11 @@ kornia.geometry.subpix
======================
.. meta::
- :name: description
- :content: "The kornia.geometry.subpix module provides functionalities for extracting coordinates with sub-pixel accuracy. It includes convolutional methods like soft argmax and quadratic interpolation for precise 2D and 3D coordinate extraction. Additionally, it offers spatial softmax and expectation techniques, as well as non-maximum suppression (NMS) for 2D and 3D data, making it ideal for tasks requiring high-resolution spatial localization in computer vision."
+ :description: The kornia.geometry.subpix module provides functionalities for extracting coordinates with sub-pixel accuracy. It includes convolutional methods like soft argmax and quadratic interpolation for precise 2D and 3D coordinate extraction. Additionally, it offers spatial softmax and expectation techniques, as well as non-maximum suppression (NMS) for 2D and 3D data, making it ideal for tasks requiring high-resolution spatial localization in computer vision.
.. currentmodule:: kornia.geometry.subpix
-Module with useful functionalities to extract coordinates sub-pixel accuracy.
+Functions and modules to extract coordinates with sub-pixel accuracy, for example to refine keypoint locations.
Convolutional
-------------
@@ -55,15 +54,15 @@ Spatial
.. autofunction:: spatial_soft_argmax2d
.. autofunction:: render_gaussian2d
-Non Maxima Suppression
+Non-Maxima Suppression
----------------------
.. autofunction:: nms2d
.. autofunction:: nms3d
.. autofunction:: nms3d_minmax
-Module
-------
+Modules
+-------
.. autoclass:: SpatialSoftArgmax2d
.. autoclass:: ConvSoftArgmax2d
diff --git a/docs/source/geometry.transform.rst b/docs/source/geometry.transform.rst
index 6a32d6070..29a338526 100644
--- a/docs/source/geometry.transform.rst
+++ b/docs/source/geometry.transform.rst
@@ -2,13 +2,11 @@ kornia.geometry.transform
=========================
.. meta::
- :name: description
- :content: "The kornia.geometry.transform module provides a comprehensive set of functions for performing various geometric transformations on 2D and 3D images. It includes operators for warping, affine, and perspective transformations, as well as tools for resizing, scaling, rotating, and shearing images. Additionally, it supports advanced image registration techniques, pyramid building, and non-rigid transformations such as elastic transforms. This module is essential for tasks requiring image manipulation and alignment in computer vision and image processing workflows."
+ :description: The kornia.geometry.transform module provides a comprehensive set of functions for performing various geometric transformations on 2D and 3D images. It includes operators for warping, affine, and perspective transformations, as well as tools for resizing, scaling, rotating, and shearing images. Additionally, it supports advanced image registration techniques, pyramid building, and non-rigid transformations such as elastic transforms. This module is essential for tasks requiring image manipulation and alignment in computer vision and image processing workflows.
.. currentmodule:: kornia.geometry.transform
-The functions in this section perform various geometrical transformations of 2D images.
-
+The functions in this section perform various geometric transformations of 2D and 3D images.
Warp operators
--------------
@@ -25,7 +23,7 @@ Warp operators
.. autofunction:: homography_warp
.. autofunction:: homography_warp3d
-Image 2d transforms
+Image 2D transforms
-------------------
.. autofunction:: affine
@@ -45,7 +43,7 @@ Image 2d transforms
.. autofunction:: build_pyramid
.. autofunction:: build_laplacian_pyramid
-Image 3d transforms
+Image 3D transforms
-------------------
.. autofunction:: affine3d
@@ -84,10 +82,8 @@ Crop operators (3D)
.. autofunction:: center_crop3d
.. autofunction:: crop_and_resize3d
-Module
-------
-
-
+Modules
+-------
.. autoclass:: Rotate
.. autoclass:: Translate
@@ -106,25 +102,14 @@ Module
.. autoclass:: HomographyWarper
.. autoclass:: CenterCrop2D
-
Image registration
------------------
.. image:: _static/img/registration.gif
:width: 400
- :alt: Image registration with ImageRegistrator module
+ :alt: Image registration with the ImageRegistrator module
+
+See also the :doc:`image registration application page <applications/image_registration>`.
.. automodule:: kornia.geometry.transform.image_registrator
:members:
-
-Interactive Demo
-----------------
-
-.. raw:: html
-
- <gradio-app src="https://kornia-kornia-resize-antialias.hf.space"></gradio-app>
-
-
-.. raw:: html
-
- <gradio-app src="https://kornia-geometry-image-transform-with-kornia.hf.space"></gradio-app>
diff --git a/docs/source/get-started/about.rst b/docs/source/get-started/about.rst
index e17d5533e..765044eea 100644
--- a/docs/source/get-started/about.rst
+++ b/docs/source/get-started/about.rst
@@ -1,13 +1,10 @@
-About
-=====
+Citing Kornia
+=============
-Cite us
--------
-
-Below you can find the different academic publication derived from Kornia. If you use Kornia in your
+Below you can find the academic publications derived from Kornia. If you use Kornia in your
work, do not hesitate to cite us :)
-.. code-block:: bash
+.. code-block:: bibtex
@inproceedings{eriba2020kornia,
author = {E. Riba, D. Mishkin, J. Shi, D. Ponsa, F. Moreno-Noguer and G. Bradski},
@@ -15,7 +12,7 @@ work, do not hesitate to cite us :)
year = {2020},
}
-.. code-block:: bash
+.. code-block:: bibtex
@inproceedings{eriba2019kornia,
author = {E. Riba, D. Mishkin, D. Ponsa, E. Rublee and G. Bradski},
@@ -25,7 +22,7 @@ work, do not hesitate to cite us :)
url = {https://arxiv.org/pdf/1910.02190.pdf}
}
-.. code-block:: bash
+.. code-block:: bibtex
@misc{Arraiy2018,
author = {E. Riba, M. Fathollahi, W. Chaney, E. Rublee and G. Bradski},
diff --git a/docs/source/get-started/conventions.rst b/docs/source/get-started/conventions.rst
index c8b11cf41..f0ee945b0 100644
--- a/docs/source/get-started/conventions.rst
+++ b/docs/source/get-started/conventions.rst
@@ -1,6 +1,9 @@
Conventions & Pitfalls
======================
+.. meta::
+ :description: The conventions every Kornia function follows: (B, C, H, W) float images in [0, 1], (x, y) points versus (h, w) sizes, degrees versus radians, homography direction, align_corners defaults, box formats and a pitfall checklist.
+
Every Kornia function follows the conventions below unless its documentation
explicitly says otherwise. If you are generating code (human or LLM), read
this page first β€” nearly every subtle Kornia bug is a convention mismatch,
diff --git a/docs/source/get-started/differentiability.rst b/docs/source/get-started/differentiability.rst
new file mode 100644
index 000000000..47ccd92db
--- /dev/null
+++ b/docs/source/get-started/differentiability.rst
@@ -0,0 +1,60 @@
+Differentiability
+=================
+
+.. meta::
+ :description: Every Kornia operator is differentiable: gradients flow through color conversions, filters, warps and augmentations, enabling image optimization, spatial transformer style networks and self-supervised losses.
+
+Kornia's defining feature is that every operator is written with differentiable PyTorch ops, so autograd flows
+through the whole library: color conversions, filters, geometric warps, augmentations and losses. Classical
+vision operations can therefore sit *inside* a model or a loss function, not only in the data loader.
+
+That enables three families of use cases:
+
+**Optimize an image directly.** Treat the image as the parameter. This is total-variation denoising in a few
+lines (see the :doc:`denoising guide </applications/image_denoising>`):
+
+.. code-block:: python
+
+ import torch
+ import kornia
+
+ noisy = torch.rand(1, 3, 64, 64)
+ estimate = noisy.clone().requires_grad_(True)
+ optimizer = torch.optim.Adam([estimate], lr=0.01)
+
+ for _ in range(50):
+ optimizer.zero_grad()
+ loss = torch.nn.functional.mse_loss(estimate, noisy) \
+ + 1e-4 * kornia.losses.total_variation(estimate).mean()
+ loss.backward()
+ optimizer.step()
+
+**Optimize transformation parameters.** Gradients flow through :func:`~kornia.geometry.transform.warp_perspective`
+with respect to the homography, which is how :class:`~kornia.geometry.transform.ImageRegistrator` aligns two
+images by direct gradient descent (see the :doc:`registration guide </applications/image_registration>`):
+
+.. code-block:: python
+
+ import torch
+ from kornia.geometry import ImageRegistrator
+
+ img_src = torch.rand(1, 1, 32, 32)
+ img_dst = torch.rand(1, 1, 32, 32)
+ homo = ImageRegistrator("similarity").register(img_src, img_dst)
+
+**Train through vision ops.** Structural losses such as :func:`~kornia.losses.ssim_loss` backpropagate to the
+network that produced the image; differentiable augmentations make techniques like AutoAugment-style policy
+search possible; and edge detectors or descriptors can be fine-tuned end to end.
+
+.. code-block:: python
+
+ import torch
+ import kornia
+
+ prediction = torch.rand(2, 3, 64, 64, requires_grad=True) # imagine a network output
+ target = torch.rand(2, 3, 64, 64)
+ loss = kornia.losses.ssim_loss(prediction, target, window_size=5)
+ loss.backward()
+ assert prediction.grad is not None
+
+Gradient correctness is enforced in CI with ``torch.autograd.gradcheck`` across the test suite.
diff --git a/docs/source/get-started/edge.rst b/docs/source/get-started/edge.rst
new file mode 100644
index 000000000..2cbe0d327
--- /dev/null
+++ b/docs/source/get-started/edge.rst
@@ -0,0 +1,32 @@
+Edge devices and Rust
+=====================
+
+.. meta::
+ :description: Deploying Kornia pipelines outside Python: export to ONNX for ONNX Runtime on CPU, GPU, TensorRT or OpenVINO, or use kornia-rs, the Rust-native computer vision library from the same organization.
+
+A trained pipeline does not have to ship with Python and PyTorch. Two paths take Kornia to production and
+resource-constrained targets:
+
+ONNX
+----
+
+Kornia operators and models export to ONNX, and :class:`~kornia.onnx.sequential.ONNXSequential` chains
+pre-exported graphs into a single model that runs under ONNX Runtime with the CPU, CUDA, TensorRT or OpenVINO
+execution providers. Pre-exported operators and models are published in the
+`kornia/ONNX_models <https://huggingface.co/kornia/ONNX_models>`_ Hugging Face repository.
+See the :doc:`ONNX support guide <onnx>`.
+
+kornia-rs
+---------
+
+`kornia-rs <https://github.com/kornia/kornia-rs>`_ is the Rust-native computer vision library developed by the
+same organization: a from-scratch implementation designed for safety-critical and embedded applications, with
+first-class support for camera I/O and efficient image decoding. It is what already powers :mod:`kornia.io`
+inside this library, through the ``kornia_rs`` Python package.
+
+- Source and documentation: `github.com/kornia/kornia-rs <https://github.com/kornia/kornia-rs>`_
+- Rust crate: `crates.io/crates/kornia <https://crates.io/crates/kornia>`_ (API docs on
+ `docs.rs <https://docs.rs/kornia>`_)
+
+If your deployment target is a robot, a camera or another device where a Python runtime is unwanted, kornia-rs
+is the intended path; reach out on `Discord <https://discord.gg/HfnywwpBnD>`_ if you are building on it.
diff --git a/docs/source/get-started/governance.rst b/docs/source/get-started/governance.rst
index c7478e7cc..b0d11243d 100644
--- a/docs/source/get-started/governance.rst
+++ b/docs/source/get-started/governance.rst
@@ -1,5 +1,8 @@
-Kornia AI Organization
-======================
+Governance
+==========
+
+.. meta::
+ :description: How the Kornia project is governed: the Kornia AI non-profit organization behind the library, its mission, membership, maintainers and how to contribute or donate.
The Kornia AI organization
--------------------------
@@ -15,16 +18,16 @@ and is the organization behind the Kornia library and its ecosystem projects.
3. The organization facilitates discussions on ethical, philosophical, and practical aspects of AI, and organizes various activities to achieve its objectives.
4. Operating on a non-profit basis, the association prohibits using its name or symbols for profit-making activities, but encourages the use of public AI goods by third parties.
-What we do ?
-------------
+What we do
+----------
-- We maintain the Kornia library and its ecosystem projects such a Limbus, kornia-rs
+- We maintain the Kornia library and its ecosystem projects, such as Limbus and kornia-rs.
- We help to organize events such as workshops, meetups related to Computer Vision and robotics.
- We promote the use of Kornia and its ecosystem projects in the industry and academia.
-- We promote Computer Vision and robotics in the social media and other channels.
+- We promote Computer Vision and robotics on social media and other channels.
-How to contribute ?
--------------------
+How to contribute
+-----------------
- Make a donation to the organization via:
- `Open Collective <https://opencollective.com/kornia>`_
@@ -38,7 +41,7 @@ Membership
----------
The membership is open to anyone who is interested in the mission of the organization and is willing to contribute to its activities.
-The membership is free of charge and is granted by the board of directors and can be revoked at any time if the member is not complying with the organization's rules or [Code of Conduct](https://github.com/kornia/kornia/blob/main/CODE_OF_CONDUCT.md).
+The membership is free of charge and is granted by the board of directors and can be revoked at any time if the member is not complying with the organization's rules or `Code of Conduct <https://github.com/kornia/kornia/blob/main/CODE_OF_CONDUCT.md>`_.
Governance
----------
@@ -56,10 +59,10 @@ Project Maintainers
- Edgar Riba (`edgarriba <https://github.com/edgarriba>`__)
- Jian Shi (`shijianjian <https://github.com/shijianjian>`__)
-Project Contributors and alumnis
---------------------------------
+Project Contributors and Alumni
+-------------------------------
-**Consider to contribute to the project and become a contributor! and add your name here!**
+**Consider contributing to the project, become a contributor, and add your name here!**
- Christie Jacob (`cjpurackal <https://github.com/cjpurackal>`__)
- Ceyda Cinarel (`cceyda <https://github.com/cceyda>`__)
@@ -67,4 +70,4 @@ Project Contributors and alumnis
- Duc Nguyen (`justanhduc <https://github.com/justanhduc>`__)
- Gonzalo Romero-GarcΓ­a (`Manza12 <https://github.com/Manza12>`__)
-Check the full list of contributors in the `Github contributors page <https://github.com/kornia/kornia/graphs/contributors>`_.
+Check the full list of contributors in the `GitHub contributors page <https://github.com/kornia/kornia/graphs/contributors>`_.
diff --git a/docs/source/get-started/gpu-acceleration.rst b/docs/source/get-started/gpu-acceleration.rst
new file mode 100644
index 000000000..f75e0cd6f
--- /dev/null
+++ b/docs/source/get-started/gpu-acceleration.rst
@@ -0,0 +1,40 @@
+GPU-accelerated vision
+======================
+
+.. meta::
+ :description: Every Kornia operator is a batched PyTorch function: move the input tensors to CUDA or Apple MPS and the whole pipeline runs on the GPU, with no per-image Python loops and no code changes.
+
+Kornia operators are plain PyTorch functions, so they follow PyTorch's device model: an operation runs on
+whatever device its input tensors live on. There is no ``use_gpu`` flag and nothing to configure; move the
+data, and the pipeline moves with it.
+
+.. code-block:: python
+
+ import torch
+ import kornia
+
+ device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
+
+ images = torch.rand(64, 3, 224, 224, device=device) # a whole batch on the GPU
+ gray = kornia.color.rgb_to_grayscale(images)
+ blurred = kornia.filters.gaussian_blur2d(gray, (5, 5), (1.5, 1.5))
+ rotated = kornia.geometry.transform.rotate(blurred, torch.full((64,), 30.0, device=device))
+
+Three habits make GPU pipelines fast:
+
+- **Batch.** Every operator takes ``(B, C, H, W)`` tensors and processes the whole batch in one kernel launch;
+ a Python loop over single images throws that away.
+- **Load onto the device.** :func:`kornia.io.load_image` takes a ``device`` argument, so images can be decoded
+ straight to GPU memory.
+- **Stay on the device.** Avoid round trips through NumPy or PIL in the middle of a pipeline; Kornia covers
+ color, filtering, geometry and augmentation, so the whole preprocessing chain can stay on the GPU.
+
+Augmentations are the typical win: a :class:`~kornia.augmentation.AugmentationSequential` pipeline samples and
+applies transforms for the entire batch on the GPU, inside the training loop, and most operators also run under
+``torch.compile`` for kernel fusion. The :doc:`performance page <performance>` shows measured eager-mode
+comparisons against torchvision, albumentations, OpenCV and PIL on CPU, CUDA and Apple silicon, and the
+:doc:`precision page <precision>` documents ``float16``/``bfloat16`` support.
+
+Apple silicon (``device="mps"``) is supported as well. PyTorch's MPS backend has no ``float64`` tensors, so keep
+inputs in ``float32`` (or half precision) there, and be aware that autocast on MPS can change the effective
+dtype of an operation.
diff --git a/docs/source/get-started/highlights.rst b/docs/source/get-started/highlights.rst
index 0dec0981d..623b26aff 100644
--- a/docs/source/get-started/highlights.rst
+++ b/docs/source/get-started/highlights.rst
@@ -1,44 +1,10 @@
+:orphan:
+
Highlighted Features
====================
-At Kornia, we are dedicated to pushing the boundaries of computer vision by providing a robust, efficient, and versatile toolkit. Our library is built on the powerful PyTorch backend, leveraging its efficiency and auto-differentiation capabilities to deliver high-performance solutions for a wide range of vision tasks.
-
-
-Accessible AI Models
---------------------
-
-We are excited to announce our latest advancement: a new initiative designed to seamlessly integrate lightweight AI models into Kornia. This addition is crafted to empower developers, researchers, and enthusiasts to harness the full potential of accessible AI, simplifying complex vision tasks and accelerating innovation.
-
-We have curated a selection of lightweight AI models, including YuNet, Loftr, and SAM, optimized for performance and efficiency. These models offer efficient computations that do not require expensive GPUs, making cutting-edge AI accessible to everyone. We welcome the whole community of developers and researchers who are passionate about advancing computer vision, throwing PRs for your lightning fast models!
-
-
-Classic Operators
------------------
-
-.. image:: https://github.com/kornia/data/raw/main/kornia_paper_mosaic.png
- :align: center
-
-At a granular level, Kornia is a library that consists of the following components:
+.. meta::
+ :description: This page has moved. The overview of Kornia's modules and accessible AI models now lives on the "What is Kornia?" page.
-+-----------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------+
-| **Component** | **Description** |
-+-----------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------+
-| `kornia <https://kornia.readthedocs.io/en/latest/index.html>`_ | a Differentiable Computer Vision library like OpenCV, with strong GPU support |
-+-----------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------+
-| `kornia.augmentation <https://kornia.readthedocs.io/en/latest/augmentation.html>`_| a module to perform data augmentation in the GPU |
-+-----------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------+
-| `kornia.color <https://kornia.readthedocs.io/en/latest/color.html>`_ | a set of routines to perform color space conversions |
-+-----------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------+
-| `kornia.contrib <https://kornia.readthedocs.io/en/latest/contrib.html>`_ | a compilation of user contrib and experimental operators |
-+-----------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------+
-| `kornia.feature <https://kornia.readthedocs.io/en/latest/feature.html>`_ | a module to perform feature detection |
-+-----------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------+
-| `kornia.filters <https://kornia.readthedocs.io/en/latest/filters.html>`_ | a module to perform image filtering and edge detection |
-+-----------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------+
-| `kornia.geometry <https://kornia.readthedocs.io/en/latest/geometry.html>`_ | a geometric computer vision library to perform image transformations, 3D linear algebra and conversions using different camera models |
-+-----------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------+
-| `kornia.losses <https://kornia.readthedocs.io/en/latest/losses.html>`_ | a stack of loss functions to solve different vision tasks |
-+-----------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------+
-| `kornia.morphology <https://kornia.readthedocs.io/en/latest/morphology.html>`_ | a module to perform morphological operations |
-+-----------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------+
-+-----------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------+
+This page has moved: the module overview and the accessible AI models section are now part of
+:doc:`introduction`.
diff --git a/docs/source/get-started/index.rst b/docs/source/get-started/index.rst
new file mode 100644
index 000000000..376537c2e
--- /dev/null
+++ b/docs/source/get-started/index.rst
@@ -0,0 +1,72 @@
+Learn
+=====
+
+.. meta::
+ :description: Learn Kornia: install the library, follow a quickstart application guide, learn the conventions every function follows, and see what makes the library different.
+
+New to Kornia? Three steps take you from zero to a working pipeline:
+
+.. grid:: 1
+ :gutter: 2
+ :class-container: kornia-steps
+
+ .. grid-item-card:: 1 Β· Install
+ :link: installation
+ :link-type: doc
+
+ ``pip install kornia`` β€” plus conda and from-source options, and how to check it worked.
+
+ .. grid-item-card:: 2 Β· QuickStart
+ :link: ../applications/image_augmentations
+ :link-type: doc
+
+ Pick the application closest to your task β€” augmentation, matching, stitching, registration,
+ detection, prompting or denoising β€” and adapt its pipeline.
+
+ .. grid-item-card:: 3 Β· Learn the conventions
+ :link: conventions
+ :link-type: doc
+
+ ``(B, C, H, W)`` floats in ``[0, 1]``, ``(x, y)`` points vs ``(h, w)`` sizes, degrees vs radians.
+ Nearly every subtle Kornia bug is a convention mismatch β€” read this before writing code.
+
+Looking for a specific function instead? The :doc:`API reference </api>` documents every module, and
+:doc:`What is Kornia? <introduction>` gives the one-page overview of the whole library.
+
+.. toctree::
+ :caption: Getting started
+ :hidden:
+
+ installation
+ introduction
+ conventions
+
+.. toctree::
+ :caption: Why Kornia?
+ :hidden:
+
+ gpu-acceleration
+ differentiability
+ onnx
+ edge
+ multi-framework-support
+ precision
+ Performance on Mac chips <performance>
+
+.. toctree::
+ :caption: Applications
+ :hidden:
+
+ ../applications/image_augmentations
+ ../applications/image_matching
+ ../applications/image_stitching
+ ../applications/image_registration
+ ../applications/face_detection
+ ../applications/visual_prompting
+ ../applications/image_denoising
+
+.. toctree::
+ :caption: Resources
+ :hidden:
+
+ Tutorials <https://kornia.github.io/tutorials/>
diff --git a/docs/source/get-started/installation.rst b/docs/source/get-started/installation.rst
index c6f70889a..7fdbd44ec 100644
--- a/docs/source/get-started/installation.rst
+++ b/docs/source/get-started/installation.rst
@@ -1,32 +1,55 @@
Installation
============
-To install *Kornia*, you can do it in two different ways: using the provided `PyPi
-<https://pypi.org/project/kornia/>`_ wheels or directly from source.
+.. meta::
+ :description: How to install Kornia with pip, conda or from source, and how to verify the installation. Kornia requires PyTorch 2.0 or newer and works on CPU, CUDA and Apple MPS devices.
-.. note::
- *Kornia only has as a dependency Pytorch.*
+*Kornia* is distributed as pure-Python wheels on `PyPI <https://pypi.org/project/kornia/>`_ and on
+`conda-forge <https://anaconda.org/conda-forge/kornia>`_. It requires
+`PyTorch <https://pytorch.org/get-started/locally/>`_ 2.0 or newer; the only other dependencies are
+``numpy``, ``packaging`` and `kornia-rs <https://github.com/kornia/kornia-rs>`_ (the Rust image I/O
+backend used by :mod:`kornia.io`). Install PyTorch first if you need a specific CUDA build.
-1. From pip:
+.. tab-set::
-.. code:: bash
+ .. tab-item:: pip
- pip install kornia
+ .. code-block:: bash
-2. From source:
+ pip install kornia
-.. code:: bash
+ .. tab-item:: conda
- python setup.py install
+ .. code-block:: bash
-3. From source using pip:
+ conda install -c conda-forge kornia
-.. code:: bash
+ .. tab-item:: From source
- pip install git+https://github.com/kornia/kornia
+ .. code-block:: bash
-Once you succeeded installing *Kornia* check you can import:
+ pip install git+https://github.com/kornia/kornia
-.. code:: bash
+ or, from a local clone, an editable install for development:
+
+ .. code-block:: bash
+
+ git clone https://github.com/kornia/kornia.git
+ cd kornia
+ pip install -e .
+
+Once the installation has finished, check that you can import the package:
+
+.. code-block:: bash
python -c "import kornia; print(kornia.__version__)"
+
+Pretrained models (RT-DETR, LoFTR, DISK, SAM, ...) download their checkpoints on first use, so no
+extra installation step is needed for them.
+
+Next steps
+----------
+
+- :doc:`introduction` -- what Kornia is and what each module contains.
+- :doc:`conventions` -- the tensor layout, coordinate and angle conventions to know before writing code.
+- :doc:`Applications </applications/intro>` -- end-to-end guides, or the :doc:`API reference </api>`.
diff --git a/docs/source/get-started/introduction.rst b/docs/source/get-started/introduction.rst
index 10f7473c4..6667df465 100644
--- a/docs/source/get-started/introduction.rst
+++ b/docs/source/get-started/introduction.rst
@@ -1,5 +1,8 @@
-What is Kornia library ?
-========================
+What is Kornia?
+===============
+
+.. meta::
+ :description: Kornia is a differentiable computer vision library built on PyTorch. Learn what the library is, how it bridges classical and deep computer vision, and what each of its modules provides.
Kornia is a differentiable library that allows classical computer vision to be integrated into deep learning models.
@@ -7,20 +10,76 @@ It consists of a set of routines and differentiable modules to solve generic com
At its core, the package uses PyTorch as its main backend both for efficiency and to take advantage of
the reverse-mode auto-differentiation to define and compute the gradient of complex functions.
-.. image:: https://raw.githubusercontent.com/kornia/kornia/main/docs/source/_static/img/hakuna_matata.gif
+.. image:: ../_static/img/hakuna_matata.gif
:align: center
+ :alt: Animated demo of Kornia image transformations
-The library is composed by a subset of packages containing operators that can be inserted
+The library is composed of a set of packages containing operators that can be inserted
within neural networks to train models to perform image transformations, epipolar geometry, depth estimation,
-and low level image processing such as filtering and edge detection that operate directly on tensors.
+and low-level image processing such as filtering and edge detection, all operating directly on tensors.
-Why Kornia ?
-------------
+Design principles
+-----------------
-With *Kornia* we fill the gap between classical and deep computer vision that implements
+With *Kornia* we fill the gap between classical and deep computer vision by implementing
standard and advanced vision algorithms for AI:
-1. **Computer Vision:** Kornia fills the gap between Classical and Deep computer Vision.
-2. **Differentiable:** We leverage the Computer Vision 2.0 paradigm.
-3. **Open Source:** Our libraries and initiatives are always according to the community needs.
-4. **PyTorch:** At our core we use PyTorch and its Autograd engine for its efficiency.
+1. **Computer vision:** Kornia bridges classical and deep computer vision.
+2. **Differentiable:** every operator supports autograd, so it can be used inside a training loop.
+3. **Open source:** our libraries and initiatives are driven by the needs of the community.
+4. **PyTorch:** at our core we use PyTorch and its autograd engine for efficiency and GPU support.
+
+Ready to try it? :doc:`Install Kornia <installation>` and run the examples on the :doc:`home page </index>`.
+
+What is inside
+--------------
+
+.. image:: https://github.com/kornia/data/raw/main/kornia_paper_mosaic.png
+ :align: center
+ :alt: Mosaic of Kornia operators applied to an image
+
+At a granular level, Kornia is a library that consists of the following components:
+
+.. list-table::
+ :header-rows: 1
+ :widths: 30 70
+
+ * - Component
+ - Description
+ * - :doc:`kornia </index>`
+ - a differentiable computer vision library like OpenCV, with strong GPU support
+ * - :doc:`kornia.augmentation </augmentation>`
+ - a module to perform data augmentation on the GPU, with transform tracking and inversion
+ * - :doc:`kornia.color </color>`
+ - a set of routines to perform color space conversions
+ * - :doc:`kornia.contrib </contrib>`
+ - a compilation of user-contributed and experimental operators
+ * - :doc:`kornia.enhance </enhance>`
+ - normalization, histogram equalization and intensity adjustments
+ * - :doc:`kornia.feature </feature>`
+ - local feature detection, description and matching
+ * - :doc:`kornia.filters </filters>`
+ - a module to perform image filtering and edge detection
+ * - :doc:`kornia.geometry </geometry>`
+ - a geometric computer vision library to perform image transformations, 3D linear algebra and conversions using different camera models
+ * - :doc:`kornia.io </io>`
+ - image loading and saving backed by ``kornia-rs``
+ * - :doc:`kornia.losses </losses>`
+ - a stack of loss functions to solve different vision tasks
+ * - :doc:`kornia.metrics </metrics>`
+ - metrics for classification, segmentation, detection, image quality and pose
+ * - :doc:`kornia.models </models>`
+ - pretrained model builders for detection, edge detection, segmentation and tracking
+ * - :doc:`kornia.morphology </morphology>`
+ - a module to perform morphological operations
+ * - :doc:`kornia.onnx </onnx>`
+ - ONNX loading, execution, composition and export
+
+Accessible AI models
+--------------------
+
+Beyond the classic operators, Kornia ships a curated selection of lightweight AI models, including YuNet, LoFTR,
+and SAM, optimized for performance and efficiency. These models offer efficient computations that do not require
+expensive GPUs, making cutting-edge AI accessible to everyone. They are documented under **Kornia Models** in the
+sidebar and on the :doc:`/models` page. We welcome the whole community of developers and researchers who are
+passionate about advancing computer vision: send us a pull request with your lightning-fast models!
diff --git a/docs/source/get-started/multi-framework-support.rst b/docs/source/get-started/multi-framework-support.rst
index 79035a222..d3f26c866 100644
--- a/docs/source/get-started/multi-framework-support.rst
+++ b/docs/source/get-started/multi-framework-support.rst
@@ -7,13 +7,18 @@
</a>
<br>
-Multi-Framework Support
-=======================
+Working with TensorFlow, JAX and NumPy
+======================================
-Kornia can now be used with `TensorFlow <https://www.tensorflow.org/>`_, `JAX <https://jax.readthedocs.io/en/latest/index.html>`_,
-and `Numpy <https://numpy.org/>`_ thanks to an integration with `Ivy <https://github.com/ivy-llc/ivy>`_.
+.. meta::
+ :description: Use Kornia from TensorFlow, JAX or NumPy: kornia.to_tensorflow(), kornia.to_jax() and kornia.to_numpy() transpile the library through Ivy, with examples and current limitations.
-This can be accomplished using the following functions, which are now part of the Kornia api:
+Kornia is a PyTorch library, but every function and module can also be called with `TensorFlow <https://www.tensorflow.org/>`_,
+`JAX <https://jax.readthedocs.io/en/latest/index.html>`_ or `NumPy <https://numpy.org/>`_ arrays: ``kornia.to_tensorflow()``,
+``kornia.to_jax()`` and ``kornia.to_numpy()`` return a transpiled copy of the library, powered by
+`Ivy <https://github.com/ivy-llc/ivy>`_.
+
+This can be accomplished using the following functions, which are now part of the Kornia API:
* :code:`kornia.to_tensorflow()`
@@ -37,7 +42,7 @@ So what's happening here? Let's break it down.
#. Transpiling kornia to TensorFlow
- This line lazily transpiles everything in the kornia api to TensorFlow, and creates a new module for this transpiled version of kornia.
+ This line lazily transpiles everything in the kornia API to TensorFlow, and creates a new module for this transpiled version of kornia.
Because the transpilation happens lazily, no function or class will be transpiled until it's actually called.
.. code-block:: python
diff --git a/docs/source/get-started/onnx.rst b/docs/source/get-started/onnx.rst
new file mode 100644
index 000000000..5a9f35cb3
--- /dev/null
+++ b/docs/source/get-started/onnx.rst
@@ -0,0 +1,162 @@
+ONNX support
+============
+
+.. meta::
+ :description: How to export Kornia operators and models to ONNX and chain them with ONNXSequential: installation, combining models, input/output mapping, export to a single file, and running on CUDA with ONNX Runtime execution providers.
+
+:class:`~kornia.onnx.sequential.ONNXSequential` combines several ONNX models into a single computational graph and
+runs it with ONNX Runtime. It is useful when you have pre-exported operators or models, from Kornia's
+``kornia/ONNX_models`` Hugging Face repository or your own, that should run one after another as a pipeline.
+
+- **Model chaining**: combine multiple ONNX models into one graph, with control over how the outputs of one model
+ feed the inputs of the next.
+- **Export**: save the combined model as a single ONNX file.
+- **PyTorch-like interface**: call the sequence directly, like an ``nn.Sequential``.
+- **Execution providers**: run on CPU, CUDA, TensorRT or OpenVINO through ONNX Runtime, with control over the
+ session options.
+
+Quickstart
+----------
+
+1. **Install ONNX and ONNX Runtime**
+
+ .. code-block:: bash
+
+ pip install onnx onnxruntime
+
+2. **Port your own kornia module**
+
+ Any kornia operator or ``nn.Sequential`` of operators is a regular ``nn.Module``, so
+ ``torch.onnx.export`` turns it into an ONNX file that :class:`~kornia.onnx.sequential.ONNXSequential`
+ can load, chain and re-export. Use the legacy exporter at opset 17 (``dynamo=False``) so the IR
+ version matches the pre-exported Hub operators:
+
+ .. code-block:: python
+
+ import torch
+ import kornia
+
+ torch.onnx.export(
+ kornia.color.RgbToGrayscale(),
+ torch.rand(1, 3, 256, 512),
+ "gray.onnx",
+ input_names=["input"],
+ output_names=["output"],
+ dynamic_axes={"input": {0: "B", 2: "H", 3: "W"}, "output": {0: "B", 2: "H", 3: "W"}},
+ opset_version=17,
+ dynamo=False,
+ )
+
+ The file plugs into a sequence like any other model: ``ONNXSequential("gray.onnx", ...)``.
+
+3. **Combine ONNX models**
+
+ Initialize :class:`~kornia.onnx.sequential.ONNXSequential` with ONNX models or file paths. The models are chained
+ and an optimized inference session is created.
+
+ .. code-block:: python
+
+ import numpy as np
+ from kornia.onnx import ONNXSequential
+
+ # Two operators from the kornia/ONNX_models Hugging Face repo
+ onnx_seq = ONNXSequential(
+ "hf://operators/kornia.color.gray.RgbToGrayscale",
+ "hf://operators/kornia.geometry.transform.affwarp.Resize_512x512"
+ )
+
+ input_data = np.random.randn(1, 3, 256, 512).astype(np.float32)
+ outputs = onnx_seq(input_data)
+ print(outputs)
+
+ .. note::
+ By default each ONNX model is assumed to have one input node named ``"input"`` and one output node named
+ ``"output"``. For other models, pass an ``io_maps`` argument.
+
+4. **Map inputs and outputs between models**
+
+ .. code-block:: python
+
+ io_maps = [("model1_output_0", "model2_input_0"), ("model1_output_1", "model2_input_1")]
+ onnx_seq = ONNXSequential("model1.onnx", "model2.onnx", io_maps=io_maps)
+
+5. **Export the combined model**
+
+ .. code-block:: python
+
+ onnx_seq.export("combined_model.onnx")
+
+6. **Pick an execution provider**
+
+ .. code-block:: python
+
+ onnx_seq = ONNXSequential(
+ "hf://operators/kornia.geometry.transform.flips.Hflip",
+ # a local model works too: "YOUR_OWN_MODEL.onnx", or a loaded onnx.ModelProto
+ "hf://models/kornia.models.detection.rtdetr_r18vd_640x640",
+ providers=['CUDAExecutionProvider']
+ )
+ outputs = onnx_seq(input_data)
+
+Running on CUDA
+---------------
+
+CUDA execution needs ``onnxruntime-gpu``; for other CUDA versions see
+https://github.com/microsoft/onnxruntime/issues/21769#issuecomment-2295342211. For example, to install
+``onnxruntime-gpu==1.19.2`` for CUDA 11.x:
+
+.. code-block:: console
+
+ pip install onnxruntime-gpu==1.19.2 --extra-index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/onnxruntime-cuda-11/pypi/simple/
+
+Then move a sequence between devices with ``as_cuda()`` / ``as_cpu()``:
+
+.. code-block:: python
+
+ import time
+
+ import kornia
+ from kornia.onnx import ONNXSequential
+
+ onnx_seq = ONNXSequential(
+ "hf://operators/kornia.geometry.transform.flips.Hflip",
+ "hf://models/kornia.models.detection.rtdetr_r18vd_640x640", # Or you may use "YOUR_OWN_MODEL.onnx"
+ )
+ inp = kornia.io.get_sample_images()[0].numpy()[None]
+
+ onnx_seq.as_cuda()
+ onnx_seq(inp) # GPU warm-up
+ start_time = time.time()
+ onnx_seq(inp)
+ print("--- GPU %s seconds ---" % (time.time() - start_time))
+
+ onnx_seq.as_cpu()
+ start_time = time.time()
+ onnx_seq(inp)
+ print("--- CPU %s seconds ---" % (time.time() - start_time))
+
+A typical result:
+
+.. code-block:: console
+
+ --- GPU 0.014804363250732422 seconds ---
+ --- CPU 0.17681646347045898 seconds ---
+
+Frequently asked questions
+--------------------------
+
+**Can I chain models from different sources?**
+Yes. Models can come from ONNX files, ``onnx.ModelProto`` objects or ``hf://`` references;
+:class:`~kornia.onnx.sequential.ONNXSequential` merges their graphs.
+
+**What if the input/output names of two models do not match?**
+Use the ``io_maps`` argument to say which output feeds which input.
+
+**Can I use custom ONNX Runtime session options?**
+Yes, pass your own session options to the ``create_session`` method.
+
+**Where are the pre-exported Kornia operators?**
+In the `kornia/ONNX_models <https://huggingface.co/kornia/ONNX_models>`_ Hugging Face repository; load them with
+``"hf://operators/<name>"`` and ``"hf://models/<name>"`` or with :class:`~kornia.onnx.utils.ONNXLoader`.
+
+See the :doc:`kornia.onnx </onnx>` API reference for the full class documentation.
diff --git a/docs/source/get-started/precision.rst b/docs/source/get-started/precision.rst
index 3cb4578a3..2ff317df9 100644
--- a/docs/source/get-started/precision.rst
+++ b/docs/source/get-started/precision.rst
@@ -1,5 +1,8 @@
-Half-Precision Support
-======================
+Float16 and bfloat16 support
+============================
+
+.. meta::
+ :description: Which Kornia modules support float16 and bfloat16 on CPU and CUDA, known limitations, and the latest half-precision test results.
This page documents which kornia modules support half-precision floating-point dtypes
(``torch.float16`` and ``torch.bfloat16``) and what limitations to expect.
diff --git a/docs/source/get-started/stability.rst b/docs/source/get-started/stability.rst
index b98c0eac3..50eba38df 100644
--- a/docs/source/get-started/stability.rst
+++ b/docs/source/get-started/stability.rst
@@ -1,6 +1,9 @@
API Stability Policy
====================
+.. meta::
+ :description: What Kornia users may rely on: stable, best-effort and experimental module tiers, the deprecation policy, and how breaking changes are announced.
+
Kornia is depended on by a large installed base (millions of downloads per
month) and, increasingly, by language models that carry a lagging snapshot of
the API in their weights. Both are punished by silent churn. This page states
diff --git a/docs/source/image.container.rst b/docs/source/image.container.rst
new file mode 100644
index 000000000..b0186a93b
--- /dev/null
+++ b/docs/source/image.container.rst
@@ -0,0 +1,24 @@
+Image container
+===============
+
+.. currentmodule:: kornia.image
+
+.. autoclass:: ImageSize
+ :members:
+ :undoc-members:
+
+.. autoclass:: PixelFormat
+ :members:
+ :undoc-members:
+
+.. autoclass:: ChannelsOrder
+ :members:
+ :undoc-members:
+
+.. autoclass:: ImageLayout
+ :members:
+ :undoc-members:
+
+.. autoclass:: Image
+ :members:
+ :undoc-members:
diff --git a/docs/source/image.conversion.rst b/docs/source/image.conversion.rst
new file mode 100644
index 000000000..0be9489be
--- /dev/null
+++ b/docs/source/image.conversion.rst
@@ -0,0 +1,10 @@
+Image conversion
+================
+
+.. currentmodule:: kornia.image
+
+.. autofunction:: tensor_to_image
+.. autofunction:: image_to_tensor
+.. autofunction:: image_list_to_tensor
+
+.. autoclass:: ImageToTensor
diff --git a/docs/source/image.drawing.rst b/docs/source/image.drawing.rst
new file mode 100644
index 000000000..36b8bad44
--- /dev/null
+++ b/docs/source/image.drawing.rst
@@ -0,0 +1,9 @@
+Drawing
+=======
+
+.. currentmodule:: kornia.image
+
+.. autofunction:: draw_line
+.. autofunction:: draw_rectangle
+.. autofunction:: draw_convex_polygon
+.. autofunction:: draw_point2d
diff --git a/docs/source/image.printing.rst b/docs/source/image.printing.rst
new file mode 100644
index 000000000..1a61c1285
--- /dev/null
+++ b/docs/source/image.printing.rst
@@ -0,0 +1,7 @@
+Image printing
+==============
+
+.. currentmodule:: kornia.image
+
+.. autofunction:: image_to_string
+.. autofunction:: print_image
diff --git a/docs/source/image.rst b/docs/source/image.rst
index 186de2bf5..7dce12cc2 100644
--- a/docs/source/image.rst
+++ b/docs/source/image.rst
@@ -2,58 +2,32 @@ kornia.image
============
.. meta::
- :name: description
- :content: "The kornia.image module offers a high-level API designed for processing images in computer vision tasks. It provides functionalities for handling image size, pixel formats, channel orders, and image layouts, streamlining the manipulation of images in deep learning workflows. With a user-friendly interface, this module simplifies image data preprocessing and handling for various computer vision and machine learning tasks."
-
-Module to provide a high level API to process images.
+ :description: The kornia.image module offers a high-level API designed for processing images in computer vision tasks. It provides functionalities for handling image size, pixel formats, channel orders, and image layouts, streamlining the manipulation of images in deep learning workflows. With a user-friendly interface, this module simplifies image data preprocessing and handling for various computer vision and machine learning tasks.
.. currentmodule:: kornia.image
-.. autoclass:: ImageSize
- :members:
- :undoc-members:
-
-.. autoclass:: PixelFormat
- :members:
- :undoc-members:
-
-.. autoclass:: ChannelsOrder
- :members:
- :undoc-members:
-
-.. autoclass:: ImageLayout
- :members:
- :undoc-members:
-
-.. autoclass:: Image
- :members:
- :undoc-members:
-
-Drawing
--------
-
-.. autofunction:: draw_line
-.. autofunction:: draw_rectangle
-.. autofunction:: draw_convex_polygon
-.. autofunction:: draw_point2d
-
-Image Conversion
-----------------
-
-.. autofunction:: tensor_to_image
-.. autofunction:: image_to_tensor
-.. autofunction:: image_list_to_tensor
-.. autoclass:: ImageToTensor
-
-Image Printing
---------------
-
-.. autofunction:: image_to_string
-.. autofunction:: print_image
-
-Utilities
----------
-
-.. autofunction:: make_grid
-.. autofunction:: perform_keep_shape_image
-.. autofunction:: perform_keep_shape_video
+A high-level API to describe and handle images: a typed image container, drawing primitives, conversions
+between tensors and NumPy arrays, and terminal rendering.
+
+.. list-table::
+ :widths: 30 70
+
+ * - :doc:`image.container`
+ - :class:`Image`, :class:`ImageSize`, :class:`PixelFormat`, :class:`ChannelsOrder` and :class:`ImageLayout`.
+ * - :doc:`image.drawing`
+ - Draw lines, rectangles, convex polygons and points on image tensors.
+ * - :doc:`image.conversion`
+ - Convert between NumPy ``(H, W, C)`` arrays and ``(C, H, W)`` tensors.
+ * - :doc:`image.printing`
+ - Render an image tensor as text in a terminal.
+ * - :doc:`image.utilities`
+ - Grids and shape-preserving decorators.
+
+.. toctree::
+ :hidden:
+
+ image container <image.container>
+ drawing <image.drawing>
+ conversion <image.conversion>
+ printing <image.printing>
+ utilities <image.utilities>
diff --git a/docs/source/image.utilities.rst b/docs/source/image.utilities.rst
new file mode 100644
index 000000000..ad82c070a
--- /dev/null
+++ b/docs/source/image.utilities.rst
@@ -0,0 +1,8 @@
+Utilities
+=========
+
+.. currentmodule:: kornia.image
+
+.. autofunction:: make_grid
+.. autofunction:: perform_keep_shape_image
+.. autofunction:: perform_keep_shape_video
diff --git a/docs/source/index.rst b/docs/source/index.rst
index a53533a00..e047b64f8 100644
--- a/docs/source/index.rst
+++ b/docs/source/index.rst
@@ -1,188 +1,316 @@
+.. meta::
+ :description: Kornia is the open-source geometric computer vision library for Spatial AI and robotics, built on PyTorch: batched, GPU-ready and differentiable image transforms, filters, camera geometry, data augmentation and curated models for detection, segmentation and image matching.
-.. image:: https://github.com/kornia/data/raw/main/kornia_banner_pixie.png
- :align: center
+.. raw:: html
-State-of-the-art and curated Computer Vision algorithms for AI.
+ <style>
+ /* Landing page only. conf.py already gives this page no right-rail items, but pydata still
+ renders the (empty) rail column and its header toggle; hide both. */
+ #pst-secondary-sidebar, dialog#pst-secondary-sidebar-modal,
+ button.sidebar-toggle.secondary-toggle { display: none !important; }
+ /* Room for the two-column hero; the theme caps articles at 960px. */
+ .bd-main .bd-content .bd-article-container { max-width: 1240px; }
+ /* Hairline separator above each section, matching the link board's line. */
+ .bd-article section {
+ border-top: 1px solid var(--pst-color-border);
+ margin-top: 3rem;
+ padding-top: 1.75rem;
+ }
+ </style>
-Kornia AI is on the mission to leverage and democratize the next generation of Computer Vision tools and Deep Learning libraries
-within the context of an Open Source community.
+.. grid:: 1 1 1 2
+ :gutter: 4
+ :class-container: kornia-hero
+ :padding: 0
-.. code:: python
+ .. grid-item::
+ :columns: 12 12 12 5
+ :class: kornia-hero__copy
- >>> import kornia.geometry as K
- >>> registrator = K.ImageRegistrator('similarity')
- >>> model = registrator.register(img1, img2)
+ .. raw:: html
-Ready to use with state-of-the art Deep Learning models:
+ <div class="kornia-pip" title="Install from PyPI">
+ <span class="kornia-pip__prompt" aria-hidden="true">&gt;_</span>
+ <code class="kornia-pip__cmd">pip install kornia</code>
+ <button type="button" class="kornia-pip__copy" data-copy="pip install kornia"
+ aria-label="Copy install command"><i class="fa-regular fa-copy"></i></button>
+ </div>
+ <h1 class="kornia-hero__title">Computer vision for<br>
+ <span class="kornia-accent">robotics &amp; Spatial AI.</span></h1>
+
+ .. container:: kornia-hero-actions
+
+ .. button-link:: get-started/installation.html
+ :color: primary
+
+ Get started
+
+ .. button-link:: api.html
+ :color: secondary
+ :outline:
-DexiNed edge detection model.
+ API reference
-.. code-block:: python
+ .. raw:: html
- import kornia
- from kornia.contrib import EdgeDetectorBuilder
+ <p class="kornia-hero__links">
+ <a href="https://github.com/kornia/kornia-rs"><i class="fa-solid fa-microchip"></i> Also available: kornia-rs for edge devices</a>
+ </p>
- image = kornia.io.get_sample_images()[0][None]
- model = EdgeDetectorBuilder.build()
- model.save(image)
+ .. grid-item::
+ :columns: 12 12 12 7
+ :class: kornia-hero__demo
+
+ .. raw:: html
+
+ <p class="kornia-hero__eyebrow">Why Kornia?</p>
+
+ .. tab-set::
+ :class: kornia-why-tabs
+
+ .. tab-item:: :octicon:`zap` GPU-accelerated
+
+ .. Bar chart drawn at build time by docs/generate_benchmarks.py from benchmarks/results/,
+ so the throughput figures track the committed run.
+
+ .. raw:: html
+ :file: _generated/hero-benchmark.html
+
+ .. code-block:: python
+
+ edges = kornia.filters.sobel(images.cuda()) # whole batch, one call
+
+ **Same code, any device.** Operators run wherever the tensor lives β€” no flags, no per-image loops.
+
+ :doc:`See details <get-started/gpu-acceleration>` :octicon:`arrow-right`
+
+ .. tab-item:: :octicon:`git-compare` Differentiable
+
+ .. raw:: html
+
+ <div class="kornia-tab-visual kornia-tab-visual--image">
+ <img src="_static/img/registration.gif" alt="Two images progressively aligned by gradient descent">
+ <div class="kornia-tab-visual__aside">
+ <p class="kornia-tab-visual__eyebrow">gradient descent on a homography</p>
+ <code>warped = warp_perspective(src, H, size)</code>
+ <code>loss = (warped - dst).abs().mean()</code>
+ <code>loss.backward(); optimizer.step()</code>
+ <p class="kornia-tab-visual__eyebrow">repeat until aligned</p>
+ </div>
+ </div>
+
+ **Registration by pure gradient descent.** Gradients flow through every operator, so vision ops
+ can sit inside your model or your loss β€” no labels, no training data.
+
+ :doc:`See details <get-started/differentiability>` :octicon:`arrow-right`
+
+ .. tab-item:: :octicon:`package` Production-ready
+
+ .. raw:: html
+
+ <div class="kornia-tab-visual">
+ <svg class="kornia-illo" viewBox="0 0 640 220" role="img"
+ aria-label="A kornia module is exported to ONNX, chained with Hub-hosted operators, and runs on ONNX Runtime">
+ <defs>
+ <marker id="kornia-illo-arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="8" markerHeight="8" orient="auto">
+ <path d="M0,0 L10,5 L0,10 z" class="illo-arrowhead"/>
+ </marker>
+ </defs>
+ <text x="24" y="36" class="illo-title">PyTorch module β†’ ONNX graph β†’ one deployable file</text>
+ <rect x="24" y="66" width="160" height="72" rx="10" class="illo-box"/>
+ <text x="104" y="96" text-anchor="middle" class="illo-value">kornia module</text>
+ <text x="104" y="120" text-anchor="middle" class="illo-mono">RgbToGrayscale()</text>
+ <path d="M188,102 L226,102" class="illo-line" marker-end="url(#kornia-illo-arrow)"/>
+ <rect x="232" y="66" width="140" height="72" rx="10" class="illo-box"/>
+ <text x="302" y="96" text-anchor="middle" class="illo-value">torch.onnx</text>
+ <text x="302" y="120" text-anchor="middle" class="illo-mono">gray.onnx</text>
+ <path d="M376,102 L414,102" class="illo-line" marker-end="url(#kornia-illo-arrow)"/>
+ <rect x="420" y="66" width="196" height="72" rx="10" class="illo-primary"/>
+ <text x="518" y="96" text-anchor="middle" class="illo-value illo-on-primary">ONNXSequential</text>
+ <text x="518" y="120" text-anchor="middle" class="illo-mono illo-on-primary">+ hf://…/Resize_512x512</text>
+ <text x="24" y="182" class="illo-label">runs on</text>
+ <rect x="90" y="164" width="120" height="28" rx="14" class="illo-pill"/>
+ <text x="150" y="183" text-anchor="middle" class="illo-pill-text">ONNX Runtime</text>
+ <rect x="220" y="164" width="60" height="28" rx="14" class="illo-pill"/>
+ <text x="250" y="183" text-anchor="middle" class="illo-pill-text">CPU</text>
+ <rect x="290" y="164" width="72" height="28" rx="14" class="illo-pill"/>
+ <text x="326" y="183" text-anchor="middle" class="illo-pill-text">CUDA</text>
+ <rect x="372" y="164" width="140" height="28" rx="14" class="illo-pill"/>
+ <text x="442" y="183" text-anchor="middle" class="illo-pill-text">no Python needed</text>
+ </svg>
+ </div>
-RTDETRDetector for object detection.
+ .. code-block:: python
-.. code-block:: python
+ torch.onnx.export(kornia.color.RgbToGrayscale(), x, "gray.onnx", dynamo=False)
- import kornia
- from kornia.contrib import RTDETRDetectorBuilder
+ **Export once, run anywhere ONNX Runtime does** β€” chained with Hub-hosted operators into one graph.
- image = kornia.io.get_sample_images()[0][None]
- model = RTDETRDetectorBuilder.build()
- model.save(image)
+ :doc:`See details <get-started/onnx>` :octicon:`arrow-right`
-BoxMotTracker for object tracking.
+ .. tab-item:: :octicon:`share-android` Multi-framework
-.. code-block:: python
+ .. raw:: html
+
+ <div class="kornia-tab-visual">
+ <svg class="kornia-illo" viewBox="0 0 640 220" role="img"
+ aria-label="kornia at the centre, connected to PyTorch natively and to TensorFlow, JAX and NumPy through Ivy">
+ <path d="M320,110 L150,58" class="illo-line"/>
+ <path d="M320,110 L490,58" class="illo-line"/>
+ <path d="M320,110 L150,162" class="illo-line"/>
+ <path d="M320,110 L490,162" class="illo-line"/>
+ <rect x="80" y="40" width="140" height="36" rx="18" class="illo-box"/>
+ <text x="150" y="64" text-anchor="middle" class="illo-value">PyTorch</text>
+ <text x="150" y="98" text-anchor="middle" class="illo-note">native</text>
+ <rect x="420" y="40" width="140" height="36" rx="18" class="illo-box"/>
+ <text x="490" y="64" text-anchor="middle" class="illo-value">TensorFlow</text>
+ <text x="490" y="98" text-anchor="middle" class="illo-mono">to_tensorflow()</text>
+ <rect x="80" y="144" width="140" height="36" rx="18" class="illo-box"/>
+ <text x="150" y="168" text-anchor="middle" class="illo-value">JAX</text>
+ <text x="150" y="202" text-anchor="middle" class="illo-mono">to_jax()</text>
+ <rect x="420" y="144" width="140" height="36" rx="18" class="illo-box"/>
+ <text x="490" y="168" text-anchor="middle" class="illo-value">NumPy</text>
+ <text x="490" y="202" text-anchor="middle" class="illo-mono">to_numpy()</text>
+ <circle cx="320" cy="110" r="46" class="illo-primary"/>
+ <text x="320" y="116" text-anchor="middle" class="illo-value illo-on-primary">kornia</text>
+ </svg>
+ </div>
+
+ .. code-block:: python
+
+ tf_kornia = kornia.to_tensorflow() # also to_jax(), to_numpy()
+
+ **One API, four frameworks.** PyTorch natively; TensorFlow, JAX and NumPy through Ivy.
+
+ :doc:`See details <get-started/multi-framework-support>` :octicon:`arrow-right`
- import kornia
- from kornia.contrib import BoxMotTracker
+.. raw:: html
- image = kornia.io.get_sample_images()[0][None]
- model = BoxMotTracker()
- for i in range(4):
- model.update(image)
- model.save(image)
+ <p class="kornia-sponsor-notice">Considering sponsoring? β€”
+ <a href="community/sponsor.html">Inquire now</a></p>
-Vision Transformer for image classification.
+Features
+--------
-.. code:: python
+.. rst-class:: kornia-section-lead
- >>> import torch.nn as nn
- >>> from kornia.models.vit import VisionTransformer
- >>> classifier = nn.Sequential(
- ... VisionTransformer(image_size=224, patch_size=16),
- ... nn.Linear(768, 1000), # Example: 768 is the default hidden_dim, 1000 is num_classes
- ... )
- >>> logits = classifier(img) # BxN
- >>> scores = logits.argmax(-1) # B
+|count-operators-floor|\ + differentiable operators β€” functions and ``nn.Module`` layers, batched and
+device-agnostic β€” across geometry, feature matching, filtering, color, augmentation, losses and pretrained
+models. Six places to start below; the full map is the :doc:`API reference <api>`.
-Multi-framework support
------------------------
+.. grid:: 1 2 2 3
+ :gutter: 3
+ :class-container: kornia-cards kornia-gallery
-You can now use Kornia with `NumPy <https://numpy.org/>`_, `TensorFlow <https://www.tensorflow.org/>`_, and `JAX <https://jax.readthedocs.io/en/latest/index.html>`_.
+ .. grid-item-card:: Warp, register, reconstruct
+ :img-top: _static/img/warp_affine.png
+ :link: geometry
+ :link-type: doc
-.. code:: python
+ Cameras, homographies, Lie groups, RANSAC, depth-to-3D β€” every transform differentiable, so a
+ pose is something you optimise.
- >>> import kornia
- >>> tf_kornia = kornia.to_tensorflow()
+ +++
+ |count-geometry| functions Β· ``kornia.geometry`` :octicon:`arrow-right`
-.. raw:: html
+ .. grid-item-card:: Match images
+ :img-top: https://raw.githubusercontent.com/kornia/data/main/matching/matching_loftr.jpg
+ :link: feature
+ :link-type: doc
- <p align="center">
- Powered by
- <a href="https://github.com/ivy-llc/ivy" target="_blank">
- <div class="dark-light" style="display: block;" align="center">
- <img class="dark-light" width="15%" src="https://raw.githubusercontent.com/ivy-llc/assets/refs/heads/main/assets/logos/ivy-long.svg"/>
- </div>
- </a>
- </p>
+ Detect with KeyNet, DISK or ALIKED, match with LightGlue or LoFTR β€” classical SIFT and HardNet are
+ there too.
-Join the community
-------------------
+ +++
+ |count-feature| detectors & matchers Β· ``kornia.feature`` :octicon:`arrow-right`
-- Join our social network communities with 1.8k+ members:
- - `Twitter <https://twitter.com/kornia_foss>`_: we share recent research and news with our community.
- - `Discord <https://discord.gg/HfnywwpBnD>`_: talk with people who use and develop kornia.
-- Subscribe to our `YouTube channel <https://www.youtube.com/channel/UCI1SE1Ij2Fast5BSKxoa7Ag>`_ to get the latest video demos.
+ .. grid-item-card:: Filter and detect edges
+ :img-top: _static/img/canny.png
+ :link: filters
+ :link-type: doc
-----
+ Canny, Sobel, Gaussian, bilateral and morphology, batched and differentiable β€” usable as a layer
+ or inside a loss.
-.. toctree::
- :caption: GET STARTED
- :hidden:
+ +++
+ |count-image-processing| operators Β· ``kornia.filters`` :octicon:`arrow-right`
- get-started/introduction
- get-started/highlights
- get-started/conventions
- get-started/stability
- get-started/performance
- get-started/installation
- get-started/precision
- get-started/about
- Tutorials <https://kornia.github.io/tutorials/>
- get-started/multi-framework-support
- OpenCV AI Kit <https://docs.luxonis.com/en/latest/pages/tutorials/creating-custom-nn-models/#kornia>
- get-started/governance
+ .. grid-item-card:: Augment everything
+ :img-top: _static/img/AugmentationSequential.png
+ :link: augmentation
+ :link-type: doc
-.. toctree::
- :caption: API REFERENCE
- :maxdepth: 2
- :hidden:
+ One sampled transform applied to image, mask, boxes and keypoints alike β€” on the GPU, in 2D or 3D.
- augmentation
- color
- contrib
- core
- enhance
- feature
- filters
- geometry
- sensors
- io
- image
- losses
- models
- metrics
- morphology
- onnx
- tracking
+ +++
+ |count-augmentation| transforms Β· ``kornia.augmentation`` :octicon:`arrow-right`
-.. toctree::
- :caption: KORNIA APPLICATIONS
- :hidden:
+ .. grid-item-card:: Detect and segment with pretrained models
+ :img-top: _static/img/face_detection.png
+ :link: models/index
+ :link-type: doc
- applications/intro
- applications/visual_prompting
- applications/face_detection
- applications/image_augmentations
- applications/image_matching
- applications/image_stitching
- applications/image_registration
- applications/image_denoising
+ YuNet faces, RT-DETR objects, SAM masks, DexiNed edges β€” one line to build, weights on first use.
-.. toctree::
- :caption: KORNIA MODELS
- :hidden:
+ +++
+ |count-models| model families Β· Model zoo :octicon:`arrow-right`
- models/efficient_vit
- models/rt_detr
- models/segment_anything
- models/mobile_sam
- models/yunet
- models/vit
- models/vit_mobile
- models/tiny_vit
- models/loftr
- models/defmo
- models/hardnet
- models/affnet
- models/sold2
- models/dexined
+ .. grid-item-card:: Recolor and enhance
+ :img-top: _static/img/equalize_clahe.png
+ :link: enhance
+ :link-type: doc
-.. toctree::
- :caption: SUPPORT
- :hidden:
+ Lab, HSV, YUV and color maps; CLAHE, histogram equalisation, gamma and contrast β€” all trainable.
+
+ +++
+ ``kornia.color`` Β· ``kornia.enhance`` :octicon:`arrow-right`
+
+.. rst-class:: kornia-learn-more
+
+Prefer to learn by example? :doc:`Image matching <applications/image_matching>`,
+:doc:`registration <applications/image_registration>`, :doc:`stitching <applications/image_stitching>`,
+:doc:`denoising <applications/image_denoising>`, :doc:`face detection <applications/face_detection>` and
+:doc:`visual prompting <applications/visual_prompting>` each walk through one task end to end β€” and
+:doc:`Conventions & pitfalls <get-started/conventions>` is the one page to read before writing code.
+
+.. raw:: html
- Issue tracker <https://github.com/kornia/kornia/issues>
- Discord community <https://discord.gg/HfnywwpBnD>
- LibreCV community <https://librecv.org>
- Twitter @kornia_foss <https://twitter.com/kornia_foss>
- community/chinese
- Kornia Youtube <https://www.youtube.com/channel/UCI1SE1Ij2Fast5BSKxoa7Ag>
- Kornia LinkedIn <https://www.linkedin.com/company/kornia/>
- Kornia AI <https://kornia.org>
+ <div class="kornia-linkboard">
+ <div>
+ <p class="kornia-linkboard__title">Docs</p>
+ <a href="applications/image_augmentations.html">Quick Start</a>
+ <a href="https://kornia.github.io/tutorials/">Tutorial</a>
+ <a href="api.html">API</a>
+ </div>
+ <div>
+ <p class="kornia-linkboard__title">Support</p>
+ <a href="community/sponsor.html">Sponsor</a>
+ </div>
+ <div>
+ <p class="kornia-linkboard__title">About</p>
+ <a href="get-started/governance.html">Team</a>
+ <a href="community/community.html">Community Guide</a>
+ <a href="community/adoption.html">Adoption</a>
+ <a href="https://github.com/kornia/kornia/blob/main/CODE_OF_CONDUCT.md">Conduct</a>
+ </div>
+ <div>
+ <p class="kornia-linkboard__title">Official Links</p>
+ <a href="https://twitter.com/kornia_foss">Twitter</a>
+ <a href="https://www.linkedin.com/company/kornia/">LinkedIn</a>
+ <span class="kornia-linkboard__soon">Newsletter <em>(under construction)</em></span>
+ </div>
+ <div>
+ <p class="kornia-linkboard__title">Official libs</p>
+ <a href="https://github.com/kornia/kornia">kornia</a>
+ <a href="https://github.com/kornia/kornia-rs">kornia-rs</a>
+ </div>
+ </div>
.. toctree::
- :caption: COMMUNITY
:hidden:
- community/contribute
- community/faqs
- community/bibliography
+ Learn <get-started/index>
+ API <api>
+ Models <models/index>
+ About <about>
+ Support <community/index>
diff --git a/docs/source/io.rst b/docs/source/io.rst
index 3c40c8d17..ce1f4734b 100644
--- a/docs/source/io.rst
+++ b/docs/source/io.rst
@@ -2,45 +2,45 @@ kornia.io
=========
.. meta::
- :name: description
- :content: "The Kornia.io package provides utilities to load and save image data efficiently. It integrates with `kornia_rs`, a low-level Rust implementation for computer vision, and supports the DLPack protocol to reduce memory footprint. This package is designed for Linux platforms and requires PyTorch 1.10.0 or higher."
+ :description: The kornia.io package loads and saves images directly as PyTorch tensors. It is backed by kornia-rs, a low-level Rust computer vision library, and uses the DLPack protocol to decode images with a minimal memory footprint on Linux, macOS and Windows.
.. currentmodule:: kornia.io
-Package to load and save image data.
+Package to load and save image data directly as tensors.
-The package internally implements `kornia_rs <https://github.com/kornia/kornia-rs>`_ which contains a low level implementation
-for Computer Vision in the `Rust <https://www.rust-lang.org/>`_ language. In addition, we implement the `DLPack <https://github.com/dmlc/dlpack>`_ protocol
-natively in Rust to reduce the memory footprint during the decoding and types conversion.
-
-.. tip::
- You need to ``pip install kornia_rs`` to use this package. For now we only support Linux platforms.
- Contact us or sponsor the project for more support (mac, win, rust, c++, video and camera). See:
- `https://opencollective.com/kornia <https://opencollective.com/kornia>`_
-
-.. note::
- The package needs at least PyTorch 1.10.0 installed.
+The package is backed by `kornia-rs <https://github.com/kornia/kornia-rs>`_, a low-level computer vision
+library written in `Rust <https://www.rust-lang.org/>`_ that is installed automatically as a dependency of
+Kornia (wheels are available for Linux, macOS and Windows). Decoded images are handed to PyTorch through the
+`DLPack <https://github.com/dmlc/dlpack>`_ protocol, which avoids extra copies and keeps the memory footprint low.
.. code-block:: python
+ import torch
import kornia as K
from kornia.io import ImageLoadType
- from kornia.core import Tensor
- img: Tensor = K.io.load_image(file_path, ImageLoadType.UNCHANGED, device="cuda")
- # will load CxHxW / in the original format in "cuda"
+ file_path = "image.jpg"
+
+ img = K.io.load_image(file_path, ImageLoadType.UNCHANGED, device="cuda")
+ # (C, H, W) in the file's original dtype and channel count, on "cuda"
- img: Tensor = K.io.load_image(file_path, ImageLoadType.RGB8, device="cpu")
- # will load 3xHxW / in torch.uint in range [0,255] in "cpu"
+ img = K.io.load_image(file_path, ImageLoadType.RGB8, device="cpu")
+ # (3, H, W) torch.uint8 in [0, 255], on "cpu"
- img: Tensor = K.io.load_image(file_path, ImageLoadType.GRAY8, device="cuda")
- # will load 1xHxW / in torch.uint8 in range [0,255] in "cuda"
+ img = K.io.load_image(file_path, ImageLoadType.GRAY8, device="cuda")
+ # (1, H, W) torch.uint8 in [0, 255], on "cuda"
- img: Tensor = K.io.load_image(file_path, ImageLoadType.GRAY32, device="cpu")
- # will load 1xHxW / in torch.float32 in range [0,1] in "cpu"
+ img = K.io.load_image(file_path, ImageLoadType.GRAY32, device="cpu")
+ # (1, H, W) torch.float32 in [0, 1], on "cpu"
- img: Tensor = K.io.load_image(file_path, ImageLoadType.RGB32, device="cuda")
- # will load 3xHxW / in torch.float32 in range [0,1] in "cuda"
+ img = K.io.load_image(file_path, ImageLoadType.RGB32, device="cuda")
+ # (3, H, W) torch.float32 in [0, 1], on "cuda"
+
+ K.io.write_image("copy.jpg", (img * 255).to(torch.uint8).cpu()) # expects (3, H, W) uint8
+
+.. tip::
+ Most Kornia operators expect a batched ``(B, C, H, W)`` float tensor in ``[0, 1]``; load with
+ ``ImageLoadType.RGB32`` and add the batch dimension with ``img[None]``.
.. autofunction:: load_image
.. autofunction:: write_image
diff --git a/docs/source/losses.distributions.rst b/docs/source/losses.distributions.rst
new file mode 100644
index 000000000..e601e6c50
--- /dev/null
+++ b/docs/source/losses.distributions.rst
@@ -0,0 +1,7 @@
+Distributions
+=============
+
+.. currentmodule:: kornia.losses
+
+.. autofunction:: js_div_loss_2d
+.. autofunction:: kl_div_loss_2d
diff --git a/docs/source/losses.morphology.rst b/docs/source/losses.morphology.rst
new file mode 100644
index 000000000..39ef8cf99
--- /dev/null
+++ b/docs/source/losses.morphology.rst
@@ -0,0 +1,7 @@
+Morphology
+==========
+
+.. currentmodule:: kornia.losses
+
+.. autoclass:: HausdorffERLoss
+.. autoclass:: HausdorffERLoss3D
diff --git a/docs/source/losses.reconstruction.rst b/docs/source/losses.reconstruction.rst
new file mode 100644
index 000000000..16e68f2b5
--- /dev/null
+++ b/docs/source/losses.reconstruction.rst
@@ -0,0 +1,31 @@
+Reconstruction
+==============
+
+.. currentmodule:: kornia.losses
+
+Functions
+---------
+
+.. autofunction:: ssim_loss
+.. autofunction:: ssim3d_loss
+.. autofunction:: psnr_loss
+.. autofunction:: total_variation
+.. autofunction:: inverse_depth_smoothness_loss
+.. autofunction:: charbonnier_loss
+.. autofunction:: welsch_loss
+.. autofunction:: cauchy_loss
+.. autofunction:: geman_mcclure_loss
+
+Modules
+-------
+
+.. autoclass:: SSIMLoss
+.. autoclass:: SSIM3DLoss
+.. autoclass:: MS_SSIMLoss
+.. autoclass:: TotalVariation
+.. autoclass:: PSNRLoss
+.. autoclass:: InverseDepthSmoothnessLoss
+.. autoclass:: CharbonnierLoss
+.. autoclass:: WelschLoss
+.. autoclass:: CauchyLoss
+.. autoclass:: GemanMcclureLoss
diff --git a/docs/source/losses.rst b/docs/source/losses.rst
index 03b9c0737..6c04c1114 100644
--- a/docs/source/losses.rst
+++ b/docs/source/losses.rst
@@ -2,61 +2,28 @@ kornia.losses
=============
.. meta::
- :name: description
- :content: "The kornia.losses module offers a comprehensive collection of loss functions for computer vision tasks, including image reconstruction, semantic segmentation, distribution-based losses, and morphological losses. With a wide range of loss types such as SSIM, PSNR, focal loss, and dice loss, this module enables efficient optimization for deep learning models across various domains, enhancing training for tasks like image restoration, segmentation, and object detection."
+ :description: The kornia.losses module offers a comprehensive collection of loss functions for computer vision tasks, including image reconstruction, semantic segmentation, distribution-based losses, and morphological losses. With a wide range of loss types such as SSIM, PSNR, focal loss, and dice loss, this module enables efficient optimization for deep learning models across various domains, enhancing training for tasks like image restoration, segmentation, and object detection.
.. currentmodule:: kornia.losses
-Reconstruction
---------------
+Loss functions for training vision models. Each functional loss has an ``nn.Module`` counterpart.
-.. autofunction:: ssim_loss
-.. autofunction:: ssim3d_loss
-.. autofunction:: psnr_loss
-.. autofunction:: total_variation
-.. autofunction:: inverse_depth_smoothness_loss
-.. autofunction:: charbonnier_loss
-.. autofunction:: welsch_loss
-.. autofunction:: cauchy_loss
-.. autofunction:: geman_mcclure_loss
+.. list-table::
+ :widths: 30 70
-.. autoclass:: SSIMLoss
-.. autoclass:: SSIM3DLoss
-.. autoclass:: MS_SSIMLoss
-.. autoclass:: TotalVariation
-.. autoclass:: PSNRLoss
-.. autoclass:: InverseDepthSmoothnessLoss
-.. autoclass:: CharbonnierLoss
-.. autoclass:: WelschLoss
-.. autoclass:: CauchyLoss
-.. autoclass:: GemanMcclureLoss
+ * - :doc:`losses.reconstruction`
+ - SSIM, MS-SSIM, PSNR, total variation, inverse-depth smoothness and robust losses (Charbonnier, Welsch, Cauchy, Geman-McClure).
+ * - :doc:`losses.segmentation`
+ - Focal, dice, Tversky and Lovasz losses.
+ * - :doc:`losses.distributions`
+ - Jensen-Shannon and Kullback-Leibler divergences between 2D distributions.
+ * - :doc:`losses.morphology`
+ - Hausdorff distance losses in 2D and 3D.
-Semantic Segmentation
----------------------
+.. toctree::
+ :hidden:
-.. autofunction:: kornia.losses.one_hot
-.. autofunction:: binary_focal_loss_with_logits
-.. autofunction:: focal_loss
-.. autofunction:: dice_loss
-.. autofunction:: tversky_loss
-.. autofunction:: lovasz_hinge_loss
-.. autofunction:: lovasz_softmax_loss
-
-.. autoclass:: BinaryFocalLossWithLogits
-.. autoclass:: DiceLoss
-.. autoclass:: TverskyLoss
-.. autoclass:: FocalLoss
-.. autoclass:: LovaszHingeLoss
-.. autoclass:: LovaszSoftmaxLoss
-
-Distributions
--------------
-
-.. autofunction:: js_div_loss_2d
-.. autofunction:: kl_div_loss_2d
-
-Morphology
-----------
-
-.. autoclass:: HausdorffERLoss
-.. autoclass:: HausdorffERLoss3D
+ reconstruction <losses.reconstruction>
+ segmentation <losses.segmentation>
+ distributions <losses.distributions>
+ morphology <losses.morphology>
diff --git a/docs/source/losses.segmentation.rst b/docs/source/losses.segmentation.rst
new file mode 100644
index 000000000..4f0c670da
--- /dev/null
+++ b/docs/source/losses.segmentation.rst
@@ -0,0 +1,25 @@
+Semantic segmentation
+=====================
+
+.. currentmodule:: kornia.losses
+
+Functions
+---------
+
+.. autofunction:: one_hot
+.. autofunction:: binary_focal_loss_with_logits
+.. autofunction:: focal_loss
+.. autofunction:: dice_loss
+.. autofunction:: tversky_loss
+.. autofunction:: lovasz_hinge_loss
+.. autofunction:: lovasz_softmax_loss
+
+Modules
+-------
+
+.. autoclass:: BinaryFocalLossWithLogits
+.. autoclass:: DiceLoss
+.. autoclass:: TverskyLoss
+.. autoclass:: FocalLoss
+.. autoclass:: LovaszHingeLoss
+.. autoclass:: LovaszSoftmaxLoss
diff --git a/docs/source/metrics.classification.rst b/docs/source/metrics.classification.rst
new file mode 100644
index 000000000..598e6234f
--- /dev/null
+++ b/docs/source/metrics.classification.rst
@@ -0,0 +1,6 @@
+Classification
+==============
+
+.. currentmodule:: kornia.metrics
+
+.. autofunction:: accuracy
diff --git a/docs/source/metrics.detection.rst b/docs/source/metrics.detection.rst
new file mode 100644
index 000000000..887fa69f5
--- /dev/null
+++ b/docs/source/metrics.detection.rst
@@ -0,0 +1,7 @@
+Detection
+=========
+
+.. currentmodule:: kornia.metrics
+
+.. autofunction:: mean_average_precision
+.. autofunction:: mean_iou_bbox
diff --git a/docs/source/metrics.image_quality.rst b/docs/source/metrics.image_quality.rst
new file mode 100644
index 000000000..1df8461e9
--- /dev/null
+++ b/docs/source/metrics.image_quality.rst
@@ -0,0 +1,11 @@
+Image quality
+=============
+
+.. currentmodule:: kornia.metrics
+
+.. autofunction:: psnr
+.. autofunction:: ssim
+.. autofunction:: ssim3d
+
+.. autoclass:: SSIM
+.. autoclass:: SSIM3D
diff --git a/docs/source/metrics.monitoring.rst b/docs/source/metrics.monitoring.rst
new file mode 100644
index 000000000..702e51493
--- /dev/null
+++ b/docs/source/metrics.monitoring.rst
@@ -0,0 +1,6 @@
+Monitoring
+==========
+
+.. currentmodule:: kornia.metrics
+
+.. autoclass:: AverageMeter
diff --git a/docs/source/metrics.optical_flow.rst b/docs/source/metrics.optical_flow.rst
new file mode 100644
index 000000000..87facbc9c
--- /dev/null
+++ b/docs/source/metrics.optical_flow.rst
@@ -0,0 +1,8 @@
+Optical flow
+============
+
+.. currentmodule:: kornia.metrics
+
+.. autofunction:: aepe
+
+.. autoclass:: AEPE
diff --git a/docs/source/metrics.pose.rst b/docs/source/metrics.pose.rst
new file mode 100644
index 000000000..a521a1cb0
--- /dev/null
+++ b/docs/source/metrics.pose.rst
@@ -0,0 +1,10 @@
+Pose
+====
+
+.. currentmodule:: kornia.metrics
+
+.. autofunction:: angle_error_mat
+.. autofunction:: angle_error_vec
+.. autofunction:: translation_ate
+.. autofunction:: pose_errors
+.. autofunction:: auc_from_errors
diff --git a/docs/source/metrics.rst b/docs/source/metrics.rst
index 1271542e7..60c073c7b 100644
--- a/docs/source/metrics.rst
+++ b/docs/source/metrics.rst
@@ -2,62 +2,40 @@ kornia.metrics
==============
.. meta::
- :name: description
- :content: "The kornia.metrics module provides a variety of metrics to evaluate the performance of deep learning models in computer vision tasks. It includes metrics for classification, segmentation, detection, image quality, and optical flow. With functions such as accuracy, mean IoU, PSNR, and AEPE, this module facilitates efficient monitoring and evaluation of models during training, making it a valuable tool for model performance assessment."
+ :description: The kornia.metrics module provides a variety of metrics to evaluate the performance of deep learning models in computer vision tasks. It includes metrics for classification, segmentation, detection, image quality, and optical flow. With functions such as accuracy, mean IoU, PSNR, and AEPE, this module facilitates efficient monitoring and evaluation of models during training, making it a valuable tool for model performance assessment.
.. currentmodule:: kornia.metrics
-Module containing metrics for training networks
-
-Classification
---------------
-
-.. autofunction:: accuracy
-
-Segmentation
-------------
-
-.. autofunction:: confusion_matrix
-.. autofunction:: mean_iou
-
-Detection
----------
-
-.. autofunction:: mean_average_precision
-.. autofunction:: mean_iou_bbox
-
-Image Quality
--------------
-
-.. autofunction:: psnr
-.. autofunction:: ssim
-.. autofunction:: ssim3d
-.. autoclass:: SSIM
-.. autoclass:: SSIM3D
-
-Optical Flow
--------------
-
-.. autofunction:: aepe
-.. autoclass:: AEPE
-
-Stereo
-------
-
-.. autofunction:: mean_absolute_disparity_error
-.. autofunction:: root_mean_squared_disparity_error
-.. autofunction:: mean_bad_pixel_error
-
-Pose
-----
-
-.. autofunction:: angle_error_mat
-.. autofunction:: angle_error_vec
-.. autofunction:: translation_ate
-.. autofunction:: pose_errors
-.. autofunction:: auc_from_errors
-
-Monitoring
-----------
-
-.. autoclass:: AverageMeter
+Metrics to monitor and evaluate vision models during training and validation.
+
+.. list-table::
+ :widths: 30 70
+
+ * - :doc:`metrics.classification`
+ - Top-k accuracy.
+ * - :doc:`metrics.segmentation`
+ - Confusion matrix and mean IoU.
+ * - :doc:`metrics.detection`
+ - Mean average precision and box IoU.
+ * - :doc:`metrics.image_quality`
+ - PSNR and SSIM in 2D and 3D.
+ * - :doc:`metrics.optical_flow`
+ - Average end-point error.
+ * - :doc:`metrics.stereo`
+ - Disparity error metrics.
+ * - :doc:`metrics.pose`
+ - Rotation and translation errors and AUC.
+ * - :doc:`metrics.monitoring`
+ - Running averages for training loops.
+
+.. toctree::
+ :hidden:
+
+ classification <metrics.classification>
+ segmentation & iou <metrics.segmentation>
+ detection <metrics.detection>
+ image quality <metrics.image_quality>
+ optical flow <metrics.optical_flow>
+ stereo <metrics.stereo>
+ pose <metrics.pose>
+ monitoring <metrics.monitoring>
diff --git a/docs/source/metrics.segmentation.rst b/docs/source/metrics.segmentation.rst
new file mode 100644
index 000000000..80b7c1ccc
--- /dev/null
+++ b/docs/source/metrics.segmentation.rst
@@ -0,0 +1,7 @@
+Segmentation
+============
+
+.. currentmodule:: kornia.metrics
+
+.. autofunction:: confusion_matrix
+.. autofunction:: mean_iou
diff --git a/docs/source/metrics.stereo.rst b/docs/source/metrics.stereo.rst
new file mode 100644
index 000000000..1c3446ac0
--- /dev/null
+++ b/docs/source/metrics.stereo.rst
@@ -0,0 +1,8 @@
+Stereo
+======
+
+.. currentmodule:: kornia.metrics
+
+.. autofunction:: mean_absolute_disparity_error
+.. autofunction:: root_mean_squared_disparity_error
+.. autofunction:: mean_bad_pixel_error
diff --git a/docs/source/models.rst b/docs/source/models.rst
index ddc1e01a5..1c5fe364d 100644
--- a/docs/source/models.rst
+++ b/docs/source/models.rst
@@ -1,12 +1,14 @@
-Models Overview
-===============
+kornia.models
+=============
.. meta::
- :name: description
- :content: "The Kornia models overview provides detailed information about key built-in models for computer vision tasks, including real-time object detection (RT-DETR), edge detection (DexiNed), segmentation (UNet, DeepLabV3), and multi-object tracking (BoxMotTracker). It offers comprehensive documentation on each model, including methods, parameters, and example usage to streamline the integration of these models into computer vision workflows."
+ :description: The Kornia models overview provides detailed information about key built-in models for computer vision tasks, including real-time object detection (RT-DETR), edge detection (DexiNed), segmentation (UNet, DeepLabV3), and multi-object tracking (BoxMotTracker). It offers comprehensive documentation on each model, including methods, parameters, and example usage to streamline the integration of these models into computer vision workflows.
-This section covers several of Kornia's built-in models for key computer vision tasks. Each model is documented with its respective API and example usage.
+Builders for Kornia's ready-to-use models (object detection, edge detection, semantic segmentation, multi-object tracking and Kimi-VL).
+Each builder returns a configured model with pretrained weights. For the papers behind the models, see the :doc:`Models </models/index>` section.
+Pretrained weights are downloaded on first use, and the model builders return a regular ``nn.Module`` that accepts a
+batched ``(B, 3, H, W)`` float image in ``[0, 1]`` (the tracker below wraps a detector in a plain Python class instead). :func:`kornia.io.get_sample_images` provides a couple of sample images for quick experiments.
.. _RTDETRDetectorBuilder:
@@ -18,7 +20,7 @@ The `RTDETRDetectorBuilder` class is a builder for constructing a detection mode
**Key Methods:**
- `build`: Constructs and returns an instance of the RTDETR detection model.
-- `save`: Saves the processed image or results after applying the detection model.
+- `visualize`: Draws the detected boxes on the input images.
.. autoclass:: kornia.contrib.object_detection.RTDETRDetectorBuilder
:members:
@@ -32,9 +34,12 @@ The `RTDETRDetectorBuilder` class is a builder for constructing a detection mode
.. code-block:: python
import kornia
- image = kornia.utils.sample.get_sample_images()[0][None]
- model = kornia.contrib.object_detection.RTDETRDetectorBuilder.build()
- model.save(image)
+ from kornia.contrib.object_detection import RTDETRDetectorBuilder
+
+ image = kornia.io.get_sample_images()[0][None]
+ model = RTDETRDetectorBuilder.build()
+ detections = model(image) # list of (D, 6) tensors: class id, score, x, y, w, h
+ drawn = model.visualize(image, detections) # the boxes drawn on the image
.. _EdgeDetectorBuilder:
@@ -46,7 +51,7 @@ The `EdgeDetectorBuilder` class implements a state-of-the-art edge detection mod
**Key Methods:**
- `build`: Builds and returns an instance of the DexiNed edge detection model.
-- `save`: Saves the detected edges for further processing or visualization.
+- `visualize`: Returns the edge maps as images for further processing or display.
.. autoclass:: kornia.contrib.edge_detection.EdgeDetectorBuilder
:members:
@@ -60,25 +65,30 @@ The `EdgeDetectorBuilder` class implements a state-of-the-art edge detection mod
.. code-block:: python
import kornia
- image = kornia.utils.sample.get_sample_images()[0][None]
- model = kornia.contrib.edge_detection.EdgeDetectorBuilder.build()
- model.save(image)
+ from kornia.contrib.edge_detection import EdgeDetectorBuilder
+
+ image = kornia.io.get_sample_images()[0][None]
+ model = EdgeDetectorBuilder.build()
+ edges = model(image) # list with one (1, 1, H, W) edge map per image
.. _SegmentationModels:
SegmentationModelsBuilder
-------------------------
-The `SegmentationModelsBuilder` class offers a flexible API for implementing and running various segmentation models. It supports a variety of architectures such as UNet, FPN, and others, making it highly adaptable for tasks like semantic segmentation, instance segmentation, and more.
+The `SegmentationModelsBuilder` class offers a flexible API for building and running segmentation models from the
+optional `segmentation_models_pytorch <https://github.com/qubvel-org/segmentation_models.pytorch>`_ package
+(``pip install segmentation_models_pytorch``). It supports a variety of architectures such as UNet, FPN, DeepLabV3 and
+others, with ImageNet-pretrained encoders.
**Key Methods:**
-- `__init__`: Initializes a segmentation model based on the chosen architecture (e.g., UNet, DeepLabV3, etc.).
-- `forward`: Runs inference on an input tensor and returns segmented output.
+- `build`: Constructs a segmentation model for the chosen architecture, encoder and number of classes.
-**Parameters:**
+**Main parameters of** `build`:
- `model_name`: (str) Name of the segmentation architecture to use, e.g., `"Unet"`, `"DeepLabV3"`.
+- `encoder_name`: (str) Name of the encoder backbone, e.g., `"resnet34"`.
- `classes`: (int) The number of output classes for segmentation.
.. autoclass:: kornia.models.segmentation.segmentation_models.SegmentationModelsBuilder
@@ -93,8 +103,10 @@ The `SegmentationModelsBuilder` class offers a flexible API for implementing and
.. code-block:: python
import kornia
- input_tensor = kornia.utils.sample.get_sample_images()[0][None]
- model = kornia.models.segmentation.segmentation_models.SegmentationModelsBuilder.build()
+ from kornia.models.segmentation.segmentation_models import SegmentationModelsBuilder
+
+ input_tensor = kornia.io.get_sample_images()[0][None]
+ model = SegmentationModelsBuilder.build(model_name="Unet", encoder_name="resnet34", classes=1)
segmented_output = model(input_tensor)
print(segmented_output.shape)
@@ -131,17 +143,20 @@ loading currently supports only the converted Kimi-VL-A3B-Instruct vision encode
BoxMotTracker
-------------
-The `BoxMotTracker` class is used for multi-object tracking in video streams. It is designed to track bounding boxes of objects across multiple frames, supporting various tracking algorithms for object detection and tracking continuity.
+The `BoxMotTracker` class is used for multi-object tracking in video streams. It combines a Kornia object detector with
+a tracker from the optional `boxmot <https://github.com/mikel-brostrom/boxmot>`_ package (``pip install boxmot``) to
+track bounding boxes across frames.
**Key Methods:**
-- `__init__`: Initializes the multi-object tracker.
+- `__init__`: Initializes the multi-object tracker from a detector and a tracker model name.
- `update`: Updates the tracker with a new image frame.
-- `save`: Saves the tracked object data or visualization for post-processing.
+- `visualize`: Draws the tracked boxes (and optionally their trajectories) on a frame.
-**Parameters:**
+**Main parameters:**
-- `max_lost`: (int) The maximum number of frames where an object can be lost before it is removed from the tracker.
+- `detector`: (ObjectDetector | str) The object detector instance, or the name of an RT-DETR model to build, e.g. `"rtdetr_r18vd"`.
+- `tracker_model_name`: (str) The boxmot tracker to use, e.g. `"DeepOCSORT"`.
.. autoclass:: kornia.contrib.boxmot_tracker.BoxMotTracker
:members:
@@ -155,13 +170,15 @@ The `BoxMotTracker` class is used for multi-object tracking in video streams. It
.. code-block:: python
import kornia
- image = kornia.utils.sample.get_sample_images()[0][None]
- model = kornia.contrib.boxmot_tracker.BoxMotTracker()
+ from kornia.contrib.boxmot_tracker import BoxMotTracker
+
+ image = kornia.io.get_sample_images()[0][None]
+ model = BoxMotTracker()
for i in range(4):
model.update(image) # Update the tracker with new frames
- model.save(image) # Save the tracking result
+ tracked = model.visualize(image) # Draw the tracked boxes on the frame
----
+----
.. note::
diff --git a/docs/source/models/affnet.rst b/docs/source/models/affnet.rst
index 3ef5dc663..14be44d5e 100644
--- a/docs/source/models/affnet.rst
+++ b/docs/source/models/affnet.rst
@@ -1,12 +1,16 @@
-Affnet (detection)
-..................
+AffNet
+======
+
+.. rst-class:: kornia-badges
+
+:bdg-primary:`Affine shape estimation` :bdg-secondary:`MIT`
.. card::
:link: https://paperswithcode.com/paper/repeatability-is-not-enough-learning-affine
- **Affnet: Repeatability Is Not Enough: Learning Affine Regions via Discriminability**
+ **AffNet: Repeatability Is Not Enough: Learning Affine Regions via Discriminability**
^^^
- **Abstract:** A method for learning local affine-covariant regions is presented. We show that maximizing geometric repeatability does not lead to local regions, a.k.a features,that are reliably matched and this necessitates descriptor-based learning. We explore factors that influence such learning and registration: the loss function, descriptor type, geometric parametrization and the trade-off between matchability and geometric accuracy and propose a novel hard negative-constant loss function for learning of affine regions. The affine shape estimator -- AffNet -- trained with the hard negative-constant loss outperforms the state-of-the-art in bag-of-words image retrieval and wide baseline stereo. The proposed training process does not require precisely geometrically aligned patches.
+ **Abstract:** A method for learning local affine-covariant regions is presented. We show that maximizing geometric repeatability does not lead to local regions, a.k.a. features, that are reliably matched and this necessitates descriptor-based learning. We explore factors that influence such learning and registration: the loss function, descriptor type, geometric parametrization and the trade-off between matchability and geometric accuracy and propose a novel hard negative-constant loss function for learning of affine regions. The affine shape estimator -- AffNet -- trained with the hard negative-constant loss outperforms the state-of-the-art in bag-of-words image retrieval and wide baseline stereo. The proposed training process does not require precisely geometrically aligned patches.
**Tasks:** Image Retrieval
diff --git a/docs/source/models/defmo.rst b/docs/source/models/defmo.rst
index a0862e221..5c676c47c 100644
--- a/docs/source/models/defmo.rst
+++ b/docs/source/models/defmo.rst
@@ -1,5 +1,9 @@
-DeFMO (video)
-.............
+DeFMO
+=====
+
+.. rst-class:: kornia-badges
+
+:bdg-primary:`Enhance` :bdg-primary:`Deblurring` :bdg-secondary:`Apache-2.0`
.. card::
:link: https://paperswithcode.com/paper/defmo-deblurring-and-shape-recovery-of-fast
diff --git a/docs/source/models/dexined.rst b/docs/source/models/dexined.rst
index 5b7a049c3..0e48803ce 100644
--- a/docs/source/models/dexined.rst
+++ b/docs/source/models/dexined.rst
@@ -1,7 +1,11 @@
.. _dexined_model:
-Dexined (edge detection)
-------------------------
+DexiNed
+=======
+
+.. rst-class:: kornia-badges
+
+:bdg-primary:`Edge detection` :bdg-secondary:`MIT`
.. card::
:link: https://www.computer.org/csdl/proceedings-article/wacv/2020/09093290/1jPbjFHmwi4
diff --git a/docs/source/models/efficient_vit.rst b/docs/source/models/efficient_vit.rst
index 82d789e85..8064c7311 100644
--- a/docs/source/models/efficient_vit.rst
+++ b/docs/source/models/efficient_vit.rst
@@ -1,6 +1,10 @@
EfficientViT
============
+.. rst-class:: kornia-badges
+
+:bdg-primary:`Segmentation` :bdg-primary:`Classification` :bdg-primary:`Detection` :bdg-secondary:`Apache-2.0`
+
.. card::
:link: https://arxiv.org/abs/2205.14756
diff --git a/docs/source/models/hardnet.rst b/docs/source/models/hardnet.rst
index 5855efce4..c3755856c 100644
--- a/docs/source/models/hardnet.rst
+++ b/docs/source/models/hardnet.rst
@@ -1,10 +1,14 @@
-Hardnet (descriptor)
-....................
+HardNet
+=======
+
+.. rst-class:: kornia-badges
+
+:bdg-primary:`Local feature descriptor` :bdg-secondary:`MIT`
.. card::
:link: https://paperswithcode.com/paper/working-hard-to-know-your-neighbors-margins
- **Hardnet: Working hard to know your neighbor's margins: Local descriptor learning loss**
+ **HardNet: Working hard to know your neighbor's margins: Local descriptor learning loss**
^^^
**Abstract:** We introduce a novel loss for learning local feature descriptors which is inspired by the Lowe's matching criterion for SIFT. We show that the proposed loss that maximizes the distance between the closest positive and closest negative patch in the batch is better than complex regularization methods; it works well for both shallow and deep convolution network architectures. Applying the novel loss to the L2Net CNN architecture results in a compact descriptor -- it has the same dimensionality as SIFT (128) that shows state-of-art performance in wide baseline stereo, patch verification and instance retrieval benchmarks. It is fast, computing a descriptor takes about 1 millisecond on a low-end GPU
diff --git a/docs/source/models/index.rst b/docs/source/models/index.rst
new file mode 100644
index 000000000..23aa9aec0
--- /dev/null
+++ b/docs/source/models/index.rst
@@ -0,0 +1,120 @@
+Kornia Models
+=============
+
+.. meta::
+ :description: The deep learning models shipped with Kornia, grouped by task, with their papers, tasks and licences: RT-DETR, YuNet, Segment Anything, MobileSAM, EfficientViT, ViT, MobileViT, TinyViT, LoFTR, HardNet, AffNet, SOLD2, DexiNed and DeFMO.
+
+Kornia ships a curated set of model architectures, each wrapped as a regular ``nn.Module``. Most of them come with
+pretrained weights that are downloaded on first use; MobileViT ships as an architecture only, for training or for
+loading your own checkpoint. The pages below summarize each model's paper, task and licence. The builders that
+construct them are documented on the :doc:`kornia.models </models>` API page, and the local-feature models under
+:doc:`kornia.feature </feature>`.
+
+.. list-table::
+ :header-rows: 1
+ :widths: 22 28 30 20
+
+ * - Model
+ - Task
+ - Venue
+ - Licence
+ * - :doc:`RT-DETR <rt_detr>`
+ - Object detection
+ - arXiv 2023
+ - Apache-2.0
+ * - :doc:`YuNet <yunet>`
+ - Face detection
+ - IEEE TIP 2021
+ - Apache-2.0
+ * - :doc:`Segment Anything (SAM) <segment_anything>`
+ - Promptable segmentation
+ - ICCV 2023
+ - Apache-2.0
+ * - :doc:`MobileSAM <mobile_sam>`
+ - Promptable segmentation (lightweight)
+ - arXiv 2023
+ - Apache-2.0
+ * - :doc:`EfficientViT <efficient_vit>`
+ - Segmentation, classification, detection backbone
+ - ICCV 2023
+ - Apache-2.0
+ * - :doc:`Vision Transformer (ViT) <vit>`
+ - Image classification backbone
+ - ICLR 2021
+ - Apache-2.0
+ * - :doc:`MobileViT <vit_mobile>`
+ - Image classification backbone (mobile)
+ - ICLR 2022
+ - --
+ * - :doc:`TinyViT <tiny_vit>`
+ - Image classification backbone (small)
+ - ECCV 2022
+ - --
+ * - :doc:`LoFTR <loftr>`
+ - Image matching (detector-free)
+ - CVPR 2021
+ - Apache-2.0
+ * - :doc:`HardNet <hardnet>`
+ - Local feature descriptor
+ - NeurIPS 2017
+ - MIT
+ * - :doc:`AffNet <affnet>`
+ - Affine shape estimation for local features
+ - ECCV 2018
+ - MIT
+ * - :doc:`SOLD2 <sold2>`
+ - Line detection and matching
+ - CVPR 2021
+ - MIT
+ * - :doc:`DexiNed <dexined>`
+ - Edge detection
+ - WACV 2020
+ - MIT
+ * - :doc:`DeFMO <defmo>`
+ - Enhancement -- video deblurring of fast-moving objects
+ - CVPR 2021
+ - Apache-2.0
+
+.. toctree::
+ :caption: Object detection
+ :hidden:
+
+ RT-DETR β€” real-time detector <rt_detr>
+ YuNet β€” face detector <yunet>
+
+.. toctree::
+ :caption: Segmentation
+ :hidden:
+
+ SAM β€” promptable masks <segment_anything>
+ MobileSAM β€” lightweight SAM <mobile_sam>
+ EfficientViT β€” fast backbone <efficient_vit>
+
+.. toctree::
+ :caption: Image classification
+ :hidden:
+
+ ViT β€” transformer backbone <vit>
+ MobileViT β€” mobile backbone <vit_mobile>
+ TinyViT β€” distilled backbone <tiny_vit>
+
+.. toctree::
+ :caption: Local features and matching
+ :hidden:
+
+ LoFTR β€” detector-free matcher <loftr>
+ HardNet β€” patch descriptor <hardnet>
+ AffNet β€” affine shape estimator <affnet>
+ SOLD2 β€” line detector and matcher <sold2>
+
+.. toctree::
+ :caption: Edge detection
+ :hidden:
+
+ DexiNed β€” fine-grained edges <dexined>
+
+.. toctree::
+ :caption: Enhance
+ :hidden:
+
+ DeFMO β€” video deblur <defmo>
diff --git a/docs/source/models/loftr.rst b/docs/source/models/loftr.rst
index c3960468a..57b255bd5 100644
--- a/docs/source/models/loftr.rst
+++ b/docs/source/models/loftr.rst
@@ -1,5 +1,9 @@
-LoFTR (matching)
-................
+LoFTR
+=====
+
+.. rst-class:: kornia-badges
+
+:bdg-primary:`Image matching` :bdg-secondary:`Apache-2.0`
.. card::
:link: https://paperswithcode.com/paper/loftr-detector-free-local-feature-matching
diff --git a/docs/source/models/mobile_sam.rst b/docs/source/models/mobile_sam.rst
index c0828a3c8..05ac42e97 100644
--- a/docs/source/models/mobile_sam.rst
+++ b/docs/source/models/mobile_sam.rst
@@ -1,5 +1,9 @@
-Faster Segment Anything (MobileSAM)
-===================================
+MobileSAM
+=========
+
+.. rst-class:: kornia-badges
+
+:bdg-primary:`Segmentation` :bdg-primary:`Visual prompting` :bdg-secondary:`Apache-2.0`
.. card::
:link: https://arxiv.org/abs/2306.14289
@@ -21,20 +25,21 @@ Faster Segment Anything (MobileSAM)
Usage
~~~~~
-MobileSAM is integrated directly into our Segment-Anything implementation. Once you have loaded MobileSAM, you can use it just like how you use SAM.
+MobileSAM is integrated directly into our Segment Anything implementation. Once you have loaded MobileSAM, you can use it just like SAM.
.. code:: python
import torch
from kornia.models.sam import SamConfig
from kornia.contrib.visual_prompter import VisualPrompter
+ from kornia.geometry.keypoints import Keypoints
- image = torch.randn(3, 512, 512)
+ image = torch.rand(3, 512, 512) # (3, H, W) float in [0, 1]
prompter = VisualPrompter(SamConfig("mobile_sam", pretrained=True))
prompter.set_image(image)
- keypoints = Keypoints(torch.tensor([[[500.0, 375.0]]])) # BxNx2
- labels = torch.tensor([[1]], device=device) # BxN
+ keypoints = Keypoints(torch.tensor([[[400.0, 375.0]]])) # (B, N, 2) in (x, y)
+ labels = torch.tensor([[1]]) # (B, N); 1 = foreground point, 0 = background point
prediction = prompter.predict(
keypoints=keypoints,
diff --git a/docs/source/models/rt_detr.rst b/docs/source/models/rt_detr.rst
index ee56f5587..bba638a99 100644
--- a/docs/source/models/rt_detr.rst
+++ b/docs/source/models/rt_detr.rst
@@ -1,25 +1,29 @@
-Real-Time Detection Transformer (RT-DETR)
-=========================================
+RT-DETR
+=======
+
+.. rst-class:: kornia-badges
+
+:bdg-primary:`Object detection` :bdg-secondary:`Apache-2.0`
.. code-block:: python
from kornia.io import load_image
from kornia.contrib.object_detection import RTDETRDetectorBuilder
- input_img = load_image(img_path)[None] # Load image to BCHW
+ input_img = load_image("image.jpg")[None] # (1, 3, H, W) float in [0, 1]
# NOTE: available models: 'rtdetr_r18vd', 'rtdetr_r34vd', 'rtdetr_r50vd_m', 'rtdetr_r50vd', 'rtdetr_r101vd'.
# NOTE: recommended image scales: [480, 512, 544, 576, 608, 640, 640, 640, 672, 704, 736, 768, 800]
detector = RTDETRDetectorBuilder.build("rtdetr_r18vd", image_size=640)
- # get the output boxes
- boxes = detector(input_img)
+ # get the detections: one (D, 6) tensor per image with class id, score, x, y, w, h
+ detections = detector(input_img)
- # draw the bounding boxes on the images directly.
- output = detector.draw(input_img, output_type="pil")
+ # draw the bounding boxes on the images directly
+ output = detector.visualize(input_img, detections, output_type="pil")
output[0].save("Kornia-RTDETR-output.png")
- # convert the whole model to ONNX directly
+ # convert the whole model, including pre- and post-processing, to ONNX
detector.to_onnx("RTDETR-640.onnx", image_size=640)
diff --git a/docs/source/models/segment_anything.rst b/docs/source/models/segment_anything.rst
index 9624a5696..7ce5cfa49 100644
--- a/docs/source/models/segment_anything.rst
+++ b/docs/source/models/segment_anything.rst
@@ -1,6 +1,10 @@
Segment Anything (SAM)
======================
+.. rst-class:: kornia-badges
+
+:bdg-primary:`Segmentation` :bdg-primary:`Visual prompting` :bdg-secondary:`Apache-2.0`
+
The Segment Anything Model (SAM) produces high quality object masks from input prompts such as points or boxes, and it
can be used to generate masks for all objects in an image.
@@ -32,59 +36,57 @@ can be used to generate masks for all objects in an image.
How to use SAM from Kornia
--------------------------
-The Kornia API for SAM try to provide a simple API to access initialize the model and load/download the weights. Also,
-providing it to a high-level API called :code:`VisualPrompter`, which allow the users to set an image and run multiple
-queries multiple times.
+The Kornia API for SAM provides a simple way to initialize the model and load or download its weights, together with a
+high-level API called :code:`VisualPrompter`, which allows users to set an image once and run multiple queries against it.
-The :code:`VisualPrompter` works querying on a single image, if you want to explore and query into a batch of images,
-you can use the :code:`Sam` directly. But, for it you will need to write the boilerplate to preprocess and postprocess to
-use it. This boilerplate, is already handle on the high-level API :code:`VisualPrompter`.
+The :code:`VisualPrompter` works on a single image. If you want to query a batch of images, you can use
+:code:`Sam` directly, but then you need to write the pre- and post-processing boilerplate yourself. That boilerplate is
+already handled by the high-level :code:`VisualPrompter` API.
Visual Prompter
^^^^^^^^^^^^^^^
.. _anchor Prompter:
-The High level API :code:`VisualPrompter` handle with the image and prompt transformation, preprocessing and prediction for
+The high-level :code:`VisualPrompter` API handles the image and prompt transformations, preprocessing and prediction for
a given SAM model.
About the :code:`VisualPrompter`:
-#. From a `ModelConfig` loads the desired model with the desired checkpoint to be used as the model to receive the query
- prompts. For know we just support Segment Anything model, where the *SAM-h* is the default option.
+#. From a :class:`~kornia.models.sam.SamConfig` it loads the desired model with the desired checkpoint, which then receives
+ the query prompts. For now only the Segment Anything family is supported, with *SAM ViT-H* as the default option.
-#. Based on the model, the :code:`VisualPrompter` will handle with the necessary transformations to be done into the image
- and prompts before apply it to the model. These transformations are done using PyTorch backed, by our API of
- augmentations. Where we use the :class:`kornia.geometry.augmentation.AugmentationSequential` to handle with the different
- data formats (keypoints, boxes, masks, image).
+#. Based on the model, the :code:`VisualPrompter` applies the necessary transformations to the image and prompts before
+ passing them to the model. These transformations are implemented with our augmentation API, using
+ :class:`kornia.augmentation.AugmentationSequential` to handle the different data formats (keypoints, boxes, masks, image).
-#. When you use :code:`prompter.set_image(...)`, the prompter will preprocess this image, then pass it to the encoder,
- and cache the embeddings to query it after. Note that the image should be scaled within the range [0,1].
+#. When you call :code:`prompter.set_image(...)`, the prompter preprocesses the image, passes it to the encoder,
+ and caches the embeddings for later queries. Note that the image should be scaled to the range [0, 1].
- * The preprocess steps are: 1) Resize the image to have its longer side the same size as :code:`image_encoder` image size
- input. 2) Cache the information of this transformation to apply into the prompts. 3) normalize the image based on the
- passed mean and standard deviation, or with the values of the SAM dataset. 4) pad on the bottom and right for the image
- have the encoder expected resolution: :math:`(\text{image_encoder.img_size}, \text{image_encoder.img_size})`.
+ * The preprocessing steps are: 1) resize the image so that its longer side matches the :code:`image_encoder` input size;
+ 2) cache this transformation so it can be applied to the prompts; 3) normalize the image with the given mean and
+ standard deviation, or with the SAM dataset statistics; 4) pad the bottom and right so the image has the resolution the
+ encoder expects: :math:`(\text{image_encoder.img_size}, \text{image_encoder.img_size})`.
- * The best image to be used will always have the shape equals to
+ * The best input image will always have shape
:math:`(\text{image_encoder.img_size}, \text{image_encoder.img_size})`.
-#. When you use :code:`prompter.predict(...)`, the prompter will apply the cached transformations on the coordinates of the
- prompts, and then query this prompts into the cached embeddings.
+#. When you call :code:`prompter.predict(...)`, the prompter applies the cached transformation to the prompt coordinates
+ and then queries the cached embeddings with them.
- * If :code:`output_original_size=True`, the results structure will upsample the logits from it's resolution into the
- image input original resolution. The output logits has the height and width equals to 256.
+ * If :code:`output_original_size=True`, the result structure upsamples the logits from their native resolution to the
+ original resolution of the input image. The raw logits have a height and width of 256.
-#. You can benefit from using the :code:`torch.compile(...)` API (dynamo) for torch >= 2.0.0 version. To compile with dynamo
- we provide the method :code:`prompter.compile(...)` which will optimize the right parts of the backend model and the
+#. You can benefit from the :code:`torch.compile(...)` API (dynamo) with torch >= 2.0.0. To compile with dynamo
+ we provide the :code:`prompter.compile(...)` method, which optimizes the right parts of the backend model and of the
prompter itself.
--------------
Example of using the :code:`VisualPrompter`:
-Exploring how to simple initialize the :code:`VisualPrompter`, automatically load the weights from a URL,
-read the image and set it to be query, how to write the prompts, and the multiple ways we can use these prompts
-to query the image masks from the SAM model.
+The example shows how to initialize the :code:`VisualPrompter`, automatically load the weights from a URL,
+read an image and set it as the query target, how to write the prompts, and the multiple ways these prompts
+can be used to query the SAM model for image masks.
.. code-block:: python
@@ -99,8 +101,8 @@ to query the image masks from the SAM model.
from kornia.core.utils import get_cuda_or_mps_device_if_available
model_type = 'vit_h'
- checkpoint = './https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth'
- device = get_cuda_or_mps_device_if_available
+ checkpoint = 'https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth'
+ device = get_cuda_or_mps_device_if_available()
# Load image
image = load_image('./example.jpg', ImageLoadType.RGB32, device)
@@ -121,8 +123,8 @@ to query the image masks from the SAM model.
keypoints = Keypoints(torch.tensor([[[500, 375]]], device=device, dtype=torch.float32)) # BxNx2
# For the keypoints label: 1 indicates a foreground point; 0 indicates a background point
keypoints_labels = torch.tensor([[1]], device=device) # BxN
- boxes = Boxes(
- torch.tensor([[[[425, 600], [425, 875], [700, 600], [700, 875]]]], device=device, dtype=torch.float32), mode='xyxy'
+ boxes = Boxes.from_tensor(
+ torch.tensor([[[425, 600, 700, 875]]], device=device, dtype=torch.float32), mode='xyxy' # BxNx4
)
# Runs the prediction with all prompts
@@ -157,7 +159,7 @@ to query the image masks from the SAM model.
#------------------------------------------------
# or run the prediction using the previous logits
prediction = prompter.predict(
- masks=prediction.logits
+ masks=prediction.logits,
multimask_output=True,
)
@@ -167,15 +169,15 @@ to query the image masks from the SAM model.
print(prediction.logits.shape)
-Read more about the :code:`SegmentationResults` on :ref:`the official docs<anchor SegmentationResults>`
+Read more about :code:`SegmentationResults` in :ref:`the API reference <anchor SegmentationResults>`.
Load from config
^^^^^^^^^^^^^^^^
-You can build a SAM model by specifying the encoder parameters on the :code:`SamConfig`, or from the model type. The
-:code:`from_config` method will first try to build the model based on the model type, otherwise will try from the specified
-parameters. If a checkpoint URL or path for a file is seted, the method will automatically load it.
+You can build a SAM model by specifying the encoder parameters in the :code:`SamConfig`, or just the model type. The
+:code:`from_config` method first tries to build the model from the model type, and otherwise falls back to the specified
+parameters. If a checkpoint URL or file path is set, the method loads it automatically.
.. code-block:: python
@@ -204,14 +206,14 @@ parameters. If a checkpoint URL or path for a file is seted, the method will aut
Load checkpoint
^^^^^^^^^^^^^^^
-With the load checkpoint method you can load from a file or directly from a URL. The official (by meta) model weights are:
+With the :code:`load_checkpoint` method you can load weights from a file or directly from a URL. The official model weights released by Meta are:
#. `vit_h`: `ViT-H SAM model - https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth <https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth>`_.
#. `vit_l`: `ViT-L SAM model - https://dl.fbaipublicfiles.com/segment_anything/sam_vit_l_0b3195.pth <https://dl.fbaipublicfiles.com/segment_anything/sam_vit_l_0b3195.pth>`_.
#. `vit_b`: `ViT-B SAM model - https://dl.fbaipublicfiles.com/segment_anything/sam_vit_b_01ec64.pth <https://dl.fbaipublicfiles.com/segment_anything/sam_vit_b_01ec64.pth>`_.
-If a URL is passed the model will automatically download and cache the weights using
-:code:`torch.hub.load_state_dict_from_url`
+If a URL is passed, the model automatically downloads and caches the weights using
+:code:`torch.hub.load_state_dict_from_url`.
.. code-block:: python
@@ -235,26 +237,29 @@ If a URL is passed the model will automatically download and cache the weights u
.. ^^^^^^^^^^^^^^
-Example of how to use the SAM model without API
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-This is a simple example, of how to directly use the SAM model loaded. We recommend the use of
-:ref:`Prompter API<anchor Prompter>` to handle/prepare the inputs.
+Example of how to use the SAM model without the prompter API
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+This is a simple example of how to use the loaded SAM model directly. We recommend using the
+:ref:`prompter API <anchor Prompter>` to handle and prepare the inputs.
.. code-block:: python
- from kornia.models.sam import Sam
+ import torch
+ from torch.nn.functional import pad
+
+ from kornia.models.sam import Sam, SamConfig
from kornia.models.structures import SegmentationResults
from kornia.io import load_image, ImageLoadType
from kornia.core.utils import get_cuda_or_mps_device_if_available
from kornia.geometry import resize
from kornia.enhance import normalize
- model_type = 'vit_b' # or can be a number `2` or the enum sam.SamModelType.vit_b
+ model_type = 'vit_b' # or the number `2`, or the enum `SamModelType.vit_b`
checkpoint_path = './path_for_the_model_checkpoint.pth'
device = get_cuda_or_mps_device_if_available()
# Load the model
- sam_model = Sam.from_pretrained(model_type, checkpoint_path, device)
+ sam_model = Sam.from_config(SamConfig(model_type, checkpoint_path)).to(device)
# Load image
image = load_image('./example.jpg', ImageLoadType.RGB32, device)
@@ -262,20 +267,21 @@ This is a simple example, of how to directly use the SAM model loaded. We recomm
# Transform the image (CxHxW) into a batched input (BxCxHxW)
image = image[None, ...]
- # Resize the image to have the maximum size 1024 on its largest side
+ # Resize the image to have a maximum size of 1024 on its largest side
data = resize(image, 1024, side='long')
+ h, w = data.shape[-2:]
- # Embed prompts -- ATTENTION: should match the coordinates after the resize of the image
+ # Embed prompts -- ATTENTION: prompt coordinates must match the image after the resize
sparse_embeddings, dense_embeddings = sam_model.prompt_encoder(points=None, boxes=None, masks=None)
- # define the info for normalize the input
- pixel_mean = torch.tensor(...)
- pixel_std = torch.tensor(...)
+ # SAM dataset statistics used to normalize the input, in the [0, 1] range
+ pixel_mean = torch.tensor([123.675, 116.28, 103.53], device=device) / 255.0
+ pixel_std = torch.tensor([58.395, 57.12, 57.375], device=device) / 255.0
# Preprocess input
data = normalize(data, pixel_mean, pixel_std)
- padh = model_sam.image_encoder.img_size - h
- padw = model_sam.image_encoder.img_size - w
+ padh = sam_model.image_encoder.img_size - h
+ padw = sam_model.image_encoder.img_size - w
data = pad(data, (0, padw, 0, padh))
#--------------------------------------------------------------------
@@ -294,7 +300,7 @@ This is a simple example, of how to directly use the SAM model loaded. We recomm
#--------------------------------------------------------------------
# Option B: Calling the model itself
#--------------------------------------------------------------------
- prediction = sam_model(data[None, ...], [{}], multimask_output=True)
+ prediction = sam_model(data, [{}], multimask_output=True)[0] # one SegmentationResults per image
#--------------------------------------------------------------------
# Post processing
@@ -302,8 +308,8 @@ This is a simple example, of how to directly use the SAM model loaded. We recomm
# Upscale the masks to the original image resolution
input_size = (data.shape[-2], data.shape[-1])
original_size = (image.shape[-2], image.shape[-1])
- image_size_encoder = (model_sam.image_encoder.img_size, model_sam.image_encoder.img_size)
+ image_size_encoder = (sam_model.image_encoder.img_size, sam_model.image_encoder.img_size)
prediction.original_res_logits(input_size, original_size, image_size_encoder)
- # If wants to check the binary masks
+ # Binary masks, thresholded from the logits
masks = prediction.binary_masks
diff --git a/docs/source/models/sold2.rst b/docs/source/models/sold2.rst
index b071fcb3d..962d29e5a 100644
--- a/docs/source/models/sold2.rst
+++ b/docs/source/models/sold2.rst
@@ -1,5 +1,9 @@
-SOLD2 (Line detection and matching)
-...................................
+SOLD2
+=====
+
+.. rst-class:: kornia-badges
+
+:bdg-primary:`Line detection` :bdg-primary:`Line matching` :bdg-secondary:`MIT`
.. card::
:link: https://arxiv.org/abs/2104.03362
diff --git a/docs/source/models/tiny_vit.rst b/docs/source/models/tiny_vit.rst
index e31e708af..82afe1aa6 100644
--- a/docs/source/models/tiny_vit.rst
+++ b/docs/source/models/tiny_vit.rst
@@ -1,10 +1,14 @@
.. _kornia_tiny_vit:
TinyViT
-.........
+=======
+
+.. rst-class:: kornia-badges
+
+:bdg-primary:`Image classification` :bdg-primary:`Detection`
.. card::
- :link: https://arxiv.org/abs/2110.02178
+ :link: https://arxiv.org/abs/2207.10666
**TinyViT: Fast Pretraining Distillation for Small Vision Transformers**
^^^
@@ -33,4 +37,4 @@ You can use TinyViT models as follows.
model = TinyViT.from_config("5m", pretrained=True) # ImageNet-1k pre-trained
img = torch.rand(1, 3, 224, 224)
- out = classifier(img) # 1x1000
+ out = model(img) # (1, 1000) ImageNet logits
diff --git a/docs/source/models/vit.rst b/docs/source/models/vit.rst
index 359fa2cc3..9169ed6ce 100644
--- a/docs/source/models/vit.rst
+++ b/docs/source/models/vit.rst
@@ -1,7 +1,11 @@
.. _kornia_vit:
Vision Transformer (ViT)
-........................
+========================
+
+.. rst-class:: kornia-badges
+
+:bdg-primary:`Image classification` :bdg-secondary:`Apache-2.0`
.. card::
:link: https://paperswithcode.com/paper/an-image-is-worth-16x16-words-transformers-1
@@ -33,39 +37,53 @@ One can use the *ViT* in Kornia as follows:
.. code:: python
+ import torch
+ from kornia.models.vit import VisionTransformer
+
img = torch.rand(1, 3, 224, 224)
vit = VisionTransformer(image_size=224, patch_size=16)
- out = vit(img)
+ out = vit(img) # (1, 197, 768): the class token followed by 196 patch tokens
Usage
~~~~~
-``kornia-vit`` does not include any classification head.
-You can easily add your own classification head using standard PyTorch modules.
+``kornia-vit`` does not include any classification head. The backbone returns one embedding per token,
+``(B, 1 + N, hidden_dim)``, with the class token first; a classifier reads the class token and adds a linear
+head using standard PyTorch modules:
.. code:: python
+ import torch
import torch.nn as nn
from kornia.models.vit import VisionTransformer
- classifier = nn.Sequential(
- VisionTransformer(image_size=224, patch_size=16),
- nn.Linear(768, 1000) # Example: 768 is the default hidden_dim, 1000 is num_classes
- )
+
+ class Classifier(nn.Module):
+ def __init__(self, num_classes: int = 1000) -> None:
+ super().__init__()
+ self.backbone = VisionTransformer(image_size=224, patch_size=16)
+ self.head = nn.Linear(768, num_classes) # 768 is the default hidden_dim
+
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
+ tokens = self.backbone(x) # (B, 197, 768)
+ return self.head(tokens[:, 0]) # (B, num_classes), from the class token
+
img = torch.rand(1, 3, 224, 224)
- out = classifier(img) # BxN
- scores = out.argmax(-1) # B
+ out = Classifier()(img) # (1, 1000)
+ scores = out.argmax(-1) # (1,)
-In addition to create simple image classification, our API is flexible enough to design your pipelines e.g
-to solve problems for multi-task, object detection, segmentation, etc. We show an example of a multi-task
-class with two different classification heads:
+Beyond simple image classification, the API is flexible enough to design your own pipelines, e.g.
+for multi-task learning, object detection or segmentation. We show an example of a multi-task
+module with two different classification heads:
.. code:: python
+ import torch
+ import torch.nn as nn
from kornia.models.vit import VisionTransformer
- class MultiTaskTransfornmer(nn.Module):
+ class MultiTaskTransformer(nn.Module):
def __init__(self) -> None:
super().__init__()
self.transformer = VisionTransformer(
@@ -74,11 +92,11 @@ class with two different classification heads:
self.head2 = nn.Linear(768, 50)
def forward(self, x: torch.Tensor):
- out = self.transformer(x)
+ cls_token = self.transformer(x)[:, 0] # (B, 768)
return {
- "head1": self.head1(out),
- "head2": self.head2(out),
+ "head1": self.head1(cls_token),
+ "head2": self.head2(cls_token),
}
.. tip::
- More heads, examples and a training API soon !!
+ More heads, examples and a training API are coming soon!
diff --git a/docs/source/models/vit_mobile.rst b/docs/source/models/vit_mobile.rst
index 86987bb6c..63a01af3b 100644
--- a/docs/source/models/vit_mobile.rst
+++ b/docs/source/models/vit_mobile.rst
@@ -1,7 +1,11 @@
.. _kornia_vit_mobile:
MobileViT
-.........
+=========
+
+.. rst-class:: kornia-badges
+
+:bdg-primary:`Image classification` :bdg-primary:`Detection` :bdg-primary:`Segmentation`
.. card::
:link: https://arxiv.org/abs/2110.02178
@@ -29,9 +33,12 @@ One can use the *MobileViT* in Kornia as follows:
.. code:: python
+ import torch
+ from kornia.models.vit_mobile import MobileViT
+
img = torch.rand(1, 3, 256, 256)
mvit = MobileViT(mode='xxs')
- out = mvit(img)
+ out = mvit(img) # (1, 320, 8, 8) feature map
Usage
@@ -41,6 +48,7 @@ Similar to ``Kornia-ViT``, ``Kornia-MobileViT`` does not include any classificat
.. code:: python
+ import torch
import torch.nn as nn
from kornia.models.vit_mobile import MobileViT
diff --git a/docs/source/models/yunet.rst b/docs/source/models/yunet.rst
index c74b81c01..8fe3603b3 100644
--- a/docs/source/models/yunet.rst
+++ b/docs/source/models/yunet.rst
@@ -1,7 +1,11 @@
.. _yunet_model:
YuNet
-.....
+=====
+
+.. rst-class:: kornia-badges
+
+:bdg-primary:`Face detection` :bdg-secondary:`Apache-2.0`
.. card::
:link: https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=9429909
diff --git a/docs/source/morphology.rst b/docs/source/morphology.rst
index 22c3700e8..5428757aa 100644
--- a/docs/source/morphology.rst
+++ b/docs/source/morphology.rst
@@ -2,8 +2,7 @@ kornia.morphology
======================
.. meta::
- :name: description
- :content: "The Kornia.morphology module offers a set of morphological image processing operations such as dilation, erosion, opening, closing, gradient, top hat, and bottom hat. It enables users to apply these transformations to images for advanced computer vision tasks. Try the interactive demo on Hugging Face Spaces."
+ :description: The Kornia.morphology module offers a set of morphological image processing operations such as dilation, erosion, opening, closing, gradient, top hat, and bottom hat. It enables users to apply these transformations to images for advanced computer vision tasks.
.. currentmodule:: kornia.morphology
@@ -14,11 +13,3 @@ kornia.morphology
.. autofunction:: gradient
.. autofunction:: top_hat
.. autofunction:: bottom_hat
-
-Interactive Demo
-~~~~~~~~~~~~~~~~
-.. raw:: html
-
- <gradio-app src="https://kornia-morphological-operators.hf.space"></gradio-app>
-
-Visit the demo on `Hugging Face Spaces <https://huggingface.co/spaces/kornia/morphological_operators>`_.
diff --git a/docs/source/onnx.rst b/docs/source/onnx.rst
index b2e90ee46..c3f871219 100644
--- a/docs/source/onnx.rst
+++ b/docs/source/onnx.rst
@@ -1,174 +1,16 @@
-ONNXSequential: Chain Multiple ONNX Models with Ease
-====================================================
+kornia.onnx
+===========
.. meta::
- :name: description
- :content: "The `ONNXSequential` class enables users to effortlessly chain and execute multiple ONNX models in a sequence, simplifying the creation of complex pipelines. It offers flexibility in input/output mapping, optimized execution with ONNXRuntime's providers (CPU, CUDA, etc.), and allows for exporting combined models. Ideal for real-time inference and multi-model workflows, ONNXSequential provides a simple API for efficient model management and deployment."
+ :description: API reference for kornia.onnx: ONNXModule, ONNXSequential to chain ONNX models and Kornia operators into one graph, and ONNXLoader to fetch pre-exported operators and models from the Hugging Face Hub.
-The `ONNXSequential` class is a powerful new feature that allows users to effortlessly combine and chain multiple ONNX models together. This is especially useful when you have several pre-trained models or custom ONNX operators that you want to execute sequentially as part of a larger pipeline.
+.. currentmodule:: kornia.onnx
-Whether you're working with models for inference, experimentation, or optimization, `ONNXSequential` makes it easier to manage, combine, and run ONNX models in a streamlined manner. It also supports flexibility in execution environments with ONNXRuntime's execution providers (CPU, CUDA, etc.).
+Run and compose ONNX models with ONNX Runtime: :class:`~kornia.onnx.sequential.ONNXSequential` chains several
+ONNX graphs (local files, ``onnx.ModelProto`` objects, or pre-exported Kornia operators and models from the
+``kornia/ONNX_models`` Hugging Face repository) into one model with a PyTorch-like call interface. The
+:doc:`ONNX support guide </get-started/onnx>` walks through installation, chaining, export and running on CUDA.
-Key Features
-------------
-
-- **Seamless Model Chaining**: Combine multiple ONNX models into a single computational graph.
-- **Flexible Input/Output Mapping**: Control how the outputs of one model are passed as inputs to the next.
-- **Export to ONNX**: Save the combined model into a single ONNX file for easy deployment and sharing.
-- **PyTorch-like Interface**: Use the `ONNXSequential` class like a PyTorch `nn.Sequential` model, including calling it directly for inference.
-
-Optimized Execution
--------------------
-- **ONNXRuntime**: Automatically create optimized `ONNXRuntime` sessions to speed up inference.
-- **Execution Providers Support**: Utilize ONNXRuntime's execution providers (e.g., `CUDAExecutionProvider`, `CPUExecutionProvider`, `TensorrtExecutionProvider`, `OpenVINOExecutionProvider`) for accelerated inference on different hardware.
-- **Concurrent Sessions**: You can manage multiple inference sessions concurrently, allowing for parallel processing of multiple inputs.
-- **Asynchronous API**: We offer asyncio-based execution along with the runtime's asynchronous functions to perform non-blocking inference.
-
-Quickstart Guide
-----------------
-
-Here's how you can quickly get started with `ONNXSequential`:
-
-1. **Install ONNX and ONNXRuntime**
-
- If you haven't already installed `onnx` and `onnxruntime`, you can install them using `pip`:
-
- .. code-block:: bash
-
- pip install onnx onnxruntime
-
-2. **Combining ONNX Models**
-
- You can initialize the `ONNXSequential` with a list of ONNX models or file paths. Models will be automatically chained together and optimized for inference.
-
- .. code-block:: python
-
- import numpy as np
- from kornia.onnx import ONNXSequential
-
- # Initialize ONNXSequential with two models, loading from our only repo
- onnx_seq = ONNXSequential(
- "hf://operators/kornia.color.gray.RgbToGrayscale",
- "hf://operators/kornia.geometry.transform.affwarp.Resize_512x512"
- )
-
- # Prepare some input data
- input_data = np.random.randn(1, 3, 256, 512).astype(np.float32)
-
- # Perform inference
- outputs = onnx_seq(input_data)
-
- # Print the model outputs
- print(outputs)
-
- .. note::
- By default, we assume each ONNX model contains only one input node named "input" and one output node named "output". For complex models, you may need to pass an `io_maps` argument.
-
-3. **Input/Output Mapping Between Models**
-
- When combining models, you can specify how the outputs of one model are mapped to the inputs of the next. This allows you to chain models in custom ways.
-
- .. code-block:: python
-
- io_map = [("model1_output_0", "model2_input_0"), ("model1_output_1", "model2_input_1")]
- onnx_seq = ONNXSequential("model1.onnx", "model2.onnx", io_map=io_map)
-
-4. **Exporting the Combined Model**
-
- You can easily export the combined model to an ONNX file:
-
- .. code-block:: python
-
- # Export the combined model to a file
- onnx_seq.export("combined_model.onnx")
-
-5. **Optimizing with Execution Providers**
-
- Leverage ONNXRuntime's execution providers for optimized inference. For example, to run the model on a GPU:
-
- .. code-block:: python
-
- # Initialize with CUDA execution provider
- onnx_seq = ONNXSequential(
- "hf://operators/kornia.geometry.transform.flips.Hflip",
- # Or you may use a local model with either a filepath "YOUR_OWN_MODEL.onnx" or a loaded ONNX model.
- "hf://models/kornia.models.detection.rtdetr_r18vd_640x640",
- providers=['CUDAExecutionProvider']
- )
-
- # Run inference
- outputs = onnx_seq(input_data)
-
-Frequently Asked Questions (FAQ)
---------------------------------
-
-**1. Can I chain models from different sources?**
-
-Yes! You can chain models from different ONNX files or directly from `onnx.ModelProto` objects. `ONNXSequential` handles the integration and merging of their graphs.
-
-**2. What happens if the input/output sizes of models don't match?**
-
-You can use the `io_map` parameter to control how outputs of one model are mapped to the inputs of the next. This allows for greater flexibility when chaining models with different architectures.
-
-**3. Can I use custom ONNXRuntime session options?**
-
-Absolutely! You can pass your own session options to the `create_session` method to fine-tune performance, memory usage, or logging.
-
-**4. How to run with CUDA?**
-
-For using CUDA ONNXRuntime, you need to install `onnxruntime-gpu`.
-For handling different CUDA version, you may refer to
-https://github.com/microsoft/onnxruntime/issues/21769#issuecomment-2295342211.
-
-For example, to install `onnxruntime-gpu==1.19.2` under CUDA 11.X, you may install with:
-
-.. code-block:: console
-
- pip install onnxruntime-gpu==1.19.2 --extra-index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/onnxruntime-cuda-11/pypi/simple/
-
-You may then convert your sequence to CUDA, such as:
-
-.. code-block:: python
-
- import kornia
- onnx_seq = ONNXSequential(
- "hf://operators/kornia.geometry.transform.flips.Hflip",
- "hf://models/kornia.models.detection.rtdetr_r18vd_640x640", # Or you may use "YOUR_OWN_MODEL.onnx"
- )
- inp = kornia.utils.sample.get_sample_images()[0].numpy()[None]
- import time
- onnx_seq.as_cuda()
- onnx_seq(inp) # GPU warm up
- start_time = time.time()
- onnx_seq(inp)
- print("--- GPU %s seconds ---" % (time.time() - start_time))
- onnx_seq.as_cpu()
- start_time = time.time()
- onnx_seq(inp)
- print("--- %s seconds ---" % (time.time() - start_time))
-
-You may get a decent improvement:
-
-.. code-block:: console
-
- --- GPU 0.014804363250732422 seconds ---
- --- CPU 0.17681646347045898 seconds ---
-
-Why Choose ONNXSequential?
---------------------------
-
-With the increasing adoption of ONNX for model interoperability and deployment, `ONNXSequential` provides a simple yet powerful interface for combining models and operators. By leveraging ONNXRuntime's optimization and execution provider capabilities, it gives you the flexibility to:
-- Deploy on different hardware (CPU, GPU, TensorRT, OpenVINO, etc.).
-- Run complex pipelines in production environments.
-- Combine and experiment with models effortlessly.
-
-Whether you're building an advanced deep learning pipeline or simply trying to chain pre-trained models, `ONNXSequential` makes it easy to manage, optimize, and execute ONNX models at scale.
-
-Get started today and streamline your ONNX workflows!
-
-
-API Documentation
------------------
.. autoclass:: kornia.onnx.module.ONNXModule
:members:
@@ -176,12 +18,13 @@ API Documentation
:members:
.. autoclass:: kornia.onnx.utils.ONNXLoader
+ :members:
.. code-block:: python
- # Load a HuggingFace operator
- ONNXLoader.load_model("hf://operators/kornia.color.gray.GrayscaleToRgb") # doctest: +SKIP
- # Load a local converted/downloaded operator
- ONNXLoader.load_model("operators/kornia.color.gray.GrayscaleToRgb") # doctest: +SKIP
+ from kornia.onnx.utils import ONNXLoader
- :members:
+ # Load a Hugging Face operator
+ ONNXLoader.load_model("hf://operators/kornia.color.gray.GrayscaleToRgb")
+ # Load a local converted/downloaded operator
+ ONNXLoader.load_model("operators/kornia.color.gray.GrayscaleToRgb")
diff --git a/docs/source/sensors.camera.rst b/docs/source/sensors.camera.rst
index 8a462a6f0..b562df536 100644
--- a/docs/source/sensors.camera.rst
+++ b/docs/source/sensors.camera.rst
@@ -2,8 +2,7 @@ kornia.sensors.camera
======================
.. meta::
- :name: description
- :content: "The `kornia.sensors.camera` module provides tools to define and manipulate various camera models, including the Pinhole model. It allows users to specify distortion and projection types in a differentiable way. While currently supporting only the Pinhole model, the module aims to extend its support to other models like Kannala Brandt and Orthographic. It also enables users to define custom camera models using distortion and projection types."
+ :description: The `kornia.sensors.camera` module provides tools to define and manipulate various camera models, including the Pinhole model. It allows users to specify distortion and projection types in a differentiable way. While currently supporting only the Pinhole model, the module aims to extend its support to other models like Kannala Brandt and Orthographic. It also enables users to define custom camera models using distortion and projection types.
.. currentmodule:: kornia.sensors.camera
@@ -12,22 +11,23 @@ kornia.sensors.camera
The objective of :mod:`kornia.sensors.camera` is to express well-known camera models such as Pinhole, Kannala Brandt, and others in terms of distortion and projection types while ensuring differentiability.
We also aim to equip the user with tools to define custom camera models.
-As of now, only the Pinhole model is supported.
Defining a `Pinhole` camera model is as simple as:
.. code:: python
+ import torch
from kornia.image import ImageSize
from kornia.sensors.camera import CameraModel, CameraModelType
- params = torch.tensor([328., 328., 320., 240.]) # fx, fy, cx, cy
+ params = torch.tensor([328., 328., 320., 240.]) # fx, fy, cx, cy
cam = CameraModel(ImageSize(480, 640), CameraModelType.PINHOLE, params)
-To define a custom camera model based on distortion and projection types, one can use the :class:`CameraModelBase` api:
+To define a custom camera model based on distortion and projection types, one can use the :class:`CameraModelBase` API:
.. code:: python
+ import torch
from kornia.image import ImageSize
from kornia.sensors.camera import CameraModelBase
from kornia.sensors.camera.distortion_model import AffineTransform
@@ -36,9 +36,8 @@ To define a custom camera model based on distortion and projection types, one ca
params = torch.tensor([328., 328., 320., 240.])
cam = CameraModelBase(AffineTransform(), Z1Projection(), ImageSize(480, 640), params)
-
.. note::
- At the moment, the only supported model is Pinhole. However, we plan to add Kannala Brandt, Orthographic, and other models in the near future.
+ At the moment, the only supported model is Pinhole. We plan to add Kannala-Brandt, orthographic, and other models in the future.
.. autoclass:: CameraModelBase
:members:
diff --git a/docs/source/sensors.rst b/docs/source/sensors.rst
index 3b18840c9..44ce066a5 100644
--- a/docs/source/sensors.rst
+++ b/docs/source/sensors.rst
@@ -2,10 +2,9 @@ kornia.sensors
===============
.. meta::
- :name: description
- :content: "The Kornia.sensors module provides interfaces for sensor data handling, including Camera, IMU, and GNSS sensors. Note that this API is experimental and subject to future changes. Explore sensor-related functionalities within the module."
+ :description: The Kornia.sensors module provides interfaces for sensor data handling, including Camera, IMU, and GNSS sensors. Note that this API is experimental and subject to future changes. Explore sensor-related functionalities within the module.
-Aims to provide interfaces to sensors like Camera, IMU, GNSS etc.
+This package aims to provide interfaces to sensors such as cameras, IMUs and GNSS receivers.
.. currentmodule:: kornia.sensors
@@ -14,6 +13,6 @@ Aims to provide interfaces to sensors like Camera, IMU, GNSS etc.
:mod:`kornia.sensors` is an experimental API and is subject to change.
.. toctree::
- :maxdepth: 3
+ :maxdepth: 2
- sensors.camera
+ camera models <sensors.camera>
diff --git a/docs/source/tracking.rst b/docs/source/tracking.rst
index 66b66d022..3a29e44c9 100644
--- a/docs/source/tracking.rst
+++ b/docs/source/tracking.rst
@@ -2,8 +2,7 @@ kornia.tracking
===============
.. meta::
- :name: description
- :content: "The `kornia.tracking` module provides tools for tracking objects across frames in computer vision tasks. It includes classes like `HomographyTracker` to estimate homography transformations and track objects over time."
+ :description: The `kornia.tracking` module provides tools for tracking objects across frames in computer vision tasks. It includes classes like `HomographyTracker` to estimate homography transformations and track objects over time.
.. currentmodule:: kornia.tracking
diff --git a/kornia/geometry/transform/affwarp.py b/kornia/geometry/transform/affwarp.py
index 6dbe50f3b..8c527d89d 100644
--- a/kornia/geometry/transform/affwarp.py
+++ b/kornia/geometry/transform/affwarp.py
@@ -792,10 +792,6 @@ class Resize(nn.Module):
>>> print(out.shape)
torch.Size([1, 3, 6, 8])
- .. raw:: html
-
- <gradio-app src="https://kornia-kornia-resize-antialias.hf.space"></gradio-app>
-
"""
def __init__(
diff --git a/pyproject.toml b/pyproject.toml
index 945305bb3..a273e4995 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -57,6 +57,7 @@ dev = [
]
docs = [
"furo",
+ "pydata-sphinx-theme",
"ivy>=1.0.0.0",
"kornia_moons",
"matplotlib",
@@ -90,7 +91,7 @@ build-backend = "hatchling.build"
[tool.codespell]
ignore-words-list = "ans,hist,laf,cofusion"
-skip = "*.bib,*.ipynb"
+skip = "*.bib,*.ipynb,docs/source/_data/dependents.json"
[tool.coverage.run]
branch = true
diff --git a/uv.lock b/uv.lock
index c42789763..6fb7f8bc8 100644
--- a/uv.lock
+++ b/uv.lock
@@ -993,6 +993,7 @@ docs = [
{ name = "onnx" },
{ name = "onnxruntime" },
{ name = "opencv-python" },
+ { name = "pydata-sphinx-theme" },
{ name = "pyyaml" },
{ name = "sphinx" },
{ name = "sphinx-autodoc-defaultargs" },
@@ -1026,6 +1027,7 @@ requires-dist = [
{ name = "packaging" },
{ name = "pillow", marker = "extra == 'dev'" },
{ name = "pre-commit", marker = "extra == 'dev'" },
+ { name = "pydata-sphinx-theme", marker = "extra == 'docs'" },
{ name = "pytest", marker = "extra == 'dev'" },
{ name = "pytest-cov", marker = "extra == 'dev'" },
{ name = "pytest-timeout", marker = "extra == 'dev'" },
@@ -1452,7 +1454,7 @@ name = "nvidia-cudnn-cu12"
version = "9.10.2.21"
source = { registry = "https://pypi.org/simple" }
dependencies = [
- { name = "nvidia-cublas-cu12" },
+ { name = "nvidia-cublas-cu12", marker = "(platform_machine != 'aarch64' and platform_machine != 's390x' and sys_platform == 'linux') or (platform_machine != 's390x' and sys_platform != 'darwin' and sys_platform != 'linux')" },
]
wheels = [
{ url = "https://files.pythonhosted.org/packages/ba/51/e123d997aa098c61d029f76663dedbfb9bc8dcf8c60cbd6adbe42f76d049/nvidia_cudnn_cu12-9.10.2.21-py3-none-manylinux_2_27_x86_64.whl", hash = "sha256:949452be657fa16687d0930933f032835951ef0892b37d2d53824d1a84dc97a8", size = 706758467, upload-time = "2025-06-06T21:54:08.597Z" },
@@ -1463,7 +1465,7 @@ name = "nvidia-cufft-cu12"
version = "11.3.3.83"
source = { registry = "https://pypi.org/simple" }
dependencies = [
- { name = "nvidia-nvjitlink-cu12" },
+ { name = "nvidia-nvjitlink-cu12", marker = "(platform_machine != 'aarch64' and platform_machine != 's390x' and sys_platform == 'linux') or (platform_machine != 's390x' and sys_platform != 'darwin' and sys_platform != 'linux')" },
]
wheels = [
{ url = "https://files.pythonhosted.org/packages/1f/13/ee4e00f30e676b66ae65b4f08cb5bcbb8392c03f54f2d5413ea99a5d1c80/nvidia_cufft_cu12-11.3.3.83-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:4d2dd21ec0b88cf61b62e6b43564355e5222e4a3fb394cac0db101f2dd0d4f74", size = 193118695, upload-time = "2025-03-07T01:45:27.821Z" },
@@ -1490,9 +1492,9 @@ name = "nvidia-cusolver-cu12"
version = "11.7.3.90"
source = { registry = "https://pypi.org/simple" }
dependencies = [
- { name = "nvidia-cublas-cu12" },
- { name = "nvidia-cusparse-cu12" },
- { name = "nvidia-nvjitlink-cu12" },
+ { name = "nvidia-cublas-cu12", marker = "(platform_machine != 'aarch64' and platform_machine != 's390x' and sys_platform == 'linux') or (platform_machine != 's390x' and sys_platform != 'darwin' and sys_platform != 'linux')" },
+ { name = "nvidia-cusparse-cu12", marker = "(platform_machine != 'aarch64' and platform_machine != 's390x' and sys_platform == 'linux') or (platform_machine != 's390x' and sys_platform != 'darwin' and sys_platform != 'linux')" },
+ { name = "nvidia-nvjitlink-cu12", marker = "(platform_machine != 'aarch64' and platform_machine != 's390x' and sys_platform == 'linux') or (platform_machine != 's390x' and sys_platform != 'darwin' and sys_platform != 'linux')" },
]
wheels = [
{ url = "https://files.pythonhosted.org/packages/85/48/9a13d2975803e8cf2777d5ed57b87a0b6ca2cc795f9a4f59796a910bfb80/nvidia_cusolver_cu12-11.7.3.90-py3-none-manylinux_2_27_x86_64.whl", hash = "sha256:4376c11ad263152bd50ea295c05370360776f8c3427b30991df774f9fb26c450", size = 267506905, upload-time = "2025-03-07T01:47:16.273Z" },
@@ -1503,7 +1505,7 @@ name = "nvidia-cusparse-cu12"
version = "12.5.8.93"
source = { registry = "https://pypi.org/simple" }
dependencies = [
- { name = "nvidia-nvjitlink-cu12" },
+ { name = "nvidia-nvjitlink-cu12", marker = "(platform_machine != 'aarch64' and platform_machine != 's390x' and sys_platform == 'linux') or (platform_machine != 's390x' and sys_platform != 'darwin' and sys_platform != 'linux')" },
]
wheels = [
{ url = "https://files.pythonhosted.org/packages/c2/f5/e1854cb2f2bcd4280c44736c93550cc300ff4b8c95ebe370d0aa7d2b473d/nvidia_cusparse_cu12-12.5.8.93-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:1ec05d76bbbd8b61b06a80e1eaf8cf4959c3d4ce8e711b65ebd0443bb0ebb13b", size = 288216466, upload-time = "2025-03-07T01:48:13.779Z" },
@@ -1872,6 +1874,25 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/a0/e3/59cd50310fc9b59512193629e1984c1f95e5c8ae6e5d8c69532ccc65a7fe/pycparser-2.23-py3-none-any.whl", hash = "sha256:e5c6e8d3fbad53479cab09ac03729e0a9faf2bee3db8208a550daf5af81a5934", size = 118140, upload-time = "2025-09-09T13:23:46.651Z" },
]
+[[package]]
+name = "pydata-sphinx-theme"
+version = "0.21.0"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "accessible-pygments" },
+ { name = "babel" },
+ { name = "beautifulsoup4" },
+ { name = "docutils" },
+ { name = "jinja2" },
+ { name = "pygments" },
+ { name = "requests" },
+ { name = "sphinx" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/bd/ac/692035c97b732b26ee269fb14ec790046b21c7383a46bedfb3d40c3a4884/pydata_sphinx_theme-0.21.0.tar.gz", hash = "sha256:dc3f71216ea34725ddad68e505497eab4ba134a88abfb971a7df6b28a35c1997", size = 5010490, upload-time = "2026-08-25T14:16:47.949Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/b5/8d/fb90c2ada1a938ba55f1730139f4d43736aee22d5f82f927c64cd858256f/pydata_sphinx_theme-0.21.0-py3-none-any.whl", hash = "sha256:d36a754bf9580b01789efa8a01869f2d7c87fa6c543ecbcafb14b6bdd4364f90", size = 6208465, upload-time = "2026-08-25T14:16:46.223Z" },
+]
+
[[package]]
name = "pygments"
version = "2.20.0"