Skip to content

Commit

Permalink
Deploy docs with Material Sphinx Theme (#292)
Browse files Browse the repository at this point in the history
* Deploy docs with Material Sphinx Theme

* Refactor index

* Update requirements for docs

* Update docs configuration

* Fix docs index

* Fixing navigation titles

* Fixing navigation titles

* Fixing configuration

* Minor fixes

* Fixed navigation titles
  • Loading branch information
zhiqwang authored Jan 26, 2022
1 parent 0dbc93d commit f39e931
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 31 deletions.
7 changes: 4 additions & 3 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
numpy
jupyterlab
sphinx==3.5.4
insipid-sphinx-theme
nbsphinx==0.8.7
ipython
sphinx
sphinx-material
nbsphinx
60 changes: 47 additions & 13 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
#
import os
import sys
from datetime import datetime

sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..")))


# -- Project information -----------------------------------------------------

project = "yolort"
copyright = "2020-2021, yolort community"
author = "Zhiqiang Wang"

copyright = f"{datetime.now().year}, yolort team"
author = "Zhiqiang Wang, Shiquan Yu, Fidan Kharrasov"

# -- General configuration ---------------------------------------------------

Expand All @@ -30,8 +30,13 @@
# ones.
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.mathjax",
"sphinx.ext.napoleon",
"sphinx.ext.viewcode",
"sphinx.ext.intersphinx",
"sphinx.ext.extlinks",
"nbsphinx",
"IPython.sphinxext.ipython_console_highlighting",
]

# Add any paths that contain templates here, relative to this directory.
Expand Down Expand Up @@ -91,16 +96,45 @@ def setup(app):
</style>
"""

html_theme = "insipid"
html_theme = "sphinx_material"

html_context = {
"display_github": True,
"github_user": "zhiqwang",
"github_repo": "yolov5-rt-stack",
}
# Material theme options (see theme.conf for more information)
html_theme_options = {
"left_buttons": [],
"right_buttons": [
"repo-button.html",
],
# Set the name of the project to appear in the navigation.
"nav_title": "YOLOv5 Runtime Stack",
# Set you GA account ID to enable tracking
# "google_analytics_account": "UA-XXXXX",
# Specify a base_url used to generate sitemap.xml. If not
# specified, then no sitemap will be built.
"base_url": "https://zhiqwang.com/yolov5-rt-stack",
# Set the color and the accent color
"color_primary": "blue",
"color_accent": "light-blue",
# Set the repo location to get a badge with stats
"repo_url": "https://github.com/zhiqwang/yolov5-rt-stack/",
"repo_name": "yolort",
# Visible levels of the global TOC; -1 means unlimited
"globaltoc_depth": 3,
# If False, expand all TOC entries
"globaltoc_collapse": False,
# If True, show hidden TOC entries
"globaltoc_includehidden": False,
# Text to appear at the top of the home page in a "hero" div.
"heroes": {
# We can have heroes for the home pages of training and inferencing in future.
"index": "A runtime stack for object detection on specialized accelerators."
},
}

# Disable show source link.
html_show_sourcelink = False

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# The default sidebars (for documents that don't match any pattern) are
# defined by theme itself. Builtin themes are using these templates by
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
# 'searchbox.html']``.
#
html_sidebars = {"**": ["logo-text.html", "globaltoc.html", "localtoc.html", "searchbox.html"]}
48 changes: 35 additions & 13 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
Welcome to yolort's documentation!
==================================

Runtime stack for YOLOv5 on specialized accelerators such as ``libtorch``,
``onnxruntime``, ``tvm`` and ``ncnn``.

.. image:: _static/yolort_logo.png
:width: 400px
:align: center


.. _what-is-yolort:

**What is yolort?**

``yolort`` focus on making the training and inference of the object detection task
integrate more seamlessly together. ``yolort`` now adopts the same model
structure as the official YOLOv5. The significant difference is that we adopt
structure as the official ``YOLOv5``. The significant difference is that we adopt
the dynamic shape mechanism, and within this, we can embed both pre-processing
(``letterbox``) and post-processing (``nms``) into the model graph, which
simplifies the deployment strategy. In this sense, ``yolort`` makes it possible
to be deployed more friendly on ``LibTorch``, ``ONNXRuntime``, ``TVM`` and so on.
to be deployed more friendly on ``LibTorch``, ``ONNX Runtime``, ``TensorRT``, ``TVM``
and so on.

.. _about-the-code:

Expand All @@ -33,11 +26,11 @@ Follow the design principle of `detr <https://github.com/facebookresearch/detr>`
not require complex libraries for training and inference.

``yolort`` is very simple to implement and experiment with. You like the implementation
of torchvision's faster-rcnn, retinanet or detr? You like yolov5? You love ``yolort``!
of torchvision's faster-rcnn, retinanet or detr? You like yolov5? You love yolort!

.. _quick-get-stated:

**Quick Get started**
**Introduction to yolort**

Read a source of image(s) and detect its objects:

Expand All @@ -54,20 +47,49 @@ Read a source of image(s) and detect its objects:
# Perform inference on a list of image files
predictions = model.predict(["bus.jpg", "zidane.jpg"])
**Loading checkpoint from official yolov5**

And we support loading the trained weights from YOLOv5:

.. code:: python
from yolort.models import YOLOv5
from yolort.v5 import attempt_download
# will downloaded from 'https://github.com/ultralytics/yolov5/releases/download/v6.0/yolov5n6.pt'
model_path = "yolov5n6.pt"
checkpoint_path = attempt_download(model_path)
model = YOLOv5.load_from_yolov5(checkpoint_path, score_thresh=0.25)
model.eval()
img_path = "bus.jpg"
predictions = model.predict(img_path)
**Use Cases and Solutions**

.. toctree::
:maxdepth: 2
:caption: Get started
:titlesonly:
:caption: Getting Started

installation

.. toctree::
:maxdepth: 2
:titlesonly:
:caption: Tutorials

notebooks/inference-pytorch-export-libtorch
notebooks/how-to-align-with-ultralytics-yolov5
notebooks/anchor-label-assignment-visualization
notebooks/model-graph-visualization

.. toctree::
:maxdepth: 2
:titlesonly:
:caption: Deployment

notebooks/export-onnx-inference-onnxruntime
notebooks/onnx-graphsurgeon-inference-tensorrt
notebooks/export-relay-inference-tvm
Expand Down
2 changes: 1 addition & 1 deletion docs/source/installation.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Installation
Install yolort
============

.. _required:
Expand Down
2 changes: 1 addition & 1 deletion notebooks/export-onnx-inference-onnxruntime.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Deploying yolort on ONNXRuntime"
"# Deploying yolort on ONNX Runtime"
]
},
{
Expand Down

0 comments on commit f39e931

Please sign in to comment.