TONNXRuntime
1.0.0
这是Microsoft的Freepascal开放神经网络交换(OnnxRuntime)的实现?和Delphi⚔️
Windows 8之后,OnnxRuntime库配备了大多数现代Windows版本,此后版本1.13.1是最新版本,它可以安装在MACOS和Linux版本上,以进行开发和更新,请访问OnnxRuntime GitHub页面。
onnxruntime.dll已经装有Windows,您可以在%WINDIR%SysWOW64onnxruntime.dll或%WINDIR%System32onnxruntime.dll中找到它。
检查https://github.com/microsoft/onnxruntime/releases
来自Pascal单位标题的Lazarus或Delphi项目包括文件
unit formUnit;
{ $h+ }
interface
uses onnxruntime_pas_api, onnxruntime, Classes etc... ; var
session : TORTSession;
begin
session := TORTSession.Create( ' ./mymodel/filname.onnx ' );
{
*****************************************************************
Check your model requirements for input/output
names and value dimensions before preparing the inputs.
to explore the model before preparing use :
session.GetInputCount and session.GetOutputCount
session.GetInputName and session.GetOutputName
session.GetInputTypeInfo and session.GetOutputTypeInfo
****************************************************************
} TORTTensor<type>和您的输入使用TORTNameValueList准备带有所需形状的输入张量 var
x,y:integer;
imageData : array of array of single;
inTensor : TORTTensor<single> ;
inputs : TORTNameValueList ;
begin
// assuming the model input name is 'image' and the tensor shape is [width, height]
inTensor := TORTTensor<single>.Create([width, height { , depth ,etc... } ]);
for y:= 0 to inTensor.shape[ 1 ]- 1 do
for x:= 0 to inTensor.shape[ 0 ]- 1 do
inTensor.index2[x, y]:= imageData[x, y]; // your float values
inputs[ ' image ' ] := inTensor; var
myDetection : array of single;
i:integer;
outputs : TORTNameValueList;
outTensor : TORTTensor<single>
begin
outputs := session.run(inputs);
outTensor := outputs[ ' result ' ]
for i:= 0 to outTensor.shape[ 0 ] do
myDetection[i] := outTensor.index1[i]CPU:更快的RCNN10示例文件夹
从此处下载FasterRCNN-10.onnx
GPU:Yolo V7(DirectML)文件夹
从这里下载并提取yolov7_640x640.onnx