Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

Fix typos discovered by codespell (#1214)

Christian Clauss5db1021f5073
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index e04b90600..61d170d38 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -20,6 +20,16 @@ repos:
hooks:
- id: black
+ - repo: https://github.com/codespell-project/codespell
+ rev: v2.1.0
+ hooks:
+ - id: codespell
+ args:
+ - --ignore-words-list
+ - "ans,hist"
+ - --skip
+ - "*.bib,*.ipynb"
+
- repo: https://github.com/PyCQA/isort
rev: 5.9.3
hooks:
@@ -29,3 +39,9 @@ repos:
rev: 3.9.2
hooks:
- id: flake8
+
+ #- repo: https://github.com/asottile/pyupgrade
+ # rev: v2.23.0
+ # hooks:
+ # - id: pyupgrade
+ # args: [--py36-plus]
diff --git a/docs/source/conf.py b/docs/source/conf.py
index 3c087e602..fa022b4da 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -48,7 +48,7 @@ extensions = [
'sphinxcontrib.bibtex',
]
-# subsitutes the default values
+# substitutes the default values
docstring_default_arg_substitution = 'Default: '
bibtex_bibfiles = ['references.bib']
diff --git a/docs/source/installation.rst b/docs/source/installation.rst
index 9e35c1e94..a3d1f2623 100644
--- a/docs/source/installation.rst
+++ b/docs/source/installation.rst
@@ -25,7 +25,7 @@ To install *Kornia*, you can do it in two different ways: using the provided `Py
pip install git+https://github.com/kornia/kornia
-Once you succeded installing *Kornia* check you can import:
+Once you succeeded installing *Kornia* check you can import:
.. code:: bash
diff --git a/kornia/augmentation/augmentation.py b/kornia/augmentation/augmentation.py
index 1ddcdd591..9f8706899 100644
--- a/kornia/augmentation/augmentation.py
+++ b/kornia/augmentation/augmentation.py
@@ -59,7 +59,7 @@ class RandomHorizontalFlip(GeometricAugmentationBase2D):
p: probability of the image being flipped.
return_transform: if ``True`` return the matrix describing the transformation applied to each
input tensor. If ``False`` and the input is a tuple the applied transformation
- wont be concatenated.
+ won't be concatenated.
same_on_batch: apply the same transformation across the batch.
keepdim: whether to keep the output shape the same as input (True) or broadcast it
to the batch form (False).
@@ -115,7 +115,7 @@ class RandomVerticalFlip(GeometricAugmentationBase2D):
p: probability of the image being flipped.
return_transform: if ``True`` return the matrix describing the transformation applied to each
input tensor. If ``False`` and the input is a tuple the applied transformation
- wont be concatenated.
+ won't be concatenated.
same_on_batch: apply the same transformation across the batch.
keepdim: whether to keep the output shape the same as input (True) or broadcast it
to the batch form (False).
@@ -175,7 +175,7 @@ class ColorJitter(IntensityAugmentationBase2D):
hue: The hue factor to apply.
return_transform: if ``True`` return the matrix describing the transformation applied to each
input tensor. If ``False`` and the input is a tuple the applied transformation
- wont be concatenated.
+ won't be concatenated.
same_on_batch: apply the same transformation across the batch.
keepdim: whether to keep the output shape the same as input (True) or broadcast it
to the batch form (False).
@@ -271,7 +271,7 @@ class RandomGrayscale(IntensityAugmentationBase2D):
p: probability of the image to be transformed to grayscale.
return_transform: if ``True`` return the matrix describing the transformation applied to each
input tensor. If ``False`` and the input is a tuple the applied transformation
- wont be concatenated.
+ won't be concatenated.
same_on_batch: apply the same transformation across the batch.
keepdim: whether to keep the output shape the same as input (True) or broadcast it
to the batch form (False).
@@ -518,8 +518,8 @@ class RandomAffine(GeometricAugmentationBase2D):
If (a, b, c, d), the scale is randomly sampled from the range a <= scale_x <= b, c <= scale_y <= d.
Will keep original scale by default.
shear: Range of degrees to select from.
- If float, a shear parallel to the x axis in the range (-shear, +shear) will be apllied.
- If (a, b), a shear parallel to the x axis in the range (-shear, +shear) will be apllied.
+ If float, a shear parallel to the x axis in the range (-shear, +shear) will be applied.
+ If (a, b), a shear parallel to the x axis in the range (-shear, +shear) will be applied.
If (a, b, c, d), then x-axis shear in (shear[0], shear[1]) and y-axis shear in (shear[2], shear[3])
will be applied. Will not apply shear by default.
resample: resample mode from "nearest" (0) or "bilinear" (1).
@@ -827,7 +827,7 @@ class RandomRotation(GeometricAugmentationBase2D):
resample: Default: the interpolation mode.
return_transform: if ``True`` return the matrix describing the transformation applied to each
input tensor. If ``False`` and the input is a tuple the applied transformation
- wont be concatenated.
+ won't be concatenated.
same_on_batch: apply the same transformation across the batch.
align_corners: interpolation flag.
keepdim: whether to keep the output shape the same as input (True) or broadcast it
@@ -936,7 +936,7 @@ class RandomCrop(GeometricAugmentationBase2D):
resample: the interpolation mode.
return_transform: if ``True`` return the matrix describing the transformation applied to each
input tensor. If ``False`` and the input is a tuple the applied transformation
- wont be concatenated.
+ won't be concatenated.
same_on_batch: apply the same transformation across the batch.
align_corners: interpolation flag.
keepdim: whether to keep the output shape the same as input (True) or broadcast it
@@ -1158,7 +1158,7 @@ class RandomResizedCrop(GeometricAugmentationBase2D):
resample: the interpolation mode.
return_transform: if ``True`` return the matrix describing the transformation applied to each
input tensor. If ``False`` and the input is a tuple the applied transformation
- wont be concatenated.
+ won't be concatenated.
same_on_batch: apply the same transformation across the batch.
align_corners: interpolation flag.
keepdim: whether to keep the output shape the same as input (True) or broadcast it
@@ -1536,7 +1536,7 @@ class RandomSolarize(IntensityAugmentationBase2D):
If tuple (x, y), addition will be generated from (x, y).
same_on_batch: apply the same transformation across the batch.
return_transform: if ``True`` return the matrix describing the transformation applied to each
- input tensor. If ``False`` and the input is a tuple the applied transformation wont be concatenated.
+ input tensor. If ``False`` and the input is a tuple the applied transformation won't be concatenated.
keepdim: whether to keep the output shape the same as input (True) or broadcast it
to the batch form (False).
@@ -1612,7 +1612,7 @@ class RandomPosterize(IntensityAugmentationBase2D):
If tuple (x, y), bits will be generated from (x, y).
same_on_batch: apply the same transformation across the batch.
return_transform: if ``True`` return the matrix describing the transformation applied to each
- input tensor. If ``False`` and the input is a tuple the applied transformation wont be concatenated.
+ input tensor. If ``False`` and the input is a tuple the applied transformation won't be concatenated.
keepdim: whether to keep the output shape the same as input (True) or broadcast it
to the batch form (False).
@@ -1676,7 +1676,7 @@ class RandomSharpness(IntensityAugmentationBase2D):
sharpness: factor of sharpness strength. Must be above 0.
same_on_batch: apply the same transformation across the batch.
return_transform: if ``True`` return the matrix describing the transformation applied to each
- input tensor. If ``False`` and the input is a tuple the applied transformation wont be concatenated.
+ input tensor. If ``False`` and the input is a tuple the applied transformation won't be concatenated.
keepdim: whether to keep the output shape the same as input (True) or broadcast it
to the batch form (False).
@@ -1741,7 +1741,7 @@ class RandomEqualize(IntensityAugmentationBase2D):
same_on_batch: apply the same transformation across the batch.
return_transform: if ``True`` return the matrix describing the transformation applied to each
input tensor. If ``False`` and the input is a tuple the applied transformation
- wont be concatenated.
+ won't be concatenated.
keepdim: whether to keep the output shape the same as input (True) or broadcast it
to the batch form (False).
@@ -1789,7 +1789,7 @@ class RandomGaussianBlur(IntensityAugmentationBase2D):
border_type: the padding mode to be applied before convolving.
The expected modes are: ``constant``, ``reflect``, ``replicate`` or ``circular``.
return_transform: if ``True`` return the matrix describing the transformation applied to each
- input tensor. If ``False`` and the input is a tuple the applied transformation wont be concatenated.
+ input tensor. If ``False`` and the input is a tuple the applied transformation won't be concatenated.
same_on_batch: apply the same transformation across the batch.
p: probability of applying the transformation.
@@ -1869,7 +1869,7 @@ class RandomInvert(IntensityAugmentationBase2D):
max_val: The expected maximum value in the input tensor. The shape has to
according to the input tensor shape, or at least has to work with broadcasting.
return_transform: if ``True`` return the matrix describing the transformation applied to each
- input tensor. If ``False`` and the input is a tuple the applied transformation wont be concatenated.
+ input tensor. If ``False`` and the input is a tuple the applied transformation won't be concatenated.
same_on_batch: apply the same transformation across the batch.
p: probability of applying the transformation.
@@ -1914,7 +1914,7 @@ class RandomChannelShuffle(IntensityAugmentationBase2D):
Args:
return_transform: if ``True`` return the matrix describing the transformation applied to each
- input tensor. If ``False`` and the input is a tuple the applied transformation wont be concatenated.
+ input tensor. If ``False`` and the input is a tuple the applied transformation won't be concatenated.
same_on_batch: apply the same transformation across the batch.
p: probability of applying the transformation.
@@ -1958,7 +1958,7 @@ class RandomGaussianNoise(IntensityAugmentationBase2D):
mean: The mean of the gaussian distribution.
std: The standard deviation of the gaussian distribution.
return_transform: if ``True`` return the matrix describing the transformation applied to each
- input tensor. If ``False`` and the input is a tuple the applied transformation wont be concatenated.
+ input tensor. If ``False`` and the input is a tuple the applied transformation won't be concatenated.
same_on_batch: apply the same transformation across the batch.
p: probability of applying the transformation.
@@ -2005,7 +2005,7 @@ class RandomFisheye(GeometricAugmentationBase2D):
center_y: Ranges to sample respect to y-coordinate center with shape (2,).
gamma: Ranges to sample for the gamma values respect to optical center with shape (2,).
return_transform: if ``True`` return the matrix describing the transformation applied to each
- input tensor. If ``False`` and the input is a tuple the applied transformation wont be concatenated.
+ input tensor. If ``False`` and the input is a tuple the applied transformation won't be concatenated.
same_on_batch: apply the same transformation across the batch.
p: probability of applying the transformation.
@@ -2083,13 +2083,13 @@ class RandomElasticTransform(GeometricAugmentationBase2D):
Args:
kernel_size: the size of the Gaussian kernel.
sigma: The standard deviation of the Gaussian in the y and x directions,
- respecitvely. Larger sigma results in smaller pixel displacements.
+ respectively. Larger sigma results in smaller pixel displacements.
alpha: The scaling factor that controls the intensity of the deformation
in the y and x directions, respectively.
align_corners: Interpolation flag used by `grid_sample`.
mode: Interpolation mode used by `grid_sample`. Either 'bilinear' or 'nearest'.
return_transform: if ``True`` return the matrix describing the transformation applied to each
- input tensor. If ``False`` and the input is a tuple the applied transformation wont be concatenated.
+ input tensor. If ``False`` and the input is a tuple the applied transformation won't be concatenated.
same_on_batch: apply the same transformation across the batch.
p: probability of applying the transformation.
@@ -2149,11 +2149,11 @@ class RandomThinPlateSpline(GeometricAugmentationBase2D):
.. image:: _static/img/RandomThinPlateSpline.png
Args:
- scale: the scale factor to apply to the destionation points.
+ scale: the scale factor to apply to the destination points.
align_corners: Interpolation flag used by ``grid_sample``.
mode: Interpolation mode used by `grid_sample`. Either 'bilinear' or 'nearest'.
return_transform: if ``True`` return the matrix describing the transformation applied to each
- input tensor. If ``False`` and the input is a tuple the applied transformation wont be concatenated.
+ input tensor. If ``False`` and the input is a tuple the applied transformation won't be concatenated.
same_on_batch: apply the same transformation across the batch.
p: probability of applying the transformation.
@@ -2209,7 +2209,7 @@ class RandomBoxBlur(GeometricAugmentationBase2D):
The expected modes are: ``constant``, ``reflect``, ``replicate`` or ``circular``.
normalized: if True, L1 norm of the kernel is set to 1.
return_transform: if ``True`` return the matrix describing the transformation applied to each
- input tensor. If ``False`` and the input is a tuple the applied transformation wont be concatenated.
+ input tensor. If ``False`` and the input is a tuple the applied transformation won't be concatenated.
same_on_batch (bool): apply the same transformation across the batch.
p: probability of applying the transformation.
diff --git a/kornia/augmentation/augmentation3d.py b/kornia/augmentation/augmentation3d.py
index a6117c9a4..f07d83815 100644
--- a/kornia/augmentation/augmentation3d.py
+++ b/kornia/augmentation/augmentation3d.py
@@ -30,7 +30,7 @@ class RandomHorizontalFlip3D(AugmentationBase3D):
p: probability of the image being flipped.
return_transform: if ``True`` return the matrix describing the transformation applied to each
input tensor. If ``False`` and the input is a tuple the applied transformation
- wont be concatenated.
+ won't be concatenated.
same_on_batch: apply the same transformation across the batch.
keepdim: whether to keep the output shape the same as input ``True`` or broadcast it
to the batch form ``False``.
@@ -101,7 +101,7 @@ class RandomVerticalFlip3D(AugmentationBase3D):
p: probability of the image being flipped.
return_transform: if ``True`` return the matrix describing the transformation applied to each
input tensor. If ``False`` and the input is a tuple the applied transformation
- wont be concatenated.
+ won't be concatenated.
same_on_batch: apply the same transformation across the batch.
keepdim: whether to keep the output shape the same as input ``True`` or broadcast it
to the batch form ``False``.
@@ -172,7 +172,7 @@ class RandomDepthicalFlip3D(AugmentationBase3D):
p: probability of the image being flipped.
return_transform: if ``True`` return the matrix describing the transformation applied to each
input tensor. If ``False`` and the input is a tuple the applied transformation
- wont be concatenated.
+ won't be concatenated.
same_on_batch: apply the same transformation across the batch.
keepdim: whether to keep the output shape the same as input ``True`` or broadcast it
to the batch form ``False``.
@@ -438,7 +438,7 @@ class RandomRotation3D(AugmentationBase3D):
Set to 0 to deactivate rotations.
resample:
return_transform: if ``True`` return the matrix describing the transformation applied to each
- input tensor. If ``False`` and the input is a tuple the applied transformation wont be concatenated.
+ input tensor. If ``False`` and the input is a tuple the applied transformation won't be concatenated.
same_on_batch: apply the same transformation across the batch.
align_corners: interpolation flag.
keepdim: whether to keep the output shape the same as input (True) or broadcast it
@@ -660,7 +660,7 @@ class CenterCrop3D(AugmentationBase3D):
If Tuple[int, int, int], out_d = size[0], out_h = size[1], out_w = size[2].
resample:
return_transform: if ``True`` return the matrix describing the transformation applied to each
- input tensor. If ``False`` and the input is a tuple the applied transformation wont be concatenated.
+ input tensor. If ``False`` and the input is a tuple the applied transformation won't be concatenated.
align_corners: interpolation flag.
keepdim: whether to keep the output shape the same as input (True) or broadcast it
to the batch form (False).
@@ -766,7 +766,7 @@ class RandomCrop3D(AugmentationBase3D):
padding_mode: Type of padding. Should be: constant, edge, reflect or symmetric. Default is constant.
resample:
return_transform: if ``True`` return the matrix describing the transformation applied to each
- input tensor. If ``False`` and the input is a tuple the applied transformation wont be concatenated
+ input tensor. If ``False`` and the input is a tuple the applied transformation won't be concatenated
same_on_batch: apply the same transformation across the batch.
align_corners: interpolation flag.
keepdim: whether to keep the output shape the same as input (True) or broadcast it
@@ -1016,7 +1016,7 @@ class RandomEqualize3D(AugmentationBase3D):
Args:
p: probability of the image being equalized.
return_transform: if ``True`` return the matrix describing the transformation applied to each
- input tensor. If ``False`` and the input is a tuple the applied transformation wont be concatenated.
+ input tensor. If ``False`` and the input is a tuple the applied transformation won't be concatenated.
same_on_batch): apply the same transformation across the batch.
keepdim: whether to keep the output shape the same as input (True) or broadcast it
to the batch form (False).
diff --git a/kornia/augmentation/base.py b/kornia/augmentation/base.py
index 76d04d0e7..c96c87129 100644
--- a/kornia/augmentation/base.py
+++ b/kornia/augmentation/base.py
@@ -143,7 +143,7 @@ class _AugmentationBase(_BasicAugmentationBase):
p_batch: probability for applying an augmentation to a batch. This param controls the augmentation
probabilities batch-wise.
return_transform: if ``True`` return the matrix describing the geometric transformation applied to each
- input tensor. If ``False`` and the input is a tuple the applied transformation wont be concatenated.
+ input tensor. If ``False`` and the input is a tuple the applied transformation won't be concatenated.
same_on_batch: apply the same transformation across the batch.
keepdim: whether to keep the output shape the same as input ``True`` or broadcast it
to the batch form ``False``.
@@ -258,7 +258,7 @@ class AugmentationBase2D(_AugmentationBase):
p_batch: probability for applying an augmentation to a batch. This param controls the augmentation
probabilities batch-wise.
return_transform: if ``True`` return the matrix describing the geometric transformation applied to each
- input tensor. If ``False`` and the input is a tuple the applied transformation wont be concatenated.
+ input tensor. If ``False`` and the input is a tuple the applied transformation won't be concatenated.
same_on_batch: apply the same transformation across the batch.
keepdim: whether to keep the output shape the same as input ``True`` or broadcast it to the batch
form ``False``.
@@ -302,7 +302,7 @@ class IntensityAugmentationBase2D(AugmentationBase2D):
p_batch: probability for applying an augmentation to a batch. This param controls the augmentation
probabilities batch-wise.
return_transform: if ``True`` return the matrix describing the geometric transformation applied to each
- input tensor. If ``False`` and the input is a tuple the applied transformation wont be concatenated.
+ input tensor. If ``False`` and the input is a tuple the applied transformation won't be concatenated.
same_on_batch: apply the same transformation across the batch.
keepdim: whether to keep the output shape the same as input ``True`` or broadcast it
to the batch form ``False``.
@@ -324,7 +324,7 @@ class GeometricAugmentationBase2D(AugmentationBase2D):
p_batch: probability for applying an augmentation to a batch. This param controls the augmentation
probabilities batch-wise.
return_transform: if ``True`` return the matrix describing the geometric transformation applied to each
- input tensor. If ``False`` and the input is a tuple the applied transformation wont be concatenated.
+ input tensor. If ``False`` and the input is a tuple the applied transformation won't be concatenated.
same_on_batch: apply the same transformation across the batch.
keepdim: whether to keep the output shape the same as input ``True`` or broadcast it
to the batch form ``False``.
@@ -380,7 +380,7 @@ class GeometricAugmentationBase2D(AugmentationBase2D):
if params is None:
params = self._params
if size is None and "input_size" in params:
- # Majorly for copping functions
+ # Majorly for cropping functions
size = params['input_size'].unique(dim=0).squeeze().numpy().tolist()
size = (size[0], size[1])
if 'batch_prob' not in params:
@@ -413,7 +413,7 @@ class AugmentationBase3D(_AugmentationBase):
p_batch: probability for applying an augmentation to a batch. This param controls the augmentation
probabilities batch-wise.
return_transform: if ``True`` return the matrix describing the geometric transformation applied to each
- input tensor. If ``False`` and the input is a tuple the applied transformation wont be concatenated.
+ input tensor. If ``False`` and the input is a tuple the applied transformation won't be concatenated.
same_on_batch: apply the same transformation across the batch.
"""
diff --git a/kornia/augmentation/container/augment.py b/kornia/augmentation/container/augment.py
index e4c638ccf..cbb41b07c 100644
--- a/kornia/augmentation/container/augment.py
+++ b/kornia/augmentation/container/augment.py
@@ -250,7 +250,7 @@ class AugmentationSequential(ImageSequential):
if params is None:
if self._params is None:
raise ValueError(
- "No parameters avaliable for inversing, please run a forward pass first "
+ "No parameters available for inversing, please run a forward pass first "
"or passing valid params into this function."
)
params = self._params
diff --git a/kornia/augmentation/container/patch.py b/kornia/augmentation/container/patch.py
index 9b57f1084..8adf90580 100644
--- a/kornia/augmentation/container/patch.py
+++ b/kornia/augmentation/container/patch.py
@@ -36,9 +36,9 @@ class PatchSequential(ImageSequential):
Args:
*args: a list of processing modules.
- grid_size: controls the grid board seperation.
+ grid_size: controls the grid board separation.
padding: same or valid padding. If same padding, it will pad to include all pixels if the input
- tensor cannot be divisible by grid_size. If valid padding, the redundent border will be removed.
+ tensor cannot be divisible by grid_size. If valid padding, the redundant border will be removed.
same_on_batch: apply the same transformation across the batch.
If None, it will not overwrite the function-wise settings.
keepdim: whether to keep the output shape the same as input (True) or broadcast it
@@ -254,7 +254,7 @@ class PatchSequential(ImageSequential):
return out_param
def generate_parameters(self, batch_shape: torch.Size) -> Iterator[Tuple[ParamItem, int]]:
- """Get mulitple forward sequence but maximumly one mix augmentation in between.
+ """Get multiple forward sequence but maximumly one mix augmentation in between.
Args:
batch_shape: 5-dim shape arranged as :math:``(N, B, C, H, W)``, in which N represents
@@ -336,7 +336,7 @@ class PatchSequential(ImageSequential):
_label = None
if label is not None and out_label is not None:
if len(out_label.shape) == 1:
- # Wierd the mypy error though it is as same as in the next block
+ # Weird the mypy error though it is as same as in the next block
_label = torch.ones(in_shape[0] * in_shape[1], device=out_label.device, dtype=out_label.dtype) * -1
_label = label
else:
diff --git a/kornia/augmentation/container/video.py b/kornia/augmentation/container/video.py
index 70af907f8..ed32b9ac6 100644
--- a/kornia/augmentation/container/video.py
+++ b/kornia/augmentation/container/video.py
@@ -101,7 +101,7 @@ class VideoSequential(ImageSequential):
"""Repeat parameters across channels.
The input is shaped as (B, ...), while to output (B * same_on_frame, ...), which
- to guarentee that the same transformation would happen for each frame.
+ to guarantee that the same transformation would happen for each frame.
(B1, B2, ..., Bn) => (B1, ... B1, B2, ..., B2, ..., Bn, ..., Bn)
| ch_size | | ch_size | ..., | ch_size |
diff --git a/kornia/augmentation/mix_augmentation.py b/kornia/augmentation/mix_augmentation.py
index 05b9dc136..fb160cca7 100644
--- a/kornia/augmentation/mix_augmentation.py
+++ b/kornia/augmentation/mix_augmentation.py
@@ -14,7 +14,7 @@ class RandomMixUp(MixAugmentationBase):
.. image:: _static/img/RandomMixUp.png
- Implemention for `mixup: BEYOND EMPIRICAL RISK MINIMIZATION` :cite:`zhang2018mixup`.
+ Implementation for `mixup: BEYOND EMPIRICAL RISK MINIMIZATION` :cite:`zhang2018mixup`.
The function returns (inputs, labels), in which the inputs is the tensor that contains the mixup images
while the labels is a :math:`(B, 3)` tensor that contains (label_batch, label_permuted_batch, lambda) for
@@ -127,7 +127,7 @@ class RandomCutMix(MixAugmentationBase):
.. image:: _static/img/RandomCutMix.png
- Implemention for `CutMix: Regularization Strategy to Train Strong Classifiers with
+ Implementation for `CutMix: Regularization Strategy to Train Strong Classifiers with
Localizable Features` :cite:`yun2019cutmix`.
The function returns (inputs, labels), in which the inputs is the tensor that contains the mixup images
diff --git a/kornia/augmentation/random_generator/random_generator.py b/kornia/augmentation/random_generator/random_generator.py
index 96cf5d8a7..098d1f837 100644
--- a/kornia/augmentation/random_generator/random_generator.py
+++ b/kornia/augmentation/random_generator/random_generator.py
@@ -499,8 +499,8 @@ def random_crop_size_generator(
# Element-wise w, h condition
cond = ((0 < w) * (w < size[0]) * (0 < h) * (h < size[1])).int()
- # torch.argmax is not reproducible accross devices: https://github.com/pytorch/pytorch/issues/17738
- # Here, we will select the first occurance of the duplicated elements.
+ # torch.argmax is not reproducible across devices: https://github.com/pytorch/pytorch/issues/17738
+ # Here, we will select the first occurrence of the duplicated elements.
cond_bool, argmax_dim1 = ((cond.cumsum(1) == 1) & cond.bool()).max(1)
h_out = w[torch.arange(0, batch_size, device=device, dtype=torch.long), argmax_dim1]
w_out = h[torch.arange(0, batch_size, device=device, dtype=torch.long), argmax_dim1]
diff --git a/kornia/color/hsv.py b/kornia/color/hsv.py
index 80d7bc164..aef941ef3 100644
--- a/kornia/color/hsv.py
+++ b/kornia/color/hsv.py
@@ -33,7 +33,7 @@ def rgb_to_hsv(image: torch.Tensor, eps: float = 1e-6) -> torch.Tensor:
if len(image.shape) < 3 or image.shape[-3] != 3:
raise ValueError(f"Input size must have a shape of (*, 3, H, W). Got {image.shape}")
- # The first or last occurance is not guarenteed before 1.6.0
+ # The first or last occurrence is not guaranteed before 1.6.0
# https://github.com/pytorch/pytorch/issues/20414
maxc, _ = image.max(-3)
maxc_mask = image == maxc.unsqueeze(-3)
diff --git a/kornia/contrib/connected_components.py b/kornia/contrib/connected_components.py
index 7bb253472..c02159f12 100644
--- a/kornia/contrib/connected_components.py
+++ b/kornia/contrib/connected_components.py
@@ -21,7 +21,7 @@ def connected_components(input: torch.Tensor, num_iterations: int = 100) -> torc
Args:
input: the binarized input image with shape :math:`(B, 1, H, W)`.
The image must be in floating point with range [0, 1].
- num_iterations: the number of iterations to make the algorith to converge.
+ num_iterations: the number of iterations to make the algorithm to converge.
Return:
The labels image with the same shape of the input image.
@@ -34,7 +34,7 @@ def connected_components(input: torch.Tensor, num_iterations: int = 100) -> torc
raise TypeError(f"Input input type is not a torch.Tensor. Got: {type(input)}")
if not isinstance(num_iterations, int) or num_iterations < 1:
- raise TypeError("Input num_iterations must be a postive integer.")
+ raise TypeError("Input num_iterations must be a positive integer.")
if len(input.shape) != 4 or input.shape[-3] != 1:
raise ValueError(f"Input image shape must be Bx1xHxW. Got: {input.shape}")
diff --git a/kornia/enhance/adjust.py b/kornia/enhance/adjust.py
index 745847eb0..ddc45514b 100644
--- a/kornia/enhance/adjust.py
+++ b/kornia/enhance/adjust.py
@@ -402,7 +402,7 @@ def _solarize(input: torch.Tensor, thresholds: Union[float, torch.Tensor] = 0.5)
if isinstance(thresholds, torch.Tensor) and len(thresholds.shape) != 0:
if not (input.size(0) == len(thresholds) and len(thresholds.shape) == 1):
- raise AssertionError(f"threshholds must be a 1-d vector of shape ({input.size(0)},). Got {thresholds}")
+ raise AssertionError(f"thresholds must be a 1-d vector of shape ({input.size(0)},). Got {thresholds}")
# TODO: I am not happy about this line, but no easy to do batch-wise operation
thresholds = thresholds.to(input.device).to(input.dtype)
thresholds = torch.stack([x.expand(*input.shape[-3:]) for x in thresholds])
diff --git a/kornia/enhance/equalization.py b/kornia/enhance/equalization.py
index 2f90b7c51..f3e097430 100644
--- a/kornia/enhance/equalization.py
+++ b/kornia/enhance/equalization.py
@@ -88,7 +88,7 @@ def _compute_interpolation_tiles(padded_imgs: torch.Tensor, tile_size: Tuple[int
if padded_imgs.shape[-1] % tile_size[1] != 0:
raise AssertionError("Images are not correctly padded.")
- # tiles to be interpolated are built by dividing in 4 each alrady existing
+ # tiles to be interpolated are built by dividing in 4 each already existing
interp_kernel_vert: int = tile_size[0] // 2
interp_kernel_horz: int = tile_size[1] // 2
@@ -184,7 +184,7 @@ def _map_luts(interp_tiles: torch.Tensor, luts: torch.Tensor) -> torch.Tensor:
# th, tw -> /2 the sizes of the tiles used to compute the histograms
num_imgs, gh, gw, c, th, tw = interp_tiles.shape
- # precompute idxs for non corner regions (doing it in cpu seems sligthly faster)
+ # precompute idxs for non corner regions (doing it in cpu seems slightly faster)
j_idxs = torch.empty(0, 4, dtype=torch.long)
if gh > 2:
j_floor = torch.arange(1, gh - 1).view(gh - 2, 1) // 2
@@ -269,7 +269,7 @@ def _compute_equalized_tiles(interp_tiles: torch.Tensor, luts: torch.Tensor) ->
)
iw = iw.unfold(0, th, th).unfold(1, tw, tw) # 1 x 2 x TH x TW
- # compute row and column interpolation weigths
+ # compute row and column interpolation weights
tiw = iw.expand((gw - 2) // 2, 2, th, tw).reshape(gw - 2, 1, th, tw).unsqueeze(0) # 1 x GW-2 x 1 x TH x TW
tih = ih.repeat((gh - 2) // 2, 1, 1, 1).unsqueeze(1) # GH-2 x 1 x 1 x TH x TW
diff --git a/kornia/feature/laf.py b/kornia/feature/laf.py
index 0c7ee0160..73f1915e6 100644
--- a/kornia/feature/laf.py
+++ b/kornia/feature/laf.py
@@ -9,7 +9,7 @@ from kornia.geometry import angle_to_rotation_matrix
def raise_error_if_laf_is_not_valid(laf: torch.Tensor) -> None:
- """Auxilary function, which verifies that input.
+ """Auxiliary function, which verifies that input.
Args:
laf: [BxNx2x3] shape.
@@ -194,7 +194,7 @@ def make_upright(laf: torch.Tensor, eps: float = 1e-9) -> torch.Tensor:
raise_error_if_laf_is_not_valid(laf)
det = get_laf_scale(laf)
scale = det
- # The function is equivalent to doing 2x2 SVD and reseting rotation
+ # The function is equivalent to doing 2x2 SVD and resetting rotation
# matrix to an identity: U, S, V = svd(LAF); LAF_upright = U * S.
b2a2 = torch.sqrt(laf[..., 0:1, 1:2] ** 2 + laf[..., 0:1, 0:1] ** 2) + eps
laf1_ell = torch.cat([(b2a2 / det).contiguous(), torch.zeros_like(det)], dim=3)
diff --git a/kornia/filters/filter.py b/kornia/filters/filter.py
index d9d86881b..acaf058d9 100644
--- a/kornia/filters/filter.py
+++ b/kornia/filters/filter.py
@@ -15,7 +15,7 @@ def _compute_padding(kernel_size: List[int]) -> List[int]:
raise AssertionError(kernel_size)
computed = [k // 2 for k in kernel_size]
- # for even kernels we need to do asymetric padding :(
+ # for even kernels we need to do asymmetric padding :(
out_padding = 2 * len(kernel_size) * [0]
diff --git a/kornia/filters/kernels.py b/kornia/filters/kernels.py
index fddf959bf..8eaaecd6a 100644
--- a/kornia/filters/kernels.py
+++ b/kornia/filters/kernels.py
@@ -392,7 +392,7 @@ def get_gaussian_discrete_kernel1d(kernel_size: int, sigma: float, force_even: b
def get_gaussian_erf_kernel1d(kernel_size: int, sigma: float, force_even: bool = False) -> torch.Tensor:
- r"""Function that returns Gaussian filter coefficients by interpolating the error fucntion,
+ r"""Function that returns Gaussian filter coefficients by interpolating the error function,
adapted from:
https://github.com/Project-MONAI/MONAI/blob/master/monai/networks/layers/convutils.py
diff --git a/kornia/geometry/calibration/undistort.py b/kornia/geometry/calibration/undistort.py
index ea94efc05..11c2e594a 100644
--- a/kornia/geometry/calibration/undistort.py
+++ b/kornia/geometry/calibration/undistort.py
@@ -116,7 +116,7 @@ def undistort_points(points: torch.Tensor, K: torch.Tensor, dist: torch.Tensor)
x = (x0 - deltaX) * inv_rad_poly
y = (y0 - deltaY) * inv_rad_poly
- # Covert points from normalized camera coordinates to pixel coordinates
+ # Convert points from normalized camera coordinates to pixel coordinates
x = fx * x + cx
y = fy * y + cy
diff --git a/kornia/geometry/camera/pinhole.py b/kornia/geometry/camera/pinhole.py
index 613edb62e..11744d802 100644
--- a/kornia/geometry/camera/pinhole.py
+++ b/kornia/geometry/camera/pinhole.py
@@ -92,7 +92,7 @@ class PinholeCamera:
@property
def fx(self) -> torch.Tensor:
- r"""Returns the focal lenght in the x-direction.
+ r"""Returns the focal length in the x-direction.
Returns:
tensor of shape :math:`(B)`.
@@ -317,7 +317,7 @@ class PinholeCamerasList(PinholeCamera):
size and :math:`N` is the numbers of cameras (in this case two).
Args:
- pinholes_list: a python tuple or list containg a set of `PinholeCamera` instances.
+ pinholes_list: a python tuple or list containing a set of `PinholeCamera` instances.
"""
def __init__(self, pinholes_list: Iterable[PinholeCamera]) -> None:
diff --git a/kornia/geometry/camera/stereo.py b/kornia/geometry/camera/stereo.py
index 66f703635..4eb4d9b1b 100644
--- a/kornia/geometry/camera/stereo.py
+++ b/kornia/geometry/camera/stereo.py
@@ -21,7 +21,7 @@ class StereoException(Exception):
"https://kornia.readthedocs.io/en/latest/geometry.camera.stereo.html for further information and examples."
)
final_msg = msg + doc_help
- # type ignore becauce of mypy error:
+ # type ignore because of mypy error:
# Too many arguments for "__init__" of "BaseException"
super().__init__(final_msg, *args, **kwargs) # type: ignore
@@ -260,7 +260,7 @@ def _check_Q_matrix(Q_matrix: torch.Tensor):
raise StereoException(f"Expected 'Q_matrix' to be an instance of torch.Tensor but got {type(Q_matrix)}.")
if not len(Q_matrix.shape) == 3:
- raise StereoException(f"Expected 'Q_matrix' to have 3 dimenstions." f"Got {Q_matrix.shape}")
+ raise StereoException(f"Expected 'Q_matrix' to have 3 dimensions." f"Got {Q_matrix.shape}")
if not Q_matrix.shape[1:] == (4, 4):
raise StereoException(
diff --git a/kornia/geometry/depth.py b/kornia/geometry/depth.py
index 8e0a2b452..5cd160f65 100644
--- a/kornia/geometry/depth.py
+++ b/kornia/geometry/depth.py
@@ -154,7 +154,7 @@ def warp_frame_depth(
# unproject source points to camera frame
points_3d_dst: torch.Tensor = depth_to_3d(depth_dst, camera_matrix, normalize_points) # Bx3xHxW
- # transform points from source to destionation
+ # transform points from source to destination
points_3d_dst = points_3d_dst.permute(0, 2, 3, 1) # BxHxWx3
# apply transformation to the 3d points
@@ -332,7 +332,7 @@ class DepthWarper(nn.Module):
>>> # create the depth warper, compute the projection matrix
>>> warper = DepthWarper(pinhole_dst, 32, 32)
>>> _ = warper.compute_projection_matrix(pinhole_src)
- >>> # warp the destionation frame to reference by depth
+ >>> # warp the destination frame to reference by depth
>>> depth_src = torch.ones(1, 1, 32, 32) # Nx1xHxW
>>> image_dst = torch.rand(1, 3, 32, 32) # NxCxHxW
>>> image_src = warper(depth_src, image_dst) # NxCxHxW
@@ -366,7 +366,7 @@ def depth_warp(
... torch.tensor([32]), torch.tensor([32]))
>>> pinhole_src = PinholeCamera(torch.randn(1, 4, 4), torch.randn(1, 4, 4),
... torch.tensor([32]), torch.tensor([32]))
- >>> # warp the destionation frame to reference by depth
+ >>> # warp the destination frame to reference by depth
>>> depth_src = torch.ones(1, 1, 32, 32) # Nx1xHxW
>>> image_dst = torch.rand(1, 3, 32, 32) # NxCxHxW
>>> image_src = depth_warp(pinhole_dst, pinhole_src, depth_src, image_dst, 32, 32) # NxCxHxW
diff --git a/kornia/geometry/epipolar/essential.py b/kornia/geometry/epipolar/essential.py
index daf75d1ad..24bdb3b50 100644
--- a/kornia/geometry/epipolar/essential.py
+++ b/kornia/geometry/epipolar/essential.py
@@ -113,7 +113,7 @@ def motion_from_essential(E_mat: torch.Tensor) -> Tuple[torch.Tensor, torch.Tens
r"""Get Motion (R's and t's ) from Essential matrix.
Computes and return four possible poses exist for the decomposition of the Essential
- matrix. The posible solutions are :math:`[R1,t], [R1,βˆ’t], [R2,t], [R2,βˆ’t]`.
+ matrix. The possible solutions are :math:`[R1,t], [R1,βˆ’t], [R2,t], [R2,βˆ’t]`.
Args:
E_mat: The essential matrix in the form of :math:`(*, 3, 3)`.
@@ -228,7 +228,7 @@ def motion_from_essential_choose_solution(
d1 = projection.depth(R1, t1, X)
d2 = projection.depth(R2, t2, X)
- # verify the point values that have a postive depth value
+ # verify the point values that have a positive depth value
depth_mask = (d1 > 0.0) & (d2 > 0.0)
if mask is not None:
depth_mask &= mask.unsqueeze(1)
diff --git a/kornia/geometry/epipolar/projection.py b/kornia/geometry/epipolar/projection.py
index 2d1602564..0231bd4ad 100644
--- a/kornia/geometry/epipolar/projection.py
+++ b/kornia/geometry/epipolar/projection.py
@@ -12,7 +12,7 @@ def intrinsics_like(focal: float, input: torch.Tensor) -> torch.Tensor:
The center of projection will be based in the input image size.
Args:
- focal: the focal length for tha camera matrix.
+ focal: the focal length for the camera matrix.
input: image tensor that will determine the batch size and image height
and width. It is assumed to be a tensor in the shape of :math:`(B, C, H, W)`.
diff --git a/kornia/geometry/linalg.py b/kornia/geometry/linalg.py
index be936e219..85e719d29 100644
--- a/kornia/geometry/linalg.py
+++ b/kornia/geometry/linalg.py
@@ -25,10 +25,10 @@ def compose_transformations(trans_01: torch.Tensor, trans_12: torch.Tensor) -> t
\mathbf{0} & 1\end{bmatrix}
Args:
- trans_01: tensor with the homogenous transformation from
+ trans_01: tensor with the homogeneous transformation from
a reference frame 1 respect to a frame 0. The tensor has must have a
shape of :math:`(B, 4, 4)` or :math:`(4, 4)`.
- trans_12: tensor with the homogenous transformation from
+ trans_12: tensor with the homogeneous transformation from
a reference frame 2 respect to a frame 1. The tensor has must have a
shape of :math:`(B, 4, 4)` or :math:`(4, 4)`.
@@ -116,7 +116,7 @@ def inverse_transformation(trans_12):
def relative_transformation(trans_01: torch.Tensor, trans_02: torch.Tensor) -> torch.Tensor:
- r"""Function that computes the relative homogenous transformation from a
+ r"""Function that computes the relative homogeneous transformation from a
reference transformation :math:`T_1^{0} = \begin{bmatrix} R_1 & t_1 \\
\mathbf{0} & 1 \end{bmatrix}` to destination :math:`T_2^{0} =
\begin{bmatrix} R_2 & t_2 \\ \mathbf{0} & 1 \end{bmatrix}`.
diff --git a/kornia/geometry/transform/elastic_transform.py b/kornia/geometry/transform/elastic_transform.py
index bf626e9de..279c31a93 100644
--- a/kornia/geometry/transform/elastic_transform.py
+++ b/kornia/geometry/transform/elastic_transform.py
@@ -29,7 +29,7 @@ def elastic_transform2d(
it is expected to be in x-y.
kernel_size: the size of the Gaussian kernel.
sigma: The standard deviation of the Gaussian in the y and x directions,
- respecitvely. Larger sigma results in smaller pixel displacements.
+ respectively. Larger sigma results in smaller pixel displacements.
alpha : The scaling factor that controls the intensity of the deformation
in the y and x directions, respectively.
align_corners: Interpolation flag used by ```grid_sample```.
diff --git a/kornia/geometry/transform/homography_warper.py b/kornia/geometry/transform/homography_warper.py
index dea9f5687..273d61346 100644
--- a/kornia/geometry/transform/homography_warper.py
+++ b/kornia/geometry/transform/homography_warper.py
@@ -81,7 +81,7 @@ def homography_warp(
align_corners: bool = False,
normalized_coordinates: bool = True,
) -> torch.Tensor:
- r"""Warp image patchs or tensors by normalized 2D homographies.
+ r"""Warp image patches or tensors by normalized 2D homographies.
See :class:`~kornia.geometry.warp.HomographyWarper` for details.
@@ -127,7 +127,7 @@ def homography_warp3d(
align_corners: bool = False,
normalized_coordinates: bool = True,
) -> torch.Tensor:
- r"""Warp image patchs or tensors by normalized 3D homographies.
+ r"""Warp image patches or tensors by normalized 3D homographies.
Args:
patch_src: The image or tensor to warp. Should be from source of shape :math:`(N, C, D, H, W)`.
@@ -178,7 +178,7 @@ class HomographyWarper(nn.Module):
mode: interpolation mode to calculate output values ``'bilinear'`` | ``'nearest'``.
padding_mode: padding mode for outside grid values
``'zeros'`` | ``'border'`` | ``'reflection'``.
- normalized_coordinates: wether to use a grid with normalized coordinates.
+ normalized_coordinates: whether to use a grid with normalized coordinates.
align_corners: interpolation flag.
"""
_warped_grid: Optional[torch.Tensor]
@@ -206,7 +206,7 @@ class HomographyWarper(nn.Module):
self._warped_grid = None
def precompute_warp_grid(self, src_homo_dst: torch.Tensor) -> None:
- r"""Compute and store internaly the transformations of the points.
+ r"""Compute and store internally the transformations of the points.
Useful when the same homography/homographies are reused.
diff --git a/kornia/geometry/transform/imgwarp.py b/kornia/geometry/transform/imgwarp.py
index 734bc9139..b99a1fd2e 100644
--- a/kornia/geometry/transform/imgwarp.py
+++ b/kornia/geometry/transform/imgwarp.py
@@ -71,7 +71,7 @@ def warp_perspective(
torch.Size([1, 4, 4, 2])
.. note::
- This function is often used in conjuntion with :func:`get_perspective_transform`.
+ This function is often used in conjunction with :func:`get_perspective_transform`.
.. note::
See a working example `here <https://kornia-tutorials.readthedocs.io/en/
@@ -148,7 +148,7 @@ def warp_affine(
the warped tensor with shape :math:`(B, C, H, W)`.
.. note::
- This function is often used in conjuntion with :func:`get_rotation_matrix2d`,
+ This function is often used in conjunction with :func:`get_rotation_matrix2d`,
:func:`get_shear_matrix2d`, :func:`get_affine_matrix2d`, :func:`invert_affine_transform`.
.. note::
@@ -234,7 +234,7 @@ def get_perspective_transform(src, dst):
the perspective transformation with shape :math:`(B, 3, 3)`.
.. note::
- This function is often used in conjuntion with :func:`warp_perspective`.
+ This function is often used in conjunction with :func:`warp_perspective`.
"""
if not isinstance(src, torch.Tensor):
raise TypeError(f"Input type is not a torch.Tensor. Got {type(src)}")
@@ -368,7 +368,7 @@ def get_rotation_matrix2d(center: torch.Tensor, angle: torch.Tensor, scale: torc
[-0.7071, 0.7071, 0.0000]]])
.. note::
- This function is often used in conjuntion with :func:`warp_affine`.
+ This function is often used in conjunction with :func:`warp_affine`.
"""
if not isinstance(center, torch.Tensor):
raise TypeError(f"Input center type is not a torch.Tensor. Got {type(center)}")
@@ -474,7 +474,7 @@ def remap(
[0., 0.]]]])
.. note::
- This function is often used in conjuntion with :func:`kornia.utils.create_meshgrid`.
+ This function is often used in conjunction with :func:`kornia.utils.create_meshgrid`.
"""
if not isinstance(tensor, torch.Tensor):
raise TypeError(f"Input tensor type is not a torch.Tensor. Got {type(tensor)}")
@@ -529,7 +529,7 @@ def invert_affine_transform(matrix: torch.Tensor) -> torch.Tensor:
the reverse affine transform with shape :math:`(B, 2, 3)`.
.. note::
- This function is often used in conjuntion with :func:`warp_affine`.
+ This function is often used in conjunction with :func:`warp_affine`.
"""
if not isinstance(matrix, torch.Tensor):
raise TypeError(f"Input matrix type is not a torch.Tensor. Got {type(matrix)}")
@@ -565,7 +565,7 @@ def get_affine_matrix2d(
the affine transformation matrix :math:`(B, 3, 3)`.
.. note::
- This function is often used in conjuntion with :func:`warp_affine`, :func:`warp_perspective`.
+ This function is often used in conjunction with :func:`warp_affine`, :func:`warp_perspective`.
"""
transform: torch.Tensor = get_rotation_matrix2d(center, -angle, scale)
transform[..., 2] += translations # tx/ty
@@ -611,7 +611,7 @@ def get_shear_matrix2d(center: torch.Tensor, sx: Optional[torch.Tensor] = None,
[ 0.0000, 0.0000, 1.0000]]])
.. note::
- This function is often used in conjuntion with :func:`warp_affine`, :func:`warp_perspective`.
+ This function is often used in conjunction with :func:`warp_affine`, :func:`warp_perspective`.
"""
sx = torch.tensor([0.0]).repeat(center.size(0)) if sx is None else sx
sy = torch.tensor([0.0]).repeat(center.size(0)) if sy is None else sy
@@ -670,7 +670,7 @@ def get_affine_matrix3d(
the 3d affine transformation matrix :math:`(B, 3, 3)`.
.. note::
- This function is often used in conjuntion with :func:`warp_perspective`.
+ This function is often used in conjunction with :func:`warp_perspective`.
"""
transform: torch.Tensor = get_projective_transform(center, -angles, scale)
transform[..., 3] += translations # tx/ty/tz
@@ -738,7 +738,7 @@ def get_shear_matrix3d(
[ 0.0000, 0.0000, 0.0000, 1.0000]]])
.. note::
- This function is often used in conjuntion with :func:`warp_perspective3d`.
+ This function is often used in conjunction with :func:`warp_perspective3d`.
"""
sxy = torch.tensor([0.0]).repeat(center.size(0)) if sxy is None else sxy
sxz = torch.tensor([0.0]).repeat(center.size(0)) if sxz is None else sxz
diff --git a/kornia/geometry/transform/projwarp.py b/kornia/geometry/transform/projwarp.py
index 8e1803e01..b8bf8af38 100644
--- a/kornia/geometry/transform/projwarp.py
+++ b/kornia/geometry/transform/projwarp.py
@@ -46,7 +46,7 @@ def warp_affine3d(
torch.Tensor: the warped 3d tensor with shape :math:`(B, C, D, H, W)`.
.. note::
- This function is often used in conjuntion with :func:`get_perspective_transform3d`.
+ This function is often used in conjunction with :func:`get_perspective_transform3d`.
"""
if len(src.shape) != 5:
raise AssertionError(src.shape)
@@ -129,7 +129,7 @@ def get_projective_transform(center: torch.Tensor, angles: torch.Tensor, scales:
the projection matrix of 3D rotation with shape :math:`(B, 3, 4)`.
.. note::
- This function is often used in conjuntion with :func:`warp_affine3d`.
+ This function is often used in conjunction with :func:`warp_affine3d`.
"""
if not (len(center.shape) == 2 and center.shape[-1] == 3):
raise AssertionError(center.shape)
@@ -154,7 +154,7 @@ def get_projective_transform(center: torch.Tensor, angles: torch.Tensor, scales:
to_origin_mat = from_origin_mat.clone()
to_origin_mat = _torch_inverse_cast(from_origin_mat)
- # append tranlation with zeros
+ # append translation with zeros
proj_mat = projection_from_Rt(rmat, torch.zeros_like(center)[..., None]) # Bx3x4
# chain 4x4 transforms
@@ -231,7 +231,7 @@ def get_perspective_transform3d(src: torch.Tensor, dst: torch.Tensor) -> torch.T
the perspective transformation with shape :math:`(B, 4, 4)`.
.. note::
- This function is often used in conjuntion with :func:`warp_perspective3d`.
+ This function is often used in conjunction with :func:`warp_perspective3d`.
"""
if not isinstance(src, (torch.Tensor)):
raise TypeError(f"Input type is not a torch.Tensor. Got {type(src)}")
@@ -409,7 +409,7 @@ def warp_perspective3d(
the warped input image :math:`(B, C, D, H, W)`.
.. note::
- This function is often used in conjuntion with :func:`get_perspective_transform3d`.
+ This function is often used in conjunction with :func:`get_perspective_transform3d`.
"""
check_is_tensor(src)
check_is_tensor(M)
@@ -434,7 +434,7 @@ def transform_warp_impl3d(
padding_mode: str,
align_corners: bool,
) -> torch.Tensor:
- """Compute the transform in normalized cooridnates and perform the warping."""
+ """Compute the transform in normalized coordinates and perform the warping."""
dst_norm_trans_src_norm: torch.Tensor = normalize_homography3d(dst_pix_trans_src_pix, dsize_src, dsize_dst)
src_norm_trans_dst_norm = torch.inverse(dst_norm_trans_src_norm)
diff --git a/kornia/geometry/transform/thin_plate_spline.py b/kornia/geometry/transform/thin_plate_spline.py
index 92a7245d8..a85f89d03 100644
--- a/kornia/geometry/transform/thin_plate_spline.py
+++ b/kornia/geometry/transform/thin_plate_spline.py
@@ -43,7 +43,7 @@ def get_tps_transform(points_src: torch.Tensor, points_dst: torch.Tensor) -> Tup
Returns:
:math:`(B, N, 2)` tensor of kernel weights and :math:`(B, 3, 2)`
tensor of affine weights. The last dimension contains the x-transform and y-transform weights
- as seperate columns.
+ as separate columns.
Example:
>>> points_src = torch.rand(1, 5, 2)
@@ -51,7 +51,7 @@ def get_tps_transform(points_src: torch.Tensor, points_dst: torch.Tensor) -> Tup
>>> kernel_weights, affine_weights = get_tps_transform(points_src, points_dst)
.. note::
- This function is often used in conjuntion with :func:`warp_points_tps`, :func:`warp_image_tps`.
+ This function is often used in conjunction with :func:`warp_points_tps`, :func:`warp_image_tps`.
"""
if not isinstance(points_src, torch.Tensor):
raise TypeError(f"Input points_src is not torch.Tensor. Got {type(points_src)}")
@@ -117,7 +117,7 @@ def warp_points_tps(
>>> warped_correct = torch.allclose(warped, points_dst)
.. note::
- This function is often used in conjuntion with :func:`get_tps_transform`.
+ This function is often used in conjunction with :func:`get_tps_transform`.
"""
if not isinstance(points_src, torch.Tensor):
raise TypeError(f"Input points_src is not torch.Tensor. Got {type(points_src)}")
@@ -194,7 +194,7 @@ def warp_image_tps(
>>> warped_image = warp_image_tps(image, points_src, kernel_weights, affine_weights)
.. note::
- This function is often used in conjuntion with :func:`get_tps_transform`.
+ This function is often used in conjunction with :func:`get_tps_transform`.
"""
if not isinstance(image, torch.Tensor):
raise TypeError(f"Input image is not torch.Tensor. Got {type(image)}")
diff --git a/kornia/morphology/morphology.py b/kornia/morphology/morphology.py
index 6e798cf6b..92ef58ae0 100644
--- a/kornia/morphology/morphology.py
+++ b/kornia/morphology/morphology.py
@@ -389,7 +389,7 @@ def top_hat(
border_value: float = 0.0,
max_val: float = 1e4,
) -> torch.Tensor:
- r"""Returns the top hat tranformation of an image.
+ r"""Returns the top hat transformation of an image.
.. image:: _static/img/top_hat.png
@@ -414,7 +414,7 @@ def top_hat(
max_val: The value of the infinite elements in the kernel.
Returns:
- Top hat transformated image with shape :math:`(B, C, H, W)`.
+ Top hat transformed image with shape :math:`(B, C, H, W)`.
.. note::
See a working example `here <https://kornia-tutorials.readthedocs.io/en/latest/
@@ -458,7 +458,7 @@ def bottom_hat(
border_value: float = 0.0,
max_val: float = 1e4,
) -> torch.Tensor:
- r"""Returns the bottom hat tranformation of an image.
+ r"""Returns the bottom hat transformation of an image.
.. image:: _static/img/bottom_hat.png
@@ -483,7 +483,7 @@ def bottom_hat(
max_val: The value of the infinite elements in the kernel.
Returns:
- Top hat transformated image with shape :math:`(B, C, H, W)`.
+ Top hat transformed image with shape :math:`(B, C, H, W)`.
.. note::
See a working example `here <https://kornia-tutorials.readthedocs.io/en/latest/
diff --git a/kornia/utils/metrics/confusion_matrix.py b/kornia/utils/metrics/confusion_matrix.py
index 38148ca4f..d702373b0 100644
--- a/kornia/utils/metrics/confusion_matrix.py
+++ b/kornia/utils/metrics/confusion_matrix.py
@@ -20,7 +20,7 @@ def confusion_matrix(
values between 0 and K-1, where targets are assumed to be provided as
one-hot vectors.
num_classes: total possible number of classes in target.
- normalized: wether to return the confusion matrix normalized.
+ normalized: whether to return the confusion matrix normalized.
Returns:
a tensor containing the confusion matrix with shape
diff --git a/packaging/README.rst b/packaging/README.rst
index d1b767c4f..df72f09eb 100644
--- a/packaging/README.rst
+++ b/packaging/README.rst
@@ -14,7 +14,7 @@ In order to generate wheels define ```KORNIA_BUILD_VERSION```.
KORNIA_BUILD_VERSION=0.x.x ./build_wheel.sh
This will produce a ```*whl``` file under ```OUT_DIR```, by default to ```/tmp```.
-You can upload the wheels usng `Twine <https://pypi.org/project/twine/>`_
+You can upload the wheels using `Twine <https://pypi.org/project/twine/>`_
.. code:: bash
diff --git a/setup.py b/setup.py
index a46092451..315df88d0 100644
--- a/setup.py
+++ b/setup.py
@@ -11,7 +11,7 @@ from setuptools import find_packages, setup
################
# The variables below define the current version under
-# development and the current pytorch supported verions.
+# development and the current pytorch supported versions.
# WARNING: Becareful and do not touch those variables,
# unless you are a maintainer. Otherwise, could brake
# the package backward compatibility.
@@ -46,7 +46,7 @@ kornia_pt_dependencies = {
}
-# version can be overiden eg with KORNIA_BUILD_VERSION so we map each possible kornia version to the dictionary keys
+# version can be overridden eg with KORNIA_BUILD_VERSION so we map each possible kornia version to the dictionary keys
def dep_version(version):
compatible_versions = [v for v in kornia_pt_dependencies if v >= version]
compatible_versions += [sorted(kornia_pt_dependencies)[-1]]
diff --git a/test/augmentation/test_augmentation.py b/test/augmentation/test_augmentation.py
index a51215be6..ccb6a812e 100644
--- a/test/augmentation/test_augmentation.py
+++ b/test/augmentation/test_augmentation.py
@@ -57,7 +57,7 @@ class CommonTests(BaseTester):
@pytest.fixture(scope="class")
def param_set(self, request):
- raise NotImplementedError("param_set must be overriden in subclasses")
+ raise NotImplementedError("param_set must be overridden in subclasses")
############################################################################################################
# Test cases
diff --git a/test/augmentation/test_container.py b/test/augmentation/test_container.py
index 03f786b74..847ef4e66 100644
--- a/test/augmentation/test_container.py
+++ b/test/augmentation/test_container.py
@@ -356,7 +356,7 @@ class TestAugmentationSequential:
data_keys=["input", "mask", "bbox", "keypoints"],
random_apply=random_apply,
)
- with pytest.raises(Exception): # No parameters avaliable for inversing.
+ with pytest.raises(Exception): # No parameters available for inversing.
aug.inverse(inp, mask, bbox, keypoints)
out = aug(inp, mask, bbox, keypoints)
diff --git a/test/geometry/calibration/test_undistort.py b/test/geometry/calibration/test_undistort.py
index 25cfad406..1c0f8a2c7 100644
--- a/test/geometry/calibration/test_undistort.py
+++ b/test/geometry/calibration/test_undistort.py
@@ -47,7 +47,7 @@ class TestUndistortion:
dist = torch.tensor([-0.1007, 0.2650, -0.0018, 0.0007, -0.2597], device=device, dtype=dtype)
- # Expected ouput generated with OpenCV:
+ # Expected output generated with OpenCV:
# import cv2
# ptsu_expected = cv2.undistortPoints(pts.numpy().reshape(-1,1,2), K.numpy(),
# dist1.numpy(), None, None, K.numpy()).reshape(-1,2)
@@ -90,7 +90,7 @@ class TestUndistortion:
dtype=dtype,
)
- # Expected ouput generated with OpenCV:
+ # Expected output generated with OpenCV:
# import cv2
# ptsu_expected = cv2.undistortPoints(pts.numpy().reshape(-1,1,2), K.numpy(),
# dist2.numpy(), None, None, K.numpy()).reshape(-1,2)
@@ -167,7 +167,7 @@ class TestUndistortion:
dtype=dtype,
)
- # Expected ouput generated with OpenCV:
+ # Expected output generated with OpenCV:
# import cv2
# ptsu_expected1 = cv2.undistortPoints(pts[0].numpy().reshape(-1,1,2), K[0].numpy(),
# dist[0].numpy(), None, None, K[0].numpy()).reshape(-1,2)
diff --git a/test/geometry/test_bbox.py b/test/geometry/test_bbox.py
index 4c34f4c7f..411897f13 100644
--- a/test/geometry/test_bbox.py
+++ b/test/geometry/test_bbox.py
@@ -14,7 +14,7 @@ class TestBbox2D:
# Sample two points of the rectangle
points = torch.rand(1, 4, device=device, dtype=dtype)
- # Fill acording missing points
+ # Fill according missing points
bbox = torch.zeros(1, 4, 2, device=device, dtype=dtype)
bbox[0, 0] = points[0][:2]
bbox[0, 1, 0] = points[0][2]
@@ -179,7 +179,7 @@ class TestBbox3D:
# Sample two points of the 3d rect
points = torch.rand(1, 6, device=device, dtype=dtype)
- # Fill acording missing points
+ # Fill according missing points
bbox = torch.zeros(1, 8, 3, device=device, dtype=dtype)
bbox[0, 0] = points[0][:3]
bbox[0, 1, 0] = points[0][3]
diff --git a/test/geometry/test_depth_warper.py b/test/geometry/test_depth_warper.py
index adce30dc0..d6b4ff4a0 100644
--- a/test/geometry/test_depth_warper.py
+++ b/test/geometry/test_depth_warper.py
@@ -41,7 +41,7 @@ class TestDepthWarper:
warper.compute_projection_matrix(pinhole_src)
assert warper._dst_proj_src is not None
- # retreive computed projection matrix and compare to expected
+ # retrieve computed projection matrix and compare to expected
dst_proj_src = warper._dst_proj_src
dst_proj_src_expected = torch.eye(4, device=device, dtype=dtype)[None].repeat(batch_size, 1, 1) # Bx4x4
dst_proj_src_expected[..., 0, -2] += pinhole_src.cx
diff --git a/test/performance/test_project_points_speed.py b/test/performance/test_project_points_speed.py
index adec749d0..6c8954b04 100644
--- a/test/performance/test_project_points_speed.py
+++ b/test/performance/test_project_points_speed.py
@@ -7,7 +7,7 @@ import kornia
points_shapes = [(64, 1024 ** 2, 3), (8192, 8192, 3), (1024 ** 2, 64, 3)]
-# TODO: remove xfail once we have enough gpu bandwith in the CI
+# TODO: remove xfail once we have enough gpu bandwidth in the CI
@pytest.mark.xfail(reason='May cause memory issues.')
diff --git a/test/utils/test_helpers.py b/test/utils/test_helpers.py
index f44f2f5c5..fca83484d 100644
--- a/test/utils/test_helpers.py
+++ b/test/utils/test_helpers.py
@@ -38,7 +38,7 @@ from kornia.utils.helpers import _torch_histc_cast, _torch_inverse_cast, _torch_
],
)
def test_extract_device_dtype(tensor_list, out_device, out_dtype, will_throw_error):
- # Add GPU tests when GPU testing avaliable
+ # Add GPU tests when GPU testing available
if torch.cuda.is_available():
import warnings