/// <summary> /// Constructor: model location relative to .exe, mlcontext, model settings of input name and output name /// </summary> /// <param name="inputModelLocation"></param> /// <param name="inputMlContext"></param> /// <param name="inputModelSettings"></param> public OnnxRNNScorer(string inputModelLocation, MLContext inputMlContext, ModelSettings inputModelSettings) { modelLocation = inputModelLocation; mlContext = inputMlContext; modelSettings = inputModelSettings; pipeline = mlContext.Transforms.ApplyOnnxModel(modelFile: modelLocation, outputColumnNames: new[] { modelSettings.modelOutput }, inputColumnNames: new[] { modelSettings.modelInput }); }
public HeadposeRNN(Pipeline pipeline, string modelNameFile, ModelSettings modelSetting) { // Create the receiver. In = pipeline.CreateReceiver <Pose>(this, ReceiveData, nameof(In)); // Create the emitter. Out = pipeline.CreateEmitter <float>(this, nameof(Out)); // location of the model relative to .exe modelFilePath = OnnxUtility.ModelAbsoluteFilename(modelNameFile); // create a scorer which has the model and setting mlContext = new MLContext(); modelScorer = new OnnxRNNScorer(modelFilePath, mlContext, modelSetting); List <float> zerosList = new List <float>(new float[NUM_OF_FEATURES]); for (int i = 0; i < NUM_OF_FRAME; i++) { dataQueueTransDiff.AddLast(zerosList); dataQueueTTRRDiffDiff2.AddLast(zerosList); } lastInputTRTRDiffDiff2 = zerosList; }