Skip to content

Commit

Permalink
Enforce that new_height and new_width are both 0 or both > 0
Browse files Browse the repository at this point in the history
  • Loading branch information
sguada committed Feb 17, 2014
1 parent fcaf5ad commit 587eeab
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/caffe/layers/images_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ void ImagesLayer<Dtype>::SetUp(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top) {
CHECK_EQ(bottom.size(), 0) << "Input Layer takes no input blobs.";
CHECK_EQ(top->size(), 2) << "Input Layer takes two blobs as output.";
const int new_height = this->layer_param_.new_height();
const int new_width = this->layer_param_.new_height();
CHECK((new_height==0 && new_width==0)||(new_height>0 && new_width > 0)) <<
"Current implementation requires new_height and new_width to be set at the same time.";
// Read the file with filenames and labels
LOG(INFO) << "Opening file " << this->layer_param_.source();
std::ifstream infile(this->layer_param_.source().c_str());
Expand All @@ -162,8 +166,6 @@ void ImagesLayer<Dtype>::SetUp(const vector<Blob<Dtype>*>& bottom,
}
// Read a data point, and use it to initialize the top blob.
Datum datum;
const int new_height = this->layer_param_.new_height();
const int new_width = this->layer_param_.new_height();
CHECK(ReadImageToDatum(lines_[lines_id_].first, lines_[lines_id_].second,
new_height,new_width,&datum));
// image
Expand Down

0 comments on commit 587eeab

Please sign in to comment.