You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While using the kornia.geometry.find_homography_dlt function, in some scenarios the Jacobian computed by the autograd return nan values.
Reproduction steps
import torch
import kornia as K
"""Code example to verify the DLT Jacobian for the homographies.|x2| |h1 h2 h3| |x1||y2| = |h4 h5 h6| @ |y1||1 | |h7 h8 h9| |1 |DLT => x' = H @ x = 0"""
def f(x):
x1, x2 = x.unbind(-1)
# TODO: this returns jacobian with nansreturn K.geometry.find_homography_dlt(x1, x2)
# NOTE: this works as expected# return K.geometry.get_perspective_transform(x1, x2)# define some points in the corners with a scale factor of 100
x1 = torch.tensor([[[0., 0.], [0., 1.], [1., 0.], [1., 1.]]])
x2 = torch.tensor([[[0., 0.], [0., 100.], [100., 0.], [100., 100.]]])
x = torch.stack((x1, x2), dim=-1)# NOTE: this guy does not produce nan values# x = torch.rand_like(x)H = f(x) # compute the homography between the set of pointsprint(H)print(H.shape)J = torch.autograd.functional.jacobian(f, x)print(J)print(J.shape)
Expected behavior
We should expect the jacobian J to always contain valid values.
Environment
PyTorch version: 1.6.0
Is debug build: False
CUDA used to build PyTorch: 10.2
ROCM used to build PyTorch: N/A
OS: Ubuntu 20.04.2 LTS (x86_64)
GCC version: (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Clang version: Could not collect
CMake version: version 3.20.5
Libc version: glibc-2.17
Python version: 3.7.11 (default, Jul 27 2021, 14:32:16) [GCC 7.5.0] (64-bit runtime)
Python platform: Linux-5.11.0-37-generic-x86_64-with-debian-bullseye-sid
Is CUDA available: True
CUDA runtime version: Could not collect
GPU models and configuration: GPU 0: NVIDIA GeForce GTX 1650 with Max-Q Design
Nvidia driver version: 470.63.01
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Versions of relevant libraries:
[pip3] mypy==0.910
[pip3] mypy-extensions==0.4.3
[pip3] numpy==1.21.2
[pip3] pytest-mypy==0.8.1
[pip3] torch==1.9.0
[pip3] torchmetrics==0.5.1
[pip3] torchvision==0.7.0
[conda] blas 1.0 mkl
[conda] cudatoolkit 10.2.89 hfd86e86_1
[conda] ffmpeg 4.3 hf484d3e_0 pytorch
[conda] mkl 2021.3.0 h06a4308_520
[conda] mkl-service 2.4.0 py37h7f8727e_0
[conda] mkl_fft 1.3.0 py37h42c9631_2
[conda] mkl_random 1.2.2 py37h51133e4_0
[conda] mypy 0.910 pypi_0 pypi
[conda] mypy-extensions 0.4.3 pypi_0 pypi
[conda] numpy 1.21.2 pypi_0 pypi
[conda] numpy-base 1.20.3 py37h74d4b33_0
[conda] pytest-mypy 0.8.1 pypi_0 pypi
[conda] pytorch 1.6.0 py3.7_cuda10.2.89_cudnn7.6.5_0 pytorch
[conda] torch 1.9.0 pypi_0 pypi
[conda] torchmetrics 0.5.1 pypi_0 pypi
[conda] torchvision 0.7.0 py37_cu102 pytorch
Additional context
Seems only to happen when zeros come to the game for some points.
The text was updated successfully, but these errors were encountered:
Describe the bug
While using the
kornia.geometry.find_homography_dlt
function, in some scenarios the Jacobian computed by the autograd return nan values.Reproduction steps
Expected behavior
We should expect the jacobian
J
to always contain valid values.Environment
Additional context
Seems only to happen when zeros come to the game for some points.
The text was updated successfully, but these errors were encountered: