I'm working on Mask(Labels) generation for Semantic segmentation problem
I have a NumPy array of 250x321
. It's a single-channel image. I've to annotate this image. But since this is a single-channel image, when trying to save it in the normal mode of matplotlib.pyplot
, dimensions are changed along with a change in the channel (4). When storing just a single-channel image in png
format, the image is all black, hence unable to annotate the image.
So I'm unable to annotate png
format image (All Black) and also unable to use normal matplotlib.pyplot
save function (Dim are changed along with channels)
Can someone suggest me how to achieve this job!
I've used code given below
plt.imshow(data[:, 400:650].T)
plt.tight_layout()
plt.xticks([])
plt.yticks([])
plt.axis('off')
plt.savefig('/content/new.png',bbox_inches='tight', pad_inches=0.0)
The above code is generating an array of shape 245x315x4
when used plt.imread
when in the original array was of shape 250x321x1
.