utils.py 文件源码

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

项目:Multi-views-fusion 作者: luogongning 项目源码 文件源码
def shift_augmentation(X, h_range, w_range):
    progbar = Progbar(X.shape[0])  # progress bar for augmentation status tracking

    X_shift = np.copy(X)
    size = X.shape[2:]
    for i in range(len(X)):
        h_random = np.random.rand() * h_range * 2. - h_range
        w_random = np.random.rand() * w_range * 2. - w_range
        h_shift = int(h_random * size[0])
        w_shift = int(w_random * size[1])
        for j in range(X.shape[1]):
            X_shift[i, j] = ndimage.shift(X[i, j], (h_shift, w_shift), order=0)
        progbar.add(1)
    return X_shift
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号