Skip to content
New issue

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

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

Already on GitHub? # to your account

[DetectNetTransformation] Use bicubic interpolation #216

Merged

Conversation

lukeyeager
Copy link
Member

@lukeyeager lukeyeager commented Aug 23, 2016

cv::resize() was being called with INTER_CUBIC in the wrong place:
http://docs.opencv.org/2.4/modules/imgproc/doc/geometric_transformations.html#resize

Before this fix

After

@lukeyeager lukeyeager added the bug label Aug 23, 2016
@@ -81,7 +81,7 @@ void DetectNetTransformationLayer<Dtype>::retrieveMeanImage(Size dimensions) {

// resize, if dimensions were defined:
if (dimensions.area() > 0) {
resize(data_mean_, data_mean_, dimensions, cv::INTER_CUBIC);
resize(data_mean_, data_mean_, dimensions);

Choose a reason for hiding this comment

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

don't you want to use bicubic interpolation here too?

Copy link
Member Author

Choose a reason for hiding this comment

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

I was thinking it doesn't matter much because the mean image size will almost always match the incoming data size. But you're right - I might as well follow what @drendleman had originally intended.

@lukeyeager lukeyeager force-pushed the nvidia/detectnet-resize-method branch 2 times, most recently from 0a1c9f5 to d4b1a0c Compare August 26, 2016 17:42
@lukeyeager
Copy link
Member Author

I removed the clamping.

  1. Resizing and clamping to [min,max] after mean subtraction doesn't make as much sense as resizing and clamping to [0,1] before mean subtraction. But the latter would require resizing the mean for each image, which is unnecessarily expensive.
  2. Also, @drendleman found that the impact to performance was negligible.

@lukeyeager lukeyeager force-pushed the nvidia/detectnet-resize-method branch from d4b1a0c to 867b062 Compare August 29, 2016 21:18
@lukeyeager lukeyeager merged commit fe2a279 into NVIDIA:caffe-0.15 Aug 30, 2016
@lukeyeager lukeyeager deleted the nvidia/detectnet-resize-method branch August 30, 2016 20:32
mathmanu pushed a commit to mathmanu/caffe-jacinto that referenced this pull request Jun 8, 2017
…-method

[DetectNetTransformation] Use bicubic interpolation
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants