设图像大小为n * n
问题为:将 n*n 数组变为 n*n*3
1. numpy实现:
temp = np.expand_dims(img,axis=2).repeat(3,axis=2)
2.pytorch实现
tensor.repeat() 见
3. from einops import rearrange, repeat
result_patch = repeat(result_patch, 'h w -> h w c', c=3)
设图像大小为n * n
问题为:将 n*n 数组变为 n*n*3
1. numpy实现:
temp = np.expand_dims(img,axis=2).repeat(3,axis=2)
2.pytorch实现
tensor.repeat() 见
3. from einops import rearrange, repeat
result_patch = repeat(result_patch, 'h w -> h w c', c=3)