π Geometric Computer Vision Library for Spatial AI
Python artificial-intelligencecomputer-visiondeep-learninghacktoberfestimage-processingmachine-learningneural-networkpythonpytorchroboticsspatial-ai
add docs
edgarribaa9f50a4557fe
diff --git a/docs/Makefile b/docs/Makefilenew file mode 100644index 000000000..e3b092f29--- /dev/null+++ b/docs/Makefile@@ -0,0 +1,27 @@+# Minimal makefile for Sphinx documentation+#++# You can set these variables from the command line.+SPHINXOPTS =+SPHINXBUILD = sphinx-build+SPHINXPROJ = torchgeometry+SOURCEDIR = source+BUILDDIR = build++# Put it first so that "make" without argument is like "make help".+help:+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)++docset: html+ doc2dash --name $(SPHINXPROJ) --icon $(SOURCEDIR)/_static/img/pytorch-logo-flame.png --enable-js --online-redirect-url http://pytorch.org/vision/ --force $(BUILDDIR)/html/++ # Manually fix because Zeal doesn't deal well with `icon.png`-only at 2x resolution.+ cp $(SPHINXPROJ).docset/icon.png $(SPHINXPROJ).docset/[email protected]+ convert $(SPHINXPROJ).docset/[email protected] -resize 16x16 $(SPHINXPROJ).docset/icon.png++.PHONY: help Makefile docset++# Catch-all target: route all unknown targets to Sphinx using the new+# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).+%: Makefile+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)diff --git a/docs/requirements.txt b/docs/requirements.txtnew file mode 100644index 000000000..09a5dd7ae--- /dev/null+++ b/docs/requirements.txt@@ -0,0 +1,3 @@+sphinx+sphinxcontrib-googleanalytics+-e git://github.com/snide/sphinx_rtd_theme.git#egg=sphinx_rtd_themediff --git a/docs/source/_static/css/pytorch_theme.css b/docs/source/_static/css/pytorch_theme.cssnew file mode 100644index 000000000..55ae8e2d7--- /dev/null+++ b/docs/source/_static/css/pytorch_theme.css@@ -0,0 +1,118 @@+body {+ font-family: "Lato","proxima-nova","Helvetica Neue",Arial,sans-serif;+}++/* Default header fonts are ugly */+h1, h2, .rst-content .toctree-wrapper p.caption, h3, h4, h5, h6, legend, p.caption {+ font-family: "Lato","proxima-nova","Helvetica Neue",Arial,sans-serif;+}++/* Use white for docs background */+.wy-side-nav-search {+ background-color: #fff;+}++.wy-nav-content-wrap, .wy-menu li.current > a {+ background-color: #fff;+}++@media screen and (min-width: 1400px) {+ .wy-nav-content-wrap {+ background-color: rgba(0, 0, 0, 0.0470588);+ }++ .wy-nav-content {+ background-color: #fff;+ }+}++/* Fixes for mobile */+.wy-nav-top {+ background-color: #fff;+ /background-image: url('../img/arraiy-logo-text-black-large-final.svg');+ background-repeat: no-repeat;+ background-position: center;+ padding: 0;+ margin: 0.4045em 0.809em;+ color: #333;+}++.wy-nav-top > a {+ display: none;+}++@media screen and (max-width: 768px) {+ .wy-side-nav-search>a img.logo {+ height: 60px;+ }+}++/* This is needed to ensure that logo above search scales properly */+.wy-side-nav-search a {+ display: block;+}++/* This ensures that multiple constructors will remain in separate lines. */+.rst-content dl:not(.docutils) dt {+ display: table;+}++/* Use our red for literals (it's very similar to the original color) */+.rst-content tt.literal, .rst-content tt.literal, .rst-content code.literal {+ color: #F05732;+}++.rst-content tt.xref, a .rst-content tt, .rst-content tt.xref,+.rst-content code.xref, a .rst-content tt, a .rst-content code {+ color: #404040;+}++/* Change link colors (except for the menu) */++a {+ color: #F05732;+}++a:hover {+ color: #F05732;+}+++a:visited {+ color: #D44D2C;+}++.wy-menu a {+ color: #b3b3b3;+}++.wy-menu a:hover {+ color: #b3b3b3;+}++/* Default footer text is quite big */+footer {+ font-size: 80%;+}++footer .rst-footer-buttons {+ font-size: 125%; /* revert footer settings - 1/80% = 125% */+}++footer p {+ font-size: 100%;+}++/* For hidden headers that appear in TOC tree */+/* see http://stackoverflow.com/a/32363545/3343043 */+.rst-content .hidden-section {+ display: none;+}++nav .hidden-section {+ display: inherit;+}++.wy-side-nav-search>div.version {+ color: #000;+}diff --git a/docs/source/_static/img/arraiy-logo-large-final.svg b/docs/source/_static/img/arraiy-logo-large-final.svgnew file mode 100644index 000000000..5a12d4b43--- /dev/null+++ b/docs/source/_static/img/arraiy-logo-large-final.svg@@ -0,0 +1,84 @@+<?xml version="1.0" encoding="UTF-8" standalone="no"?>+<svg+ xmlns:dc="http://purl.org/dc/elements/1.1/"+ xmlns:cc="http://creativecommons.org/ns#"+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"+ xmlns:svg="http://www.w3.org/2000/svg"+ xmlns="http://www.w3.org/2000/svg"+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"+ viewBox="0 0 200 230.93501"+ height="230.935"+ width="200"+ xml:space="preserve"+ version="1.1"+ id="svg2"+ inkscape:version="0.92.3 (2405546, 2018-03-11)"+ sodipodi:docname="arraiy-logo-large-final.svg"+ inkscape:export-filename="/opt/home/daden/Documents/logos/arraiy-logo-large-final.png"+ inkscape:export-xdpi="300.01703"+ inkscape:export-ydpi="300.01703"><sodipodi:namedview+ pagecolor="#ffffff"+ bordercolor="#666666"+ borderopacity="1"+ objecttolerance="10"+ gridtolerance="10"+ guidetolerance="10"+ inkscape:pageopacity="0"+ inkscape:pageshadow="2"+ inkscape:window-width="1299"+ inkscape:window-height="711"+ id="namedview22"+ showgrid="false"+ inkscape:zoom="0.2501441"+ inkscape:cx="1734.2973"+ inkscape:cy="902.06562"+ inkscape:window-x="67"+ inkscape:window-y="27"+ inkscape:window-maximized="0"+ inkscape:current-layer="g10"+ fit-margin-top="0"+ fit-margin-left="0"+ fit-margin-right="0"+ fit-margin-bottom="0" /><metadata+ id="metadata8"><rdf:RDF><cc:Work+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs+ id="defs6"><clipPath+ id="clipPath20"+ clipPathUnits="userSpaceOnUse"><path+ id="path22"+ d="M 0,256 H 787.274 V 0 H 0 Z"+ inkscape:connector-curvature="0" /></clipPath></defs><g+ transform="matrix(1.25,0,0,-1.25,1767.5575,-351.2222)"+ id="g10"><g+ id="g4169"+ transform="matrix(0.15558319,0,0,0.15558319,-1192.9124,-393.26661)"><g+ id="g12"+ transform="matrix(4.6782157,0,0,4.6782157,-1377.3033,403.64027)"><path+ inkscape:connector-curvature="0"+ d="M 0,0 101.079,58.924 204.117,-0.001 V -117.847 L 102.062,-176.764 0,-117.845 Z"+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"+ id="path14" /></g><g+ id="g16"+ transform="matrix(4.6782157,0,0,4.6782157,-1419.622,-470.81369)"><g+ id="g18"+ clip-path="url(#clipPath20)"><g+ id="g24"+ transform="translate(9.0459,186.9204)"><path+ inkscape:connector-curvature="0"+ d="M 0,0 101.079,58.924 204.117,-0.001 V -117.847 L 102.062,-176.764 0,-117.845 Z"+ style="fill:none;stroke:#e18113;stroke-width:15.70800018;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"+ id="path26" /></g></g></g><g+ id="g28"+ transform="matrix(4.6782157,0,0,4.6782157,-869.90217,112.85782)"><path+ inkscape:connector-curvature="0"+ d="M 0,0 56.912,32.491 56.584,-32.844 0,-65.589 Z"+ style="fill:#2a6d9b;fill-opacity:1;fill-rule:nonzero;stroke:none"+ id="path30" /></g><g+ id="g32"+ transform="matrix(4.6782157,0,0,4.6782157,-1167.5349,311.46024)"><path+ inkscape:connector-curvature="0"+ d="M 0,0 57.105,33.143 115.157,0 57.358,-32.645 Z"+ style="fill:#c1c1c1;fill-opacity:1;fill-rule:nonzero;stroke:none"+ id="path34" /></g></g></g></svg>\ No newline at end of filediff --git a/docs/source/conf.py b/docs/source/conf.pynew file mode 100644index 000000000..392349744--- /dev/null+++ b/docs/source/conf.py@@ -0,0 +1,250 @@+#!/usr/bin/env python3+# -*- coding: utf-8 -*-+#+# PyTorch documentation build configuration file, created by+# sphinx-quickstart on Fri Dec 23 13:31:47 2016.+#+# This file is execfile()d with the current directory set to its+# containing dir.+#+# Note that not all possible configuration values are present in this+# autogenerated file.+#+# All configuration values have a default; values that are commented out+# serve to show the default.++# If extensions (or modules to document with autodoc) are in another directory,+# add these directories to sys.path here. If the directory is relative to the+# documentation root, use os.path.abspath to make it absolute, like shown here.+#+# import os+# import sys+# sys.path.insert(0, os.path.abspath('.'))+import torch+import torchgeometry+import sphinx_rtd_theme+++# -- General configuration ------------------------------------------------++# If your documentation needs a minimal Sphinx version, state it here.+#+# needs_sphinx = '1.0'++# Add any Sphinx extension module names here, as strings. They can be+# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom+# ones.+extensions = [+ 'sphinx.ext.autodoc',+ 'sphinx.ext.autosummary',+ 'sphinx.ext.doctest',+ 'sphinx.ext.intersphinx',+ 'sphinx.ext.todo',+ 'sphinx.ext.coverage',+ 'sphinx.ext.mathjax',+ 'sphinx.ext.napoleon',+ 'sphinx.ext.viewcode',+ #'sphinxcontrib.googleanalytics',+]++napoleon_use_ivar = True++googleanalytics_id = 'UA-90545585-1'+googleanalytics_enabled = True++# Add any paths that contain templates here, relative to this directory.+templates_path = ['_templates']++# The suffix(es) of source filenames.+# You can specify multiple suffix as a list of string:+#+# source_suffix = ['.rst', '.md']+source_suffix = '.rst'++# The master toctree document.+master_doc = 'index'++# General information about the project.+project = 'Torchgeometry'+copyright = '2018, Arraiy, Inc.'+author = 'Arraiy, Inc.'++# The version info for the project you're documenting, acts as replacement for+# |version| and |release|, also used in various other places throughout the+# built documents.+#+# The short X.Y version.+# TODO: change to [:2] at v1.0+version = 'master (' + torchgeometry.__version__ + ' )'+# The full version, including alpha/beta/rc tags.+# TODO: verify this works as expected+release = 'master'++# The language for content autogenerated by Sphinx. Refer to documentation+# for a list of supported languages.+#+# This is also used if you do content translation via gettext catalogs.+# Usually you set "language" from the command line for these cases.+language = None++# List of patterns, relative to source directory, that match files and+# directories to ignore when looking for source files.+# This patterns also effect to html_static_path and html_extra_path+exclude_patterns = []++# The name of the Pygments (syntax highlighting) style to use.+pygments_style = 'sphinx'++# If true, `todo` and `todoList` produce output, else they produce nothing.+todo_include_todos = True+++# -- Options for HTML output ----------------------------------------------++# The theme to use for HTML and HTML Help pages. See the documentation for+# a list of builtin themes.+#+html_theme = 'sphinx_rtd_theme'+html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]++# Theme options are theme-specific and customize the look and feel of a theme+# further. For a list of options available for each theme, see the+# documentation.+#+html_theme_options = {+ 'collapse_navigation': False,+ 'display_version': True,+ 'logo_only': True,+}++html_logo = '_static/img/arraiy-logo-large-final.svg'++# Add any paths that contain custom static files (such as style sheets) here,+# relative to this directory. They are copied after the builtin static files,+# so a file named "default.css" will overwrite the builtin "default.css".+html_static_path = ['_static']++# html_style_path = 'css/pytorch_theme.css'+html_context = {+ 'css_files': [+ 'https://fonts.googleapis.com/css?family=Lato',+ '_static/css/pytorch_theme.css'+ ],+}+++# -- Options for HTMLHelp output ------------------------------------------++# Output file base name for HTML help builder.+htmlhelp_basename = 'PyTorchdoc'+++# -- Options for LaTeX output ---------------------------------------------++latex_elements = {+ # The paper size ('letterpaper' or 'a4paper').+ #+ # 'papersize': 'letterpaper',++ # The font size ('10pt', '11pt' or '12pt').+ #+ # 'pointsize': '10pt',++ # Additional stuff for the LaTeX preamble.+ #+ # 'preamble': '',++ # Latex figure (float) alignment+ #+ # 'figure_align': 'htbp',+}++# Grouping the document tree into LaTeX files. List of tuples+# (source start file, target name, title,+# author, documentclass [howto, manual, or own class]).+latex_documents = [+ (master_doc, 'pytorch.tex', 'torchgeometry Documentation',+ 'Torch Contributors', 'manual'),+]+++# -- Options for manual page output ---------------------------------------++# One entry per manual page. List of tuples+# (source start file, name, description, authors, manual section).+man_pages = [+ (master_doc, 'torchgeometry', 'torchgeometry Documentation',+ [author], 1)+]+++# -- Options for Texinfo output -------------------------------------------++# Grouping the document tree into Texinfo files. List of tuples+# (source start file, target name, title, author,+# dir menu entry, description, category)+texinfo_documents = [+ (master_doc, 'torchgeometry', 'torchgeometry Documentation',+ author, 'torchgeometry', 'One line description of project.',+ 'Miscellaneous'),+]+++# Example configuration for intersphinx: refer to the Python standard library.+intersphinx_mapping = {+ 'python': ('https://docs.python.org/', None),+ 'numpy': ('http://docs.scipy.org/doc/numpy/', None),+}++# -- A patch that prevents Sphinx from cross-referencing ivar tags -------+# See http://stackoverflow.com/a/41184353/3343043++from docutils import nodes+from sphinx.util.docfields import TypedField+from sphinx import addnodes+++def patched_make_field(self, types, domain, items, **kw):+ # `kw` catches `env=None` needed for newer sphinx while maintaining+ # backwards compatibility when passed along further down!++ # type: (List, unicode, Tuple) -> nodes.field+ def handle_item(fieldarg, content):+ par = nodes.paragraph()+ par += addnodes.literal_strong('', fieldarg) # Patch: this line added+ # par.extend(self.make_xrefs(self.rolename, domain, fieldarg,+ # addnodes.literal_strong))+ if fieldarg in types:+ par += nodes.Text(' (')+ # NOTE: using .pop() here to prevent a single type node to be+ # inserted twice into the doctree, which leads to+ # inconsistencies later when references are resolved+ fieldtype = types.pop(fieldarg)+ if len(fieldtype) == 1 and isinstance(fieldtype[0], nodes.Text):+ typename = u''.join(n.astext() for n in fieldtype)+ typename = typename.replace('int', 'python:int')+ typename = typename.replace('long', 'python:long')+ typename = typename.replace('float', 'python:float')+ typename = typename.replace('type', 'python:type')+ par.extend(self.make_xrefs(self.typerolename, domain, typename,+ addnodes.literal_emphasis, **kw))+ else:+ par += fieldtype+ par += nodes.Text(')')+ par += nodes.Text(' -- ')+ par += content+ return par++ fieldname = nodes.field_name('', self.label)+ if len(items) == 1 and self.can_collapse:+ fieldarg, content = items[0]+ bodynode = handle_item(fieldarg, content)+ else:+ bodynode = self.list_type()+ for fieldarg, content in items:+ bodynode += nodes.list_item('', handle_item(fieldarg, content))+ fieldbody = nodes.field_body('', bodynode)+ return nodes.field('', fieldname, fieldbody)+++TypedField.make_field = patched_make_fielddiff --git a/docs/source/index.rst b/docs/source/index.rstnew file mode 100644index 000000000..c0528ac84--- /dev/null+++ b/docs/source/index.rst@@ -0,0 +1,49 @@+torchgeometry+=============++The :mod:`torchgeometry` package consists of a set of routines and differentiable modules to solve generic geometry problems. At its core, the package uses PyTorch as its main backend both for efficiency and to take advantage of autograd to define and compute the gradient of complex functions. In this first version, we provide different functions designed mainly for computer vision applications, such as image and tensors warping modules which rely on the epipolar geometry theory. The roadmap will include adding more and more functionality so that developers in the short term can use the package for the purpose of optimizing their loss functions to solve geometry problems.++Version v0.1.0 focuses on Image and tensor warping functions such as:++* Calibration+* Epipolar geometry+* Homography+* Depth+++.. automodule:: torchgeometry+.. currentmodule:: torchgeometry++Pinhole+--------++.. autofunction:: inverse+.. autofunction:: inverse_pose+.. autofunction:: pinhole_matrix+.. autofunction:: inv_pinhole_matrix+.. autofunction:: scale_pinhole+.. autofunction:: homography_i_H_ref++Convertions+-----------++.. autofunction:: rad2deg+.. autofunction:: deg2rad+.. autofunction:: convert_points_from_homogeneous+.. autofunction:: convert_points_to_homogeneous+.. autofunction:: transform_points++Utilities+---------++.. autofunction:: tensor_to_image+.. autofunction:: image_to_tensor++Containers+----------++.. autoclass:: HomographyWarper+ :members:++.. autoclass:: DepthWarper+ :members: