【问题标题】:How to set the arguments of tf.extract_image_patches如何设置 tf.extract_image_patches 的参数
【发布时间】:2017-04-07 04:52:44
【问题描述】:

我想从我的 tensorflow 模型中的输入图像中提取图像补丁。 假设输入图像是[batch, in_width, in_height, channels],我想输出[no_patches, patch_width, patch_height, channels]no_patches 是可以从input_image 中提取的补丁总数。

我发现tf.extract_image_patches 可以胜任这项工作。 但是,我不明白参数stridesrates 的区别。

有人能解释一下如何使用上述函数来完成这项工作吗?

【问题讨论】:

    标签: image tensorflow extract patch stride


    【解决方案1】:

    strides 是关于窗口在您的数据上的移动。

    rates 是关于窗口的“展开”程度。

    例如,如果您使用strides = [1,5,5,1],您的窗口在第 1 维和第 2 维都会跳跃 5 个像素。如果您使用rates = [1,1,1,1],您的窗口是“紧凑的”,这意味着所有像素都是连续的。如果你使用rates = [1,1,2,1],那么你的窗口会在第 2 维展开,每 2 维取一个像素。

    ksizes = [1,3,2,1] 为例(暂时忽略步幅):左侧使用rates = [1,1,1,1],中间使用rates = [1,1,2,1],右侧使用rates = [1,2,2,1]

    *  *  3  4  5          *  2  *  4  5          *  2  *  4  5 
    *  *  8  9  10         *  7  *  9  10         6  7  8  9  10
    *  *  13 14 15         *  12 *  14 15         *  12 *  14 15
    16 17 18 19 20         16 17 18 19 20         16 17 18 19 20
    21 22 23 24 25         21 22 23 24 25         *  22 *  24 25
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-12-25
      • 1970-01-01
      • 1970-01-01
      • 2010-11-02
      • 1970-01-01
      • 1970-01-01
      • 2013-11-30
      相关资源
      最近更新 更多