Skip to content

Commit

Permalink
Merge pull request #4003 from voxel51/docs/super-gradients-direct
Browse files Browse the repository at this point in the history
Adding SuperGradients integration docs
  • Loading branch information
brimoor authored Jan 15, 2024
2 parents c502414 + ca86e23 commit e2461b2
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 0 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ learn how:
:image_src: https://voxel51.com/images/integrations/ultralytics-128.png
:image_title: Ultralytics

.. customimagelink::
:image_link: integrations/super_gradients.html
:image_src: https://voxel51.com/images/integrations/super-gradients-128.png
:image_title: SuperGradients

.. customimagelink::
:image_link: recipes/adding_detections.html
:image_src: https://voxel51.com/images/integrations/tensorflow-128.png
Expand Down
8 changes: 8 additions & 0 deletions docs/source/integrations/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,13 @@ on the cards below to see how!
:image: ../_static/images/integrations/ultralytics.jpg
:tags: Model-Training,Model-Evaluation,Model-Zoo

.. customcarditem::
:header: SuperGradients
:description: Use our SuperGradients integration to run inference with YOLO-NAS models on your FiftyOne datasets with just a few lines of code.
:link: super_gradients.html
:image: ../_static/images/integrations/super_gradients.png
:tags: Model-Training,Model-Evaluation,Model-Zoo

.. customcarditem::
:header: PyTorch Hub
:description: Did you know? You can load any model from the PyTorch Hub and run inference on your FiftyOne datasets with just a few lines of code.
Expand Down Expand Up @@ -186,5 +193,6 @@ on the cards below to see how!
LanceDB <lancedb.rst>
Transformers <transformers.rst>
Ultralytics <ultralytics.rst>
SuperGradients <super_gradients.rst>
PyTorch Hub <pytorch_hub.rst>
Lightning Flash <lightning_flash.rst>
73 changes: 73 additions & 0 deletions docs/source/integrations/super_gradients.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
.. _super-gradients-integration:

Super Gradients Integration
===========================

.. default-role:: code

FiftyOne integrates natively with Deci AI's
`SuperGradients <https://github.com/Deci-AI/super-gradients>`_ library, so you
can run inference with YOLO-NAS architectures on your FiftyOne datasets with
just a few lines of code!

.. _super-gradients-setup:

Setup
_____

To get started with
`SuperGradients <https://github.com/Deci-AI/super-gradients>`_, just install
the `super-gradients` package:

.. code-block:: shell
pip install super-gradients
.. _super-gradients-inference:

Inference
_________

You can directly pass SuperGradients YOLO-NAS models to your FiftyOne dataset's
:meth:`apply_model() <fiftyone.core.collections.SampleCollection.apply_model>`
method:

.. code-block:: python
:linenos:
import fiftyone as fo
import fiftyone.zoo as foz
from super_gradients.training import models
dataset = foz.load_zoo_dataset("quickstart", max_samples=25)
dataset.select_fields().keep_fields()
model = models.get("yolo_nas_m", pretrained_weights="coco")
# model = models.get("yolo_nas_l", pretrained_weights="coco")
# model = models.get("yolo_nas_s", pretrained_weights="coco")
dataset.apply_model(model, label_field="yolo_nas", confidence_thresh=0.7)
session = fo.launch_app(dataset)
.. _super-gradients-model-zoo:

Model zoo
_________

SuperGradients YOLO-NAS is also available directly from the
:ref:`FiftyOne Model Zoo <model-zoo-yolo-nas-torch>`!

.. code-block:: python
:linenos:
import fiftyone as fo
import fiftyone.zoo as foz
model = foz.load_zoo_model("yolo-nas-torch")
dataset = foz.load_zoo_dataset("quickstart")
dataset.apply_model(model, label_field="yolo_nas")
session = fo.launch_app(dataset)

0 comments on commit e2461b2

Please sign in to comment.