All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
resizeAndMergeCaffe.hpp
Go to the documentation of this file.
#ifndef OPENPOSE_NET_RESIZE_AND_MERGE_CAFFE_HPP
#define OPENPOSE_NET_RESIZE_AND_MERGE_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 ResizeAndMergeCaffe
{
public:
explicit ResizeAndMergeCaffe();
virtual ~ResizeAndMergeCaffe();
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 T netFactor, const T scaleFactor, const bool mergeFirstDimension = true,
const int gpuID = 0);
virtual inline const char* type() const { return "ResizeAndMerge"; }
void setScaleRatios(const std::vector<T>& scaleRatios);
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:
std::vector<T*> mTempGPUData;
std::vector<T> mScaleRatios;
std::vector<std::array<int, 4>> mBottomSizes;
std::array<int, 4> mTopSize;
int mGpuID;
DELETE_COPY(ResizeAndMergeCaffe);
};
}
#endif // OPENPOSE_NET_RESIZE_AND_MERGE_CAFFE_HPP
op::ResizeAndMergeCaffe::setScaleRatios
void setScaleRatios(const std::vector< T > &scaleRatios)
op::ResizeAndMergeCaffe::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::ResizeAndMergeCaffe::~ResizeAndMergeCaffe
virtual ~ResizeAndMergeCaffe()
op::ResizeAndMergeCaffe::Forward_cpu
virtual void Forward_cpu(const std::vector< caffe::Blob< T > * > &bottom, const std::vector< caffe::Blob< T > * > &top)
op::ResizeAndMergeCaffe
Definition: resizeAndMergeCaffe.hpp:12
common.hpp
op::ResizeAndMergeCaffe::Reshape
virtual void Reshape(const std::vector< caffe::Blob< T > * > &bottom, const std::vector< caffe::Blob< T > * > &top, const T netFactor, const T scaleFactor, const bool mergeFirstDimension=true, const int gpuID=0)
op::ResizeAndMergeCaffe::type
virtual const char * type() const
Definition: resizeAndMergeCaffe.hpp:25
op::ResizeAndMergeCaffe::Forward_ocl
virtual void Forward_ocl(const std::vector< caffe::Blob< T > * > &bottom, const std::vector< caffe::Blob< T > * > &top)
caffe::Blob
Definition: macros.hpp:81
op::ResizeAndMergeCaffe::ResizeAndMergeCaffe
ResizeAndMergeCaffe()
op::ResizeAndMergeCaffe::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::ResizeAndMergeCaffe::LayerSetUp
virtual void LayerSetUp(const std::vector< caffe::Blob< T > * > &bottom, const std::vector< caffe::Blob< T > * > &top)
cl::vector
std::vector< T, Alloc > vector
Definition: cl2.hpp:567
op::ResizeAndMergeCaffe::Forward_gpu
virtual void Forward_gpu(const std::vector< caffe::Blob< T > * > &bottom, const std::vector< caffe::Blob< T > * > &top)
op::ResizeAndMergeCaffe::Forward
virtual void Forward(const std::vector< caffe::Blob< T > * > &bottom, const std::vector< caffe::Blob< T > * > &top)