#ifndef CAFFE_POSE_DATA_LAYER_HPP_ #define CAFFE_POSE_DATA_LAYER_HPP_ #include #include "caffe/blob.hpp" #include "caffe/layer.hpp" #include "caffe/proto/caffe.pb.h" #include "caffe/layers/base_data_layer.hpp" namespace caffe { template class PoseDataLayer : public BaseDataLayer { public: explicit PoseDataLayer(const LayerParameter& param) : BaseDataLayer(param), has_new_data_(false) {} virtual void DataLayerSetUp(const vector*>& bottom, const vector*>& top); virtual inline const char* type() const { return "PoseData"; } virtual inline int ExactNumBottomBlobs() const { return 0; } virtual inline int ExactNumTopBlobs() const { return 2; } virtual void AddDatumVector(const vector& datum_vector); virtual void AddMatVector(const vector& mat_vector, const vector& labels); // Reset should accept const pointers, but can't, because the memory // will be given to Blob, which is mutable void Reset(Dtype* data, Dtype* label, int n); void set_batch_size(int new_size); int batch_size() { return batch_size_; } int channels() { return channels_; } int height() { return height_; } int width() { return width_; } protected: virtual void Forward_cpu(const vector*>& bottom, const vector*>& top); int batch_size_, channels_, height_, width_, size_; Dtype* data_; Dtype* labels_; int n_; size_t pos_; Blob added_data_; Blob added_label_; bool has_new_data_; }; } // namespace caffe #endif