About image resize in Caffe

711 views
Skip to first unread message

Yin Zheng

unread,
Oct 7, 2015, 7:33:02 AM10/7/15
to Caffe Users
Hi Guys,

In the tutorial of Caffe, we use the following code to resize images and generate lmdb dataset:

echo "Creating val lmdb..."


GLOG_logtostderr=1 $TOOLS/convert_imageset \

    --resize_height=$RESIZE_HEIGHT \

    --resize_width=$RESIZE_WIDTH \

    --shuffle \

    $VAL_DATA_ROOT \

    $DATA/val.txt \

    $EXAMPLE/ilsvrc12_val_lmdb


One thing I would like to know is: Will the resize operation change the aspect ration of the original images? For example, if the size of the original image is 150x120 (widthxheight), and the RESIZE_HEIGHT is 80 and RESIZE_WIDTH is 120. Then what is the size of  the resized image? Will Caffe do some padding to keep the aspect ratio?


Thanks very much for any comment!


Best wishes,

Yin

cooling

unread,
Oct 7, 2015, 11:12:40 AM10/7/15
to Caffe Users
No it does not keep it.

Yin Zheng

unread,
Oct 8, 2015, 7:39:23 AM10/8/15
to cooling, Caffe Users
Hi Cooling,

Thanks very much for the comments! 

Is there some way to keep the aspect ratio? You know, if the image size is very thin, e.g. 120x20, the change of aspect ratio would make the resized image very different from the original one. 

Best wishes,
Yin

--
You received this message because you are subscribed to a topic in the Google Groups "Caffe Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/caffe-users/MqE-YaZs8R4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to caffe-users...@googlegroups.com.
To post to this group, send email to caffe...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/caffe-users/dcc0905e-18c8-4b14-a47e-13dba6043758%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
------------------------------------------------------------------------------------------------------
Wir mussen wissen, Wir werden wissen.
                                  ——David Hilbert(1862~1943)
 
 

bingca...@gmail.com

unread,
Oct 15, 2015, 4:25:44 PM10/15/15
to Caffe Users

On Wednesday, October 7, 2015 at 4:33:02 AM UTC-7, Yin Zheng wrote:
If you have the Caffe source code, you may be able to find the answer in the data_transformer.cpp file. I have not tried to use an image size that is NOT square. I was wondering if that is supported.

Cheers,
Bingcai 
Reply all
Reply to author
Forward
0 new messages