All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
nmsCaffe.hpp
Go to the documentation of this file.
#ifndef OPENPOSE_NET_NMS_CAFFE_HPP
#define OPENPOSE_NET_NMS_CAFFE_HPP
#include <openpose/core/common.hpp>
namespace op
{
// It mostly follows the Caffe::layer implementation, so Caffe users can easily use it. However, in order to keep
// the compatibility with any generic Caffe version, we keep this 'layer' inside our library rather than in the
// Caffe code.
template <typename T>
class NmsCaffe
{
public:
explicit NmsCaffe();
virtual ~NmsCaffe();
virtual void LayerSetUp(const std::vector<caffe::Blob<T>*>& bottom, const std::vector<caffe::Blob<T>*>& top);
virtual void Reshape(const std::vector<caffe::Blob<T>*>& bottom, const std::vector<caffe::Blob<T>*>& top,
const int maxPeaks, const int outputChannels = -1, const int gpuID = 0);
virtual inline const char* type() const { return "Nms"; }
void setThreshold(const T threshold);
// Empirically gives better results (copied from Matlab original code)
void setOffset(const Point<T>& offset);
virtual void Forward(const std::vector<caffe::Blob<T>*>& bottom, const std::vector<caffe::Blob<T>*>& top);
virtual void Forward_cpu(const std::vector<caffe::Blob<T>*>& bottom, const std::vector<caffe::Blob<T>*>& top);
virtual void Forward_gpu(const std::vector<caffe::Blob<T>*>& bottom, const std::vector<caffe::Blob<T>*>& top);
virtual void Forward_ocl(const std::vector<caffe::Blob<T>*>& bottom, const std::vector<caffe::Blob<T>*>& top);
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 Backward_gpu(const std::vector<caffe::Blob<T>*>& top, const std::vector<bool>& propagate_down,
const std::vector<caffe::Blob<T>*>& bottom);
private:
T mThreshold;
Point<T> mOffset;
int mGpuID;
// PIMPL idiom
// http://www.cppsamples.com/common-tasks/pimpl.html
struct ImplNmsCaffe;
std::unique_ptr<ImplNmsCaffe> upImpl;
// PIMP requires DELETE_COPY & destructor, or extra code
// http://oliora.github.io/2015/12/29/pimpl-and-rule-of-zero.html
DELETE_COPY(NmsCaffe);
};
}
#endif // OPENPOSE_NET_NMS_CAFFE_HPP
DELETE_COPY
#define DELETE_COPY(className)
Definition: macros.hpp:34
op::NmsCaffe::LayerSetUp
virtual void LayerSetUp(const std::vector< caffe::Blob< T > * > &bottom, const std::vector< caffe::Blob< T > * > &top)
op::NmsCaffe::~NmsCaffe
virtual ~NmsCaffe()
op::NmsCaffe::Forward
virtual void Forward(const std::vector< caffe::Blob< T > * > &bottom, const std::vector< caffe::Blob< T > * > &top)
op::NmsCaffe::Forward_cpu
virtual void Forward_cpu(const std::vector< caffe::Blob< T > * > &bottom, const std::vector< caffe::Blob< T > * > &top)
op::NmsCaffe::setOffset
void setOffset(const Point< T > &offset)
op::Point
Definition: point.hpp:10
common.hpp
op::NmsCaffe::type
virtual const char * type() const
Definition: nmsCaffe.hpp:24
op::NmsCaffe::Forward_ocl
virtual void Forward_ocl(const std::vector< caffe::Blob< T > * > &bottom, const std::vector< caffe::Blob< T > * > &top)
op::NmsCaffe::Forward_gpu
virtual void Forward_gpu(const std::vector< caffe::Blob< T > * > &bottom, const std::vector< caffe::Blob< T > * > &top)
op::NmsCaffe::NmsCaffe
NmsCaffe()
op::NmsCaffe::Reshape
virtual void Reshape(const std::vector< caffe::Blob< T > * > &bottom, const std::vector< caffe::Blob< T > * > &top, const int maxPeaks, const int outputChannels=-1, const int gpuID=0)
caffe::Blob
Definition: macros.hpp:81
op::NmsCaffe::Backward_cpu
virtual void Backward_cpu(const std::vector< caffe::Blob< T > * > &top, const std::vector< bool > &propagate_down, const std::vector< caffe::Blob< T > * > &bottom)
op::NmsCaffe::Backward_gpu
virtual void Backward_gpu(const std::vector< caffe::Blob< T > * > &top, const std::vector< bool > &propagate_down, const std::vector< caffe::Blob< T > * > &bottom)
op::NmsCaffe::setThreshold
void setThreshold(const T threshold)
cl::vector
std::vector< T, Alloc > vector
Definition: cl2.hpp:567
op::NmsCaffe
Definition: nmsCaffe.hpp:12