Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Add RKNN object detection docs #325

Merged
merged 6 commits into from
Jan 21, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added source/_static/assets/objdetectFiltering.mp4
Binary file not shown.
37 changes: 37 additions & 0 deletions source/docs/objectDetection/about-object-detection.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
About Object Detection
======================

.. image:: images/notes-ui.png

How does it work?
^^^^^^^^^^^^^^^^^^^
mcm001 marked this conversation as resolved.
Show resolved Hide resolved

PhotonVision supports object detection using neural network accelerator hardware built into Orange Pi 5/5+ coprocessors. The Neural Processing Unit, or NPU, is `used by Photon <https://github.com/PhotonVision/rknn_jni/tree/main>`_ to massively accelerate certain math operations like those needed for running ML-based object detection.
mcm001 marked this conversation as resolved.
Show resolved Hide resolved

For the 2024 season, Photon ships with a **pre-trained NOTE detector** (shown above), as well as a mechanism for swapping in custom models. Future development will focus on enabling lower friction management of multiple custom models.

Tuning and Filtering
^^^^^^^^^^^^^^^^^^^^

Compared to other pipelines, object detection exposes very few tuning handles. The Confidence slider changes the minimum confidence that the model needs to have in a given detection to consider it valid, as a number between 0 and 1 (with 0 meaning completely uncertain and 1 meaning maximally certain).

.. raw:: html

<video width="85%" controls>
<source src="../../_static/assets/objdetectFiltering.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>

The same area, aspect ratio, and target orientation/sort parameters from :ref:`reflective pipelines <docs/reflectiveAndShape/contour-filtering:Reflective>` are also exposed in the object detection hard.
mcm001 marked this conversation as resolved.
Show resolved Hide resolved

Training Custom Models
^^^^^^^^^^^^^^^^^^^^^^

Coming soon!

Uploading Custom Models
mcm001 marked this conversation as resolved.
Show resolved Hide resolved
^^^^^^^^^^^^^^^^^^^^^^^

Our `pre-trained NOTE model <https://github.com/PhotonVision/photonvision/blob/master/photon-server/src/main/resources/models/note-640-640-yolov5s.rknn>`_ is automatically extracted from the JAR when PhotonVision starts, only if a file named “note-640-640-yolov5s.rknn” and "labels.txt" does not exist in the folder ``photonvision_config/models/``. This technically allows power users to replace the model and label files with new ones without rebuilding Photon from source and uploading a new JAR.

Use a program like WinSCP or FileZilla to access your coprocessor's filesystem, and copy the new ``.rknn`` model file into /home/pi. Next, SSH into the coprocessor and ``sudo mv /path/to/new/model.rknn /opt/photonvision/photonvision_config/models/note-640-640-yolov5s.rknn``. Repeat this process with the labels file, which should contain one line per label the model outputs with no training newline. Next, restart PhotonVision via the web UI.
Binary file added source/docs/objectDetection/images/notes-ui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions source/docs/objectDetection/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Object Detection
================

.. toctree::
:maxdepth: 0
:titlesonly:

about-object-detection
4 changes: 2 additions & 2 deletions source/docs/reflectiveAndShape/index.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Colored Shape Detection
=======================
Colored Shape & Reflective
==========================

.. toctree::
:maxdepth: 0
Expand Down
4 changes: 2 additions & 2 deletions source/docs/reflectiveAndShape/thresholding.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ In PhotonVision, HSV thresholds is available in the "Threshold" tab.
.. raw:: html

<video width="85%" controls>
<source src="../../../../_static/assets/tuningHueSatVal.mp4" type="video/mp4">
<source src="../../_static/assets/tuningHueSatVal.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>

Expand All @@ -20,7 +20,7 @@ The color picker can be used to quickly adjust HSV values. "Set to average" will
.. raw:: html

<video width="85%" controls>
<source src="../../../../_static/assets/colorPicker.mp4" type="video/mp4">
<source src="../../_static/assets/colorPicker.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>

Expand Down
1 change: 1 addition & 0 deletions source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ PhotonVision is licensed under the `GNU GPL v3 <https://www.gnu.org/licenses/gpl
docs/pipelines/index
docs/apriltag-pipelines/index
docs/reflectiveAndShape/index
docs/objectDetection/index
docs/calibration/calibration

.. toctree::
Expand Down
Loading