OpenPose  1.0.0rc2
OpenPose: A Real-Time Multi-Person Key-Point Detection And Multi-Threading C++ Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
bodyPartConnectorCaffe.hpp
Go to the documentation of this file.
1 #ifndef OPENPOSE_POSE_BODY_PART_CONNECTOR_CAFFE_HPP
2 #define OPENPOSE_POSE_BODY_PART_CONNECTOR_CAFFE_HPP
3 
6 
7 namespace op
8 {
9  // It mostly follows the Caffe::layer implementation, so Caffe users can easily use it. However, in order to keep
10  // the compatibility with any generic Caffe version, we keep this 'layer' inside our library rather than in the
11  // Caffe code.
12  template <typename T>
14  {
15  public:
16  explicit BodyPartConnectorCaffe();
17 
18  virtual ~BodyPartConnectorCaffe();
19 
20  virtual void Reshape(const std::vector<caffe::Blob<T>*>& bottom);
21 
22  virtual inline const char* type() const { return "BodyPartConnector"; }
23 
24  void setPoseModel(const PoseModel poseModel);
25 
26  void setMaximizePositives(const bool maximizePositives);
27 
28  void setInterMinAboveThreshold(const T interMinAboveThreshold);
29 
30  void setInterThreshold(const T interThreshold);
31 
32  void setMinSubsetCnt(const int minSubsetCnt);
33 
34  void setMinSubsetScore(const T minSubsetScore);
35 
36  void setScaleNetToOutput(const T scaleNetToOutput);
37 
38  virtual void Forward(const std::vector<caffe::Blob<T>*>& bottom, Array<T>& poseKeypoints,
39  Array<T>& poseScores);
40 
41  virtual void Forward_cpu(const std::vector<caffe::Blob<T>*>& bottom, Array<T>& poseKeypoints,
42  Array<T>& poseScores);
43 
44  virtual void Forward_gpu(const std::vector<caffe::Blob<T>*>& bottom, Array<T>& poseKeypoints,
45  Array<T>& poseScores);
46 
47  virtual void Backward_cpu(const std::vector<caffe::Blob<T>*>& top, const std::vector<bool>& propagate_down,
48  const std::vector<caffe::Blob<T>*>& bottom);
49 
50  virtual void Backward_gpu(const std::vector<caffe::Blob<T>*>& top, const std::vector<bool>& propagate_down,
51  const std::vector<caffe::Blob<T>*>& bottom);
52 
53  private:
54  PoseModel mPoseModel;
55  bool mMaximizePositives;
56  T mInterMinAboveThreshold;
57  T mInterThreshold;
58  int mMinSubsetCnt;
59  T mMinSubsetScore;
60  T mScaleNetToOutput;
61  std::array<int, 4> mHeatMapsSize;
62  std::array<int, 4> mPeaksSize;
63  std::array<int, 4> mTopSize;
64  // GPU auxiliary
65  unsigned int* pBodyPartPairsGpuPtr;
66  unsigned int* pMapIdxGpuPtr;
67  Array<T> mFinalOutputCpu;
68  T* pFinalOutputGpuPtr;
69 
70  DELETE_COPY(BodyPartConnectorCaffe);
71  };
72 }
73 
74 #endif // OPENPOSE_POSE_BODY_PART_CONNECTOR_CAFFE_HPP
void setMinSubsetCnt(const int minSubsetCnt)
virtual void Forward_gpu(const std::vector< caffe::Blob< T > * > &bottom, Array< T > &poseKeypoints, Array< T > &poseScores)
void setScaleNetToOutput(const T scaleNetToOutput)
PoseModel
Definition: enumClasses.hpp:9
virtual void Backward_cpu(const std::vector< caffe::Blob< T > * > &top, const std::vector< bool > &propagate_down, const std::vector< caffe::Blob< T > * > &bottom)
void setMaximizePositives(const bool maximizePositives)
virtual void Forward_cpu(const std::vector< caffe::Blob< T > * > &bottom, Array< T > &poseKeypoints, Array< T > &poseScores)
virtual void Reshape(const std::vector< caffe::Blob< T > * > &bottom)
virtual const char * type() const
Definition: bodyPartConnectorCaffe.hpp:22
void setMinSubsetScore(const T minSubsetScore)
void setInterMinAboveThreshold(const T interMinAboveThreshold)
Definition: macros.hpp:81
Definition: array.hpp:20
void setPoseModel(const PoseModel poseModel)
std::vector< T, Alloc > vector
Definition: cl2.hpp:567
void setInterThreshold(const T interThreshold)
virtual void Forward(const std::vector< caffe::Blob< T > * > &bottom, Array< T > &poseKeypoints, Array< T > &poseScores)
Definition: bodyPartConnectorCaffe.hpp:13
virtual void Backward_gpu(const std::vector< caffe::Blob< T > * > &top, const std::vector< bool > &propagate_down, const std::vector< caffe::Blob< T > * > &bottom)