【发布时间】:2021-02-09 13:21:05
【问题描述】:
如何制作滑动邻域掩码,例如5个邻域掩码,假设掩码维度为[6, 6],则掩码应如下所示:
[[1 1 1 0 0 0] #mask at pos 1
[1 1 1 1 0 0] #mask at pos 2
[1 1 1 1 1 0] #mask at pos 3
[0 1 1 1 1 1]] #mask at pos 4
【问题讨论】:
标签: tensorflow mask
如何制作滑动邻域掩码,例如5个邻域掩码,假设掩码维度为[6, 6],则掩码应如下所示:
[[1 1 1 0 0 0] #mask at pos 1
[1 1 1 1 0 0] #mask at pos 2
[1 1 1 1 1 0] #mask at pos 3
[0 1 1 1 1 1]] #mask at pos 4
【问题讨论】:
标签: tensorflow mask
使用linalg.band_part():
import tensorflow as tf
input = tf.ones((6, 6), tf.int32)
output = tf.linalg.band_part(input, 2, 2)
【讨论】: