PaddlePaddle / PaddlePaddle/Paddle

请教im2sequence中out_stride参数的语义是什么?

Open
#44,544 4 comments 0 reactions 1 assignee View on GitHub

@ronny1996 is already working on this.

Since Jul 22, 2022.

status/new-issue type/others
Dominant language
C++
Stars
24.1k
Forks
6k
Avg merge
4d 17h
Merged PRs (30d)
60

Description

问题描述 Please describe your issue

您好!我在使用Paddle im2sequence过程中,发现多batch输入尺寸不一致的场景下会有这个out_stride参数。这个参数是用来对原图片进行截取操作吗?这样不是会丢掉很多的图片信息吗?能否帮忙解答一下?万分感谢。

来源:paddle/fluid/operators/im2sequence_op.h
for (int i = 0; i < batch_size; i++) {
int tmp_real_h = static_cast((cpu_shape_tensor.data())[2 * i]);
int tmp_real_w =
static_cast((cpu_shape_tensor.data())[2 * i + 1]);
if (tmp_real_h % out_stride[0] == 0) {
tmp_real_h = tmp_real_h / out_stride[0];
} else {
tmp_real_h = tmp_real_h / out_stride[0] + 1;
}
if (tmp_real_w % out_stride[1] == 0) {
tmp_real_w = tmp_real_w / out_stride[1];
} else {
tmp_real_w = tmp_real_w / out_stride[1] + 1;
}
imgreal_h.push_back(tmp_real_h);
imgreal_w.push_back(tmp_real_w);
output_height.push_back(Im2SeqOutputSize(
imgreal_h[i], kernels[0], paddings[0], paddings[2], strides[0]));
output_width.push_back(Im2SeqOutputSize(
imgreal_w[i], kernels[1], paddings[1], paddings[3], strides[1]));
result += output_height[i] * output_width[i];
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.