TONNXRuntime
1.0.0
これは、MicrosoftのOpen Neural Network Exchange(onnxruntime)のFreepascalの実装ですか?そしてdelphi⚔️
onnxruntimeライブラリには、 Windows 8後に最新のWindowsリリースのほとんどが付属しています。これは書かれている時点で、バージョン1.13.1は最新のリリースであり、 MacosおよびLinuxリリースのほとんどにインストールできます。
onnxruntime.dllすでにWindowsで出荷されています。 %WINDIR%SysWOW64onnxruntime.dllまたは%WINDIR%System32onnxruntime.dllで見つけることができます。
https://github.com/microsoft/onnxruntime/releasesを確認してください
パスカルユニットのヘッダーにあるラザロまたはデルファイプロジェクトからファイルが含まれています
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をダウンロードして抽出します