Caffe
image_data_layer.hpp
1 #ifndef CAFFE_IMAGE_DATA_LAYER_HPP_
2 #define CAFFE_IMAGE_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 
22 template <typename Dtype>
24  public:
25  explicit ImageDataLayer(const LayerParameter& param)
27  virtual ~ImageDataLayer();
28  virtual void DataLayerSetUp(const vector<Blob<Dtype>*>& bottom,
29  const vector<Blob<Dtype>*>& top);
30 
31  virtual inline const char* type() const { return "ImageData"; }
32  virtual inline int ExactNumBottomBlobs() const { return 0; }
33  virtual inline int ExactNumTopBlobs() const { return 2; }
34 
35  protected:
36  shared_ptr<Caffe::RNG> prefetch_rng_;
37  virtual void ShuffleImages();
38  virtual void load_batch(Batch<Dtype>* batch);
39 
40  vector<std::pair<std::string, int> > lines_;
41  int lines_id_;
42 };
43 
44 
45 } // namespace caffe
46 
47 #endif // CAFFE_IMAGE_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 image files.
Definition: image_data_layer.hpp:23
virtual int ExactNumTopBlobs() const
Returns the exact number of top blobs required by the layer, or -1 if no exact number is required...
Definition: image_data_layer.hpp:33
virtual const char * type() const
Returns the layer type.
Definition: image_data_layer.hpp:31
virtual int ExactNumBottomBlobs() const
Returns the exact number of bottom blobs required by the layer, or -1 if no exact number is required...
Definition: image_data_layer.hpp:32
A wrapper around SyncedMemory holders serving as the basic computational unit through which Layers...
Definition: blob.hpp:24