public PoseExtractorCaffe(PoseModel poseModel, string modelFolder, int gpuId, HeatMapType[] heatMapTypes = null, ScaleMode heatMapScale = ScaleMode.ZeroToOne, bool addPartCandidates = false, bool maximizePositives = false, bool enableGoogleLogging = true) { if (!Directory.Exists(modelFolder)) { throw new DirectoryNotFoundException($"{modelFolder} is not found."); } var modelFolderBytes = Encoding.UTF8.GetBytes(modelFolder); using (var types = new StdVector <HeatMapType>(heatMapTypes ?? new HeatMapType[0])) this.NativePtr = PoseExtractorCaffeNative.op_PoseExtractorCaffe_new(poseModel, modelFolderBytes, gpuId, types.NativePtr, heatMapScale, addPartCandidates, maximizePositives, enableGoogleLogging); }
//public override void InitializationOnThread() //{ // this.ThrowIfDisposed(); // PoseExtractorCaffeNative.op_PoseExtractorCaffe_initializationOnThread(this.NativePtr); //} #region Overrides /// <summary> /// Releases all unmanaged resources. /// </summary> protected override void DisposeUnmanaged() { base.DisposeUnmanaged(); if (this.NativePtr == IntPtr.Zero) { return; } PoseExtractorCaffeNative.op_PoseExtractorCaffe_delete(this.NativePtr); }
public override void ForwardPass(IEnumerable <Array <float> > inputNetData, Point <int> inputDataSize, double[] scaleRatios = null) { if (inputNetData == null) { throw new ArgumentNullException(nameof(inputNetData)); } this.ThrowIfDisposed(); using (var inputNetVector = new StdVector <Array <float> >(inputNetData)) using (var inputDataSizeNative = inputDataSize.ToNative()) using (var scaleVector = new StdVector <double>(scaleRatios ?? new[] { 1.0d })) PoseExtractorCaffeNative.op_PoseExtractorCaffe_forwardPass(this.NativePtr, inputNetVector.NativePtr, inputDataSizeNative.NativePtr, scaleVector.NativePtr); }