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(const std::vector<caffe::Blob<T>*>& bottom, Array<T>& poseKeypoints,
37  Array<T>& poseScores);
38 
39  virtual void Forward_cpu(const std::vector<caffe::Blob<T>*>& bottom, Array<T>& poseKeypoints,
40  Array<T>& poseScores);
41 
42  virtual void Forward_gpu(const std::vector<caffe::Blob<T>*>& bottom, Array<T>& poseKeypoints,
43  Array<T>& poseScores);
44 
45  virtual void Backward_cpu(const std::vector<caffe::Blob<T>*>& top, const std::vector<bool>& propagate_down,
46  const std::vector<caffe::Blob<T>*>& bottom);
47 
48  virtual void Backward_gpu(const std::vector<caffe::Blob<T>*>& top, const std::vector<bool>& propagate_down,
49  const std::vector<caffe::Blob<T>*>& bottom);
50 
51  private:
52  PoseModel mPoseModel;
53  T mInterMinAboveThreshold;
54  T mInterThreshold;
55  int mMinSubsetCnt;
56  T mMinSubsetScore;
57  T mScaleNetToOutput;
58  std::array<int, 4> mHeatMapsSize;
59  std::array<int, 4> mPeaksSize;
60  std::array<int, 4> mTopSize;
61  // GPU auxiliary
62  unsigned int* pBodyPartPairsGpuPtr;
63  unsigned int* pMapIdxGpuPtr;
64  Array<T> mFinalOutputCpu;
65  T* pFinalOutputGpuPtr;
66 
67  DELETE_COPY(BodyPartConnectorCaffe);
68  };
69 }
70 
71 #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: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)