python独一无二的路_纽比。独一无二投掷

我尝试使用以下函数:def randomChose(bp, xsteps, ysteps, bs):

# Number of points to be chosen

s = int((bp * xsteps * ysteps) / (bs * bs))

# Generating an array representing the input indexes

indices = numpy.arange(xsteps * ysteps)

# Resampling without replacement

cs = npr.choice(indices, size=s, replace=False)

f = []

for idx in cs:

nb = indices[max(idx-(bs*bs/2), 0):min(idx+(bs*bs/2)+1, xsteps*ysteps)]

f.append(nb)

f = numpy.array(f).flatten()

fix = numpy.unique(numpy.array(f))

return fix

它以数字bp、数据维度xsteps*ysteps和%bs作为参数。在

我要做的是选择一些有效的索引来考虑这个图像中的某个邻域。在

但是,在调用numpy.unique时,我一直收到错误消息,但并不总是这样:

^{pr2}$

我这样称呼它:nx = 57.2

ny = 24.0

xsteps = 144

ysteps = 106

bs = 5 # Block size

bp = 0.1 # Percentage of blocks

fix = randomChose(bp, xsteps, ysteps, bs)

我试图理解什么是错的。据我所知,这种方法需要一个ndarray作为输入,这是给定的。在

谢谢你的帮助。在

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值