Skip to content

Commit 808fbb1

Browse files
authored
feat: support EDGETPU_NNAPI (#1309)
1 parent fc1eec7 commit 808fbb1

File tree

1 file changed

+16
-3
lines changed
  • Packages/com.github.homuler.mediapipe/Runtime/Scripts/Tasks/Core

1 file changed

+16
-3
lines changed

Packages/com.github.homuler.mediapipe/Runtime/Scripts/Tasks/Core/BaseOptions.cs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ public sealed class BaseOptions
1010
{
1111
public enum Delegate
1212
{
13-
CPU,
14-
GPU,
13+
CPU = 0,
14+
GPU = 1,
15+
// Edge TPU acceleration using NNAPI delegate.
16+
EDGETPU_NNAPI = 2,
1517
}
1618

1719
public Delegate delegateCase { get; } = Delegate.CPU;
@@ -39,7 +41,18 @@ private Proto.Acceleration acceleration
3941
case Delegate.GPU:
4042
return new Proto.Acceleration
4143
{
42-
Gpu = new InferenceCalculatorOptions.Types.Delegate.Types.Gpu { },
44+
Gpu = new InferenceCalculatorOptions.Types.Delegate.Types.Gpu
45+
{
46+
UseAdvancedGpuApi = true,
47+
},
48+
};
49+
case Delegate.EDGETPU_NNAPI:
50+
return new Proto.Acceleration
51+
{
52+
Nnapi = new InferenceCalculatorOptions.Types.Delegate.Types.Nnapi
53+
{
54+
AcceleratorName = "google-edgetpu",
55+
},
4356
};
4457
default:
4558
return null;

0 commit comments

Comments
 (0)