Skip to content

Unity Barracudaを用いてMobileNet(画像クラス分類)をWebGL上で推論するサンプルです。

License

Notifications You must be signed in to change notification settings

Kazuhito00/Unity-Barracuda-MobileNet-WebGL-Sample

Repository files navigation

Unity-Barracuda-MobileNet-WebGL-Sample

Unity Barracudaを用いてMobileNet(画像クラス分類)をWebGL上で推論するサンプルです。
現時点(2021/02/09)でUnityのWebGLはCPU推論のみのサポートです。
GPU推論と比較しパフォーマンスは出ません。GPU推論やAndroid上での実行時の参考FPSを後述しています。
v9g8l-5fqfl

Demo

動作確認用ページは以下。
MobileNetV1のデモです。
https://kazuhito00.github.io/Unity-Barracuda-MobileNet-WebGL-Sample/WebGL-Build

FPS(参考値)

WebCamController.cs の Update()の呼び出し周期を計測したものです。
以下のように動作は基本的に非同期処理のため、FPSは見かけ上のFPSであり、推論自体のFPSではありません。
 CSharpBurst:非同期
 CSharpRef:同期
 ComputePrecompiled:非同期

MobileNetV1 MobileNetV2
WebGL
CPU:Core i7-8750H CPU @2.20GHz
約2.2FPS
CSharpBurst
約0.08FPS
CSharpRef
※CSharpBurstで動作せず
WebGL
CPU:Core i5-5200U CPU @2.20GHz
約1.1FPS
CSharpBurst
未計測
Android
Google Pixel4a(Snapdragon 730G)
約1.9FPS
ComputePrecompiled
約1.8FPS
ComputePrecompiled
Unity Editor
GPU:GTX 1050 Ti Max-Q(4GB)
約45FPS
ComputePrecompiled
約41FPS
ComputePrecompiled

Requirement (Unity)

  • Unity 2020.1.6f1 or later
  • Barracuda 1.3.0 or later

Requrement (Python) ※ONNX変換をする場合のみ

  • Tensorflow 2.4.0 or later
  • tf2onnx 1.8.2 or later
  • onnxruntime 1.6.0 or later(※ONNX変換後の推論をテストする場合のみ)

Reference

ToDo

Author

高橋かずひと(https://twitter.com/KzhtTkhs)

License

Unity-Barracuda-MobileNet-WebGL-Sample is under Apache-2.0 License.

Licence(Font)

Noto Sans JP fonts is under Open Font License.

About

Unity Barracudaを用いてMobileNet(画像クラス分類)をWebGL上で推論するサンプルです。

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published