def itf( X, npx, mode='RGB' ):
X = ( X.reshape( -1, nc, npx, npx ).transpose( 0, 2, 3, 1 ) + 1. ) / 2.
if mode == 'LAB':
X[:,:,:,0] *= 100
X[:,:,:,1] *= 255
X[:,:,:,2] *= 255
X[:,:,:,1] -= 128
X[:,:,:,2] -= 128
for i in range(X.shape[0]):
X[i,:,:,:] = color.lab2rgb(X[i,:,:,:].astype('int8'))
return X.astype('float32')
评论列表
文章目录