onnx inference:ValueError: cannot reshape array of size 8640000 into shape (1200,1800,1)
ValueError Traceback (most recent call last)
ValueError: cannot reshape array of size 8640000 into shape (1200,1800,1)
I'm not familiar with the formatting of the onnx output, but at least from the error message it looks like you're getting an array which is 4x bigger than expected, that is: 8640000 = 4 * (1200 * 1800)
So I either the mask image is 4x bigger than the 1200x1800 sizing (e.g. 2400x3600) or maybe you're getting 4 masks. If the sizing is the problem, you could quickly fix it by hard-coding in the extra scaling by adding a 2*h and 2*w on the line with the error:
mask_image = mask.reshape(2*h, 2*w, 1) * color.reshape(1, 1, -1)
It seems more likely that you're getting 4 masks, in which case you could reshape the mask output accordingly, though you'll then need to pick which index to use when drawing the image with something like:
mask_index = 0
mask_image = mask.reshape(4, h, w, 1)[mask_index] * color.reshape(1, 1, -1)
try return_single_mask when output decoder, maybe help
modify "mask_image = mask.reshape(h, w, 1) * color.reshape(1, 1, -1)" to "mask_image = mask.reshape(h, w, -1) * color.reshape(1, 1, -1)" is ok