If I recall correctly (iirc), the output from results[0].masks.xy
is list of Numpy arrays. This would mean that you’d need to extract each array from the list to get the mask. The reason this is a list and not a Numpy array, is because the mask contours might be different lengths, and would not be able to be stacked with mismatch array sizes.
result[0].masks.xy
>>> [
>>> array[i, 2],
>>> array[j, 2],
>>> array[k, 2],
>>> ...,
>>> array[N, 2],
>>> ]
# here, i, j, k represent different values for the first
# array dimension, with up to N different values
One important factor to consider (and possibly answer) is what do you wish to accomplish with the contours? Knowing this might provide better insight on how to accomplish your end goal (see this post for context).