const int batchsize = layer->layer_param_.batchsize();
const int cropsize = layer->layer_param_.cropsize();
const bool mirror = layer->layer_param_.mirror();
+ const int resize_image = layer->layer_param_.resize_image();
if (mirror && cropsize == 0) {
LOG(FATAL) << "Current implementation requires mirror and cropsize to be "
for (int itemid = 0; itemid < batchsize; ++itemid) {
// get a blob
CHECK_GT(lines_size,layer->lines_id_);
- if (!ReadImageToDatum(layer->lines_[layer->lines_id_].first,
- layer->lines_[layer->lines_id_].second, &datum)) {
+ if (!ReadImageToDatum(layer->lines_[layer->lines_id_].first, layer->lines_[layer->lines_id_].second,
+ resize_image, resize_image, &datum)) {
continue;
};
const string& data = datum.data();
// We have reached the end. Restart from the first.
DLOG(INFO) << "Restarting data prefetching from start.";
layer->lines_id_=0;
+ if (layer->layer_param_.shuffle_data()) {
+ std::random_shuffle(layer->lines_.begin(), layer->lines_.end());
+ }
}
}
}
// Read a data point, and use it to initialize the top blob.
Datum datum;
+ const int resize_image = this->layer_param_.resize_image();
CHECK(ReadImageToDatum(lines_[lines_id_].first, lines_[lines_id_].second,
- &datum));
+ resize_image,resize_image,&datum));
// image
int cropsize = this->layer_param_.cropsize();
if (cropsize > 0) {
// be larger than the number of keys in the leveldb.
optional uint32 rand_skip = 53 [ default = 0 ];
- optional bool shuffle_data = 61 [default = true];
+ // Used by Input_layer to shuffle the list of files at every epoch
+ optional bool shuffle_data = 61 [default = false];
+ // If >0 then it will resize input images to size given by resize_image using cv::resize
+ optional int32 resize_image = 62 [default = 0 ];
}
message LayerConnection {