NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI
PyPI, #2577 most downloaded on PyPI
Open Source Differentiable Computer Vision Library for PyTorch
Latest stable
0.9.1
Last release 9 days ago
13 Nov 2026
Ships fairly regularly
a new release about every 4 months
Nearly every release is documented
notes for 44 of 46 stable releases
Nothing withdrawn
no release was ever pulled
7 years old
47 releases · first in 2019
Drag across the ruler to compare, or tap a release to open it.
31 entries in the changelog's Breaking changes section. Most are correctness fixes: inputs that used to give a wrong result silently now raise, or out…
Kornia 0.9.1 is a bug-fix, documentation and kornia.feature speed-up release. Requirements are the same as 0.9.0:
Python ≥ 3.11, PyTorch ≥ 2.5.1, NumPy ≥ 1.21 and kornia_rs ≥ 0.2.0.
Bug fixes. 192 fixes across augmentation, geometry, feature, filters, color, losses, contrib and the
models. Among them:
contrib.distance_transform computes exact Euclidean distances for binary images and volumes;get_tps_transform solves the standard thin-plate spline and now matches scipy;apply_colormap gives every palette entry an equal share of the range, as matplotlib does;HausdorffERLoss no longer ignores misclassified pixels whose true-class probability is between 0.29 and 0.5;Normalize/Denormalize/Rescale register a torch.nn.Parameter argument again, so optimizers, torch.exportDocumentation. A new image-matching guide compares kornia's local-feature pipelines and matchers with the authors'
code, OpenCV and faiss for speed and accuracy, on CUDA, an x86 CPU and Apple M1. Plus clearer docstrings and newly
documented public exports.
Faster kornia.feature.
match_xfeat is 1.6–3.8x faster than one call per pair on CUDA.scaled_dot_product_attention on every device.match_snn, match_smnn, match_mnn): up to 7.7x faster on MPS and 1.2–1.9x on CUDA.kornia.feature: nms2d with 5×5/7×7 windows is 2–6x faster on CUDA, and get_gaussian_discrete_kernel1dBenchmarks. The 0.9.1 snapshots are in benchmarks/results/0.9.1/. They cover an Apple M1 Pro (CPU, MPS) and an
i7-14700K + RTX 4090 (CPU, CUDA), with the same torch 2.14 stack and baselines as 0.9.0. Compared with 0.9.0:
match_smnn is up tocanny is 1.5–6x faster on the M1 Pro and 1.2–3x on CUDA;distance_transform is 2–6x faster on CPU and 4–41x on CUDA. It is slower on MPS at batches 8 and 32Most other ops are unchanged. On the CUDA machine, kornia and torchvision v2 both measured up to about 15% slower at
small batches than in the 0.9.0 run; its WSL kernel was updated between the two runs.
31 entries in the changelog's Breaking changes section. Most are correctness fixes: inputs that used to give a wrong
result silently now raise, or outputs change because the old ones were wrong.
Now raise instead of returning a wrong result:
RandomCrop(pad_if_needed=False) with a crop larger than the input;RandomRotation90 on non-square input when an odd number of quarter turns is possible;AugmentationSequential with keypoints or boxes through RandomElasticTransform, RandomThinPlateSpline orRandomFisheye;warp_grid, homography_warp, transform_points and distort_points;ScalePyramid arguments and posterize bits outside [0, 8];BaseWarper / BaseModel.Change values:
get_tps_transform / warp_image_tps / RandomThinPlateSpline;apply_colormap;distance_transform with fractional masks;HausdorffERLoss;LightGlue("doghardnet") now prunes by default (pass depth_confidence=-1, width_confidence=-1 for the old matches);load_state_dict of augmentation ranges now takes effect.Change shapes, dtypes or API:
VideoBoxes.compute_area / to_mask and VideoKeypoints indexing use the video axis;XFeat.match_xfeat returns one match tensor per pair;ParametrizedLine.intersect keeps the plane batch shape;torch.autocast;StereoCamera.Q of a half-precision rig is float32;XFeat half outputs stay half;override_parameters drops unknown keys;OperationBase.magnitude_range is read-only;MS_SSIMLoss restored from an old whole-module pickle no longer scripts;kornia.models.paligemma, unfinished and undocumented, is removed (use transformers).validate_bbox/validate_bbox3d on invalid boxes, bbox_to_mask(width, height), PinholeCamera with
(B, N, 4, 4) matrices, Boxes.trim, Keypoints3D.pad/unpad and others now warn. They will change in a future
release. See Added in the changelog.
NotImplementedError. RANSAC with the homography and fundamental models needs torch 2.7,find_homography_dlt (default solver="lu") needs torch 2.10, and find_fundamental (default 8-point) needsPYTORCH_ENABLE_MPS_FALLBACK=1 runs them on any torch. Details: #6773, #6774.Full notes: CHANGELOG.md, 0.9.1.
Posted on behalf of @ducha-aiki by Claude (Opus 5.5).
Your coding agent can read these notes before it upgrades. Set up the MCP server →
validate_bbox, and validate_bbox3d for a non-finite coordinate, emit a FutureWarning when they return False: a future release raises AssertionError instead, as validate_bbox3d already does for other invalid boxes. Both validators now synchronize with the device once per call, which roughly halves their cost on MPS and speeds up infer_bbox_shape3d and bbox_to_mask3d. (#6324)Keypoints3D.transform_keypoints and transform_keypoints_ are implemented and apply a (4, 4) or (B, 4, 4) matrix like their 2D counterparts. Keypoints3D.pad and unpad, which were never implemented and always raised NotImplementedError, are deprecated, now also emit a DeprecationWarning, and will be removed in a future release. (#6326)Boxes.trim, which was never implemented and always raised NotImplementedError, is deprecated and now also emits a DeprecationWarning; it will be removed in a future release. Boxes.clamp is annotated to take tensor bounds only, and 'fast' is no longer listed as a Boxes.translate method; both paths always raised. (#6327)p_batch and that it can be set as an attribute; only RandomHorizontalFlip, RandomVerticalFlip, RandomTransplantation and RandomTransplantation3D take it in the constructor. (#6330)PinholeCamera with (B, N, 4, 4) intrinsics or extrinsics is deprecated and emits a DeprecationWarning; it will raise in a future release, because project and unproject never supported that layout. Flatten the cameras into the batch dimension and pass (B, 4, 4) tensors. (#6331)DataKey, is_powerof_two, find_next_powerof_two, KORNIA_CHECK_SAME_SHAPE and
KORNIA_CHECK_IS_COLOR_OR_GRAY are declared public: they are in their modules' __all__ and in the API
reference. They were already importable and used downstream. (#6332)kornia.core.exceptions.AsyncCheckError, a ValueCheckError that is also a RuntimeError. A tensor value check that runs as torch._assert_async on an accelerator raises it on the host: for a CPU tensor, and on MPS before torch 2.13. except RuntimeError therefore handles that check on every device, and the gaussian_blur2d sigma check still raises a BaseError on the CPU. (#6342)kornia.geometry.bbox.bbox_to_mask takes size=(height, width), the order of bbox_to_mask3d and Boxes.to_mask. Passing width and height still works but emits a DeprecationWarning; those arguments will be removed in a future release. (#6343)resize_to_be_divisible emits a DeprecationWarning when side is passed; the argument will be removed in a future release. It never had an effect, because both sides are rounded to a multiple of divisible_factor, and results do not change. get_sample_images passes its side keyword only to resize when resize is given. (#6408)LightGlue computes its cross-attention with torch.nn.functional.scaled_dot_product_attention on every device, as its self-attention already did, instead of only on CUDA with flash=True. In float32 the matches are the same and the scores move by rounding; in half precision, rounding can also change a few matches. A 2048-keypoint DISK pair matches 1.3-1.7x faster on an Apple M1 CPU, 1.2-1.5x faster on MPS and 2.3-4x faster on an x86 CPU (i7-14700K). On CUDA the default flash=True runs as before, and flash=False matches 1.1-1.2x faster. (#6417)ALIKED computes the per-keypoint convolutions of its descriptor head (SDDH) as matrix products with the same weights. At 2048 keypoints on a 480 x 640 image, this makes the head about 3x faster and the whole forward about 1.5x faster on an Apple M1 CPU, where conv2d sent these inputs to NNPACK. On an x86 CPU (i7-14700K), which uses oneDNN, the head and the forward are about 5 % faster, and on CUDA the head is about 10 % faster. On CPU the descriptors change at float32 rounding level only. On CUDA they move closer to float64, because the convolutions ran in TF32 by default (torch.backends.cudnn.allow_tf32) and the matrix products do not (torch.backends.cuda.matmul.allow_tf32 is off by default). (#6423)SOLD2_detector neither builds nor runs the descriptor head of the SOLD2 network, whose output it never used: the same junctions, heatmaps and line segments, 7 % fewer parameters, and a network forward about 7 % faster at 512 x 512 on an Apple M1, on CPU and MPS; the whole detector, whose line detection is unchanged, is about 3 % faster on CPU. Weights saved with the head still load. SOLD2_detector also downloads the pretrained checkpoint from the Hugging Face mirror with a fallback, the same file SOLD2 uses, instead of a single ETH URL, so the two classes share one cached copy. (#6424)LightGlueMatcher accepts the "xfeat" and "raco-aliked" modes, whose weights LightGlue already loads. With "xfeat", pass the descriptors of XFeat.detectAndCompute and LAFs centred on its keypoints. (#6428)torch.cdist instead of a manual fallback: match_snn and match_smnn run 1.4-1.9x faster at 6000 descriptors, and unmasked match_smnn_batched runs 7.7x faster and needs about a third of the memory at 2 x 3000. Under export the distance fallback broadcasts instead of repeating the squared norms, with the same result, and runs 1.3-1.8x faster. (#6429)DeDoDe G descriptor uses torch.nn.functional.scaled_dot_product_attention instead of materialising the attention weights of every head; only training mode with a non-zero attn_drop, which no kornia builder sets, still materialises them. On an Apple M1 the attention layer is about 2x faster on the CPU, and the whole 24-block ViT-L backbone 1.3x faster on the CPU at 476 x 644 and 1.1 to 1.2x faster on MPS at 476 x 644 and 784 x 784. The extra CPU memory of one attention layer at 784 x 784 falls from 1.3 GB to 73 MB, and the outputs agree with the previous ones to float32 rounding. (#6430)crop_by_boxes emits a DeprecationWarning when validate_boxes is passed as True or False; the argument will be removed in a future release. Up to kornia 0.7.1 it rejected non-rectangular boxes; since 0.7.2 it has had no effect, and results do not change. (#6438)kornia.feature package docstring and the ALIKED, SIFTFeature, SIFTFeatureScaleSpace, match_snn and match_smnn docstrings carry the same guidance, including where kornia is slower and what to use instead. The top-level kornia docstring, which help(kornia) shows, says when kornia pays off and when plain PyTorch or torchvision is just as good, and points to the conventions and performance pages. (#6452)torch.no_grad() or torch.inference_mode(), ALIKED and kornia.feature.aliked.deform_conv2d sample the deformable convolution with one grid_sample call over every offset group instead of four gathers per sample. On an Apple M1 the ALIKED-n16 forward of a 640 x 512 image is 1.8x faster on MPS, in float32 and float16, and 5 % faster on CPU; outputs change by rounding. Half-precision inputs are sampled in float32, as accurately as before. With autograd enabled the previous sampler stays: grid_sample's normalized coordinates can round a sample at an integer position onto the previous pixel and give it that pixel's derivative. (#6464)match_snn and match_smnn find the nearest and second-nearest distance of each descriptor with two row reductions instead of torch.topk, with the same matches and ratios, nan and infinite distances included. On an Apple M1, given 2048 x 2048 to 8000 x 8000 distance matrices, match_snn is 2.3x faster and match_smnn 1.5-1.8x faster; with the distance computation, both are 1.2-1.7x faster. The reductions take a transient copy of the distance matrix, 2.25 times its size for match_smnn. CPU and CUDA keep torch.topk, which is faster there: the reductions were 2-5x slower on an x86 CPU and no faster on CUDA. (#6465)nms2d and NonMaximaSuppression2d with a (5, 5) or (7, 7) window take the separable max-pool path instead of their 24- or 48-comparison chains for floating-point maps, with the same masks. On an RTX 4090 the suppression is 2-6x faster for 480 x 640 to 960 x 1280 maps, and the extraction of XFeat, DISK and ALIKED, which suppress with a 5 x 5 window, is 3-5% faster. CPU, MPS and integer maps keep the comparison chains: they are faster on CPU, and before torch 2.16 MPS max_pool2d mishandles nan and -inf. (#6474)ALIKED.extract_dense_map takes a keyword-only channels_last flag, False by default, which returns the feature map
with the strides of torch.channels_last. ALIKED.forward and ALIKED.forward_laf use it for a float32 or float64
image on CPU, where normalising the map and sampling it for the descriptors are several times faster: the ALIKED-n16
forward is 1.18-1.36x faster on an Apple M1 and 1.30-1.57x on an x86 i7-14700K, from 1024 x 768 to 640 x 480. Keypoints,
scores and LAFs are unchanged, and float32 descriptors change by rounding (a few 1e-6). MPS and CUDA keep the previous
layout, which is faster there, as do float16 and bfloat16 on CPU, where torch's half-precision grid_sample is
unreliable in either layout (#5810). (#6498)XFeat.match_xfeat_star finds the nearest neighbour of each second-image descriptor with a second matrix product and a
row-wise argmax, instead of an argmax down the columns of the similarity matrix, and frees the first matrix before
computing the second. XFeat* matching of a 640 x 480 pair is 1.26x faster on an Apple M1 CPU and 1.07-1.25x on an x86
i7-14700K, with identical matches. On CUDA (RTX 4090) the speed is unchanged, and the call's peak memory falls from 450
to 66 MiB at top_k=4096, because the column argmax allocated about six times the similarity matrix in scratch. MPS is
unchanged. (#6499)HardNet, HardNet8, SOSNet, TFeat, HyNet, LAFAffNetShapeEstimator and OriNet now run their convolutions in
channels-last memory layout where that is faster, also when scripted with TorchScript (LAFAffNetShapeEstimator does
not script): on MPS in float32 and float16, where their convolution bodies are 1.04-1.38x faster on an Apple M1; on CUDA
in float16 and bfloat16, where their forwards on 2048 patches are 1.08-1.44x faster on an RTX 4090; and on CPU in
float32 when torch is built with oneDNN, where they are 1.2-1.5x faster on an x86 i7-14700K (HardNet8 gains only at
the default thread count). CUDA float32 keeps the default layout, which is faster there. HardNet used to convert on
every CPU float32 build, including the macOS arm64 wheels, whose NNPACK convolutions take only the default layout, so
the conversion was a copy that changed nothing. Outputs agree up to rounding: bitwise on MPS, and within the dtype's
rounding on x86 CPUs and on CUDA. (#6502, #6567)match_nn, match_mnn, match_snn and match_smnn select their matches on squared distances, the matrix product
that torch.cdist computes before its square root, and take the square root of the selected distances only. On CUDA,
the ratio tests of match_snn and match_smnn find the two nearest neighbours with two minimum reductions instead of
torch.topk. The returned distances and ratios are bit for bit those of torch.cdist. On an RTX 4090 with 4,096 to
8,192 RootSIFT descriptors per image, the four are 1.2-2.6x faster. On an x86 i7-14700K they are 1.1-1.4x faster from
1,024 descriptors on. Two distances that differ only below the precision of their square roots are no longer tied, and
the nearer one is returned. The matchers keep torch.cdist in these cases: inputs that need gradients, half precision,
autocast, exported or traced calls, MPS, and matrices smaller than 2,048 x 2,048 on CUDA or 256 x 256 on the CPU. (#6509)find_fundamental(..., method="AFFINE") estimates the affine fundamental matrix of two affine cameras (weak-perspective or other parallel-projection views, such as aerial images taken with a long focal length) from four or more correspondences, by the Gold Standard orthogonal regression of Hartley and Zisserman's algorithm 14.1, and RANSAC("fundamental_affine") estimates it robustly from four-point samples, with the exact geometric distance as its residual. (#6569)VideoKeypoints.from_tensor and ModelBaseMixin.save emit a DeprecationWarning when validate_boxes or is_batch is passed as True or False; the arguments will be removed in a future release. Neither argument has ever had an effect, and results do not change. VideoKeypoints.from_tensor now has a docstring, and its shape error names keypoints instead of boxes. (#6583)random_apply with a count below the number of children and above the sum of random_apply_weights, or with a range that can draw a count above that sum which the children can fill, such as PatchSequential with patchwise_apply=True, now warns: it will stop repeating children in a future minor release. How often each child runs will change too: with weights [0.9, 0.05, 0.05] and random_apply=2, each 0.05 child runs in about 10% of calls today and will run in about 50%. Weights that sum to at least the count already give the new behavior. (#6592)build_laplacian_pyramid gains minimal_padding=True, which pads a side only when max_level requires it and only to the next multiple of 2 ** (max_level - 1), so a 480x640 image at three levels stays 480x640 instead of becoming 512x1024; a side too small to reflect repeats its last row or column, or raises a clear error under border_type="reflect". The current rule stays the default (minimal_padding=None) and now warns on the calls whose level shapes will change when a future minor release makes minimal_padding=True the default; minimal_padding=False keeps the current rule without the warning, and after that change keeps it for one more minor release with a deprecation warning. The values of each level change as well, even after cropping (up to 0.354 on a 5x8 image whose rows hold their index); an image rebuilt from the levels and cropped to the input size stays the same up to float rounding. (#6631)kornia.filters.canny avoids redundant floating-point convolution during hysteresis tracking by using separable boolean dilation, and avoids the stacked non-maximum-suppression window by comparing neighbor slices directly. Rounded atan2 sector decisions, including floating-point boundary behavior, are preserved. (#6668)RANSAC(compile=True) documentation now limits the CPU-then-CUDA inductor-cache segfault to PyTorch before 2.15. PyTorch 2.15.0 saves a separate CUDA program and no longer reproduces it. (#6686)adjust_gamma, adjust_contrast, histogram, histogram2d, render_gaussian2d, equalize and equalize3d (and the AdjustGamma and AdjustContrast modules) skip their value checks on CUDA tensors, as do graphs recorded with torch.jit.trace on every device. (#6708)find_fundamental with method="7POINT" or "8POINT", are fast again on CUDA with torch 2.15 when no gradient is needed. Torch 2.15 factorizes batches of non-square matrices one matrix at a time on CUDA (pytorch/pytorch#200581), which made CUDA RANSAC 2-270x slower than on torch 2.14, growing with the sample budget. The batched LU null space now factorizes square matrices padded with zero columns in one batched kernel: 8,192 seven- or eight-point samples take about 0.3 ms instead of 920 ms on an RTX 4090, and on torch 2.14 RANSAC is 3-14% faster than before. Results are unchanged, except that on this path an exactly rank-deficient minimal sample gives a NaN model instead of an arbitrary one from its larger null space, which RANSAC already discards as degenerate. A sample with a repeated correspondence is the common case: find_fundamental(..., method="8POINT") with exactly eight points, one of them repeated, can now return NaN on CUDA where the CPU returns an arbitrary matrix. CPU, gradients and find_homography_dlt are unchanged. (#6740)get_gaussian_discrete_kernel1d computes all its modified Bessel orders in one pass of each recurrence (backward and upward) instead of one pass per order, so its cost grows linearly instead of quadratically with the kernel size: about 14x faster at 31 taps and 60x faster at 121 taps on CPU and CUDA, with bitwise identical kernels. (#6741)adjust_gamma, AdjustGamma and RandomGamma clamp their result in place when no gradient is recorded, so each call allocates one image-sized buffer fewer. Eager CPU calls on a batch of 32 images of 256 × 256 are about 1.2 times as fast. Values and gradients are unchanged. (#6771)psnr, psnr_loss and PSNRLoss compute float16 and bfloat16 images in float32, including a tensor data range. The result uses the promoted image dtype, also promoted with a tensor max_val dtype; a float32 tensor data range gives a float32 result for half-precision images. In float16, max_val**2 / mse overflowed, so every PSNR above 48.16 dB (8-bit quantization of a float image alone gives about 59 dB) came back as inf and psnr_loss gradients were NaN. (#5780)
aepe and AEPE compute float16 and bfloat16 flows in float32 and return the result in the input dtype. In float16 the squared distance overflowed, so an endpoint error of 256 px or more came back as inf, turned the mean into inf, and had a zero gradient. (#5781)
mean_iou_bbox converts float16 and bfloat16 xywh and cxcywh boxes to corners in float32. The corners used to be rounded in the box dtype first: in float16, 289.5 + 22.375 became 312.0, which moved the IoU of that pair from 0.4994 to 0.5029, and a 1 px wide box at x = 2048 collapsed to zero width and raised AssertionError. (#5782)
depth_to_3d, depth_to_3d_v2, warp_frame_depth and depth_to_normals now build the pixel grid in the promoted dtype of depth and camera_matrix instead of in the dtype of depth. In 0.9.0, uint8 and int8 depth wrapped the column index past 255 and 127, and uint16 and uint32 depth raised NotImplementedError, in all four. In the first three, a bfloat16 depth map with float32 intrinsics also rounded the column index, putting X up to 2 px off at 640 px wide; float16 depth did so past 2048 px. (#6153)
spatial_softmax2d, and the soft-argmax functions built on it, no longer return NaN in float16 when a sharp temperature would push the scaled logits past the dtype range: the logits are shifted by their per-map maximum before the division. (#6206)
quaternion_exp_to_log returns the derivative of the log map at a quaternion with a zero vector part and w > 0, the identity included: I / w with respect to (x, y, z) and 0 with respect to w. It returned an all-zero gradient there, so a rotation fitted through the log map from the identity quaternion never moved. For w > 0 the eps clamp no longer applies, so a vector part shorter than eps gets its true log and gradient: (1, 1e-9, 0, 0) returns 1e-9 with d log_x / dx = 1, where it returned 1e-10 and 0.2. For w <= 0 the clamp is unchanged. (#6208)
VisualPrompter now reports the unsupported configuration type and the accepted SamConfig or None alternatives instead of raising an empty NotImplementedError. (#6211)
fit_plane, fit_line, average_quaternions, solve_pnp_dlt, find_homography_dlt(solver="svd") and find_homography_lines_dlt return a finite gradient when the singular vector or eigenvector they keep is well defined but two of the other singular values or eigenvalues are equal. torch's SVD and eigh backward passes divide by the gap between every pair, so every entry of the gradient was NaN for some exact inputs, depending on the SVD backend: the corners of a square checkerboard (fit_plane), points along a coordinate axis (fit_line), identical members or rotations about one axis (average_quaternions), world points on the corners of a cube (solve_pnp_dlt) and the identity homography on an exact grid. The vector's value is unchanged; its gradient now divides only by the gaps to its own value, and equals the SVD's gradient to rounding wherever that is finite. Second derivatives use the same gaps, so they are finite at those inputs too. (#6214)
TranslateX and TranslateY in kornia.augmentation.auto.operations now read a learned magnitude, or one passed to forward_parameters, as a fraction of the image width or height, the same as a magnitude sampled from magnitude_range. They used to translate by that value in pixels, so the default TranslateX() moved the image by 0.2 pixels. RandAugment, TrivialAugment and AutoAugment already read their translate magnitudes as fractions, so their translations do not change. (#6216)
kornia.metrics.accuracy no longer reports accuracies above 100 % when target holds a different number of samples than pred: a one-entry target was compared with every row of pred and the count divided by 1, so accuracy(torch.tensor([[0.0, 1.0], [0.0, 1.0]]), torch.tensor([1])) returned [tensor(200.)]. Such calls now raise ShapeError, as do other malformed pred and target shapes. topk entries must be positive integers (Python or NumPy integers or integer tensors, not bools): a k of 0 used to report 0 %, and a negative k counted from the other end. A pred or target that is not a tensor now raises TypeCheckError, and tensors on different devices raise DeviceError. (#6220)
mean_absolute_disparity_error, root_mean_squared_disparity_error, mean_bad_pixel_error and kitti_d1_error move a valid_mask that is on another device than the disparity maps to the maps' device. In 0.9.0, a CPU mask with CUDA or MPS maps raised torch's RuntimeError under every reduction; it works again and gives the same result as a mask on the maps' device. Maps on two different devices now raise kornia's DeviceError instead of torch's RuntimeError. DeviceError is a ValueError, not a RuntimeError, so an except RuntimeError around such a call no longer catches it. A 0-d map on the CPU still combines with a 0-d map on another device, because torch treats a 0-d CPU tensor as a scalar. (#6227)
tversky_loss and TverskyLoss raise TypeError when target is not a tensor; it used to be an AttributeError, or a misleading device-mismatch ValueError for a NumPy array. They raise ValueError when alpha, beta or eps is a Python int or float that is negative, infinite or NaN (TverskyLoss at construction): a NaN weight returned a NaN loss, a negative one returned a meaningless loss (alpha=-0.5 could give a loss below 0), and an infinite one returned 1. Tensor-valued alpha, beta and eps, including one weight per class, are not checked and work as before. (#6229)
dice_loss and DiceLoss raise TypeCheckError, a TypeError, when target is not a tensor; it used to be an AttributeError, or a misleading device-mismatch ValueError for a NumPy array. They raise ValueError when eps is a negative Python int or float (DiceLoss at construction); such an eps used to be accepted: eps=-1e-8 gave the eps=0 loss, and eps=-inf gave 1. A tensor eps, including one per class, is not checked and works as before. DiceLoss also rejects an unknown average when it is created instead of at its first call. (#6230)
HausdorffERLoss and HausdorffERLoss3D raise TypeError for a pred or target that is not a tensor (was AttributeError) and DeviceError, a ValueError, for tensors on different devices (was torch's RuntimeError). Their constructors raise ValueError for an alpha that is NaN or +inf (the loss was NaN) and for a negative k (the loss was 0), and TypeError for a boolean k (counted as 0 or 1 erosions) or a k that is not an integer (TypeError in forward before); an unknown reduction raises the same NotImplementedError in the constructor instead of in forward. A k given as a NumPy integer or an integer tensor, k=0, a negative alpha and alpha=-inf still work. (#6234)
Functions that flattened a batch with reshape(B, -1) or view(B, -1) now accept empty batches instead of raising
"cannot reshape tensor of 0 elements" (#6266, group A): the 2D and 3D mutual-information losses and their FromRef
modules, lovasz_softmax_loss, lovasz_hinge_loss and their modules, determinant_to_polynomial, ALIKED,
XFeatModel and LoFTR. XFeat.detectAndCompute returns an empty list and XFeat.match_xfeat_star an empty list of
matches for an empty batch. determinant_to_polynomial also accepts a non-contiguous input, which raised "view size is
not compatible". A mutual-information signal with no samples raises a clear error instead of an IndexError. (#6238)
RandomFisheye returns finite gradients with respect to its center_x and center_y parameters when the distortion center falls exactly on a pixel, as a centered distortion does on an odd-sized image. They were NaN there. The output values are unchanged. (#6239)
copy.deepcopy of So2, So3, Se2, Se3, Quaternion, Hyperplane and ParametrizedLine no longer raises when their state carries autograd history, as for Se3.exp(v) with a v that requires grad. The copy holds that state as new leaves that keep requires_grad, still registered as buffers, like a torch.save / torch.load round trip, and the original keeps its history. (#6242)
The default TrivialAugment policy now posterizes to 4 to 8 bits, the same as RandAugment and AutoAugment. It used to draw from 0 to 4 bits, so one posterize draw in 8 returned an entirely black image, about 1% of all outputs. A policy passed explicitly is unchanged. (#6247)
ShearX and ShearY in kornia.augmentation.auto.operations, and with them the shear_x / shear_y entries of AutoAugment, RandAugment and TrivialAugment, now read the magnitude as a shear factor and map it to degrees with rad2deg(atan(magnitude)), as torchvision does. They used to multiply it by 180, so the top of the default range, 0.3, sheared by 54 degrees (a shear factor of 1.38) instead of about 16.7 degrees (a factor of 0.3). (#6252)
Brightness, Contrast and Saturate in kornia.augmentation.auto.operations, and with them the brightness, contrast and color entries of AutoAugment, RandAugment and TrivialAugment, now apply the PIL ImageEnhance formulas their 0.1 to 1.9 factor ranges come from: brightness multiplies the image by the factor, contrast blends each image with its mean grayscale level, and color blends it with its grayscale version. They used to add factor - 1 for brightness, multiply the image by the factor for contrast and scale the HSV saturation for color, so a brightness factor of 0.3 clipped most of an image to black. Saturate now also returns a single-channel image unchanged instead of raising. RandomBrightness, RandomContrast and RandomSaturation are unchanged. (#6254)
adjust_gamma, AdjustGamma and RandomGamma now return a zero gradient at black pixels (input 0) for a gamma between 0 and 1, where x ** gamma has an infinite derivative. The gradient there was NaN on torch 2.14 and inf on earlier releases, so every image with a black pixel gave a non-finite input gradient. Output values are unchanged. A graph captured by torch.jit.trace keeps the plain power, as in 0.9.0, so tracing a module whose parameters feed adjust_gamma passes the trace check. (#6255, #6772)
torch.jit.script(undistort_points_kannala_brandt) no longer hangs on CUDA from its second call. TorchScript unrolled the ten-step Gauss-Newton loop and its CUDA fuser inlined the steps into an expression that grew exponentially, until the process ran out of host memory. Eager outputs are unchanged. (#6258)
RandomThinPlateSpline and RandomFisheye now identify the augmentation and unsupported mask input in their existing NotImplementedError, including when p=0. (#6262)
kornia.image.Image now raises ShapeError when an int, float or one-element tensor size in its ImageLayout does not match the data. In 0.9.0 the layout check compared the sizes as strings and skipped any that were not all digits, so a tensor, float or negative size was never checked (CameraModel.scale returns tensor and float sizes), and height and width then reported the layout's size instead of the data's. A multi-element tensor size now raises RuntimeError when the Image is built. The ShapeError message, also for data with the wrong number of dimensions, now reads like Shape mismatch: expected (3, 9, 9), got [3, 4, 5].
Building an Image from x.shape, and depth_from_disparity with a (B,) baseline or focal, now compile under torch.compile(fullgraph=True) with dynamic shapes, including the automatic recompile at a second image or batch size; in 0.9.0 both raised Unsupported there. A (B,) parameter that does not match the batch now reports Shape mismatch: expected (2,), got [3]. (#6265)
bilateral_blur and joint_bilateral_blur take each window sum in one reduction again on the CPU and CUDA. In 0.9.0 they summed over the kernel's columns and then its rows, which rounded every partial sum to the input dtype and made float16 and bfloat16 gradients with respect to a tensor sigma_color or sigma_space up to about six times less accurate (float16 sigma_color: a relative error of 7.5e-2 instead of 1.3e-2). MPS keeps the two-step sum, which is much faster there, so on MPS those half-precision gradients stay less accurate; pass a float32 input there when they matter, since tensor sigmas take the input's dtype. (#6285)
Fix camera factories raising TypeError when constructing extrinsics from float rotation angles. (#6286)
RandomRotation90 now draws times uniformly over the whole numbers of its closed range. The draw used to be a continuous number that was then rounded, which gave the two end points half the probability of the others: times=(-1, 1) drew no turn about half of the time and each quarter turn about a quarter of the time (#4409). Seeded draws therefore differ from earlier releases, and an integer tensor range such as torch.tensor([0, 2]) now draws its upper bound too, where it used to draw only 0 and 1. A range with a fractional bound is drawn as before. (#6288)
HausdorffERLoss and HausdorffERLoss3D now support empty batches. (#6291)
The functions equalize_clahe, in_range, jpeg_codec_differentiable, the modules InRange and JPEGCodecDifferentiable, and the decorators perform_keep_shape_image and perform_keep_shape_video now accept an empty batch. In 0.9.0, an empty batch or any zero leading dimension raised ValueError: Invalid input tensor, it is empty.. Now an empty batch or any zero leading dimension returns an empty result. For example, an input image of shape (0, 3, H, W) gives an output of (0, 3, H, W); for a mask returned by in_range(..., return_mask=True) or InRange(..., return_mask=True) the output shape is (0, 1, H, W). An image with a zero channel, height or width still raises ValueError, and for video a zero depth does too. The JPEG codec now also accepts an empty quality tensor for an empty batch. A non-empty batch with an empty quality now raises ShapeError instead of the RuntimeError from amin(). (#6293)
kornia.metrics.aepe and AEPE no longer return NaN gradients where the predicted flow equals the target. The gradient at an exact match is now 0, the subgradient torch.linalg.vector_norm uses, so a loss masked to the valid pixels stays finite and the values are unchanged. (#6299)
JPEGCodecDifferentiable exported to ONNX with a dynamic height and width now follows the input size. The TorchScript exporter (dynamo=False) used to give a graph that, at any size but the traced one, returned an image of the traced size or wrong values, without an error. The dynamo exporter's graph used to fail in onnxruntime at any other padded size; on torch 2.14 it now follows the input size as well. (#6300)
kornia.filters.fft_conv now returns an empty batch for an empty input instead of raising an MKL FFT error. (#6301)
create_intrinsics preserves gradients through tensor principal points instead of detaching them during camera construction. (#6304)
kornia.geometry.transform.center_crop and center_crop3d now start the crop at the integer pixel int(src / 2 - dst / 2), as CenterCrop2D, K.CenterCrop and K.CenterCrop3D do, so they return a sub-image of the input (for center_crop3d, with its default align_corners=True). With an odd margin they used to start half a pixel off the grid, so bilinear blended neighbouring pixels and nearest duplicated rows or columns instead of returning the centre slice. For a size larger than the input with an odd margin, the extra padding pixel is now at the bottom/right. (#6313)
kornia.augmentation.PadTo.inverse now restores the input shape on every axis. It used to return the cropped tensor unchanged when the target was smaller than the input, so a pipeline's inverse did not get back to the input size. A cropped axis is now regrown at the right/bottom with zeros, as the crop augmentations' inverses do; padding is still removed exactly. (#6314)
kornia.geometry.transform.get_shear_matrix3d now keeps center fixed for every combination of shears. Before, two or more shears that meet in a product term (for example syx with szy) moved the center by up to several pixels, so get_affine_matrix3d and a shear-only RandomAffine3D also translated the volume. Single shears and shears about the origin are unchanged. (#6315)
kornia.geometry.transform.crop_by_indices no longer reads pixels from the opposite edge for a box that starts left of or above the image. The part of the box outside the image is clipped, as past the right or bottom edge, and shape_compensation then applies; with "pad" the padding goes on the side where the box overflowed. The torch.compile path gives the same result. CenterCrop2D in its default slice mode now zero-pads a size larger than the input, as its resample mode does, instead of stretching the last row or column. (#6322)
When raise_if_not_floating_point=False, the Keypoints, Keypoints3D, Boxes, Boxes3D and VideoBoxes constructors cast integer tensor coordinates to float32, or to float64 when that is the default dtype; they still reject integer tensors by default. Boxes.from_tensor, Boxes3D.from_tensor and VideoBoxes.from_tensor accept integer input and use the same dtype promotion. Boxes used to cast integers to the default dtype, which under a float16 or bfloat16 default moved coordinates above 2048 or 256; Keypoints used to cast to float32 even under a float64 default. (#6323)
RandomAutoContrast emits a DeprecationWarning when clip_output is passed; the argument will be removed in a future release. It never changed the output, because normalize_min_max already returns values in [0, 1]. Its default clamp also zeroed the gradient wherever a channel's minimum or maximum was shared by several pixels on torch 2.14 and later. The clamp is gone, so the gradient no longer depends on the torch version. (#6325)
gaussian_blur2d no longer waits for the device when sigma is a tensor on CUDA, or on MPS from torch 2.13: its positivity is checked there with torch._assert_async. A value that is not positive in such a sigma used to raise BaseError during the call and now raises RuntimeError at the next synchronization, which on CUDA is a device-side assert. A tuple or a CPU tensor sigma is still checked during the call. (#6337)
RandomPosterize now draws bits uniformly over the whole numbers of its closed range. The draw used to be a continuous number that was then rounded, which gave the two end points half the probability of interior values: bits=(0, 8) drew 0 and 8 about half as often as values 1 through 7 (#6334). The auto-augment Posterize op draws through the same generator, so TrivialAugment's posterize draws over (4, 8) are now uniform too; RandAugment sets the magnitude directly and AutoAugment's posterize bins have fractional bounds, so neither changes. Seeded draws therefore differ from earlier releases. A range with a fractional bound is drawn as before. (#6339)
DistributionWithMapper delegates missing attributes to its wrapped distribution without recursion, allowing metadata access, copying and pickle restoration. (#6340)
The tensor value checks of adjust_gamma, adjust_contrast, solarize, marginal_pdf, histogram and the vertex modes of Boxes used to be skipped on MPS; they now run there, as torch._assert_async from torch 2.13 and as a host read before, and under TorchScript always as a host read. These checks, and those of gaussian_blur2d and the integer mask cast of AugmentationSequential, are now skipped when checks are disabled with disable_checks(), python -O or KORNIA_CHECKS=0 (they used to run regardless, except in gaussian_blur2d). The input-range checks of equalize, equalize3d and equalize_clahe still run then, since they keep the lookup in bounds. All of them are skipped under torch.vmap, which used to fail on the missing batching rule of the assert. Under torch.compile, all but the equalize range checks are also skipped inside torch.func.grad and the other functorch transforms, where they used to run. A float additions of solarize and a tuple sigma of gaussian_blur2d are checked on the CPU whatever the default device; under a CUDA default device an invalid one used to trigger a device-side assert. equalize and equalize3d compile with TorchScript again. (#6342)
The RandomSnow, TwoWayTransformer and TwoWayAttentionBlock docstrings now state the defaults the constructors use (p=1.0 and nn.ReLU) and document attention_downsample_rate instead of a nonexistent attention_type argument. (#6345)
Models that reshaped a batch with a -1 next to the batch dimension now accept empty batches instead of raising
"cannot reshape tensor of 0 elements" (#6266): TinyViT, VisionTransformer, YuNet and FaceDetector, the SAM
image encoder and mask decoder (an image with no prompts), the EfficientViT backbones, MoonViT and KimiVLModel, and
get_intermediate_layers(reshape=True) of DeDoDe's DINOv2 backbone. (#6350)
reproject_disparity_to_3D is now exported from kornia.geometry.camera (and therefore from kornia.geometry), next to StereoCamera. It was documented on the stereo camera page but importable only from kornia.geometry.camera.stereo. (#6351)
BlobDoGSingle.__repr__ now opens its parenthesis, and the augmentation input shape check names every allowed shape in its error instead of only the last one. (#6357)
transform_tensor(input, shape=..., match_channel=False) on 3D augmentations now inserts the missing channel axis at dim 1, so a (B, D, H, W) mask becomes (B, 1, D, H, W) instead of (B, D, 1, H, W), and a (D, H, W) or (C, D, H, W) input now reaches 5 dimensions. (#6358)
kornia.geometry.bbox.nms no longer suppresses a box that does not overlap the kept box when both boxes have zero area. Their union is empty, so the IoU was 0 / 0 = NaN, which compared as an overlap and dropped the lower-scored box however far away it was: two zero-width boxes or two points kept only one. The IoU of an empty union is now 0, as in torchvision.ops.nms. (#6362)
kornia.feature.match_adalam and kornia.feature.adalam.AdalamFilter no longer repeat sample couples in their local RANSAC. The couple sampler used the size of the last, incomplete row of couples as its first index, so that row repeated couples already drawn instead of continuing with new ones: with the default ransac_iters=128, 8 of the 128 hypotheses in each region were duplicates and the 17th-ranked sample was never paired with the 8 best. A region with too few samples for ransac_iters distinct couples (16 or fewer at the default) still wraps its sample indices and reuses couples, as before. Matches and their confidences can therefore differ slightly from earlier releases. (#6365)
SOLD2 line-endpoint refinement samples integer pixel coordinates correctly instead of assigning them zero heatmap scores, keeping horizontal and vertical segments on their supporting pixels. (#6367)
kornia.metrics.root_mean_squared_disparity_error now has a finite gradient where the prediction matches the target exactly. The derivative of the square root is infinite at a zero error, so an exact match used to get a NaN gradient: every matching pixel under reduction='none', and every pixel of a perfect prediction under 'mean' or 'sum', even where a valid_mask excluded the differing pixels. It now gets 0, as aepe does since #6299. A pixel that valid_mask excludes because its ground truth is NaN or inf also gets a 0 gradient instead of NaN. The value is unchanged. (#6374)
VideoKeypoints indexing results support to_tensor(): vk[0].to_tensor() returns (1, T, N, 2), where it used to raise AttributeError because the result had no temporal_channel_size. An AugmentationSequential with a VideoSequential now also accepts a VideoKeypoints object for its keypoints and returns one; it used to raise TypeError in torch.is_floating_point. VideoSequential hands its children frame-level keypoints, so augmenting video keypoints gives the same result as before. (#6376)
ALIKED.forward_laf returns (0, 0, 2, 3) LAFs, (0, 0, 1) responses and (0, 0, D) descriptors for an empty batch,
in the dtypes of a non-empty batch, instead of raising (#6266). (#6377)
equalize_clahe(..., slow_and_differentiable=True) builds its soft-histogram bin centres and bandwidth in float64 for a float64 image and in float32 for every other dtype. In 0.9.0 they were built in the default dtype: a float64 image was equalized with float32 centres, up to about 7e-5 relative away from a float64 computation, and a float64 default dtype changed the result for every input dtype, by up to 3e-2 for a bfloat16 image. The fast path is unchanged, and float32, float16 and bfloat16 results under the float32 default are bit-identical to 0.9.0. (#6383)
Under CPU autocast, kl_div_loss_2d took the logarithm of a float16/bfloat16 pred in half precision before F.kl_div promoted to float32, so two identical bfloat16 heatmaps gave a divergence of about 1e-3 instead of 0, and other values were off by a similar amount. The logarithm is now taken in float32 there, as CUDA and MPS autocast already did. Results outside autocast and on other devices are unchanged. (#6387)
Assigning a kornia.geometry.boxes.VideoBoxes value whose temporal_channel_size differs from the target's, video_boxes[key] = other, now raises ValueError instead of regrouping the value's frames into videos of the target's length: two 2-frame videos assigned to one 4-frame video used to be stitched into it, one 4-frame video assigned to two 2-frame videos was split across them, and a frame total that did not divide by the target's length raised a RuntimeError from view. A plain Boxes value is still read as frames of the target's length. (#6389)
kornia.geometry.homography.line_segment_transfer_error_one_way now returns inf for a segment with an endpoint that H maps to the line at infinity (w' = 0), as oneway_transfer_error does, and keeps growing as an endpoint approaches it. It used to dehomogenize the endpoints with transform_points, which returns the numerator unchanged for |w'| <= 1e-8, so such a segment read a small finite error (1 in the issue's case) and RANSAC(model_type="homography_from_linesegments") counted it as an inlier. A zero-length image-2 segment still reads 0. The distances are now computed in at least float32 and outside a caller's autocast: float16 segments with coordinates in the hundreds of pixels no longer overflow to inf or NaN, which made find_homography_lines_dlt_iterated return NaN in float16, and segments of different dtypes no longer raise; the result takes their promoted dtype. (#6394)
crop_by_indices now rejects unsupported shape_compensation values instead of treating them as padding. The legacy "F.pad" alias remains supported. (#6403)
get_perspective_transform and get_perspective_transform3d now return a matrix in the default floating dtype for integer or boolean points instead of truncating it to the input dtype. (#6405)
Corrected the dimension labels in the crop_by_boxes3d batch error message to match (depth, height, width). (#6406)
convert_affinematrix_to_homography and convert_affinematrix_to_homography3d now reject integer and bool input up front with a ValueError naming the dtype, as Rt_to_matrix4x4 does; before, it failed with a bare RuntimeError from the in-place += 1.0 on the padded homography. ARKitQTVecs_to_ColmapQTVecs now rejects an integer, bool or complex qvec and a complex tvec with a TypeCheckError naming the argument, as ColmapQTVecs_to_ARKitQTVecs does; before, they failed inside linalg.vector_norm or a comparison. An integer tvec with a floating qvec still promotes and returns the floating result. (#6411)
AugmentationSequential.transform_matrix now includes geometric operations inside plain ImageSequential children in silent mode instead of omitting them. Each operation contributes its current matrix in execution order, including repeated sampled members. The rigid and skip modes retain their behavior. (#6415)
LightGlue early stopping (depth_confidence) counts only the real keypoints on the static-length path of LightGlue.compile, so a padded pair stops at the same layer, with the same matches, as without padding; the padded positions used to count as unconfident points and delay the stop. Building a LightGlue model no longer switches PyTorch's process-wide FlashAttention setting (torch.backends.cuda.enable_flash_sdp) on or off: flash only selects the half-precision attention of CUDA tensors. (#6417)
XFeat.match_xfeat_star measures the refinement soft-argmax from bin 3 of the fine matcher's 8 x 8 heatmap, where the pretrained fine matcher puts a zero displacement, instead of from bin 4 as the reference implementation does. The refined points of the first image used to be shifted by about 1 px up and to the left; matching an image with itself, 94 % of them now stay within 1 px, against 1 %. Away from a zero displacement the refinement still moves a point only about half of the way, as the reference does. (#6419)
Keyword arguments of LightGlue (and the params of LightGlueMatcher) now override the configuration of features. depth_confidence, width_confidence and filter_threshold given with "xfeat", "doghardnet", "dog_affnet_hardnet" or "keynet_affnet_hardnet" used to be replaced silently by the preset's values. (#6421)
ALIKED.from_pretrained loads the checkpoint strictly, so a checkpoint whose keys do not match the model raises instead of leaving the unmatched layers at their random initialisation. dkd.hw_grid, which is rebuilt from nms_radius, is no longer part of the state dict; a state dict that contains it still loads. (#6423)
match_adalam and AdalamFilter report, for a match accepted by several overlapping local verifications, the inverse confidence of its most confident one; they used to report the value of whichever copy came first, which depended on the order of the neighbourhoods and the device's sort. (#6428)
DeDoDe.detect and DeDoDe.forward take the scoremap softmax and the keypoint sampling in float32 for a float16 or bfloat16 model, and the detector logits are no longer rounded to the half dtype, so the scores of a half-precision model are float32 like its keypoints. They used to run in the model dtype: in float16 the probabilities of an image above 128 x 128 fall below the smallest normal number, and on a peaky synthetic map 97 % of the top-10000 scores were 0 and only 15 % of the float32 keypoints were kept; bfloat16 kept 99.5 % of them, in another order. Float32 models are unchanged on CPU and MPS; on CUDA, where amp_dtype autocast is on by default, the first upsampling of the logits now also runs in float32, as in the reference. Float64 models keep every logit term in float64 instead of rounding the later ones to float32. (#6430)
cart2pol now computes float16 and bfloat16 radii in float32 and rounds them once. It used to form x ** 2 + y ** 2 in the input dtype, so a float16 radius of about 256 or more gave rho = nan ((300, 150)) and small float16 radii were inexact ((2e-4, 0) gave 2.44e-4). Inside the eps neighbourhood rho is now the exact radius: it used to be computed as (rho + 1) - 1, which in float32 turned (1e-5, 0) into 1.0014e-5 and every radius below about 6e-8 into 0, and in bfloat16 every radius up to 1e-4 into 0. A float32 or float64 square sum that overflows now gives rho = inf instead of nan. Elsewhere float32 and float64 values and gradients are unchanged; float16 and bfloat16 radii and gradients can move by about one unit in the last place, to the correctly rounded value. The gradient inside eps is still zero, and for float16 input eps is compared with the float32 square sum, so radii between 1e-4 and about 2e-4 now get the gradient x / rho instead of 0 or a wrong value. (#6431)
KRt_from_projection, projections_from_fundamental, get_perpendicular, get_closest_point_on_epipolar_line and multiply_deg_one_poly raise ShapeError, naming the argument and its expected shape, when P, F_mat, points, pts2, a or b lacks the batch dimension or has an extra one. Previously they raised an IndexError, a RuntimeError or an AssertionError from a later step, or, for some inputs with an extra dimension, returned wrong values: multiply_deg_one_poly with (A, 4, 4) inputs, and the two epipolar functions when lines and points, or pts1 and pts2, both had shape (A, B, 3, 3). The two epipolar functions also raise ShapeError instead of a bare AssertionError when points or pts2 has a last dimension other than 2 or 3. The too-few-correspondences message of RANSAC and the matrix-shape message of NamedPose.from_rt and NamedPose.from_matrix no longer contain runs of spaces, and the latter prints each expected shape once, as [2, 2] instead of [2, 2]x[2, 2]. (#6434)
LightGlue(mp=True) runs a float64 model on CUDA. It used to cast the descriptors to float16 under autocast, which does not cast float64 weights, so every float64 call raised mat1 and mat2 must have the same dtype. A float64 model now gives float64 scores and the matches of mp=False, as on CPU. (#6441)
kornia.contrib.KMeans now rejects a num_clusters that is not a positive integer when it is constructed, and fit rejects more clusters than samples when the starting centres are drawn from the data, each with an error that names num_clusters. A negative or None count used to pass the constructor and fail in fit inside one_hot ("Class values must be smaller than num_classes"), and more clusters than samples drew fewer centres and failed the first update with an unrelated tensor-size RuntimeError. (#6443)
psnr, psnr_loss and PSNRLoss no longer overflow an integer tensor data range: max_val=torch.tensor(255, dtype=torch.uint8) with an MSE of 1 returned 0 dB instead of 48.13 dB, and an int16 range of 255 returned NaN. Python numbers and int64 or floating tensor ranges are unchanged. (#6444)
So3 * points and Se3 * points, and so NamedPose.transform_points for a 3D pose, now accept an (N, 3) point set with an unbatched pose, as Se2 does for (N, 2). They used to raise in torch.linalg.cross. A point layout outside the contract of either group, such as a batch of poses with a point set (B, N, 3) or (B, N, 2), or B poses with N points, now raises a ValueError that names the accepted layouts, instead of a torch.linalg.cross or broadcast error, or Se2's "Invalid translation shape". (#6445)
Preserve range bounds when float64 sampling is selected via set_rng_device_and_dtype while the default dtype is float32, instead of first rounding them to float32. This applies to RandomAffine, RandomTranslate, RandomMotionBlur, RandomMotionBlur3D, RandomSaltAndPepperNoise, RandomLinearIllumination and RandomLinearCornerIllumination. (#6447)
A wrong input rank raises kornia.core.exceptions.InputRankError, with one message format, from every augmentation entry point: the 2D and 3D classes, validate_tensor, AugmentationSequential, ImageSequential, PatchSequential and VideoSequential. They used to raise ValueError, RuntimeError or AssertionError with different messages; InputRankError is a ShapeError (ValueError) and also a RuntimeError and an AssertionError, so existing except clauses still catch it. validate_tensor now accepts the (H, W) and (C, H, W) inputs that forward accepts (and their 3D counterparts) instead of rejecting them. (#6448)
Register augmentation dispatcher children so parameter discovery, checkpoints, training modes, and device or dtype moves include the contained sequences. After .to(device), .cuda(), or .double(), the children sample on that device and in that dtype, as in AugmentationSequential, so random draws after a move can differ from Kornia 0.9.0. state_dict() now includes child buffers and parameters. A compatibility fallback preserves initialized and lazy child buffers and parameters, and non-tensor extra state, for legacy checkpoints without augmentation entries. With strict=True, missing new-format augmentation state, including a completely absent child subtree, raises a missing-key error when checkpoint metadata is preserved. (#6449)
PatchDominantGradientOrientation now gives ze
Meet kornia==0.9.0 - more correct, much faster, more documented, better half-precision, CUDA and MPS support. More than 800 issues have been raised an
Meet kornia==0.9.0 - more correct, much faster, more documented, better half-precision, CUDA and MPS support. More than 800 issues have been raised and fixed.
For example, now:
We have run 3 month audit, looking for silent bugs, crashes, and stupid slow-downs -- with Astra, Fable and Opus 5.5 -- under tight human control. We fixed some things ourselves and merged 995 PRs from the community contributors. We removed some of the models, which never worked (sorry!) -- like SAM3, and fixed others, like Qwen 2.5.
Our new contributor policy became simple, honest and friendly -- both for humans and agents. Kornia is still slop-hostile, be it natural or artificial.
Maybe, it is all pointless, because agents will write the code from scratch, tailored for your specific use-case. In that case we hope, that they will be trained on kornia 0.9.0 source.
Full Changelog (5000 lines) - https://github.com/kornia/kornia/blob/v0.9.0/CHANGELOG.md
Target Kornia 0.9.0 explicitly, and check its documented contracts before generating code.
The release adds an agent index, a
full reference with examples, and
conformance-backed support information. latest follows development; use documentation matching
installed kornia.__version__. The
0.9.0 candidate sources
pin the reference used for these notes.
Choose an existing operation first. Use AugmentationSequential to apply sampled transforms
to registered images, masks, boxes, and keypoints together. Check the expanded RANSAC options,
match_smnn_batched, and LoFTR.extract_features before implementing estimation, batched matching,
or repeated feature extraction yourself. Prefer documented stable-core APIs; pretrained wrappers
and ONNX are best-effort, and contrib is experimental. The
stability policy defines the
current guarantees; proposed future tiers are not yet in force.
| Before choosing or calling an API | Contract to check |
|---|---|
| Runtime | Python ≥3.11, torch ≥2.5.1, NumPy ≥1.21, kornia_rs ≥0.2.0. Use [image], [onnx], or [sd] extras for the corresponding integrations. RANSAC(compile=True) additionally needs torch ≥2.14; check its supported option combinations. |
| Images and coordinates | (B,C,H,W) RGB floats in [0,1] are the usual image convention, with per-API exceptions. Points use (x,y); output sizes use (h,w). Check whether matrices act on pixel or normalized coordinates, and set align_corners deliberately. |
| Angles and boxes | 2D image-transform angles generally use degrees; 3D/conversion APIs generally use radians. RandomAffine turns a positive angle clockwise, unlike rotate/RandomRotation. Boxes stores inclusive vertices but converts exclusive xyxy/xywh modes; keep coordinates in pixels because normalized-box conversion remains unsafe. |
| Models | Several feature constructors now download pretrained weights by default. Choose the documented offline/random option (False or None, depending on the API). Complete pretrained builders use eval mode; random or partly initialized models may remain in training mode. Call .eval() for inference after custom loading. |
| Precision and devices | Half inputs may compute internally in float32; several feature pipelines now return float32 keypoints/LAFs alongside half descriptors. Preserve those coordinate types through matching. Support for forward execution does not establish gradient accuracy or native-half speed. Some MPS geometry decompositions use CPU fallbacks. |
| Compilation and export | Consult the support matrix for the exact operator, exporter, and dynamic-shape requirements. Eager success does not imply full-graph compilation, ONNX parity, or dynamic-batch correctness. Benchmark the actual shape, batch, device, and execution mode. |
Read the conventions, precision guidance, and ONNX/compile support matrix for the operation you choose.
When migrating from 0.8.3: recheck numerical baselines for warps, resize, RANSAC, and
integer-image processing; corrected behavior can change outputs without raising. Use documented
imports such as kornia.image for image helpers; the Ivy-powered to_jax, to_numpy, and
to_tensorflow entry points no longer perform conversion. Validate a representative workflow,
including annotation alignment and gradients when used, on the intended device and dtype;
validate the exported artifact separately if deployment requires it.
Known exceptions to carry into generated code: compiled RANSAC can crash when CPU and CUDA
share an Inductor cache (#6278); use separate
TORCHINDUCTOR_CACHE_DIR values per device or KORNIA_RANSAC_AOT=0, which costs performance.
Keep learnable bilateral-filter sigmas in float32
(#6284). Do not infer blanket half-precision
warp/geometry support from the release highlights; consult the per-operation limits above.
When contributing: read the checkout's AGENTS.md and
contribution policy.
Check for an existing issue or PR, reuse existing utilities, include a reproducer and meaningful
validation, and disclose how AI helped. Numerical fixes should be supported by a reference,
a mathematical invariant, or realistic failing inputs. Follow the policy's discussion-first
rule for numerical edge cases outside realistic input ranges.
Full changelog: https://github.com/kornia/kornia/blob/v0.9.0/CHANGELOG.md
kornia.metrics.kitti_d1_error, the outlier ratio reported by the KITTI 2015 stereo benchmark.
A pixel counts as an outlier only when its absolute disparity error exceeds abs_threshold
and its relative error exceeds rel_threshold, both strictly, with the ground truth as the
relative denominator. That conjunction is what separates it from mean_bad_pixel_error, which
applies the absolute criterion alone and so penalises large disparities for errors that are small
next to their magnitude. A batch is pooled over every valid pixel, as the devkit accumulates it,
rather than averaged per image. Closes #3758. (#3931)
PadTo takes crop_if_exceeds. The default True keeps the existing behavior: an input larger than size on an axis is cropped to size there. With crop_if_exceeds=False that axis passes through unchanged, so the output is at least size on each axis and boxes and keypoints stay inside the image. Closes #3518. (#3964)
Added opt-in kornia.contrib.augmentation_audit reports with executed geometric provenance,
native parameter snapshots, out-of-frame diagnostics and actual keypoint/box round-trip
measurements, including explicit unsupported transforms and JSON export. (#4465)
Relevant camera and image-coordinate API docstrings now link directly to the camera and general conventions guides. (#4501)
Document per-class coordinate, sampling, crop, resize, padding, and non-rigid warp conventions for 2D geometric augmentations, with executable tests for current behavior and known limitations. Clarify sampler migration after module and container moves. (#4538)
Document per-class value-range, parameter-meaning, filter, noise, weather, illumination and normalization conventions for the 2D intensity augmentations, with executable tests for current behavior and issue-linked pins for the known limitations. Rewrite the stale sampler-migration citations in the 2D augmentation bases. (#4566)
Document the conventions of mix and 3D augmentations and automatic augmentation policies, with executable tests for their sampling, coordinate, label, and output contracts. (#4634)
SIFTFeature and SIFTFeatureScaleSpace now accept descriptor_backend="pyramid" for fast extraction at their sparse detections. SIFTDescriptorFromPyramid describes supplied LAFs and can share an extraction pyramid between orientation assignment and description.
The scale-space preset has a dedicated backend that reuses the detector Gaussian pyramid and retained octave/layer assignments, computing gradients once per used level. It preserves sparse detections and integrates rotated SIFT histograms directly from gradient fields.
The optimized scale-space path also specializes DoG detection: sparse refinement, exact octave coordinates, and top-K response ranking without contrast or edge rejection. The default patch backend remains available.
CPU Gaussian filtering avoids convolution work buffers; sparse neighbourhood gathers, two-bin angular voting, and device-specific descriptor chunks reduce extraction time without reducing integration support or the requested feature budget. Compiled and eager pyramid backends share checkpoint keys and support full-module serialization.
CPU inference builds Gaussian volumes directly in their final storage and reuses sampling coordinates; gradient atlases also avoid a full transpose copy. Spatial ties are rejected before bounded sparse gathers. Empty detections and descriptors retain zero gradients, and half-precision masks preserve their suppression semantics.
CUDA uses packed sparse refinement and separable descriptor histogram pooling to reduce kernel launches and extraction time while retaining bounded descriptor chunks. CPU and MPS keep their existing refinement paths.
Shared conv_quad_interp3d and iterative_quad_interp3d now group finite differences and Cramer determinants on CUDA float32/float64, also accelerating the default patch-based SIFTFeatureScaleSpace pipeline. CPU, MPS and reduced-precision inputs retain their scalar paths. (#4638)
depth_from_disparity accepts a per-batch-element (B,) baseline and focal, so a batch of stereo pairs from
rigs with different baselines or focal lengths no longer has to be split and processed one sample at a time.
Element b pairs with disparity[b], which needs a disparity of rank 3 or more with a leading size of B; a
mismatched size still raises ShapeError. The shared forms, a Python number, a scalar tensor or a (1,) tensor,
behave exactly as before, and the two may be mixed. (#4648)
Added kornia.contrib.connected_components_union_find, an exact, pure PyTorch 8-connected component labeling alternative using 2x2 block union-find. It converges without a user-selected iteration budget and returns integer labels for boolean, integer and floating-point masks, including half precision. (#4666)
Document the conventions of RandomTransplantation and RandomTransplantation3D — mask-driven donor selection, the (i - 1) mod B donor rule, label sampling and excluded_labels, the replay contract, and the data-key and dtype rules — with executable tests, and export both names from kornia.augmentation.__all__. (#4695)
Add opt-in numerical reconstruction masks to both stereo disparity reprojection entry points with return_mask=True, preserving existing coordinates, precision and gradients. The mask checks finite homogeneous components, the existing absolute W cutoff and finite returned XYZ; it does not certify matches, front-of-camera eligibility or visibility. (#4701)
ColorJiggle now accepts a fixed order for deterministic application and full-graph compilation on RGB inputs. (#4717)
kornia.morphology gains engine="shift": a running max or min over the shifted views of the padded image. For finite inputs its output equals engine="unfold" (torch.equal; only the sign of a zero can differ), torch.compile fuses it into a single kernel, and forward-only its peak memory is flat in the kernel area instead of growing with it (69 MiB of peak RSS growth against 1380 MiB for "unfold" with a 15x15 kernel on 8x3x256x256 float32 on CPU). Under autograd it saves two output-sized intermediates per kernel position, so engine="auto" keeps "unfold" for the float32/float64 CPU backward path. (#4728, #4996)
Document the conventions of kornia.morphology — the kernel reflection in dilation and its absence in
erosion, the membership-mask kernel and additive structuring_element, the [row, col] origin and its
even-size default, and the five border_type values with their scipy / scikit-image names (and OpenCV's for
geodesic and reflect) — as Convention blocks on the seven public functions and a new section on the Conventions &
Pitfalls page, with executable tests for the kornia-side claims and for the max_val sentinel, non-float
operand and convolution-engine dtype warts. (#4743)
The kornia.core API page documents the six exception classes in kornia.core.exceptions (BaseError, ShapeError, TypeCheckError, ValueCheckError, DeviceError, ImageError), so references to them from other pages now link. (#4798)
camtoworld_to_worldtocam_Rt and worldtocam_to_camtoworld_Rt accept check_rotation=True, which raises ValueError when R is not a rotation matrix instead of silently returning a wrong pose. (#4817)
rotation_matrix_to_axis_angle, rotation_matrix_to_quaternion, Quaternion.from_matrix,
So3.from_matrix and Se3.from_matrix take check_rotation (default False). With
check_rotation=True they raise a ValueError unless every input is a rotation:
max|R @ R^T - I| within 100 eps of the input dtype (16 eps for float16 and bfloat16) and
det(R) > 0. Without it the behaviour is unchanged, so a reflection such as diag(-1, 1, 1)
is still reported as the identity rotation [0., 0., 0.], and Se3.from_matrix still accepts
a reflection block. (#4773) (#4840)
Convention blocks for the two-view F/E contract (find_fundamental, find_essential, the epipolar metrics, decompose_essential_matrix and their siblings), a "Two-view geometry" section on the Conventions & Pitfalls page with the OpenCV mapping, and 28 convention and wart pins; the warts are documented and linked (#2198, #4831, #4855, #4862, #4874–#4881, #4883, #4884), not fixed. (#4887)
Convention blocks for the projection and structure functions of kornia.geometry.epipolar (projection_from_KRt, KRt_from_projection, projections_from_fundamental, depth_from_point, scale_intrinsics, intrinsics_like, random_intrinsics, triangulate_points, generate_scene), three functions added to the rendered API reference, and 16 convention and wart pins; the #4263 wart is documented and linked, not fixed; #4863, #4864, #4865 and #4900 are fixed by #4901. (#4889)
Convention blocks for homography estimation (find_homography_dlt and its iterated and line-segment variants, the transfer errors), RANSAC and the polynomial and homogeneous solvers (solve_quadratic, solve_cubic, solve_quartic, determinant_to_polynomial, null_vector_3x4), with convention and wart pins; solve_quartic is added to the rendered API reference. The documented defects are linked to their issues (#4833, #4866–#4870, #4872–#4874, #4881, #4890, #4905) and not fixed here. (#4892)
RANSAC(prosac_sampling=True) now draws progressive samples from correspondences sorted best-first, following Chum
and Matas (CVPR 2005); the flag used to be accepted and ignored. The schedule advances per sampled set inside each
batch, and the sampler runs the full batch_size * max_iter budget. RANSAC also accepts lo_sample_size, which
fits max_lo_iters random inlier subsets of that size in one solver batch before a final full-inlier refit. (#4902)
normalize_points accepts optional per-point weights of shape (B, N): the centroid and the mean radius are
weighted, negative weights count as zero, and a batch element whose weights are all zero uses the unweighted
statistics. (#4908)
Convention blocks for Quaternion, average_quaternions and So3 (storage, product order, principal log, Jacobian sides), a "Rotations and rigid motions" section on the Conventions & Pitfalls page with the scipy / Sophus / Eigen mapping, and 19 convention and wart pins; the warts are documented and linked (#3950, #3953, #4923, #4942), not fixed. (#4976)
Convention blocks for So2, Se2 and Se3 (tangent order, direction, log range, adjoint and matrix layouts, composition order) and 25 convention and wart pins; the warts are documented and linked (#4923, #4929, #4931, #4932, #4942), not fixed. (#4977)
Convention blocks for relative_transformation and its linalg siblings (frame naming, rigid-only inputs, the contrast with relative_camera_motion) and for NamedPose, an API page for kornia.geometry.pose, and 12 convention and wart pins; the warts are documented and linked (#4881, #4937), not fixed. (#4978)
RANSAC gains local_optimization ("lm" or "dlt"), refine_iters for the final Levenberg-Marquardt refinement, the "fundamental_8pt" model type, and an offset argument to RANSAC.sample that continues the PROSAC schedule across batches of different sizes. The new pipeline normalizes the correspondences once per call, solves minimal samples through a batched LU null space and scores them with one matrix product per batch; on PhotoTourism fundamental matrices and HEB homographies it is more accurate than the previous defaults and several times faster on CUDA. sample_is_valid_for_homography no longer copies index tensors to the device on every call. The minimal solvers share their LU null space with the public estimators: find_fundamental(method="7POINT"), the eight-correspondence unweighted case of find_fundamental, and the four-correspondence find_homography_dlt(solver="lu") replace eigh, QR or SVD with one batched LU factorization, which is several times faster on CPU and now runs in float16 and bfloat16; the seven-point cubic is expanded without inverting the null-space basis. sampson_epipolar_distance and oneway_transfer_error (and so symmetric_transfer_error) score several matrices on one set of correspondences with one or two matrix products, faster on CPU and CUDA for RANSAC-sized batches, and find_fundamental's eight-point solver removes the smallest singular value in closed form instead of with an SVD for batches of 128 or more on CPU and 512 or more on other devices, about twice as fast for 2048 samples. (#5031)
ImageRegistrator.warp_dst_into_src, the correctly spelled inverse of warp_src_into_dst; its docstring now names the argument it warps, dst_img. The misspelled warp_dst_inro_src still works as a deprecated alias that emits a DeprecationWarning. (#5049)
Convention blocks for create_meshgrid, create_meshgrid3d and kornia.geometry.subpix (the (x, y) / (d, x, y) coordinate orders, corner-aligned normalization, the grid_sample reorder for 3D grids, the conv soft-argmax windows, the quadratic refiners' rejection rules and strict NMS), the matching additions to the Conventions & Pitfalls page, and 14 convention and wart pins; the warts are documented and linked (#4503, #5020, #5065, #5066), not fixed. (#5068)
Convention blocks for Keypoints, Vector3 and the PLY writers ((x, y) pixel coordinates, homogeneous transformation, copy / in-place / write-through aliasing, the double x y z PLY layout), an API page for kornia.geometry.vector, and 13 convention and wart pins; the warts are documented and linked (#5022, #5023), not fixed. (#5069)
Convention blocks for ParametrizedLine, fit_line, Hyperplane, fit_plane and ImageRegistrator (unnormalized line directions, the n . x + d = 0 plane and the orientation of through, the built-in destination-to-source registration models in normalized coordinates), fit_plane and the Hyperplane methods on the line API page, and 13 convention and wart pins; the wart is documented and linked (#4923), not fixed. (#5070)
kornia.image.draw_rectangle now accepts line_width to draw outlines thicker than one pixel. The outline grows
inward from each edge, so it stays inside the rectangle, and the part of it outside the image is not drawn. (#5093)
RANSAC gains opt-in degensac=True (off by default), DEGENSAC's dominant-plane recovery for seven-point fundamental matrices (Chum, Werner and Matas, CVPR 2005), following Chum's implementation in pydegensac: record-setting seven-point models are tested for five or more correspondences related by one homography, and a degenerate one hands that homography to a plane-and-parallax search over the correspondences off the plane. The new kornia.geometry.homography.sampson_homography_distance returns the Sampson distance of correspondences to homographies, the first-order geometric error over both images (Hartley and Zisserman, section 4.2.6): unlike oneway_transfer_error, it accounts for noise in both images and does not depend on the scale of H, and an exact correspondence scores 0. (#5099)
RANSAC(compile=True) runs the whole local_optimization="lm" estimation (homography, fundamental and essential
matrices) as one torch.compile graph on CPU and CUDA with torch 2.14 or later. The graph is traced once per configuration and does not
depend on the number of correspondences, the threshold, the confidence or the sample budget; it is saved next to
inductor's cache, so a later process loads it instead of compiling. Seeded compiled calls are reproducible but use
their own random stream without changing the global CPU or CUDA generators. Ordinary and inference-mode calls
share the compiled artifact. Eager results are unchanged.
Compiled calls normalize autocast, distinguish thread/default-dtype/default-device settings in the artifact cache, and draw their samples from a counter-based hash of the seed, so concurrent seeded calls preserve the global RNG. Large explicit CPU batches split to bound scoring memory while retaining the sample budget. Zero-weight singular correspondences no longer prevent LM refinement; artifact writes are atomic. (#5117)
convert_sift_descriptor_layout reorders SIFT descriptors between kornia's layout and OpenCV's, and SIFTFeature and SIFTFeatureScaleSpace take descriptor_layout="opencv" to return OpenCV's layout directly. LightGlueMatcher("sift") expects OpenCV's layout, which kornia's SIFT descriptors do not use by default, so request it or convert before matching: on Oxford Graf 1→4, SIFTFeature descriptors matched in kornia's layout gave 2 correct matches, and 497 in OpenCV's. (#5145)
Convention blocks for filter2d, filter2d_separable, filter3d, fft_conv and the kernel builders: correlation vs behaviour='conv', the border_type vocabulary, the (k - 1) // 2 anchor of an even kernel, kernel batch and normalisation rules, the Rodrigues axis-angle vector used by get_motion_kernel3d, and the orientation, sign and normalisation of every derivative kernel. A new Filtering section on the Conventions page maps the border modes, the correlation rule and the even-kernel anchor to scipy and OpenCV. fft_conv and ten kernel builders are added to the API reference. (#5230)
correlate2d, convolve2d, correlate3d and convolve3d are now listed in kornia.filters.__all__, so from kornia.filters import * brings them, and appear on the Filtering API page and in the API-surface inventory. They were already importable from kornia.filters by name, and equal filter2d / filter3d with behaviour='corr' / 'conv'. The two 2-D docstrings now state the output shape for padding='valid', and each of the four has an example that shows how correlation and convolution differ. (#5249)
kornia.morphology.reconstruction: grayscale morphological reconstruction by dilation or erosion, matching skimage.morphology.reconstruction. (#5257)
Document color-space and enhancement conventions, correct channel units and API contracts, and add executable convention and known-defect tests. (#5319)
Convention blocks for spatial_gradient, spatial_gradient3d, sobel, laplacian, canny, in_range and otsu_threshold: the (dx, dy) output layout and default normalisation of the derivative filters, the Laplacian kernel's sign and scale, the unnormalized Sobel magnitude that canny's thresholds are compared with and its tie rule, in_range's inclusive bounds and accepted bound shapes, and the per-plane Otsu threshold read from the upper edge of the split bin. The Filtering section of the Conventions page maps the derivative scales and canny's thresholds to OpenCV and scikit-image. (#5427)
Convention blocks for the blurring operators of kornia.filters (gaussian_blur2d, box_blur, median_blur, bilateral_blur, joint_bilateral_blur, guided_blur, motion_blur, motion_blur3d, unsharp_mask, blur_pool2d, max_blur_pool2d, edge_aware_blur_pool2d and their module classes): kernel_size and sigma given rows first, per-sample tensor sigmas, the bilateral and guided filters' parameter units and argument order, the motion-blur angle and streak weighting, the blur pools' sampling grid and padding. The Filtering section of the Conventions page relates them to OpenCV, scipy, scikit-image and the antialiased-cnns BlurPool. edge_aware_blur_pool2d, motion_blur3d, EdgeAwareBlurPool2D, MotionBlur3D and StableDiffusionDissolving are added to the API reference. (#5433)
kornia.feature.match_smnn_batched matches independent descriptor pairs with batched distance computation, packed match indices, and optional validity masks for padded inputs. (#5558)
Convention blocks for the image-quality and regression losses and metrics (ssim, ssim3d, psnr, the SSIM / MS-SSIM / PSNR losses, the Charbonnier / Cauchy / Geman–McClure / Welsch losses, total variation, inverse-depth smoothness and the KL / JS divergences), with test_convention_* pins and a new "Losses and metrics" section on the conventions page. (#5566)
Convention blocks for the mutual-information losses (mutual_information_loss, its normalized, 2-D, 3-D and FromRef module forms, and MIKernel), with test_convention_* pins and a new Registration API page that lists all 13 mutual-information exports. (#5632)
Convention blocks for the dense-prediction losses (focal_loss, binary_focal_loss_with_logits, dice_loss, tversky_loss, the Lovász and Hausdorff losses and one_hot), with test_convention_* pins and a "Dense-prediction losses" sub-section on the conventions page. (#5634)
Convention blocks for the task metrics (classification, segmentation, detection, optical flow, disparity and pose), with test_convention_* pins and a "Task metrics" sub-section on the conventions page that tabulates each metric's output, pooling and scale. (#5635)
The docstrings of shear, Shear, Affine, get_affine_matrix2d, get_shear_matrix2d and RandomAffine now say what their shear arguments mean: raw factors about pixel (0, 0) for shear and Shear, and angles in radians about the centre, sheared by their negative tangent, for Affine, the two matrix helpers and RandomAffine (in degrees there). That two entry points read shear differently is a known defect (#5661). (#5682)
DoGHardNet and DoGAffNetHardNet return LAFs and HardNet descriptors that LightGlueMatcher("doghardnet") and LightGlueMatcher("dog_affnet_hardnet") take without rescaling. They detect with the DoG detector of the default "patch" backend of SIFTFeatureScaleSpace, DoGAffNetHardNet adding AffNet shapes, estimate the orientation at the detection scale, and return and describe LAFs twice the detection frames: 12 sigma, the scale those LightGlue weights were trained with. The LightGlueMatcher documentation states that scale. (#5727)
Document an explicit scale-space pyramid SIFT recipe, distinguish multiresolution detection from scale-space detection, and explain the patch, dense and supplied-frame descriptor interfaces. Document the repaired multiresolution pyramid orientation and its remaining validation and possible-deprecation criteria without changing defaults, adding runtime warnings or removing APIs. (#5750)
kornia.image.ColorSpace is exported, so a PixelFormat or a colour space for Image.from_numpy no longer needs an
import from kornia.image.base. draw_point2d and draw_line accept a single-value colour, of shape (1,) or 0-d,
and write it to every channel, as draw_rectangle and draw_convex_polygon already did; they used to raise for it on
an image with more than one channel. OpenCV's and Pillow's scalar colours fill only the first channel. (#5813)
The ONNX guide and the landing page now export with the torch.export-based exporter (dynamo=True, with
dynamic_shapes) instead of the deprecated TorchScript-based one at opset 17, and show the
auto_ir_version_conversion=True flag that ONNXSequential needs to chain such an export with the pre-exported Hub
operators. (#5818)
The ONNX, torch.compile and torch.export page is now presented as a dated survey rather than a support statement: it is titled a survey, opens with a note that it records one measurement that Kornia's tests check only in part, and reports passed / probed instead of supported / probed. The ONNX guide no longer quotes the share of operators that export. (#5820)
The kornia.io and kornia.image API documentation states their conventions: the channels, dtype and range of each
load_image type, the dtypes and channel counts each write_image format stores, when the NumPy converters share
memory, the pixel frame, rounding and clipping of the drawing functions, the value ranges of the terminal
printers, and the supported dtypes for Image.to_gray(). The conventions page gains a Files and arrays section,
with the load types and a table mapping OpenCV's, Pillow's and torchvision's readers, writers and converters onto
kornia's, and a Drawing section. One known defect is documented: write_image raises a bare Exception and
leaves an empty or truncated file for an image with zero height or width (#5770). (#5823)
Document the conventions of the local affine frame (LAF) and patch-extraction API (kornia.feature.laf, get_laf_descriptors, LAFDescriptor and KORNIA_CHECK_LAF) as Convention blocks and pointers, and add a "Local features" section to the Conventions & Pitfalls page: the [A | c] frame in pixels, scale and orientation, the patch a LAF samples, detector padding, and the conversion from OpenCV keypoints. (#5827)
Document the conventions of the kornia.feature response functions, detectors, orientation and affine-shape estimators as Convention blocks and pointers: the sign and intensity scaling of each response, the candidates, frame and padding of ScaleSpaceDetector, the level-pixel frame of MultiResolutionDetector, the input range of KeyNet, the orientation sign, and the layout of the PatchAffineShapeEstimator output. (#5835)
Document the conventions of the kornia.feature patch descriptors (SIFTDescriptor, DenseSIFTDescriptor, SIFTDescriptorFromPyramid, HardNet, HardNet8, SOSNet, TFeat, HyNet, FilterResponseNorm2d, TLU and MKDDescriptor) as Convention blocks and pointers: the patch shape and sampling, which intensity changes leave a descriptor unchanged, the output norm and width, SIFT clipping and RootSIFT, and the dense and pyramid SIFT cell geometry. (#5836)
Document the conventions of the kornia.feature matchers (match_nn, match_mnn, match_snn, match_smnn, match_smnn_batched, match_fginn, match_adalam, DescriptorMatcher, GeometryAwareDescriptorMatcher, LocalFeatureMatcher, LightGlueMatcher, LightGlue, OnnxLightGlue and LoFTR) as Convention blocks and pointers: what the returned values and index pairs hold for each matcher, the inclusive ratio thresholds and a given distance matrix, the keypoints, image size and extra inputs each LightGlue feature type takes, the dtype of LightGlue's matching scores, the LoFTR keypoint frame, and the known defects of match_adalam, LightGlue and OnnxLightGlue. (#5856)
LoFTR.extract_features(image) returns the features of an image that do not depend on the image it is matched with
(the backbone's coarse and fine maps, the coarse one position-encoded), and LoFTR.forward accepts them as
features0 / features1 instead of image0 / image1, on either side or both. Matching one image against many no
longer runs the backbone for every pair. For images of different sizes the matches are bitwise the same as when
passing the images; forward still runs two images of the same size through the backbone together.
All image and feature input combinations reject unequal batch sizes with ValueError. (#5880)
Document the conventions of the kornia.feature local-feature presets and learned models (LocalFeature, SIFTFeature, SIFTFeatureScaleSpace, the AffNet/HardNet/KeyNet presets, DISK, ALIKED, XFeat, XFeatModel, InterpolateSparse2d, DeDoDe, SOLD2, SOLD2_detector and DeFMO) as Convention blocks and pointers: the input range and layout each model reads, the keypoint frame, order and dtype each returns, how DISK's n and ALIKED's top-k and threshold modes select keypoints and where that departs from the reference implementations, which dense descriptors are normalised, the padded slots of LocalFeature and why they must be dropped before matching, and the known defects of SIFTFeature, ALIKED, SOLD2 and InterpolateSparse2d. (#5899)
kornia.geometry.conversions.denormalize_homography3d, the inverse of normalize_homography3d, and
kornia.geometry.conversions.ColmapQTVecs_to_ARKitQTVecs, the reverse of ARKitQTVecs_to_ColmapQTVecs, so both
conversions can now be round-tripped through the public API. (#5938)
Add weighted kornia.geometry.find_affine estimation and RANSAC(model_type="affine") for full 2D affine transforms. AdaLAM shares the linear solver while retaining its seed-constrained neighborhood RANSAC. Affine fitting and scoring retain at least float32 arithmetic under autocast. (#5940)
kornia.tracking and the numeric and tooling exports of kornia.contrib document their conventions in Convention blocks, the contrib page lists histogram_matching and interp and maps the connected-component connectivity onto SciPy, OpenCV and scikit-image, and the known defect links its issue (#5956). (#5978)
kornia.augmentation.CenterCrop, RandomCrop and RandomResizedCrop support inverse in their default cropping_mode="slice": images and masks, and for RandomCrop also boxes and keypoints, are warped back onto the input canvas with the inverse of the recorded transform_matrix, as in resample mode. Cropped-away content is not restored. These calls used to raise NotImplementedError, except that CenterCrop and RandomResizedCrop returned a tensor for an empty batch or one the crop was not applied to. (#5984)
kornia.models.qwen25.Qwen25VisionTransformer and Qwen25VisionConfig, the Qwen2.5-VL vision tower: a
temporal patch embedding, a 2D rotary position embedding, RMS-normalized blocks with gated MLPs, windowed
attention with full attention in selected blocks, and the 2 x 2 patch merger. from_pretrained strictly
loads the visual.* tensors of a Qwen2.5-VL checkpoint from a local file or directory. On the released
3B weights it matches Hugging Face transformers v4.51.0 on the same preprocessed patches.
kornia.core.load_safetensors gains an include predicate that copies only the selected tensors out of
the file, so a vision tower can be read from a shard it shares with a language model. Closes #6003. (#6025)
SigLip2Model.forward takes a pixel_attention_mask for the vision tower, as transformers' Siglip2Model.forward does: it reaches get_image_features, so the image embeddings, the logits and the return_loss loss leave out the masked patches. (#6051)
KORNIA_CHECK_SAME_SIZE checks that two tensors have the same size along a dimension, optionally accepting a size of 1 for the first, and KORNIA_CHECK_SIZES checks a tensor against sizes computed at run time, with None for a dimension of any size. Both build their error message only on failure. The msg of every KORNIA_CHECK* helper can also be a function without arguments, called only when the check fails: KORNIA_CHECK(condition, lambda: f"..."). (#6063)
kornia.filters.dexined.DexiNed is now the same class as kornia.models.dexined.DexiNed, which that module re-exports with its building blocks, so it gains to_onnx and its ONNX declarations. A whole model pickled from kornia.filters.dexined still loads, and a newly pickled one is stored under kornia.models.dexined. (#6107)
Added force_download=True to CachedDownloader and the ONNX loaders, including the Hugging Face community loader and DepthAnythingONNXBuilder, to refresh cached models, external weights, and preprocessing configs. Failed downloads preserve the previous cached file. Errors when loading cached models or parsing configs now suggest the option. (#6139)
The ONNX, torch.compile and torch.export page now opens with "What Kornia promises": the stable-core configurations
that export with the dynamo ONNX exporter at opset 18 and match eager in onnxruntime, and the ones that compile with
torch.compile(..., fullgraph=True) and match eager, for inference at static shapes, checked in CI on torch 2.9 and
2.14, with the configurations left out, the known failures and their tracking issues; the survey tables mark every
promised configuration. nms and draw_rectangle document how torch.compile handles them, and are left out of the
compile promise (#6194). (#6233)
API reference entries now carry a Try in browser badge that links a function, its
nn.Module counterpart or a browser model to its interactive page on the kornia.org
playground, so readers can run the operator on a sample image without installing anything.
The set of linked APIs is a snapshot of the playground in docs/source/_playground_links.json,
refreshed by docs/generate_playground_links.py. (#4333)
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)
An ONNX, torch.compile and torch.export support page under Resources (get-started/export-support)
lists every surveyed public operator, grouped by package and section, with its dynamo ONNX export,
torch.export and torch.compile outcome, the cause of each failure and a search box with result
filters. It is rendered at build time from the committed snapshot
docs/source/_data/export_support.json; docs/export_support/run.py reruns the survey to refresh
it. (#4182)
Documentation pages now provide search-specific titles and descriptions, canonical tutorial links, and a canonicalized redirect from the retired highlighted-features page. (#4226)
Documented bbox/Boxes geometry-operation conventions and added executable pins for transforms, NMS, padding, clipping, and area filtering, including known unbatched-input limitations. (#4245)
Documented camera distortion and calibration conventions (normalized versus pixel inputs, the
coefficient layout, the new_K/K roles, the iterative inverses) and added executable pins for
kornia.geometry.camera's distortion models and kornia.geometry.calibration, with the
tilt-projection, Kannala-Brandt Jacobian and float16 defects tracked in dedicated issues. (#4312)
Documented camera projection-core conventions (PinholeCamera frames, integer pixel centres, the two
meanings of depth, the z = 0 policies) and added executable pins for kornia.geometry.camera's
projection core, with the known scale-rule, aliasing, guard and legacy-API limitations tracked in
dedicated issues. (#4294)
Documented depth and stereo conventions (the two meanings of depth, the (B, 3, H, W) versus
(B, H, W, 3) layouts, the opposite source/destination naming of warp_frame_depth and
DepthWarper, the rectified stereo Q matrix) and added executable pins for kornia.geometry.depth
and StereoCamera, including dtype promotion, extra-axis broadcasting, subpixel border sampling,
and singular stereo reprojection. Remaining defects are tracked in dedicated issues. (#4317)
Documented the kornia.sensors.camera conventions (Vector-typed inputs, the per-model params
layout, the shared half-pixel scale rule, and the pinhole mapping shared with kornia.geometry.camera,
including its camera-axis broadcasting, projection rounding and zero/near-zero depth differences) and
added executable pins, with the unimplemented models tracked in a dedicated issue; the three non-pinhole
models now appear on the sensors documentation page. (#4318)
Documented the shared 2D contract of kornia.augmentation — the (B, C, H, W) float working layout
and keepdim, p / p_batch / same_on_batch, where random parameters are drawn and how torch.manual_seed
and params= replay them, what a module serializes, and what AugmentationSequential does with each data key
(layouts, the inclusive xyxy_plus boxes and integer-centre flips, nearest masks, extra_args, inverse) —
as Convention blocks on the base classes and containers, with the canonical randomness and serialization
statements on the Conventions & Pitfalls page and executable pins. The contracts distinguish sampler and
returned-parameter placement, trainable range parameters, application-time replay exceptions, padding labels,
information lost by rotated tensor boxes, mask-list gates, mixed mask dtypes, dictionary-key exceptions,
and the transplantation constructors. Scope corrections and regression tests cover mix-specific contracts,
inverse support, mask erasing/filtering/precision, nested matrices, serialization and sampler limitations;
the container, p_batch,
set_rng_device_and_dtype, state_dict and B = 0 defects are tracked in dedicated issues. (#4452)
Dynamo ONNX export (torch.onnx.export(..., dynamo=True)) now covers a much larger part of the
library: about 140 additional operator cases in the export survey capture, pass the ONNX checker
and match eager execution under onnxruntime. Operators that failed graph capture or had no ONNX
lowering gained an export-time path that returns the same values eagerly: matrix inverses up to
4x4 use a closed-form adjugate instead of aten::linalg_inv (warp_perspective3d,
warp_affine3d, rotate3d, affine3d, get_projective_transform, invert_affine_transform,
denormalize_homography, symmetric_transfer_error, safe_inverse_with_mask, DepthWarper,
PinholeCamera, StereoCamera, NamedPose, ImageRegistrator, ParametrizedLine.intersect
and the Se2/Se3/So2 groups); MedianBlur/median_blur select the median through sort;
HausdorffERLoss/HausdorffERLoss3D pool through amax (which also makes the 3D loss run on MPS); distance_transform avoids hypot;
match_nn/match_mnn/DescriptorMatcher avoid cdist; the mutual-information losses, the
Bessel kernels, solve_quadratic, matrix_cofactor_tensor, decompose_essential_matrix_no_svd,
distort_points/undistort_points/undistort_image, Boxes/Boxes3D (from_tensor,
to_mask), bbox_to_mask3d, mean_iou_bbox, conv_soft_argmax2d with a tensor temperature,
JPEGCodecDifferentiable, ZCAWhitening (transform/inverse_transform), BoxFiltering,
MotionBlur3D, center_crop/crop_and_resize/crop_by_transform_mat3d and the
OriNet/LAFOrienter/LAFAffNetShapeEstimator/HardNet/HardNet8/SIFTFeature/
LAFDescriptor/DeDoDe feature stack are branch-free or guard their data-dependent checks with
kornia.core.utils.is_exporting(). Among augmentations, LongestMaxSize, SmallestMaxSize,
RandomCrop, RandomResizedCrop, RandomAffine3D, RandomRotation3D, RandomMotionBlur3D,
RandomJPEG, RandomMedianBlur, RandomPlanckianJitter and AugmentationSequential with
crops or boxes now export, and LightGlue exports once depth_confidence/width_confidence
pruning is disabled. Behavior notes: Se2/Se3/So2/ParametrizedLine built from a tensor
that already carries autograd history (Se2.exp(v), ParametrizedLine.through(p0, p1)) keep
that history: the tensor is registered as a buffer instead of being re-rooted as an
nn.Parameter, so .to(), state_dict() and load_state_dict() still reach it under the same
key but it no longer appears in parameters(); kornia.core.utils.is_exporting() falls back to
is_compiling() on torch < 2.6, which has no export flag (inside a Dynamo trace newer torch
folds its flag to True for torch.compile as well, so the export-safe paths are what a
compiled graph contains on every supported version); under export crop_by_indices with a
size resamples the crop and without one keeps the eager path, distort_points/
undistort_points always apply the tilt term (a no-op when the coefficients are zero) and
normalize/denormalize accept a 1-D (C,) mean/std; matrix_cofactor_tensor returns exact
cofactors for singular matrices instead of raising when every matrix in the batch is singular.
(#4182)
Every page in the Models section of the docs now opens with the shortest script that runs the
model and a figure of its output on a real input, with the paper card moved to the bottom. The
figures are rendered by docs/generate_model_examples.py and committed under
docs/source/_static/img/models/, so the docs build needs neither the weights nor the sample
images. (#4178)
Implemented the exported Brown-Conrady, Kannala-Brandt K3, and Orthographic sensor camera models, including distortion/projection plumbing, intrinsic matrices, and batched project/unproject support. (#4284, #4377)
KimiVL and SigLIP2 builders load their safetensors checkpoints with kornia's own downloader
(kornia.core.download_hf_file/download_file_from_url, which share the retrying, rate-limit-aware
cache every other checkpoint uses) and a pure-torch reader (kornia.core.load_safetensors);
huggingface_hub and safetensors are no longer needed. Both were imported without ever being
declared as dependencies, so KimiVLBuilder.from_pretrained_hf() and
SigLip2Builder.from_pretrained_hf() used to raise ImportError on a plain pip install kornia.
The checkpoints move to torch's hub cache as a result; see Breaking changes. (#4293)
Linux CPU half-precision CI now uses explicit reproducible profiles, exact phase/exception manifests, complete lifecycle verification, and guarded candidate-only baseline regeneration. (#4154)
New "Camera and world conventions across the ecosystem" page cataloguing the pixel-centre, axis
and extrinsics conventions of OpenCV, COLMAP, OpenGL, ARKit, ARCore, PyTorch3D and Direct3D with the
kornia converter for each, plus the baked align_corners rows for the depth and undistortion warps on
the Conventions & Pitfalls page. (#4315)
Optional-dependency extra kornia[image] installs Pillow for PIL-backed image input/output,
display helpers and kornia.io.sample; missing-Pillow errors now name the extra to install, and the unused
DinoVisionTransformer.forward_features_list list path has been removed. (#4464)
Optional-dependency extras kornia[onnx] and kornia[sd] declare the third-party packages that
the ONNX and Stable-Diffusion-dissolving wrappers lazily import, and are documented on the
installation page. Missing-dependency errors now name the extra to install, and dev no longer
pulls diffusers and transformers. (#4301)
Repeatable Oxford affine local-feature benchmarks for SIFT, SIFT-AffNet-HardNet, and KeyNet-HardNet, with eager/compiled median/IQR speed, homography corner error, and JSON output; historical scale-space SIFT CPU/CUDA batch-runtime comparisons and plotting. (#4254)
The blocking MPS CI gate now runs on torch 2.14.0 instead of 2.9.1, on the macos-15 image
instead of macos-latest, and its recorded failure baseline drops from 200 entries to 14.
torch 2.14.0 adds MPS kernels for grid_sample's 2-D and 3-D backward passes, for
padding_mode="border" and 5-D mode="nearest" sampling, and for the eigen/QR/LU/SVD family
(eigh, svd, svdvals, qr, lu_solve, lstsq, cholesky_solve, matrix_exp), so most of
what used to fail on Apple silicon now runs there natively. What is still pinned in the
baseline: torch.linalg.eigvals, which has no MPS kernel and keeps the 5-point essential-matrix
solver off the device, and the yuv420/yuv422 empty-input reshape defect. Separately,
tests/geometry/test_ransac.py is skipped rather than pinned — it aborts the process on the
runners' paravirtualized GPU, and a SIGABRT has no exception type to record
(#4204); the skip costs 9 tests that pass on real
Apple hardware, and --run-mps-process-abort runs them locally. The underlying limit is that
torch.linalg.svd/svdvals/lstsq fails to build a Metal pipeline once its input
holds 8192 elements or more, which used to keep RANSAC's batched minimal solvers off the
device (#4201); _torch_svd_cast and
_torch_linalg_svdvals now route such inputs through the CPU, so the fundamental and
homography solvers reach it, while find_essential still raises on torch.linalg.eigvals,
which has no MPS kernel. The image stays on macos-15: on macos-latest (macOS 26) the runner's virtual
GPU cannot compile the Metal 4 cooperative-tensor shaders torch 2.14 emits, which fails 664
tests — a physical M1 on macOS 26 compiles them fine. kornia still supports torch 2.5.1, so the
in-tree MPS workarounds stay. (#4202)
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 furo layout stayed available
behind KORNIA_DOCS_THEME=furo until #4304 removed that fallback. (#4155)
benchmarks/feature/laf_ops.py microbenchmarks seven public LAF operations
(laf_from_center_scale_ori, make_upright, ellipse_to_laf, laf_to_boundary_points,
laf_is_inside_image, extract_patches_simple, extract_patches_from_pyramid) as kornia eager vs
torch.compile, and its CPU and CUDA runs are the first committed non-Apple result set, so the docs
performance page now shows CUDA numbers. The page labels its throughput column from a new optional
units metadata key (LAFs/s here, items/s when absent) and identifies a row by every config field
that varies within a result file rather than by (op, batch) alone, which a suite sweeping a second
axis at a fixed batch would otherwise collapse onto one row. run_batch_sweep gained label_fn,
items_fn and units so such a suite can use the shared sweep; the existing callers are unchanged.
(#4119)
kornia.feature.laf_is_filled(laf) returns the (B, N) mask of the slots a detection filled, the complement
of a detector's zero-LAF padding. Fixed-shape detectors pad the slots no detection filled with an all-zero LAF,
and those slots must be dropped before matching -- their descriptors are identical to one another, so they match
each other at zero distance and a mutual nearest-neighbour test does not reject them. LocalFeature.forward's
docstring already required callers of a hand-rolled pipeline to do this and gave them the expression to copy;
they can now call the function instead. It replaces the same expression at four internal sites in
kornia/feature. (#4223)
kornia.models.RRDBNet, a vendored Real-ESRGAN generator; RRDBNetBuilder no longer needs basicsr. (#4292)
kornia.metrics disparity reductions accumulate in float32 for float16 and bfloat16
inputs, so mean_absolute_disparity_error, root_mean_squared_disparity_error and
mean_bad_pixel_error no longer return inf on an image-sized map. A float16 sum saturates at
65504, and a bfloat16 sum lost roughly 0.5% over 100k terms. root_mean_squared_disparity_error
additionally squared in the input dtype, so a 300 px error saturated before any reduction ran;
it now squares in the accumulator dtype. A mixed-dtype pair now returns the promoted dtype from
every metric in the module rather than the dtype of input, matching what
mean_absolute_disparity_error already did. (#3931)warp_perspective, warp_affine, homography_warp, HomographyWarper and warp_image_tps now
build their sampling grid and homography normalization under the same align_corners convention
they pass to grid_sample. Previously the grid was always corner-aligned, so with
align_corners=False an identity homography did not reproduce its input (max deviation 11.25
on a 4x4 arange image) and a whole-pixel translation resampled at fractional offsets;
warp_image_tps was affected on its default path. create_meshgrid, normal_transform_pixel,
normalize_homography and denormalize_homography gain an align_corners parameter (last,
default True, so existing calls are unchanged). crop_by_transform_mat drops the #3650
correction matrix and the 1-pixel warp_affine fallback that worked around the mismatch, so
1-pixel outputs are exact under both settings. normal_transform_pixel also writes the
align_corners=False offset as a single division, so eager and graph capture agree bit for bit at
every size rather than differing by one float32 step at 5 of the first 4999.
Fixes #3904, #3928, #3929, #4411. (#3945)build_laplacian_pyramid() now pads mixed image sizes when needed to keep adjacent pyramid levels aligned, while
preserving the output shapes of sizes that already worked. (#3971)normal_transform_pixel and normal_transform_pixel3d now raise ValueError for an integer
dtype instead of returning a rank-deficient matrix. The scale 2 / (size - 1) truncated to 0,
so normal_transform_pixel(4, 5, dtype=torch.int64) returned [[0, 0, -1], [0, 0, -1], [0, 0, 1]]
and mapped every pixel to (-1, -1), with no error or warning. Floating point dtypes, including the
float8 formats, and complex dtypes are unaffected. (#3974)normal_transform_pixel and normal_transform_pixel3d also keep float64 constants exact under TorchScript, where they were previously rounded through float32. (#3979)rotation_matrix_to_quaternion no longer adds eps inside the square root of the dominant component, which inflated every float64 result: the identity used to return [1.0000000012499999, 0, 0, 0] and now returns exactly [1, 0, 0, 0], and the unit-norm error of random rotations drops from about 2.5e-9 to about 7e-16. eps is now only a floor on the radicands of the discarded branches; the selected branch's radicand is at least 1 for any real 3x3 matrix, so it never reaches the floor. ARKitQTVecs_to_ColmapQTVecs inherits the fix. float32, float16 and bfloat16 outputs are unchanged. (#3981)RANSAC's local-optimization step now keeps the polished model that verify() scores best, instead of always
taking the first candidate the polisher returns, so the returned model agrees with the returned inliers.
Every built-in polisher returns a single candidate, so results are unchanged for them; the fix matters for custom
polisher_solvers that return several candidates. (#3991)Boxes now preserves each batch element's padding metadata, so to_tensor()
returns the original number of boxes per element. (#4194)kornia.feature.loftr's CoarseMatching no longer crashes in training mode. Its gt-padding
branch called zip() with four separate 2-element lists instead of two 4-element lists, so
every resulting tuple failed to unpack (ValueError: too many values to unpack) on every call;
no existing test exercised this path. Restructured the zip() to pair each real tensor with its
ground-truth counterpart. Once reachable, a second bug surfaced: the padding tensor mconf_gt
was built without dtype=, defaulting to float32 regardless of mconf's own dtype (which can be
float16/bfloat16 under autocast) and silently promoting the concatenated result. Fixed by building
mconf_gt in mconf.dtype. (#4359)kornia.enhance.image_histogram2d no longer collapses distinct bins together on a float16 or bfloat16 image. The auto-built bin centers were created at the image dtype, which cannot represent the bin indices exactly: bfloat16 lost 63 of 256 centers at the default n_bins, and float16 lost 511 of 2048, so those bins came back numerically identical. The centers are now built at float32 for half-precision images (a float64 image keeps float64), and a floating-point image still gets its own dtype back. Integer images and explicitly passed centers behave exactly as before. (#4360)kornia.geometry.subpix.render_gaussian2d no longer distorts the rendered Gaussian's peak location on large grids for float16 and bfloat16 inputs. The pixel-coordinate linspace was built at the input dtype, so distinct coordinates collapsed together once width/height exceeded what the dtype represents exactly: about 2048 for float16 and about 256 for bfloat16. The coordinate vectors are now built at float32 for half-precision inputs, and the result is returned in the original dtype. Half-precision outputs of this function change bitwise (in a random-input check against the previous code every grid from 5x7 up differed, and a 1x1 grid did not), so stored regression baselines for half-precision inputs need regenerating. (#4361)PinholeCamera.scale_ now promotes an integer height / width with a floating-point scale factor to floating point, matching scale, instead of raising RuntimeError. (#4371)Boxes, Boxes3D, their from_tensor helpers and _transform_boxes now cast integer
input to torch.get_default_dtype() instead of a hardcoded float32. Under a caller that
sets torch.set_default_dtype(torch.float64) — as NPU and other backends commonly do — the
old .float() silently forced every box and transformation matrix down to single precision,
losing precision end to end. The mask, shape and transform results now follow the configured
default dtype. (#4379)unproject_meshgrid, depth_to_3d_v2 and
warp_frame_depth by passing a floating-point norm order. (#4389)linalg.svd and
linalg.svdvals fail to build their Metal pipeline state object once an input holds 8192 elements
or more, whatever the per-matrix shape. At realistic batch sizes find_fundamental and solve_pnp_dlt
raised that "Failed to created pipeline state object" exception; find_homography_dlt(..., solver="svd")
instead caught it, emitted a "SVD did not converge" warning, and returned an uninitialized (invalid)
tensor. Such inputs are now decomposed on the CPU and moved back. find_essential still raises on
MPS at any batch size, because run_5point calls torch.linalg.eigvals, which has no MPS kernel. (#4455)AutoAugment, RandAugment and TrivialAugment now raise a RuntimeError from inverse when the
drawn sub-policy applied a non-geometric operation, instead of silently returning a tensor that still
carries it -- for a draw with no geometry at all, the input unchanged. Only geometric operations are
invertible, and the sub-policy is redrawn on every forward pass. An operation whose probability gate
skipped every sample does not count. (#4456)RandomCrop with padding or pad_if_needed no longer shifts keypoints and bounding boxes by the
left/top padding when the crop is skipped; they previously moved while the image and mask stayed
unchanged. (#4473) (#4485)transform_points returns an empty result for an empty transkornia 0.9.0rc1 — headline: compile-first, deployable augmentations .
kornia 0.9.0rc1 — headline: compile-first, deployable augmentations.
Release candidate. Install with
pip install --pre kornia(won't be picked up by a plainpip install kornia). Please trytorch.export/torch.compileon your pipelines and report regressions before the final 0.9.0.
torch.export support — deterministic transforms (Normalize/Denormalize/Resize/CenterCrop/PadTo) and AugmentationSequential pipelines now capture cleanly and match eager, on torch 2.9.1 and 2.10 (#3856, #3858, #3861).torch.compile fullgraph sweep — ~20 ops across augmentation / enhance / color / filters / losses / geometry made graph-break-free, with a PR-time dynamo CI job on the CI torch version.elastic_transform2d 40×, RandomChannelShuffle 12×, posterize 16× (GPU); lazy transform-matrix (up to 2.9×); RNG-device propagation through container .to()/.cuda(); the compiled pipeline beats torchvision v2.RandomGrayscale (#3853)PatchMix augmentation (#3664)ColorJitter order, fullgraph-safe (#3799)correlate2d / convolve2d / correlate3d / convolve3d aliases (#3604)transform_points returns empty unchanged for 0-point input (#3855)torch.export: resample-mode crop after a resize no longer uses a stale shape (#3861)median_blur B=0; LightGlue empty keypoints (#3584); BgrToRgba (#3673)_commit_state state-write chokepoint (#3857); _blend_by_prob dispatch DRY (#3844); dead-override + dead-code removal (#3843, #3862)[0,1] input footgun note (#3850); custom-augmentation guide fix (#3852); base-class hierarchy diagram (#3860); torch.export/compile/ONNX deployment section (#3859)🤖 Generated with Claude Code
…broad documentation/docstring coverage. Several deprecated utilities in kornia.utils begin emitting DeprecationWarning targeting future removal.
Kornia v0.8.3 is a patch release rolling up ~175 commits since v0.8.2. Highlights:
new feature detectors and descriptors (XFeat, ALIKED), VisualPrompter batched
inference, half-precision (float16/bfloat16) support and test infrastructure,
performance improvements to core geometry ops (depth_to_normals ~3x, transform
points, denormalize_points_with_intrinsics ~2x), MPS device fixes, ONNX export
fixes, and broad documentation/docstring coverage. Several deprecated utilities
in kornia.utils begin emitting DeprecationWarning targeting future removal.
reviewers from Dependabot config (#3493) (7049f29)Note truncated.
Remove deprecation decorator from depth_to_3d function by @Incharajayaram in #3142
point_line_distance by 28% by @dasarchan in #3152val2list by 229% by @dasarchan in #3151KORNIA_CHECK_IS_IMAGE by 92% by @misrasaurabh1 in #3156connected_components() by @Halyjo in #3168torch<2.0.0 by @johnnv1 in #3186normalize_min_max by 64% by @Meggison in #3246compose_transformations by 24% by @Meggison in #3247val2tuple by 148% by @Meggison in #3233convert_points_from_homogeneous by @manurare in #3329Note truncated.
Remove deprecation decorator from depth_to_3d function by @Incharajayaram in #3142
point_line_distance by 28% by @dasarchan in #3152val2list by 229% by @dasarchan in #3151KORNIA_CHECK_IS_IMAGE by 92% by @misrasaurabh1 in #3156Full Changelog: v0.8.0...v0.8.1
Nick/ruff bugbear by @ntjohnson1 in #3076
2.5.1 by @johnnv1 in #3070Full Changelog: v0.7.4...v0.8.0
Replace deprecated torch.cuda.amp decorators for torch 2.4 by @loichuder in #2967
augmentation.Normalize (#3003) by @fang-d in #3004Full Changelog: v0.7.3...v0.7.4
Pre commit update hooks by @johnnv1 in #2844
dedode.tranformer by @johnnv1 in #2849robots.txt from docs by @johnnv1 in #2869Full Changelog: v0.7.2...v0.7.3
rename missing main by @edgarriba in #2723
viewcode to github by @johnnv1 in #2727extract_tensor_patches to work with partial patches cases by @johnnv1 in #27352.1.2 by @johnnv1 in #2742test -> tests by @johnnv1 in #2743kornia.testing by @johnnv1 in #2745torch==2.2.0 by @johnnv1 in #2772benchmarks/ by @johnnv1 in #2777ruff 0.2.1 config by @johnnv1 in #2784AugmentationSequential by @johnnv1 in #2740RandomLinearIllumination and `RandomLinearCornerIll… by @johnnv1 in #2827Full Changelog: https://github.com/kornia/kornia/commits/v0.7.2
replace deprecated prompter test and fix skiping dynamo test by @johnnv1 in https://github.com/kornia/kornia/pull/2623
sphinx==7.0.1 by @johnnv1 in https://github.com/kornia/kornia/pull/2518grid_sample from F without importing it. by @antoinebrl in https://github.com/kornia/kornia/pull/2532importlib.util import by @Avasam in https://github.com/kornia/kornia/pull/2558torchvision from docs deps by @johnnv1 in https://github.com/kornia/kornia/pull/2591torch.jit.script support for warp_affine by @balbok0 in https://github.com/kornia/kornia/pull/2588cv2 as dev dependency by @johnnv1 in https://github.com/kornia/kornia/pull/2593average_endpoint_error metric by @johnnv1 in https://github.com/kornia/kornia/pull/2620scipy from dev dependencies by @johnnv1 in https://github.com/kornia/kornia/pull/2634depth_to_3d by @johnnv1 in https://github.com/kornia/kornia/pull/2636focal.py by @omerferhatt in https://github.com/kornia/kornia/pull/2654kornia.nerf improvements by @edgarriba in https://github.com/kornia/kornia/pull/2661x requirements by @johnnv1 in https://github.com/kornia/kornia/pull/2670torch.ones not needed for kernel_values by @kunaltyagi in https://github.com/kornia/kornia/pull/2678Full Changelog: https://github.com/kornia/kornia/compare/v0.7.0...v0.7.1
One column per quarter.