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 setInterMinAboveThreshold(const T interMinAboveThreshold);
27 
28  void setInterThreshold(const T interThreshold);
29 
30  void setMinSubsetCnt(const int minSubsetCnt);
31 
32  void setMinSubsetScore(const T minSubsetScore);
33 
34  void setScaleNetToOutput(const T scaleNetToOutput);
35 
36  virtual void Forward_cpu(const std::vector<caffe::Blob<T>*>& bottom, Array<T>& poseKeypoints,
37  Array<T>& poseScores);
38 
39  virtual void Forward_gpu(const std::vector<caffe::Blob<T>*>& bottom, Array<T>& poseKeypoints,
40  Array<T>& poseScores);
41 
42  virtual void Backward_cpu(const std::vector<caffe::Blob<T>*>& top, const std::vector<bool>& propagate_down,
43  const std::vector<caffe::Blob<T>*>& bottom);
44 
45  virtual void Backward_gpu(const std::vector<caffe::Blob<T>*>& top, const std::vector<bool>& propagate_down,
46  const std::vector<caffe::Blob<T>*>& bottom);
47 
48  private:
49  PoseModel mPoseModel;
50  T mInterMinAboveThreshold;
51  T mInterThreshold;
52  int mMinSubsetCnt;
53  T mMinSubsetScore;
54  T mScaleNetToOutput;
55  std::array<int, 4> mHeatMapsSize;
56  std::array<int, 4> mPeaksSize;
57  std::array<int, 4> mTopSize;
58  // GPU auxiliary
59  unsigned int* pBodyPartPairsGpuPtr;
60  unsigned int* pMapIdxGpuPtr;
61  Array<T> mFinalOutputCpu;
62  T* pFinalOutputGpuPtr;
63 
64  DELETE_COPY(BodyPartConnectorCaffe);
65  };
66 }
67 
68 #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)
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:80
Definition: array.hpp:20
void setPoseModel(const PoseModel poseModel)
std::vector< T, Alloc > vector
Definition: cl2.hpp:567
void setInterThreshold(const T interThreshold)
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)