Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

Fix docstrings tags typos (#2461)

Qingpeng Lic4eb67ea1973
diff --git a/kornia/contrib/models/sam/model.py b/kornia/contrib/models/sam/model.py
index b496911b6..8a072156c 100644
--- a/kornia/contrib/models/sam/model.py
+++ b/kornia/contrib/models/sam/model.py
@@ -201,7 +201,7 @@ class Sam(ModelBase[SamConfig]):
This method expects that the images have already been pre-processed, at least been normalized, resized and
padded to be compatible with the `self.image_encoder`.
- .. note: For each image :math:`(3, H, W)`, it is possible to input a batch (:math:`K`) of :math:`N` prompts,
+ .. note:: For each image :math:`(3, H, W)`, it is possible to input a batch (:math:`K`) of :math:`N` prompts,
the results are batched by the number of prompts batch. So given a prompt with :math:`K=5`, and
:math:`N=10`, the results will look like :math:`5xCxHxW` where :math:`C` is determined by
multimask_output. And within each of these masks :math:`(5xC)`, it should be possible to find
diff --git a/kornia/contrib/models/structures.py b/kornia/contrib/models/structures.py
index 3384c55ca..f5e2b313b 100644
--- a/kornia/contrib/models/structures.py
+++ b/kornia/contrib/models/structures.py
@@ -27,7 +27,8 @@ class SegmentationResults:
Shape will be the same of logits :math:`(B, C, H, W)` where :math:`C` is the number masks predicted.
- .. note: If you run `original_res_logits`, this will generate the masks based on the original resolution logits.
+ .. note:: If you run `original_res_logits`, this will generate the masks
+ based on the original resolution logits.
Otherwise, this will use the low resolution logits (self.logits).
"""
if self._original_res_logits is not None:
@@ -44,7 +45,7 @@ class SegmentationResults:
Resize to image encoder input -> remove padding (bottom and right) -> Resize to original size
- .. note: This method set a internal `original_res_logits` which will be used if available for the binary masks.
+ .. note:: This method set a internal `original_res_logits` which will be used if available for the binary masks.
Args:
input_size: The size of the image input to the model, in (H, W) format. Used to remove padding.
diff --git a/kornia/geometry/quaternion.py b/kornia/geometry/quaternion.py
index ff7f16a0c..0924be711 100644
--- a/kornia/geometry/quaternion.py
+++ b/kornia/geometry/quaternion.py
@@ -24,14 +24,14 @@ class Quaternion(Module):
The general definition of a quaternion is given by:
- .. math ::
+ .. math::
Q = a + b \cdot \mathbf{i} + c \cdot \mathbf{j} + d \cdot \mathbf{k}
Thus, we represent a rotation quaternion as a contiguous tensor structure to
perform rigid bodies transformations:
- .. math ::
+ .. math::
Q = \begin{bmatrix} q_w & q_x & q_y & q_z \end{bmatrix}
diff --git a/kornia/geometry/transform/imgwarp.py b/kornia/geometry/transform/imgwarp.py
index 5e5eebc35..eab8f9650 100644
--- a/kornia/geometry/transform/imgwarp.py
+++ b/kornia/geometry/transform/imgwarp.py
@@ -294,7 +294,7 @@ def get_perspective_transform(points_src: Tensor, points_dst: Tensor) -> Tensor:
The function calculates the matrix of a perspective transform that maps from
the source to destination points:
- .. math ::
+ .. math::
\begin{bmatrix}
x^{'} \\
@@ -964,7 +964,7 @@ def get_perspective_transform3d(src: Tensor, dst: Tensor) -> Tensor:
The function calculates the matrix of a perspective transform so that:
- .. math ::
+ .. math::
\begin{bmatrix}
t_{i}x_{i}^{'} \\
@@ -983,12 +983,12 @@ def get_perspective_transform3d(src: Tensor, dst: Tensor) -> Tensor:
where
- .. math ::
+ .. math::
dst(i) = (x_{i}^{'},y_{i}^{'},z_{i}^{'}), src(i) = (x_{i}, y_{i}, z_{i}), i = 0,1,2,5,7
Concrete math is as below:
- .. math ::
+ .. math::
\[ u_i =\frac{c_{00} * x_i + c_{01} * y_i + c_{02} * z_i + c_{03}}
{c_{30} * x_i + c_{31} * y_i + c_{32} * z_i + c_{33}} \]
@@ -997,7 +997,7 @@ def get_perspective_transform3d(src: Tensor, dst: Tensor) -> Tensor:
\[ w_i =\frac{c_{20} * x_i + c_{21} * y_i + c_{22} * z_i + c_{23}}
{c_{30} * x_i + c_{31} * y_i + c_{32} * z_i + c_{33}} \]
- .. math ::
+ .. math::
\begin{pmatrix}
x_0 & y_0 & z_0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & -x_0*u_0 & -y_0*u_0 & -z_0 * u_0 \\
diff --git a/kornia/losses/charbonnier.py b/kornia/losses/charbonnier.py
index 651adffa9..8b2a3ce10 100644
--- a/kornia/losses/charbonnier.py
+++ b/kornia/losses/charbonnier.py
@@ -25,7 +25,7 @@ def charbonnier_loss(img1: Tensor, img2: Tensor, reduction: str = "none") -> Ten
[3] https://hal.inria.fr/inria-00074015/document
[4] https://arxiv.org/pdf/1712.05927.pdf
- . note::
+ .. note::
This implementation follows the formulation by Barron [1]. Other works utilize
a slightly different implementation (see [4]).
@@ -89,7 +89,7 @@ class CharbonnierLoss(Module):
[3] https://hal.inria.fr/inria-00074015/document
[4] https://arxiv.org/pdf/1712.05927.pdf
- . note::
+ .. note::
This implementation follows the formulation by Barron [1]. Other works utilize
a slightly different implementation (see [4]).
diff --git a/kornia/losses/focal.py b/kornia/losses/focal.py
index 74b7396d3..aae030718 100644
--- a/kornia/losses/focal.py
+++ b/kornia/losses/focal.py
@@ -41,7 +41,7 @@ def focal_loss(
will be applied, ``'mean'``: the sum of the output will be divided by
the number of elements in the output, ``'sum'``: the output will be
summed.
- weight: weights for classes with shape :math:`(num_of_classes,)`.
+ weight: weights for classes with shape :math:`(num\_of\_classes,)`.
Return:
the computed loss.
@@ -127,7 +127,7 @@ class FocalLoss(nn.Module):
will be applied, ``'mean'``: the sum of the output will be divided by
the number of elements in the output, ``'sum'``: the output will be
summed.
- weight: weights for classes with shape :math:`(num_of_classes,)`.
+ weight: weights for classes with shape :math:`(num\_of\_classes,)`.
Shape:
- Input: :math:`(N, C, *)` where C = number of classes.
@@ -188,9 +188,9 @@ def binary_focal_loss_with_logits(
will be applied, ``'mean'``: the sum of the output will be divided by
the number of elements in the output, ``'sum'``: the output will be
summed.
- pos_weight: a weight of positive examples with shape :math:`(num_of_classes,)`.
+ pos_weight: a weight of positive examples with shape :math:`(num\_of\_classes,)`.
It is possible to trade off recall and precision by adding weights to positive examples.
- weight: weights for classes with shape :math:`(num_of_classes,)`.
+ weight: weights for classes with shape :math:`(num\_of\_classes,)`.
Returns:
the computed loss.
@@ -282,9 +282,9 @@ class BinaryFocalLossWithLogits(nn.Module):
will be applied, ``'mean'``: the sum of the output will be divided by
the number of elements in the output, ``'sum'``: the output will be
summed.
- pos_weight: a weight of positive examples with shape :math:`(num_of_classes,)`.
+ pos_weight: a weight of positive examples with shape :math:`(num\_of\_classes,)`.
It is possible to trade off recall and precision by adding weights to positive examples.
- weight: weights for classes with shape :math:`(num_of_classes,)`.
+ weight: weights for classes with shape :math:`(num\_of\_classes,)`.
Shape:
- Input: :math:`(N, C, *)` where C = number of classes.
diff --git a/kornia/losses/lovasz_hinge.py b/kornia/losses/lovasz_hinge.py
index da3a6abbf..b8101d451 100644
--- a/kornia/losses/lovasz_hinge.py
+++ b/kornia/losses/lovasz_hinge.py
@@ -34,7 +34,7 @@ def lovasz_hinge_loss(pred: Tensor, target: Tensor) -> Tensor:
[1] http://proceedings.mlr.press/v37/yub15.pdf
[2] https://arxiv.org/pdf/1705.08790.pdf
- . note::
+ .. note::
This loss function only supports binary labels. For multi-class labels please
use the Lovasz-Softmax loss.
@@ -114,7 +114,7 @@ class LovaszHingeLoss(nn.Module):
[1] http://proceedings.mlr.press/v37/yub15.pdf
[2] https://arxiv.org/pdf/1705.08790.pdf
- . note::
+ .. note::
This loss function only supports binary labels. For multi-class labels please
use the Lovasz-Softmax loss.
diff --git a/kornia/losses/lovasz_softmax.py b/kornia/losses/lovasz_softmax.py
index a59689731..02f6dddb2 100644
--- a/kornia/losses/lovasz_softmax.py
+++ b/kornia/losses/lovasz_softmax.py
@@ -33,7 +33,7 @@ def lovasz_softmax_loss(pred: Tensor, target: Tensor) -> Tensor:
Reference:
[1] https://arxiv.org/pdf/1705.08790.pdf
- . note::
+ .. note::
This loss function only supports multi-class (C > 1) labels. For binary
labels please use the Lovasz-Hinge loss.
@@ -121,7 +121,7 @@ class LovaszSoftmaxLoss(nn.Module):
Reference:
[1] https://arxiv.org/pdf/1705.08790.pdf
- . note::
+ .. note::
This loss function only supports multi-class (C > 1) labels. For binary
labels please use the Lovasz-Hinge loss.