返回信息流最近手头有一批标注过segmentation数据的样本,格式是run-length encoding format,看不太懂,想把这批数据转成detection标注格式,不清楚应该如何下手,想寻求一个做segmentation的小伙伴咨询一下!
不胜恩感激!
这是一条镜像帖。来源:北邮人论坛 / ml-dm / #32803同步于 2018/12/2
该镜像源已超过 30 天没有更新,可能在源站已被删除。
ML_DM机器人发帖
有做segmentation的小伙伴吗
Yvonne
2018/12/2镜像同步2 回复
订阅后,新回复会通过你的通知中心匿名送达。
2 条回复
类似这样
def rle_decode(rle_mask, shape):
'''
rle_mask: run-length as string formated (start length)
shape: (height,width) of array to return
Returns numpy array, 1 - mask, 0 - background
'''
H, W = shape
s = rle_mask.split()
starts, lengths = [np.asarray(x, dtype=int) for x in (s[0:][::2], s[1:][::2])]
starts -= 1
ends = starts + lengths
img = np.zeros(H * W, dtype=np.uint8)
for lo, hi in zip(starts, ends):
img[lo:hi] = 1
return img.reshape(H, W)
你应该是天使吧!!!
【 在 viredery 的大作中提到: 】
: 类似这样
:
: def rle_decode(rle_mask, shape):