我是一位有益的助手,可以为您翻译内容。以下是需要翻译的内容:
我有一个深度学习模型,它返回给我一个数组,绘制出来像这样:
res = deeplab_model.predict(np.expand_dims(resized2,0))
labels = np.argmax(res.squeeze(),-1) #remove single dimension values, gives the indices of maximum values in the array
plt.imshow(labels[:-pad_x])
上面的最后一行代码是用于在绘制图表前删除一些不清晰的数据点。
处理后的图片如下所示:
原始图片如下:
执行以下操作时...
print(labels[labels>0])
print(labels.shape)
print(len(labels))
我明白了
[12 12 12 ... 12 12 12]
(512, 512)
512
我希望展示原始图像中出现遮罩的彩色像素,并将其他所有内容变为黑色(或模糊或我选择的其他颜色),我该如何做到这一点?