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