lowbrightnessgenerator.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:crayimage 作者: yandexdataschool 项目源码 文件源码
def _impose_white_noise(self, data):
    import scipy.stats as stats
    original_shape = data.shape

    noise_area_distr = stats.expon(scale = self._white_noise_rate)
    data = data.reshape(data.shape[0], -1)
    s = data.shape[1]

    for i in xrange(data.shape[0]):
      n_white_noise = int(np.minimum(noise_area_distr.rvs(size=1), self._white_noise_maximum) * s)
      indx = np.random.choice(s, size=n_white_noise, replace=False)
      data[i, indx] = self._signal_level

    return data.reshape(original_shape)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号