Skip to content

Aspect keeping resize in convert_imageset - #1178

Closed
ducha-aiki wants to merge 1 commit into
BVLC:devfrom
ducha-aiki:aspect_keeping_resize
Closed

Aspect keeping resize in convert_imageset#1178
ducha-aiki wants to merge 1 commit into
BVLC:devfrom
ducha-aiki:aspect_keeping_resize

Conversation

@ducha-aiki

Copy link
Copy Markdown
Contributor

Three changes:

  1. Added aspect keeping resize possibility to convert_imageset and io.cpp (as lots of people use it since "Some Improvements on Deep Convolutional Neural Network Based Image Classification" http://arxiv.org/abs/1312.5402 )
  2. At<>`s changed to pointers for speed.
  3. Function MatToDatum.

@sguada

sguada commented Oct 6, 2014

Copy link
Copy Markdown
Contributor

@ducha-aiki see #1070

@ducha-aiki

Copy link
Copy Markdown
Contributor Author

@sguada nice PR! But it doesn`t cover aspect keeping resiz, so I will remove already merged stuff from my PR and make new one.

@sguada

sguada commented Oct 8, 2014

Copy link
Copy Markdown
Contributor

I think when people maintain the aspect ratio they don't resize it to make it square with black padding. I think it is more common to resize such that the minimum size is a fix number, i.e. 256, and the other dimension is resized appropriately to keep the aspect ratio.
I'm working in another PR to store the image files directly into the backend DB which will allow you to do any desired cv::Mat transformation afterwards.

@sguada

sguada commented Oct 8, 2014

Copy link
Copy Markdown
Contributor

@ducha-aiki see #1239

@ducha-aiki

Copy link
Copy Markdown
Contributor Author

I have experimented with different setups and found that black padding often works best. Of course, depending on type of data you use.

-----Початкове повідомлення-----
Від: "Sergio Guadarrama" notifications@github.com
Надіслано: ‎08.‎10.‎2014 3:42
Кому: "BVLC/caffe" caffe@noreply.github.com
Копія: "Dmytro Mishkin" ducha.aiki@gmail.com
Тема: Re: [caffe] Aspect keeping resize in convert_imageset (#1178)

I think when people maintain the aspect ratio they don't resize it to make it square with black padding. I think it is more common to resize such that the minimum size is a fix number, i.e. 256, and the other dimension is resized appropriately to keep the aspect ratio.
I'm working in another PR to store the image files directly into the backend DB which will allow you to do any desired cv::Mat transformation afterwards.

Reply to this email directly or view it on GitHub.

@netheril96

Copy link
Copy Markdown
Contributor

I think when people maintain the aspect ratio they don't resize it to make it square with black padding. I think it is more common to resize such that the minimum size is a fix number, i.e. 256, and the other dimension is resized appropriately to keep the aspect ratio.

@sguada That is how I do it. Is a square with black padding "aspect preserving" somehow?

@netheril96

Copy link
Copy Markdown
Contributor

Besides, the padding should be a choice. An image will white background needs white padding, more complex images may need reflection or repetition based padding.

@ducha-aiki

Copy link
Copy Markdown
Contributor Author

Replaced with #1550

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants