MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / DataLayerSetUp

Method DataLayerSetUp

rtpose_wrapper/src/caffe/layers/data_layer.cpp:26–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24
25template <typename Dtype>
26void DataLayer<Dtype>::DataLayerSetUp(const vector<Blob<Dtype>*>& bottom,
27 const vector<Blob<Dtype>*>& top) {
28 const int batch_size = this->layer_param_.data_param().batch_size();
29 // Read a data point, and use it to initialize the top blob.
30 Datum& datum = *(reader_.full().peek());
31
32 // Use data_transformer to infer the expected blob shape from datum.
33 vector<int> top_shape = this->data_transformer_->InferBlobShape(datum);
34 this->transformed_data_.Reshape(top_shape);
35 // Reshape top[0] and prefetch_data according to the batch_size.
36 top_shape[0] = batch_size;
37 top[0]->Reshape(top_shape);
38 for (int i = 0; i < this->PREFETCH_COUNT; ++i) {
39 this->prefetch_[i].data_.Reshape(top_shape);
40 }
41 LOG(INFO) << "output data size: " << top[0]->num() << ","
42 << top[0]->channels() << "," << top[0]->height() << ","
43 << top[0]->width();
44 // label
45 if (this->output_labels_) {
46 vector<int> label_shape(1, batch_size);
47 top[1]->Reshape(label_shape);
48 for (int i = 0; i < this->PREFETCH_COUNT; ++i) {
49 this->prefetch_[i].label_.Reshape(label_shape);
50 }
51 }
52}
53
54// This function is called on prefetch thread
55template<typename Dtype>

Callers 1

TYPED_TESTFunction · 0.45

Calls 8

batch_sizeMethod · 0.80
InferBlobShapeMethod · 0.80
numMethod · 0.80
peekMethod · 0.45
ReshapeMethod · 0.45
channelsMethod · 0.45
heightMethod · 0.45
widthMethod · 0.45

Tested by 1

TYPED_TESTFunction · 0.36