Caffe
window_data_layer.hpp
1 #ifndef CAFFE_WINDOW_DATA_LAYER_HPP_
2 #define CAFFE_WINDOW_DATA_LAYER_HPP_
3 
4 #include <string>
5 #include <utility>
6 #include <vector>
7 
8 #include "caffe/blob.hpp"
9 #include "caffe/data_transformer.hpp"
10 #include "caffe/internal_thread.hpp"
11 #include "caffe/layer.hpp"
12 #include "caffe/layers/base_data_layer.hpp"
13 #include "caffe/proto/caffe.pb.h"
14 
15 namespace caffe {
16 
24 template <typename Dtype>
26  public:
27  explicit WindowDataLayer(const LayerParameter& param)
29  virtual ~WindowDataLayer();
30  virtual void DataLayerSetUp(const vector<Blob<Dtype>*>& bottom,
31  const vector<Blob<Dtype>*>& top);
32 
33  virtual inline const char* type() const { return "WindowData"; }
34  virtual inline int ExactNumBottomBlobs() const { return 0; }
35  virtual inline int ExactNumTopBlobs() const { return 2; }
36 
37  protected:
38  virtual unsigned int PrefetchRand();
39  virtual void load_batch(Batch<Dtype>* batch);
40 
41  shared_ptr<Caffe::RNG> prefetch_rng_;
42  vector<std::pair<std::string, vector<int> > > image_database_;
43  enum WindowField { IMAGE_INDEX, LABEL, OVERLAP, X1, Y1, X2, Y2, NUM };
44  vector<vector<float> > fg_windows_;
45  vector<vector<float> > bg_windows_;
46  Blob<Dtype> data_mean_;
47  vector<Dtype> mean_values_;
48  bool has_mean_file_;
49  bool has_mean_values_;
50  bool cache_images_;
51  vector<std::pair<std::string, Datum > > image_database_cache_;
52 };
53 
54 } // namespace caffe
55 
56 #endif // CAFFE_WINDOW_DATA_LAYER_HPP_
Definition: base_data_layer.hpp:47
Definition: base_data_layer.hpp:53
A layer factory that allows one to register layers. During runtime, registered layers can be called b...
Definition: blob.hpp:14
Provides data to the Net from windows of images files, specified by a window data file...
Definition: window_data_layer.hpp:25
virtual int ExactNumBottomBlobs() const
Returns the exact number of bottom blobs required by the layer, or -1 if no exact number is required...
Definition: window_data_layer.hpp:34
virtual const char * type() const
Returns the layer type.
Definition: window_data_layer.hpp:33
virtual int ExactNumTopBlobs() const
Returns the exact number of top blobs required by the layer, or -1 if no exact number is required...
Definition: window_data_layer.hpp:35
A wrapper around SyncedMemory holders serving as the basic computational unit through which Layers...
Definition: blob.hpp:24