#ifndef OPENPOSE_POSE_POSE_EXTRACTOR_CAFFE_HPP #define OPENPOSE_POSE_POSE_EXTRACTOR_CAFFE_HPP #include #include #include #include #include #include #include #include #include namespace op { class OP_API PoseExtractorCaffe : public PoseExtractorNet { public: PoseExtractorCaffe( const PoseModel poseModel, const std::string& modelFolder, const int gpuId, const std::vector& heatMapTypes = {}, const ScaleMode heatMapScaleMode = ScaleMode::ZeroToOneFixedAspect, const bool addPartCandidates = false, const bool maximizePositives = false, const std::string& protoTxtPath = "", const std::string& caffeModelPath = "", const float upsamplingRatio = 0.f, const bool enableNet = true, const bool enableGoogleLogging = true); virtual ~PoseExtractorCaffe(); virtual void netInitializationOnThread(); /** * @param poseNetOutput If it is not empty, OpenPose will not run its internal body pose estimation network * and will instead use this data as the substitute of its network. The size of this element must match the * size of the output of its internal network, or it will lead to core dumped (segmentation) errors. You can * modify the pose estimation flags to match the dimension of both elements (e.g., `--net_resolution`, * `--scale_number`, etc.). */ virtual void forwardPass( const std::vector>& inputNetData, const Point& inputDataSize, const std::vector& scaleInputToNetInputs = {1.f}, const Array& poseNetOutput = Array{}); const float* getCandidatesCpuConstPtr() const; const float* getCandidatesGpuConstPtr() const; const float* getHeatMapCpuConstPtr() const; const float* getHeatMapGpuConstPtr() const; std::vector getHeatMapSize() const; const float* getPoseGpuConstPtr() const; private: // Used when increasing spNets const PoseModel mPoseModel; const int mGpuId; const std::string mModelFolder; const std::string mProtoTxtPath; const std::string mCaffeModelPath; const float mUpsamplingRatio; const bool mEnableNet; const bool mEnableGoogleLogging; // General parameters std::vector> spNets; std::shared_ptr> spResizeAndMergeCaffe; std::shared_ptr> spNmsCaffe; std::shared_ptr> spBodyPartConnectorCaffe; std::shared_ptr> spMaximumCaffe; std::vector> mNetInput4DSizes; // Init with thread std::vector>> spCaffeNetOutputBlobs; std::shared_ptr> spHeatMapsBlob; std::shared_ptr> spPeaksBlob; std::shared_ptr> spMaximumPeaksBlob; DELETE_COPY(PoseExtractorCaffe); }; } #endif // OPENPOSE_POSE_POSE_EXTRACTOR_CAFFE_HPP