@@ -31,6 +31,7 @@ void* InputLayerPrefetch(void* layer_pointer) {
31
31
const int batchsize = layer->layer_param_ .batchsize ();
32
32
const int cropsize = layer->layer_param_ .cropsize ();
33
33
const bool mirror = layer->layer_param_ .mirror ();
34
+ const int resize_image = layer->layer_param_ .resize_image ();
34
35
35
36
if (mirror && cropsize == 0 ) {
36
37
LOG (FATAL) << " Current implementation requires mirror and cropsize to be "
@@ -46,8 +47,8 @@ void* InputLayerPrefetch(void* layer_pointer) {
46
47
for (int itemid = 0 ; itemid < batchsize; ++itemid) {
47
48
// get a blob
48
49
CHECK_GT (lines_size,layer->lines_id_ );
49
- if (!ReadImageToDatum (layer->lines_ [layer->lines_id_ ].first ,
50
- layer-> lines_ [layer-> lines_id_ ]. second , &datum)) {
50
+ if (!ReadImageToDatum (layer->lines_ [layer->lines_id_ ].first , layer-> lines_ [layer-> lines_id_ ]. second ,
51
+ resize_image, resize_image , &datum)) {
51
52
continue ;
52
53
};
53
54
const string& data = datum.data ();
@@ -114,6 +115,9 @@ void* InputLayerPrefetch(void* layer_pointer) {
114
115
// We have reached the end. Restart from the first.
115
116
DLOG (INFO) << " Restarting data prefetching from start." ;
116
117
layer->lines_id_ =0 ;
118
+ if (layer->layer_param_ .shuffle_data ()) {
119
+ std::random_shuffle (layer->lines_ .begin (), layer->lines_ .end ());
120
+ }
117
121
}
118
122
}
119
123
@@ -157,8 +161,9 @@ void InputLayer<Dtype>::SetUp(const vector<Blob<Dtype>*>& bottom,
157
161
}
158
162
// Read a data point, and use it to initialize the top blob.
159
163
Datum datum;
164
+ const int resize_image = this ->layer_param_ .resize_image ();
160
165
CHECK (ReadImageToDatum (lines_[lines_id_].first , lines_[lines_id_].second ,
161
- &datum));
166
+ resize_image,resize_image, &datum));
162
167
// image
163
168
int cropsize = this ->layer_param_ .cropsize ();
164
169
if (cropsize > 0 ) {
0 commit comments