Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问实例分割中MASK的标签是每个像素实例ID该怎么处理? #1699

Closed
dimtxw opened this issue Nov 16, 2020 · 5 comments
Closed

Comments

@dimtxw
Copy link

dimtxw commented Nov 16, 2020

我使用MASKRCNN做实例分割,用的自己的数据集,这个数据集里面MASK标注是个单通道图像,每个点对应原图的实例ID,而非每个实例的轮廓多边形。我看到fluid.layers.generate_mask_labels的gt_segms参数需要是轮廓多边形,请问是否有别的方法替代generate_mask_labels?还是把轮廓线提出来,轮廓线的所有点作为gt_segms?

@qingqing01
Copy link
Collaborator

@dimtxw 可以使用COCO API,将mask的标注转换为poly坐标的形式,可以参考 cocodataset/cocoapi#131

@dimtxw
Copy link
Author

dimtxw commented Nov 16, 2020

@qingqing01 谢谢,我前面用opencv提供的函数也实现了将mask的标注转换为poly坐标的形式,但是我看到要通过这些点100%复原mask,poly坐标形式的点很多,每个实例几百上千个点,不知道是否会影响效率?也有提取出来点比较少的设置,但是通过这些点产生的mask与原始的mask只有0.9的IoU。

@qingqing01
Copy link
Collaborator

qingqing01 commented Nov 17, 2020

利用Poly坐标计算的地位不是特别多,效率感觉可能还好,可以看下速度。

但是通过这些点产生的mask与原始的mask只有0.9的IoU。

大部分实例都这样呢?还是一少部分呢?

@dimtxw
Copy link
Author

dimtxw commented Nov 17, 2020

我是用的opencv的findContours函数,method参数使用CHAIN_APPROX_SIMPLE时,复原回来的mask是完全匹配的,但这种获取到的点很多,几乎就是轮廓线上的所有点。
复原回来只有0.9IoU的是method参数使用CHAIN_APPROX_TC89_KCOS,0.9是一部分图片中所有实例的平均值。使用这种方法获得的点比用CHAIN_APPROX_SIMPLE的基本要少十倍以上。
我感觉generate_mask_labels要生成二值mask,但是本身就已经有了mask,是不是就可以省略生成mask的步骤?所以寻找有没有方法不用生成mask,是否有只建立ROI到mask的映射的方法来取代generate_mask_labels。

@qingqing01
Copy link
Collaborator

@dimtxw generate_mask_labels内部的计算需要Poly坐标,目前静态图的版本还不支持mask的作为输入。 如果需要改变的话,是可以用Python重新实现generate_mask_labels,在静态图中使用py_func。

另外,也可以用转换的Poly先看下效果。内部也有业务使用过poly训练的,结果没问题。另外,不知道COCO API和cv2的结果是否有差异。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants