我有语义分割掩码的结果(值在 0-1 之间,需要大津阈值来确定什么是积极的),我想直接在 RGB 图像上绘制,在 RGB 图像上每个预测类具有不同的随机颜色。
我使用以下内容绘制了具有单一颜色的单个蒙版。是否有一个包或简单的策略可以为多类别做到这一点?
fig, ax = plt.subplots(nrows=nrows, ncols=ncols, figsize=(5, 5))
ax.imshow(image, cmap='gray')
ax.axis('off')
mask = (fused_mosaic[..., channel]*255).astype('uint8')
ret3,th3 = cv2.threshold(mask,0,255,cv2.THRESH_BINARY+cv2.THRESH_OTSU)
fig, ax = image_show(full_im)
ax.imshow(mask>ret3, alpha=0.3)
I’m looking for something like this, just simples without the boxes and labels. I tried using detectron2 (the package that generates this annotation in the example, but they require some odd metadata object which I can’t figure out).
Thanks