-
Notifications
You must be signed in to change notification settings - Fork 291
Add support for object detection on Rubik Pi 3 #2005
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 38 commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
e99ffa1
add tflite files to exclusion
samfreund b4ea002
update Neural Network Managers
samfreund ad916d5
update requesthandler for rubik support
samfreund 7b81037
update object detection pipeline
samfreund 40bb937
add rubik to gradle and other updates
09300c4
start implementing pipelines
1519206
finish integrating rubik
6491934
make the frontend work
samfreund 447363f
update user and pw for deploy
samfreund 7c37845
some issues with the image, so we're hacking this in for now
samfreund 4b529ab
QCS6490 isn't a pi
samfreund bd2a5aa
new image with device-tree
samfreund 7dc495b
add basic model for testing
samfreund c3f10f5
update rubik version
samfreund 1e6d1ca
fix model extraction to exclude non-supported models
samfreund 4fa79ad
rewrite rubik object detector for JNI changes
samfreund 11e145e
refactor loadModel to take a path
samfreund 5a73e6a
add toString() function to models
samfreund 0d17123
add better checking for detector forceloads
samfreund 4ba57d8
improved logging and catching
samfreund 7d89c48
finally load the right libraries
samfreund a3053bb
add new model
samfreund 15bb870
bump rubik and update jni
samfreund 04b5c46
remove unused model
samfreund 20239e7
remove comments about changes by model
samfreund 4623454
disallow v5 for rubik
samfreund 917fe98
refactor docs to include separate sections per coproc for OD
samfreund e737182
add benchmark command to docs
samfreund 09fc206
move to common coco list
samfreund 8755fba
refactor model extract
samfreund ad8c8c3
only allow supported model types
samfreund 30f1b74
add letterboxing note
samfreund f2f4085
Merge branch 'main' into rubik-od
samfreund 02ff00b
extract license
samfreund ecd3fef
version of rubik_jni
samfreund 492982e
add algae coral model
samfreund b95d442
fix nms tooltip
samfreund 0ec19e8
Discard changes to photon-server/build.gradle
samfreund 379809c
Fix spacing
samfreund f5e3569
Update wording
samfreund 80bc32f
Lint and fix spacing
Gold856 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,7 @@ modifiableFileExclude { | |
| \.webp$ | ||
| \.ico$ | ||
| \.rknn$ | ||
| \.tflite$ | ||
| \.mp4$ | ||
| \.ttf$ | ||
| \.woff2$ | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ modifiableFileExclude { | |
| \.webp$ | ||
| \.ico$ | ||
| \.rknn$ | ||
| \.tflite$ | ||
| \.svg$ | ||
| \.woff2$ | ||
| gradlew | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| # Object Detection | ||
|
|
||
| ```{toctree} | ||
| :maxdepth: 0 | ||
| :titlesonly: true | ||
|
|
||
| about-object-detection | ||
| opi | ||
samfreund marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| rubik | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Orange Pi 5 (and variants) Object Detection | ||
|
|
||
| ## How it works | ||
|
|
||
| PhotonVision runs object detection on the Orange Pi 5 by use of the RKNN model architecture, and [this JNI code](https://github.com/PhotonVision/rknn_jni). | ||
|
|
||
| ## Supported models | ||
|
|
||
| PhotonVision currently ONLY supports 640x640 Ultralytics YOLOv5, YOLOv8, and YOLOv11 models trained and converted to `.rknn` format for RK3588 SOCs! Other models require different post-processing code and will NOT work. | ||
|
|
||
| ## Converting Custom Models | ||
|
|
||
| :::{warning} | ||
| Only quantized models are supported, so take care when exporting to select the option for quantization. | ||
| ::: | ||
|
|
||
| PhotonVision now ships with a [Python Notebook](https://github.com/PhotonVision/photonvision/blob/main/scripts/rknn-convert-tool/rknn_conversion.ipynb) that you can use in [Google Colab](https://colab.research.google.com) or in a local environment. In Google Colab, you can simply paste the PhotonVision GitHub URL into the "GitHub" tab and select the `rknn_conversion.ipynb` notebook without needing to manually download anything. | ||
|
|
||
| Please ensure that the model you are attempting to convert is among the {ref}`supported models <docs/objectDetection/opi:Supported Models>` and using the PyTorch format. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # Rubik Pi 3 Object Detection | ||
|
|
||
| ## How it works | ||
|
|
||
| PhotonVision runs object detection on the Rubik Pi 3 by use of [TensorflowLite](https://github.com/tensorflow/tensorflow), and [this JNI code](https://github.com/PhotonVision/rubik_jni). | ||
|
|
||
| ## Supported models | ||
|
|
||
| PhotonVision currently ONLY supports 640x640 Ultralytics YOLOv8 and YOLOv11 models trained and converted to `.tflite` format for QCS6490 SOCs! Other models require different post-processing code and will NOT work. | ||
|
|
||
| ## Converting Custom Models | ||
|
|
||
| :::{warning} | ||
| Only quantized models are supported, so take care when exporting to select the option for quantization. | ||
| ::: | ||
|
|
||
| PhotonVision now ships with a [Python Notebook](https://github.com/PhotonVision/photonvision/blob/main/scripts/rubik_conversion.ipynb) that you can use in [Google Colab](https://colab.research.google.com) or in a local environment. In Google Colab, you can simply paste the PhotonVision GitHub URL into the "GitHub" tab and select the `rubik_conversion.ipynb` notebook without needing to manually download anything. | ||
|
|
||
| Please ensure that the model you are attempting to convert is among the {ref}`supported models <docs/objectDetection/rubik:Supported Models>` and using the PyTorch format. | ||
|
|
||
| ## Benchmarking | ||
|
|
||
| Before you can perform benchmarking, it's necessary to install `tensorflow-lite-qcom-apps` with apt. | ||
|
|
||
| By SSHing into your Rubik Pi and running this command, replacing `PATH/TO/MODEL` with the path to your model, `benchmark_model --graph=src/test/resources/yolov8nCoco.tflite --external_delegate_path=/usr/lib/libQnnTFLiteDelegate.so --external_delegate_options=backend_type:htp --external_delegate_options=htp_use_conv_hmx:1 --external_delegate_options=htp_performance_mode:2` you can determine how long it takes for inference to be performed with your model. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.