OpenPose  1.0.0rc2
OpenPose: A Real-Time Multi-Person Key-Point Detection And Multi-Threading C++ Library
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
netCaffe.hpp
Go to the documentation of this file.
1 #ifdef USE_CAFFE
2 #ifndef OPENPOSE_CORE_NET_CAFFE_HPP
3 #define OPENPOSE_CORE_NET_CAFFE_HPP
4 
5 #include <caffe/net.hpp>
7 #include <openpose/core/net.hpp>
8 
9 namespace op
10 {
11  class OP_API NetCaffe : public Net
12  {
13  public:
14  NetCaffe(const std::array<int, 4>& netInputSize4D, const std::string& caffeProto, const std::string& caffeTrainedModel, const int gpuId = 0,
15  const std::string& lastBlobName = "net_output");
16 
17  virtual ~NetCaffe();
18 
19  void initializationOnThread();
20 
21  // Alternative a) getInputDataCpuPtr or getInputDataGpuPtr + forwardPass
22  float* getInputDataCpuPtr() const;
23 
24  float* getInputDataGpuPtr() const;
25 
26  // Alternative b)
27  void forwardPass(const float* const inputNetData = nullptr) const;
28 
29  boost::shared_ptr<caffe::Blob<float>> getOutputBlob() const;
30 
31  private:
32  // Init with constructor
33  const int mGpuId;
34  const std::array<int, 4> mNetInputSize4D;
35  const unsigned long mNetInputMemory;
36  const std::string mCaffeProto;
37  const std::string mCaffeTrainedModel;
38  const std::string mLastBlobName;
39  // Init with thread
40  std::unique_ptr<caffe::Net<float>> upCaffeNet;
41  boost::shared_ptr<caffe::Blob<float>> spOutputBlob;
42 
43  DELETE_COPY(NetCaffe);
44  };
45 }
46 
47 #endif // OPENPOSE_CORE_NET_CAFFE_HPP
48 #endif
#define DELETE_COPY(className)
Definition: macros.hpp:25
#define OP_API
Definition: macros.hpp:5