NScript.Onnx
1.0.0.1
dotnet add package NScript.Onnx --version 1.0.0.1
NuGet\Install-Package NScript.Onnx -Version 1.0.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NScript.Onnx" Version="1.0.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NScript.Onnx --version 1.0.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: NScript.Onnx, 1.0.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install NScript.Onnx as a Cake Addin #addin nuget:?package=NScript.Onnx&version=1.0.0.1 // Install NScript.Onnx as a Cake Tool #tool nuget:?package=NScript.Onnx&version=1.0.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
NScript.Onnx
这是一个简单的 Onnx helper 库,可以简化相关的开发。
以 campplus 声纹识别模型,示例使用方法:
public class CampPlusModule
{
private OnnxRuntime _runtime;
private OnnxModel _model;
public CampPlusModule(OnnxRuntime runtime)
{
_runtime = runtime;
_model = runtime.CreateModel("path_of_campplus.onnx");
}
public float[] GetFeature(float[] fbankFeature)
{
float[]? val = null;
Tensor<float> inputTensors = new DenseTensor<float>(fbankFeature, new[] { 1, fbankFeature.Length/80, 80 });
var inputs = new List<NamedOnnxValue> { NamedOnnxValue.CreateFromTensor(_model.FirstInputName, inputTensors) };
_model.Infer(inputs, results =>
{
val = results[0].AsEnumerable<float>().ToArray();
});
return val!;
}
}
...
var runtime = new OnnxRuntime();
var camplusModule = new CampPlusModule(runtime);
var fbankFeature = new float[500 * 80]; // 模拟的 fbank 特征
var camplusFeature = camplusModule.GetFeature(fbankFeature);
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Microsoft.ML.OnnxRuntime (>= 1.18.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.