Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

reorganise documenation in subsections (#542)

Edgar Ribae09fab32c144
diff --git a/docs/source/augmentation.rst b/docs/source/augmentation.rst
index f48668c95..85d9d3999 100644
--- a/docs/source/augmentation.rst
+++ b/docs/source/augmentation.rst
@@ -1,5 +1,5 @@
kornia.augmentation
--------------------
+===================
.. currentmodule:: kornia.augmentation
@@ -11,11 +11,53 @@ Kornia provides Torchvision-like augmentation APIs while may not reproduce Torch
- AdjustBrightness
- RandomRectangleErasing
-For detailed comparision, please checkout the For detailed comparision, please checkout the `Colab: Kornia vs. Torchvision<https://colab.research.google.com/drive/1T20UNAG4SdlE2n2wstuhiewve5Q81VpS#revisionId=0B4unZG1uMc-WdzZqaStjVzZ1U0hHOHphQkgvcGFCZ1RlUzJvPQ>`.
+For detailed comparision, please checkout the For detailed comparision, please checkout the `Colab: Kornia vs. Torchvision <https://colab.research.google.com/drive/1T20UNAG4SdlE2n2wstuhiewve5Q81VpS#revisionId=0B4unZG1uMc-WdzZqaStjVzZ1U0hHOHphQkgvcGFCZ1RlUzJvPQ/>`_.
+
+Containers
+----------
+
+This is the base class for creating a new transform. The user only needs to overrive: `generate_parameters`, `apply_transformation` and optionally, `compute_transformation`.
+
+
+.. autoclass:: AugmentationBase
+ :members:
+
+Create your own transformation:
+
+.. code-block:: python
+
+ class MyRandomTransform(nn.Module):
+ def __init__(self, return_transform: bool = False) -> None:
+ super(MyRandomTransform, self).__init__(return_transform)
+
+ def generate_parameters(self, input_shape: torch.Size):
+ # generate the random parameters as you wish depending on your use case.
+ angles_rad torch.Tensor = torch.rand(batch_shape) * K.pi
+ angles_deg = kornia.rad2deg(angles_rad) * self.angle
+ return dict(angles=angles_deg)
+
+ def compute_transformation(self, input, params):
+ # compute transformation
+ angles: torch.Tensor = params['angles'].type_as(input)
+ center = torch.tensor([[W / 2, H / 2]]).type_as(input)
+ transform = K.get_rotation_matrix2d(center, angles, torch.ones_like(angles))
+ return transform
+
+ def apply_transformation(self, input, params):
+ # compute transformation
+ transform = self.compute_transform(input, params)
+
+ # apply transformation and return
+ output = K.warp_affine(input, transform, (H, W))
+
+ return (output, transform)
+
+Module
+------
.. autoclass:: RandomHorizontalFlip
.. autoclass:: RandomVerticalFlip
-.. autoclass:: RandomRectangleErasing
+.. autoclass:: RandomErasing
.. autoclass:: RandomGrayscale
.. autoclass:: RandomAffine
.. autoclass:: RandomPerspective
@@ -27,5 +69,8 @@ For detailed comparision, please checkout the For detailed comparision, please c
.. autoclass:: Normalize
.. autoclass:: Denormalize
+Functional
+----------
+
.. automodule:: kornia.augmentation.functional
:members:
diff --git a/docs/source/color.rst b/docs/source/color.rst
index 28eeaf0b4..958233784 100644
--- a/docs/source/color.rst
+++ b/docs/source/color.rst
@@ -1,5 +1,5 @@
kornia.color
-------------
+============
.. currentmodule:: kornia.color
diff --git a/docs/source/contrib.rst b/docs/source/contrib.rst
index bb6624b3e..11e9bc940 100644
--- a/docs/source/contrib.rst
+++ b/docs/source/contrib.rst
@@ -1,11 +1,14 @@
kornia.contrib
-=====================
+==============
.. currentmodule:: kornia.contrib
.. autofunction:: extract_tensor_patches
.. autofunction:: max_blur_pool2d
+Module
+------
+
.. autoclass:: ExtractTensorPatches
.. autoclass:: MaxBlurPool2d
diff --git a/docs/source/feature.rst b/docs/source/feature.rst
index d75e124e3..a10bf8bfa 100644
--- a/docs/source/feature.rst
+++ b/docs/source/feature.rst
@@ -1,15 +1,33 @@
kornia.feature
-=====================
+==============
.. currentmodule:: kornia.feature
+Non Maxima Suppression
+----------------------
+
.. autofunction:: non_maxima_suppression2d
.. autofunction:: non_maxima_suppression3d
.. autofunction:: nms2d
.. autofunction:: nms3d
+
+Detectors
+---------
+
.. autofunction:: gftt_response
.. autofunction:: harris_response
.. autofunction:: hessian_response
+
+Descriptors
+-----------
+
+.. autoclass:: SIFTDescriptor
+.. autoclass:: HardNet
+.. autoclass:: SOSNet
+
+Local Affine Frames (LAF)
+-------------------------
+
.. autofunction:: extract_patches_from_pyramid
.. autofunction:: extract_patches_simple
.. autofunction:: normalize_laf
@@ -27,13 +45,16 @@ kornia.feature
.. autofunction:: laf_from_three_points
.. autofunction:: raise_error_if_laf_is_not_valid
+
+Module
+------
+
.. autoclass:: NonMaximaSuppression2d
.. autoclass:: NonMaximaSuppression3d
.. autoclass:: BlobHessian
.. autoclass:: CornerGFTT
.. autoclass:: CornerHarris
-.. autoclass:: SIFTDescriptor
-.. autoclass:: HardNet
+
.. autoclass:: ScaleSpaceDetector
:members: forward
.. autoclass:: PassLAF
diff --git a/docs/source/filters.rst b/docs/source/filters.rst
index 0cc8f91df..05705f8a8 100644
--- a/docs/source/filters.rst
+++ b/docs/source/filters.rst
@@ -1,26 +1,40 @@
kornia.filters
----------------------
+==============
.. currentmodule:: kornia.filters
The functions in this sections perform various image filtering operations.
+Blurring
+--------
+
.. autofunction:: filter2D
.. autofunction:: box_blur
.. autofunction:: median_blur
.. autofunction:: gaussian_blur2d
-.. autofunction:: laplacian
-.. autofunction:: sobel
-.. autofunction:: spatial_gradient
-.. autofunction:: spatial_gradient3d
.. autofunction:: motion_blur
+Kernels
+-------
+
.. autofunction:: get_gaussian_kernel1d
.. autofunction:: get_gaussian_kernel2d
.. autofunction:: get_laplacian_kernel1d
.. autofunction:: get_laplacian_kernel2d
.. autofunction:: get_motion_kernel2d
+
+Edge detection
+--------------
+
+.. autofunction:: laplacian
+.. autofunction:: sobel
+.. autofunction:: spatial_gradient
+.. autofunction:: spatial_gradient3d
+
+Module
+------
+
.. autoclass:: BoxBlur
.. autoclass:: MedianBlur
.. autoclass:: GaussianBlur2d
diff --git a/docs/source/geometry.rst b/docs/source/geometry.rst
index a70bfbb4f..737423f63 100644
--- a/docs/source/geometry.rst
+++ b/docs/source/geometry.rst
@@ -3,6 +3,19 @@ kornia.geometry
.. currentmodule:: kornia.geometry
+.. toctree::
+ :maxdepth: 2
+
+ geometry.camera
+ geometry.conversions
+ geometry.depth
+ geometry.linalg
+ geometry.transform
+ geometry.warp
+
+Coordinates Subpixel
+--------------------
+
.. autofunction:: spatial_softmax_2d
.. autofunction:: spatial_softargmax_2d
.. autofunction:: render_gaussian_2d
@@ -11,20 +24,10 @@ kornia.geometry
.. autofunction:: conv_quad_interp3d
.. autofunction:: spatial_softmax_2d
+Module
+------
.. autoclass:: SpatialSoftArgmax2d
.. autoclass:: ConvSoftArgmax2d
.. autoclass:: ConvSoftArgmax3d
.. autoclass:: ConvQuadInterp3d
-
-
-.. toctree::
- :maxdepth: 2
-
- geometry.camera
- geometry.conversions
- geometry.depth
- geometry.linalg
- geometry.transform
- geometry.warp
-
diff --git a/docs/source/losses.rst b/docs/source/losses.rst
index 76e866829..54a8c1139 100644
--- a/docs/source/losses.rst
+++ b/docs/source/losses.rst
@@ -1,18 +1,32 @@
kornia.losses
-====================
+=============
.. currentmodule:: kornia.losses
-.. autofunction:: dice_loss
-.. autofunction:: total_variation
-.. autofunction:: psnr_loss
-.. autofunction:: tversky_loss
-.. autofunction:: focal_loss
+Reconstruction
+--------------
+
.. autofunction:: ssim
+.. autofunction:: psnr_loss
+.. autofunction:: total_variation
.. autofunction:: inverse_depth_smoothness_loss
+
+Semantic Segmentation
+---------------------
+
+.. autofunction:: focal_loss
+.. autofunction:: dice_loss
+.. autofunction:: tversky_loss
+
+Distributions
+-------------
+
.. autofunction:: js_div_loss_2d
.. autofunction:: kl_div_loss_2d
+Module
+------
+
.. autoclass:: DiceLoss
.. autoclass:: TverskyLoss
.. autoclass:: FocalLoss
diff --git a/docs/source/utils.metrics.rst b/docs/source/utils.metrics.rst
deleted file mode 100644
index 4171c1e60..000000000
--- a/docs/source/utils.metrics.rst
+++ /dev/null
@@ -1,7 +0,0 @@
-kornia.utils.metrics
-===========================
-
-.. currentmodule:: kornia.utils.metrics
-
-.. autofunction:: confusion_matrix
-.. autofunction:: mean_iou
diff --git a/docs/source/utils.rst b/docs/source/utils.rst
index 2210b3af7..49e258f54 100644
--- a/docs/source/utils.rst
+++ b/docs/source/utils.rst
@@ -3,15 +3,27 @@ kornia.utils
.. currentmodule:: kornia.utils
+Image
+-----
+
.. autofunction:: tensor_to_image
.. autofunction:: image_to_tensor
+
+Grid
+----
+
.. autofunction:: create_meshgrid
.. autofunction:: create_meshgrid3d
+
+Pointcloud
+----------
+
.. autofunction:: save_pointcloud_ply
.. autofunction:: load_pointcloud_ply
-.. autofunction:: one_hot
-.. toctree::
- :maxdepth: 2
+Metrics
+-------
- utils.metrics
+.. autofunction:: confusion_matrix
+.. autofunction:: mean_iou
+.. autofunction:: one_hot