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
nmsCaffe.hpp
Go to the documentation of this file.
1 #ifndef OPENPOSE_CORE_NMS_CAFFE_HPP
2 #define OPENPOSE_CORE_NMS_CAFFE_HPP
3 
5 
6 namespace op
7 {
8  // It mostly follows the Caffe::layer implementation, so Caffe users can easily use it. However, in order to keep
9  // the compatibility with any generic Caffe version, we keep this 'layer' inside our library rather than in the
10  // Caffe code.
11  template <typename T>
13  {
14  public:
15  explicit NmsCaffe();
16 
17  virtual ~NmsCaffe();
18 
19  virtual void LayerSetUp(const std::vector<caffe::Blob<T>*>& bottom, const std::vector<caffe::Blob<T>*>& top);
20 
21  virtual void Reshape(const std::vector<caffe::Blob<T>*>& bottom, const std::vector<caffe::Blob<T>*>& top,
22  const int maxPeaks, const int outputChannels = -1, const int gpuID = 0);
23 
24  virtual inline const char* type() const { return "Nms"; }
25 
26  void setThreshold(const T threshold);
27 
28  virtual void Forward_cpu(const std::vector<caffe::Blob<T>*>& bottom, const std::vector<caffe::Blob<T>*>& top);
29 
30  virtual void Forward_gpu(const std::vector<caffe::Blob<T>*>& bottom, const std::vector<caffe::Blob<T>*>& top);
31 
32  virtual void Forward_ocl(const std::vector<caffe::Blob<T>*>& bottom, const std::vector<caffe::Blob<T>*>& top);
33 
34  virtual void Backward_cpu(const std::vector<caffe::Blob<T>*>& top, const std::vector<bool>& propagate_down,
35  const std::vector<caffe::Blob<T>*>& bottom);
36 
37  virtual void Backward_gpu(const std::vector<caffe::Blob<T>*>& top, const std::vector<bool>& propagate_down,
38  const std::vector<caffe::Blob<T>*>& bottom);
39 
40  private:
41  T mThreshold;
42  int mGpuID;
43 
44  // PIMPL idiom
45  // http://www.cppsamples.com/common-tasks/pimpl.html
46  struct ImplNmsCaffe;
47  std::unique_ptr<ImplNmsCaffe> upImpl;
48 
49  // PIMP requires DELETE_COPY & destructor, or extra code
50  // http://oliora.github.io/2015/12/29/pimpl-and-rule-of-zero.html
52  };
53 }
54 
55 #endif // OPENPOSE_CORE_NMS_CAFFE_HPP
#define DELETE_COPY(className)
Definition: macros.hpp:30
virtual const char * type() const
Definition: nmsCaffe.hpp:24
Definition: macros.hpp:77
std::vector< T, Alloc > vector
Definition: cl2.hpp:567
Definition: nmsCaffe.hpp:12
#define OP_API
Definition: macros.hpp:15