Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-square cropping #1980

Closed
wants to merge 3 commits into from
Closed

Non-square cropping #1980

wants to merge 3 commits into from

Conversation

okuta
Copy link

@okuta okuta commented Feb 26, 2015

Add crop_h and crop_w to TransformationParameter.
This PR is implemented similar to h/w kernel size.
Related issue: #1834

@seanbell
Copy link

This is a great addition.

Small suggestion: I think it's a good idea to add in some checks (in the DataTransformer constructor) with helpful messages like:

CHECK(!param_.has_crop_size() !=
      !(param_.has_crop_h() && param_.has_crop_w()))
      << "Crop size is crop_size OR crop_h and crop_w; not both";
CHECK(param_.has_crop_size() ||
      (param_.has_crop_h() && param_.has_crop_w()))
      << "For non-square crops both crop_h and crop_w are required.";

(this was adapted from checks done in the convolution layer https://github.com/BVLC/caffe/blob/master/src/caffe/layers/base_conv_layer.cpp#L16 )

@okuta
Copy link
Author

okuta commented Feb 27, 2015

@seanbell Tahnk you for your suggestion.
crop_size, crop_h and crop_w have default value.
https://github.com/okuta/caffe/blob/4d445f420e7e6fe6426ffbc62e6c212f5b9fc6d8/src/caffe/proto/caffe.proto#L333-335
Therefore I wrote a check code that does not use methods such as has_crop_size().

@haoyangz
Copy link

This is very helpful for Deep Learning work on non-CV fields . Any chance that it could be merged soon?

@liyongsea
Copy link

I am working with 1d time series data and a 1d crop could be very useful. I am wondering if this change would be merged?

}
cv::Rect roi(w_off, h_off, crop_size, crop_size);
cv::Rect roi(w_off, h_off, crop_h, crop_w);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the crop_h and crop_w are swapped.

@lukeyeager
Copy link
Contributor

👍

@elezar
Copy link
Contributor

elezar commented Mar 31, 2016

Can this non-square crop be implemented using the ND crop layer as in #3570?

@shelhamer
Copy link
Member

Closing as better handled by a Python data layer. Thanks for extending crop, but I think including all these varieties of augmentation adds too much code which is more clearly expressed in Python anyway.

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.

8 participants