lizhengwei1992 / Semantic_Human_Matting

Semantic Human Matting
527 stars 145 forks source link

Alpha image is gray, how to np2Tensor? #23

Closed Jason-xin closed 4 years ago

Jason-xin commented 4 years ago

Hello, in code datase.py def np2Tensor(array): ts = (2, 0, 1) tensor = torch.FloatTensor(array.transpose(ts).astype(float)) return tensor but alpha image is gray with only 2-D, how to transpose it?

xiankgx commented 4 years ago

Hello, in code datase.py def np2Tensor(array): ts = (2, 0, 1) tensor = torch.FloatTensor(array.transpose(ts).astype(float)) return tensor but alpha image is gray with only 2-D, how to transpose it?

Stack 3 copies of the same rank-2 grayscale image tensor to become a rank-3 tensor.