Skip to content
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

How can I use GPU? #43

Open
achmstein opened this issue Apr 29, 2024 · 1 comment
Open

How can I use GPU? #43

achmstein opened this issue Apr 29, 2024 · 1 comment

Comments

@achmstein
Copy link

Hello,

Thank you for the great library.

How to use GPU for face detection and recognition? I want to use it with Frigate for camera's stream!

@georg-jung
Copy link
Owner

Thanks for the kind words. Instead of

dotnet add package Microsoft.ML.OnnxRuntime
dotnet add package FaceAiSharp.Bundle

you could do

dotnet add package Microsoft.ML.OnnxRuntime.Gpu
// or
dotnet add package Microsoft.ML.OnnxRuntime.DirectML
dotnet add package FaceAiSharp.Bundle

Then, for e.g. DirectML you could do

        _embedderSessOpts = new SessionOptions
        {
            EnableMemoryPattern = false,
        };
        _embedderSessOpts.AppendExecutionProvider_DML();

        _emb = new ArcFaceEmbeddingsGenerator(
            new()
            {
                ModelPath = arcFaceModel.FullName,
            },
            _embedderSessOpts);

Also take a look here: https://onnxruntime.ai/docs/get-started/with-csharp.html#running-on-gpu-optional

Let me know if this works for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants