Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

add precommit (#1038)

Jirka Borovec5025cbe7f9c7
diff --git a/.circleci/config.yml b/.circleci/config.yml
index c12089b5a..870744fa4 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -21,7 +21,7 @@ references:
name: Build and push Docker image
command: |
gcloud --quiet auth configure-docker
- cd docker/tpu-tests
+ cd docker/tpu-tests
# Update PR refs for testing.
if [[ -n "${CIRCLE_PR_NUMBER}" ]]
then
diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md
index c787c0641..cc0aed32b 100644
--- a/.github/ISSUE_TEMPLATE/bug-report.md
+++ b/.github/ISSUE_TEMPLATE/bug-report.md
@@ -47,4 +47,3 @@ python collect_env.py
## Additional context
<!-- Add any other context about the problem here. -->
-
diff --git a/.github/ISSUE_TEMPLATE/documentation.md b/.github/ISSUE_TEMPLATE/documentation.md
index edb20ef75..ff328fb86 100644
--- a/.github/ISSUE_TEMPLATE/documentation.md
+++ b/.github/ISSUE_TEMPLATE/documentation.md
@@ -7,4 +7,3 @@ about: Report an issue related to https://kornia.readthedocs.io
## 📚 Documentation
<!-- A clear and concise description of what content in https://kornia.readthedocs.io is an issue. If this has to do with the general https://kornia.org website, please file an issue at https://github.com/kornia/kornia.github.io/issues/new/choose instead. If this has to do with https://kornia.org/tutorials, please file an issue at https://github.com/kornia/tutorials/issues/new -->
-
diff --git a/.github/ISSUE_TEMPLATE/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md
index 71317b147..f8d6825f5 100644
--- a/.github/ISSUE_TEMPLATE/feature-request.md
+++ b/.github/ISSUE_TEMPLATE/feature-request.md
@@ -22,4 +22,3 @@ about: Submit a proposal/request for a new Kornia feature
## Additional context
<!-- Add any other context or screenshots about the feature request here. -->
-
diff --git a/.github/ISSUE_TEMPLATE/questions-help-support.md b/.github/ISSUE_TEMPLATE/questions-help-support.md
index 8722923c9..16f94c469 100644
--- a/.github/ISSUE_TEMPLATE/questions-help-support.md
+++ b/.github/ISSUE_TEMPLATE/questions-help-support.md
@@ -11,4 +11,3 @@ about: Do you need support? We have resources.
We have a set of [listed resources available on the Wiki](https://github.com/kornia/kornia/wiki). Our primary means of support is our discussion forum:
- [Discussion Forum](https://discuss.pytorch.org/c/vision/kornia)
-
diff --git a/.github/configurations/changelog-ci-config.json b/.github/configurations/changelog-ci-config.json
index b16115047..2629b507b 100644
--- a/.github/configurations/changelog-ci-config.json
+++ b/.github/configurations/changelog-ci-config.json
@@ -1,25 +1,38 @@
{
- "header_prefix": "Version:",
- "commit_changelog": false,
- "comment_changelog": true,
- "pull_request_title_regex": "^(?i:release)",
- "version_regex": "v?([0-9]{1,2})+[.]+([0-9]{1,2})+[.]+([0-9]{1,2})\\s\\(\\d{1,2}-\\d{1,2}-\\d{4}\\)",
- "group_config": [
- {
- "title": "Bug Fixes",
- "labels": ["bug", "bugfix"]
- },
- {
- "title": "Code Improvements",
- "labels": ["improvements", "enhancement"]
- },
- {
- "title": "New Features",
- "labels": ["feature", "feature request"]
- },
- {
- "title": "Documentation Updates",
- "labels": ["docs", "documentation", "doc"]
- }
- ]
-}
\ No newline at end of file
+ "comment_changelog": true,
+ "commit_changelog": false,
+ "group_config": [
+ {
+ "labels": [
+ "bug",
+ "bugfix"
+ ],
+ "title": "Bug Fixes"
+ },
+ {
+ "labels": [
+ "improvements",
+ "enhancement"
+ ],
+ "title": "Code Improvements"
+ },
+ {
+ "labels": [
+ "feature",
+ "feature request"
+ ],
+ "title": "New Features"
+ },
+ {
+ "labels": [
+ "docs",
+ "documentation",
+ "doc"
+ ],
+ "title": "Documentation Updates"
+ }
+ ],
+ "header_prefix": "Version:",
+ "pull_request_title_regex": "^(?i:release)",
+ "version_regex": "v?([0-9]{1,2})[.]([0-9]{1,2})[.]([0-9]{1,2})\\s\\(\\d{1,2}-\\d{1,2}-\\d{4}\\)"
+}
diff --git a/.github/pull-request-template.md b/.github/pull-request-template.md
index 7b00901cf..a13cf8ae2 100644
--- a/.github/pull-request-template.md
+++ b/.github/pull-request-template.md
@@ -16,7 +16,7 @@ A few sentences describing the changes proposed in this pull request.
### PR Implementer
This is a small checklist for the implementation details of this PR.
-If there are any questions regarding code style or other conventions check out our
+If there are any questions regarding code style or other conventions check out our
[summary](https://github.com/kornia/kornia/blob/master/CONTRIBUTING.rst).
- [ ] Did you discuss the functionality or any breaking changes before ?
@@ -30,10 +30,10 @@ If there are any questions regarding code style or other conventions check out o
### KorniaTeam
<details>
<summary>KorniaTeam workflow</summary>
-
+
- [ ] Assign correct label
- [ ] Assign PR to a reviewer
- - [ ] Does this PR close an Issue? (add `closes #IssueNumber` at the bottom if
+ - [ ] Does this PR close an Issue? (add `closes #IssueNumber` at the bottom if
not already in description)
</details>
@@ -46,5 +46,5 @@ If there are any questions regarding code style or other conventions check out o
- [ ] Does the implementation follow `kornia` design conventions?
- [ ] Is the documentation complete enough ?
- [ ] Are the tests covering simple and corner cases ?
-
+
</details>
diff --git a/.github/stale.yml b/.github/stale.yml
index 3b2ddeff8..04a6f8626 100644
--- a/.github/stale.yml
+++ b/.github/stale.yml
@@ -10,7 +10,7 @@ exemptLabels:
- help wanted
- pinned
- security
- - priority
+ - priority
# Label to use when marking an issue as stale
staleLabel: wontfix
# Comment to post when marking an issue as stale. Set to `false` to disable
diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml
index dec88e1c5..0914825f2 100644
--- a/.github/workflows/changelog.yml
+++ b/.github/workflows/changelog.yml
@@ -15,4 +15,4 @@ jobs:
changelog_filename: CHANGELOG.md
config_file: .github/configurations/changelog-ci-config.json
env:
- GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
\ No newline at end of file
+ GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml
index 487222ffb..46224ccca 100644
--- a/.github/workflows/format.yml
+++ b/.github/workflows/format.yml
@@ -52,7 +52,7 @@ jobs:
- name: Run mypy
shell: bash -l {0}
run: make mypy
-
+
doctest:
runs-on: [ubuntu-latest]
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 000000000..a04fff4f8
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,35 @@
+default_language_version:
+ python: python3.8
+
+ci:
+ autofix_prs: true
+ autoupdate_commit_msg: '[pre-commit.ci] pre-commit suggestions'
+ # submodules: true
+
+repos:
+ - repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v4.0.1
+ hooks:
+ - id: end-of-file-fixer
+ - id: trailing-whitespace
+ - id: check-yaml
+ - id: pretty-format-json
+
+ - repo: https://github.com/pre-commit/mirrors-yapf
+ rev: v0.31.0
+ hooks:
+ - id: yapf
+ name: formatting
+ entry: yapf
+ args: [--parallel]
+ language: python
+ types: [python]
+
+ - repo: https://github.com/PyCQA/flake8
+ rev: 3.9.2
+ hooks:
+ - id: flake8
+ name: PEP8
+ entry: flake8
+ language: python
+ types: [python]
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 81fce900d..748b09fb6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -25,11 +25,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added unsharp mask filtering ([#1004](https://github.com/kornia/kornia/pull/1004))
### Fixed
-- Fixed angle axis to quaternion order bug ([#926](https://github.com/kornia/kornia/pull/926))
+- Fixed angle axis to quaternion order bug ([#926](https://github.com/kornia/kornia/pull/926))
- Fixed type error for lab_to_rgb conversion when using coremltools. ([#1002](https://github.com/kornia/kornia/pull/1002))
### Changed
-- Mask with unbatched motion from essential choose solution ([#998](https://github.com/kornia/kornia/pull/998))
+- Mask with unbatched motion from essential choose solution ([#998](https://github.com/kornia/kornia/pull/998))
## [0.5.1] - 2021-04-30
@@ -48,17 +48,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Improve kornia porphology ([#965](https://github.com/kornia/kornia/pull/965))
- Improve cuda ci workflow speed ([#975](https://github.com/kornia/kornia/pull/975))
- Refactor augmentation module ([#948](https://github.com/kornia/kornia/pull/948))
-- Implement fast version of crop function in augmentations ([#967](https://github.com/kornia/kornia/pull/967))
-- Implement missing jit ops in kornia.geometry.transform ([#981](https://github.com/kornia/kornia/pull/981))
+- Implement fast version of crop function in augmentations ([#967](https://github.com/kornia/kornia/pull/967))
+- Implement missing jit ops in kornia.geometry.transform ([#981](https://github.com/kornia/kornia/pull/981))
### Fixed
-- Fixed RandomAffine translation range check ([#917](https://github.com/kornia/kornia/pull/917)
+- Fixed RandomAffine translation range check ([#917](https://github.com/kornia/kornia/pull/917)
- Fixed the issue of NaN gradients by adding epsilon in focal loss ([#924](https://github.com/kornia/kornia/pull/924))
- Allow crop size greater than input size. ([#957](https://github.com/kornia/kornia/pull/957))
-- Fixed RandomCrop bug ([#951](https://github.com/kornia/kornia/pull/951))
+- Fixed RandomCrop bug ([#951](https://github.com/kornia/kornia/pull/951))
### Removed
-- Deprecate some augmentation functionals ([#943](https://github.com/kornia/kornia/pull/943))
+- Deprecate some augmentation functionals ([#943](https://github.com/kornia/kornia/pull/943))
## [0.4.1] - 2020-10-20
diff --git a/CITATION.md b/CITATION.md
index 372dd539e..66a72d587 100644
--- a/CITATION.md
+++ b/CITATION.md
@@ -1,4 +1,4 @@
-
+
## Cite Kornia papers
1. Kornia: an Open Source Differentiable Computer Vision Library for PyTorch
2. A survey on Kornia: an Open Source Differentiable Computer Vision Library for PyTorch
@@ -15,7 +15,7 @@
```
```bash
@misc{riba2020survey,
- title={A survey on Kornia: an Open Source Differentiable Computer Vision Library for PyTorch},
+ title={A survey on Kornia: an Open Source Differentiable Computer Vision Library for PyTorch},
author={E. Riba and D. Mishkin and J. Shi and D. Ponsa and F. Moreno-Noguer and G. Bradski},
year={2020},
eprint={2009.10521},
@@ -25,7 +25,7 @@
```
```bash
@misc{shi2020differentiable,
- title={Differentiable Data Augmentation with Kornia},
+ title={Differentiable Data Augmentation with Kornia},
author={Jian Shi and Edgar Riba and Dmytro Mishkin and Francesc Moreno and Anguelos Nicolaou},
year={2020},
eprint={2011.09832},
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
index be1848e70..855f1acb0 100644
--- a/CODE_OF_CONDUCT.md
+++ b/CODE_OF_CONDUCT.md
@@ -74,4 +74,3 @@ available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.ht
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
-
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
index d52dc44b1..7e8daa9b4 100644
--- a/CONTRIBUTING.rst
+++ b/CONTRIBUTING.rst
@@ -9,7 +9,7 @@ Everyone is welcomed to get involved with the project. There are different ways
- Please, don't use GitHub issues for Q&A.
- In case you are a developer and want to learn more about the PyTorch ecosystem, we suggest you to join the PyTorch slack. You can apply using this form: `https://bit.ly/ptslack <https://bit.ly/ptslack>`_
-
+
2. Report bugs through `GitHub issues <https://github.com/arraiyopensource/kornia/issues>`_:
@@ -158,14 +158,12 @@ This section provides general guidance for developing code for the project. The
- Format your code:
- We follow `PEP8 style guide <https://www.python.org/dev/peps/pep-0008>`_.
- - Use ``yapf`` to autoformat: https://github.com/google/yapf
- For doing so, just run the following from the repository root
+ - Use ``pre-commit`` to autoformat each commit before push: https://pre-commit.com/.
+ For doing so, just install it for this repository:
.. code:: bash
- make yapf
- # OR for specific folder/path
- yapf kornia/jit -rip
+ pre-commit install
- Changes to PEP8:
diff --git a/Makefile b/Makefile
index 828593038..82da7d668 100644
--- a/Makefile
+++ b/Makefile
@@ -52,7 +52,7 @@ build-docs: FORCE
install: FORCE
python setup.py install
-
+
install-dev: FORCE
python setup.py develop
diff --git a/README.md b/README.md
index a1f34ce25..e7bfe4818 100644
--- a/README.md
+++ b/README.md
@@ -55,7 +55,7 @@ At a granular level, Kornia is a library that consists of the following componen
<summary>Other installation options</summary>
#### From source:
-
+
```bash
python setup.py install
```
diff --git a/docs/.gitignore b/docs/.gitignore
index 88f21e651..92c1b7060 100644
--- a/docs/.gitignore
+++ b/docs/.gitignore
@@ -1,4 +1,4 @@
build/doctest
build/html/.buildinfo
build/html/objects.inv
-source/tutorials/*
\ No newline at end of file
+source/tutorials/*
diff --git a/docs/source/_static/img/kornia_logo.svg b/docs/source/_static/img/kornia_logo.svg
index 04a832f3e..a4613ba2f 100644
--- a/docs/source/_static/img/kornia_logo.svg
+++ b/docs/source/_static/img/kornia_logo.svg
@@ -11,26 +11,26 @@
.st3{fill:#F01616;}
</style>
<sodipodi:namedview bordercolor="#666666" borderopacity="1" gridtolerance="10" guidetolerance="10" id="namedview4162" inkscape:current-layer="g4285" inkscape:cx="256.09235" inkscape:cy="-4.3199171" inkscape:guide-bbox="true" inkscape:measure-end="63.1753,74" inkscape:measure-start="5.39155e-06,112.499" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:snap-text-baseline="true" inkscape:window-height="713" inkscape:window-maximized="1" inkscape:window-width="1299" inkscape:window-x="67" inkscape:window-y="27" inkscape:zoom="1.4142136" objecttolerance="10" pagecolor="#ffffff" showgrid="false" showguides="true">
-
+
<sodipodi:guide id="guide1151" inkscape:color="rgb(0,0,255)" inkscape:label="" inkscape:locked="false" orientation="0,1" position="188.0904,85">
</sodipodi:guide>
-
+
<sodipodi:guide id="guide1153" inkscape:color="rgb(0,0,255)" inkscape:label="" inkscape:locked="false" orientation="1,0" position="610,19.979676">
</sodipodi:guide>
<sodipodi:guide id="guide1155" inkscape:locked="false" orientation="1,0" position="105,103.5721"></sodipodi:guide>
-
+
<sodipodi:guide id="guide1159" inkscape:color="rgb(0,0,255)" inkscape:label="" inkscape:locked="false" orientation="1,0" position="145,19.979676">
</sodipodi:guide>
<sodipodi:guide id="guide1161" inkscape:locked="false" orientation="0,1" position="63.789695,-1.3686142e-06"></sodipodi:guide>
<sodipodi:guide id="guide1163" inkscape:locked="false" orientation="1,0" position="0,74"></sodipodi:guide>
<sodipodi:guide id="guide1184" inkscape:locked="false" orientation="1,0" position="67.140101,125.61907"></sodipodi:guide>
-
+
<sodipodi:guide id="guide73" inkscape:color="rgb(0,0,255)" inkscape:label="" inkscape:locked="false" orientation="1,0" position="580,31.952388">
</sodipodi:guide>
-
+
<sodipodi:guide id="guide75" inkscape:color="rgb(0,0,255)" inkscape:label="" inkscape:locked="false" orientation="0,1" position="73.789713,160">
</sodipodi:guide>
-
+
<sodipodi:guide id="guide115" inkscape:color="rgb(0,0,255)" inkscape:label="" inkscape:locked="false" orientation="1,0" position="30,85">
</sodipodi:guide>
</sodipodi:namedview>
@@ -78,29 +78,29 @@
</g>
</g>
</g>
-
+
<sodipodi:namedview bordercolor="#666666" borderopacity="1" gridtolerance="10" guidetolerance="10" id="namedview4162" inkscape:current-layer="g4285" inkscape:cx="256.09235" inkscape:cy="-4.3199171" inkscape:guide-bbox="true" inkscape:measure-end="63.1753,74" inkscape:measure-start="5.39155e-06,112.499" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:snap-text-baseline="true" inkscape:window-height="713" inkscape:window-maximized="1" inkscape:window-width="1299" inkscape:window-x="67" inkscape:window-y="27" inkscape:zoom="1.4142136" objecttolerance="10" pagecolor="#ffffff" showgrid="false" showguides="true">
-
+
<sodipodi:guide id="guide1151" inkscape:color="rgb(0,0,255)" inkscape:label="" inkscape:locked="false" orientation="0,1" position="188.0904,85">
</sodipodi:guide>
-
+
<sodipodi:guide id="guide1153" inkscape:color="rgb(0,0,255)" inkscape:label="" inkscape:locked="false" orientation="1,0" position="610,19.979676">
</sodipodi:guide>
<sodipodi:guide id="guide1155" inkscape:locked="false" orientation="1,0" position="105,103.5721"></sodipodi:guide>
-
+
<sodipodi:guide id="guide1159" inkscape:color="rgb(0,0,255)" inkscape:label="" inkscape:locked="false" orientation="1,0" position="145,19.979676">
</sodipodi:guide>
<sodipodi:guide id="guide1161" inkscape:locked="false" orientation="0,1" position="63.789695,-1.3686142e-06">
</sodipodi:guide>
<sodipodi:guide id="guide1163" inkscape:locked="false" orientation="1,0" position="0,74"></sodipodi:guide>
<sodipodi:guide id="guide1184" inkscape:locked="false" orientation="1,0" position="67.140101,125.61907"></sodipodi:guide>
-
+
<sodipodi:guide id="guide73" inkscape:color="rgb(0,0,255)" inkscape:label="" inkscape:locked="false" orientation="1,0" position="580,31.952388">
</sodipodi:guide>
-
+
<sodipodi:guide id="guide75" inkscape:color="rgb(0,0,255)" inkscape:label="" inkscape:locked="false" orientation="0,1" position="73.789713,160">
</sodipodi:guide>
-
+
<sodipodi:guide id="guide115" inkscape:color="rgb(0,0,255)" inkscape:label="" inkscape:locked="false" orientation="1,0" position="30,85">
</sodipodi:guide>
</sodipodi:namedview>
diff --git a/docs/source/augmentation.base.rst b/docs/source/augmentation.base.rst
index d20bc25db..c332f5f95 100644
--- a/docs/source/augmentation.base.rst
+++ b/docs/source/augmentation.base.rst
@@ -36,9 +36,9 @@ Create your own transformation:
def generate_parameters(self, input_shape: torch.Size):
# generate the random parameters for your use case.
angles_rad torch.Tensor = torch.rand(input_shape[0]) * K.pi
- angles_deg = kornia.rad2deg(angles_rad)
+ angles_deg = kornia.rad2deg(angles_rad)
return dict(angles=angles_deg)
-
+
def compute_transformation(self, input, params):
B, _, H, W = input.shape
diff --git a/docs/source/augmentation.rst b/docs/source/augmentation.rst
index 092b81915..10a8c03fb 100644
--- a/docs/source/augmentation.rst
+++ b/docs/source/augmentation.rst
@@ -38,7 +38,7 @@ Kornia augmentation implementations have two additional parameters compare to To
360, return_transform=True, same_on_batch=True
)
self.jit = K.ColorJitter(0.2, 0.3, 0.2, 0.3, same_on_batch=True)
-
+
def forward(self, input):
input, transform = self.aff(input)
input, transform = self.jit((input, transform))
@@ -57,14 +57,14 @@ Example for semantic segmentation using low-level randomness control:
self.jit = K.ColorJitter(0.2, 0.3, 0.2, 0.3)
def forward(self, input, mask):
- assert input.shape == mask.shape,
+ assert input.shape == mask.shape,
f"Input shape should be consistent with mask shape, "
- f"while got {input.shape}, {mask.shape}"
+ f"while got {input.shape}, {mask.shape}"
aff_params = self.aff.forward_parameters(input.shape)
input = self.aff(input, aff_params)
mask = self.aff(mask, aff_params)
-
+
jit_params = self.jit.forward_parameters(input.shape)
input = self.jit(input, jit_params)
mask = self.jit(mask, jit_params)
@@ -75,4 +75,4 @@ Example for semantic segmentation using low-level randomness control:
augmentation.base
augmentation.module
- augmentation.container
\ No newline at end of file
+ augmentation.container
diff --git a/docs/source/faqs.rst b/docs/source/faqs.rst
index f09ecb739..c5069fa8b 100644
--- a/docs/source/faqs.rst
+++ b/docs/source/faqs.rst
@@ -18,7 +18,7 @@ Kornia relation to Pytorch Geometry/Geometric
This project started as a small differentiable geometric computer
vision package called `PyTorch Geometry <https://pypi.org/project/torchgeometry>`_
-released during the PyTorch devcon 2018 (see the presented
+released during the PyTorch devcon 2018 (see the presented
`poster <https://drive.google.com/file/d/1xiao1Xj9WzjJ08YY_nYwsthE-wxfyfhG/view?usp=sharing>`_).
The project evolved to a more generic computer vision library and due to the naming
conflict between `Pytorch Geometric <https://pytorch-geometric.readthedocs.io/en/latest>`_
diff --git a/docs/source/feature.rst b/docs/source/feature.rst
index 8380b9add..04807f320 100644
--- a/docs/source/feature.rst
+++ b/docs/source/feature.rst
@@ -88,5 +88,3 @@ Module
:members: forward
.. autoclass:: LAFAffNetShapeEstimator
:members: forward
-
-
diff --git a/docs/source/geometry.conversions.rst b/docs/source/geometry.conversions.rst
index d66edf444..33190dd3b 100644
--- a/docs/source/geometry.conversions.rst
+++ b/docs/source/geometry.conversions.rst
@@ -23,4 +23,3 @@ kornia.geometry.conversions
.. autofunction:: denormalize_pixel_coordinates3d
.. autofunction:: normalize_pixel_coordinates3d
.. autofunction:: normalize_quaternion
-
diff --git a/docs/source/index.rst b/docs/source/index.rst
index 71ac13b31..907d42fae 100644
--- a/docs/source/index.rst
+++ b/docs/source/index.rst
@@ -1,5 +1,5 @@
:github_url: https://github.com/kornia/kornia
-
+
Kornia Documentation
====================
diff --git a/docs/source/introduction.rst b/docs/source/introduction.rst
index f695d9c21..d48081d6c 100644
--- a/docs/source/introduction.rst
+++ b/docs/source/introduction.rst
@@ -4,7 +4,7 @@ Introduction
Kornia is a differentiable computer vision library for PyTorch.
It consists of a set of routines and differentiable modules to solve generic computer vision problems.
-At its core, the package uses PyTorch as its main backend both for efficiency and to take advantage of
+At its core, the package uses PyTorch as its main backend both for efficiency and to take advantage of
the reverse-mode auto-differentiation to define and compute the gradient of complex functions.
Inspired by OpenCV, this library is composed by a subset of packages containing operators that can be inserted
@@ -72,8 +72,8 @@ Cite us
booktitle = {Winter Conference on Applications of Computer Vision},
year = {2020},
url = {https://arxiv.org/pdf/1910.02190.pdf}
- }
-
+ }
+
.. code-block:: bash
@misc{Arraiy2018,
diff --git a/docs/source/morphology.rst b/docs/source/morphology.rst
index c9c9b5a98..33d903f3b 100644
--- a/docs/source/morphology.rst
+++ b/docs/source/morphology.rst
@@ -9,4 +9,4 @@ kornia.morphology
.. autofunction:: close
.. autofunction:: gradient
.. autofunction:: top_hat
-.. autofunction:: black_hat
\ No newline at end of file
+.. autofunction:: black_hat
diff --git a/docs/source/references.bib b/docs/source/references.bib
index 5ba592a4a..448a53acb 100644
--- a/docs/source/references.bib
+++ b/docs/source/references.bib
@@ -29,7 +29,7 @@
@inproceedings{TFeat2016,
author = {Vassileios Balntas and Edgar Riba and Daniel Ponsa and Krystian Mikolajczyk},
- title = {Learning local feature descriptors with triplets and shallow convolutional neural networks},
+ title = {Learning local feature descriptors with triplets and shallow convolutional neural networks},
booktitle = {British Machine Vision Conference {(BMVC)}},
year = {2016}
}
@@ -65,14 +65,14 @@
}
@article{lin2018focal,
- title={Focal Loss for Dense Object Detection},
+ title={Focal Loss for Dense Object Detection},
author={Tsung-Yi Lin and Priya Goyal and Ross Girshick and Kaiming He and Piotr Dollár},
year={2018},
journal={arXiv ePrint 1708.02002}
}
@article{salehi2017tversky,
- title={Tversky loss function for image segmentation using 3D fully convolutional deep networks},
+ title={Tversky loss function for image segmentation using 3D fully convolutional deep networks},
author={Seyed Sadegh Mohseni Salehi and Deniz Erdogmus and Ali Gholipour},
year={2017},
journal={arXiv ePrint 1706.05721}
diff --git a/kornia/augmentation/README.md b/kornia/augmentation/README.md
index 07f1ff2ae..93d2eb6a8 100644
--- a/kornia/augmentation/README.md
+++ b/kornia/augmentation/README.md
@@ -46,4 +46,4 @@
| RandomCutMix &nbsp; &nbsp; &nbsp; | ✅ | ❌ |
</td>
</tr>
-</table>
\ No newline at end of file
+</table>
diff --git a/kornia/feature/orientation.py b/kornia/feature/orientation.py
index 6eed4fc24..ef21958bb 100644
--- a/kornia/feature/orientation.py
+++ b/kornia/feature/orientation.py
@@ -172,7 +172,7 @@ class OriNet(nn.Module):
class LAFOrienter(nn.Module):
"""Module, which extracts patches using input images and local affine frames (LAFs),
- then runs :class:`~kornia.feature.PatchDominantGradientOrientation` or
+ then runs :class:`~kornia.feature.PatchDominantGradientOrientation` or
:class:`~kornia.feature.OriNet` on patches and then rotates the LAFs by the estimated angles
Args:
diff --git a/packaging/README.rst b/packaging/README.rst
index 9ae2d078c..d1b767c4f 100644
--- a/packaging/README.rst
+++ b/packaging/README.rst
@@ -12,7 +12,7 @@ In order to generate wheels define ```KORNIA_BUILD_VERSION```.
.. code:: bash
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/>`_
diff --git a/path.bash.inc b/path.bash.inc
index f88b97284..a293ab258 100644
--- a/path.bash.inc
+++ b/path.bash.inc
@@ -9,8 +9,8 @@ if [ "$apparent_sdk_dir" = "$script_link" ]; then
fi
sdk_dir="$(cd -P "$apparent_sdk_dir" > /dev/null && pwd -P )"
if [ ! -e $sdk_dir/.dev_env/bin/conda ]; then
- $sdk_dir/setup_dev_env.sh
-fi
+ $sdk_dir/setup_dev_env.sh
+fi
cmd="source $sdk_dir/.dev_env/bin/activate $sdk_dir/.dev_env/envs/venv"
if [ -z $CI ]; then
diff --git a/requirements-dev.txt b/requirements-dev.txt
index 53af987ca..2b5e3d04d 100644
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -3,5 +3,7 @@ pytest==5.4.2
pytest-flake8==1.0.6
pytest-cov==2.9.0
pytest-mypy==0.7.0
+autopep8
pydocstyle
-yapf
\ No newline at end of file
+pre-commit>=2.0
+yapf
diff --git a/setup.cfg b/setup.cfg
index 4b442c43c..a7ce95802 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -9,7 +9,21 @@ license_file = LICENSE
[flake8]
max-line-length = 120
-ignore = W504,E305,E402,E721,E722,E741,F401,F403,F405,F821,F841,F999,W605,F811
+ignore =
+ W504
+ E305
+ E402
+ E721
+ E722
+ E741
+ F401
+ F403
+ F405
+ F821
+ F841
+ F999
+ W605
+ F811
exclude = docs/src
[mypy]
diff --git a/tutorials/README.rst b/tutorials/README.rst
index 829ff6500..e1b56b8f3 100644
--- a/tutorials/README.rst
+++ b/tutorials/README.rst
@@ -1,4 +1,4 @@
Tutorials
=========
-This page contains the tutorials about Kornia.
\ No newline at end of file
+This page contains the tutorials about Kornia.