diff --git a/docs/requirements.txt b/docs/requirements.txt index 2b491a28..b60d038b 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,5 +1,6 @@ numpy jupyterlab -sphinx==3.5.4 -insipid-sphinx-theme -nbsphinx==0.8.7 +ipython +sphinx +sphinx-material +nbsphinx diff --git a/docs/source/conf.py b/docs/source/conf.py index 6f398bdc..dcd08ba9 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -12,6 +12,7 @@ # import os import sys +from datetime import datetime sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))) @@ -19,9 +20,8 @@ # -- 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 --------------------------------------------------- @@ -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. @@ -91,16 +96,45 @@ def setup(app): """ -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"]} diff --git a/docs/source/index.rst b/docs/source/index.rst index 8cbed444..2ed4295f 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -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: @@ -33,11 +26,11 @@ Follow the design principle of `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: @@ -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 diff --git a/docs/source/installation.rst b/docs/source/installation.rst index c87633bc..e8f3eb05 100644 --- a/docs/source/installation.rst +++ b/docs/source/installation.rst @@ -1,4 +1,4 @@ -Installation +Install yolort ============ .. _required: diff --git a/notebooks/export-onnx-inference-onnxruntime.ipynb b/notebooks/export-onnx-inference-onnxruntime.ipynb index 0d20d11e..b0d3a14b 100644 --- a/notebooks/export-onnx-inference-onnxruntime.ipynb +++ b/notebooks/export-onnx-inference-onnxruntime.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Deploying yolort on ONNXRuntime" + "# Deploying yolort on ONNX Runtime" ] }, {