From fcaf5ad386ce95983d000e41fbba2801a79a7919 Mon Sep 17 00:00:00 2001 From: sguada Date: Mon, 17 Feb 2014 10:18:26 -0800 Subject: [PATCH] Fixed typos to pass test_images_layer --- include/caffe/vision_layers.hpp | 10 +++++----- src/caffe/layers/images_layer.cpp | 4 ++-- src/caffe/proto/caffe.proto | 6 ++++++ src/caffe/test/test_images_layer.cpp | 3 ++- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/include/caffe/vision_layers.hpp b/include/caffe/vision_layers.hpp index 51d3a36..ee79bbc 100644 --- a/include/caffe/vision_layers.hpp +++ b/include/caffe/vision_layers.hpp @@ -341,17 +341,17 @@ class DataLayer : public Layer { // This function is used to create a pthread that prefetches the data. template -void* InputLayerPrefetch(void* layer_pointer); +void* ImagesLayerPrefetch(void* layer_pointer); template -class InputLayer : public Layer { +class ImagesLayer : public Layer { // The function used to perform prefetching. - friend void* InputLayerPrefetch(void* layer_pointer); + friend void* ImagesLayerPrefetch(void* layer_pointer); public: - explicit InputLayer(const LayerParameter& param) + explicit ImagesLayer(const LayerParameter& param) : Layer(param) {} - virtual ~InputLayer(); + virtual ~ImagesLayer(); virtual void SetUp(const vector*>& bottom, vector*>* top); diff --git a/src/caffe/layers/images_layer.cpp b/src/caffe/layers/images_layer.cpp index f600dbc..75ed643 100644 --- a/src/caffe/layers/images_layer.cpp +++ b/src/caffe/layers/images_layer.cpp @@ -162,8 +162,8 @@ void ImagesLayer::SetUp(const vector*>& bottom, } // Read a data point, and use it to initialize the top blob. Datum datum; - const int new_height = layer->layer_param_.new_height(); - const int new_width = layer->layer_param_.new_height(); + 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 diff --git a/src/caffe/proto/caffe.proto b/src/caffe/proto/caffe.proto index d9a5524..183cf62 100644 --- a/src/caffe/proto/caffe.proto +++ b/src/caffe/proto/caffe.proto @@ -92,6 +92,12 @@ message LayerParameter { // be larger than the number of keys in the leveldb. optional uint32 rand_skip = 53 [ default = 0 ]; + // For the Reshape Layer one need to specify the new dimensions + optional int32 new_num = 60 [default = 0]; + optional int32 new_channels = 61 [default = 0]; + optional int32 new_height = 62 [default = 0]; + optional int32 new_width = 63 [default = 0]; + // Used by ImageLayer to shuffle the list of files at every epoch it will also // resize images if new_height or new_width are not zero optional bool shuffle_images = 64 [default = false]; diff --git a/src/caffe/test/test_images_layer.cpp b/src/caffe/test/test_images_layer.cpp index f98df37..af5f81d 100644 --- a/src/caffe/test/test_images_layer.cpp +++ b/src/caffe/test/test_images_layer.cpp @@ -80,7 +80,8 @@ TYPED_TEST(ImagesLayerTest, TestResize) { LayerParameter param; param.set_batchsize(5); param.set_source(this->filename); - param.set_resize_image(256); + param.set_new_height(256); + param.set_new_width(256); param.set_shuffle_images(false); ImagesLayer layer(param); layer.SetUp(this->blob_bottom_vec_, &this->blob_top_vec_); -- 2.7.4