YexingWan / Fast-Portrait-Segmentation

The MNN base implementation of SINet for CPU realtime portrait segmentation
MIT License
63 stars 13 forks source link

ValueError: cannot reshape array of size 40960 into shape (1,2,160,256) #4

Closed kiyse closed 3 years ago

kiyse commented 3 years ago

file : runIE.py model : Dnc_SINet_bi_256_160.mnn result = (np.reshape(result,(-1,4))[:,:2]).T.reshape(out_shape) ValueError: cannot reshape array of size 40960 into shape (1,2,160,256) Is [:,:2] right?

kiyse commented 3 years ago

@enjustli @YexingWan

YexingWan commented 3 years ago

Could you please show more info to us such as your input size or shape of result? As 256160=40960, and the ValueError is not from [:,:2], which indexing and output array with shape, i guess, (20480,2). The 20480 is result h result w, which should be same as input h and imput w. So i guess the input size of image might be wrong. Feel free to ask : >

zengchan commented 3 years ago

I I have the same problem, I don't know how to solve it.@YexingWan

zengchan commented 3 years ago

My input_tensor is (256,320,3) and the model I use is Dnc_SINet_bi_320_256.mnn, the result shape is 1,2,256,320,when I run cam_seg.py, the line " (np.reshape(result, (-1, 4)))[:, :2].T.reshape(output_shape)" will be wrong, the output shape is (1,2,256,320) Can you help me solve it, thank you very much.