尽管我正确地安装了化茧工具,但我仍然面临一些问题。此外,在colab上试用,那里已经安装了化茧工具。
安装方法:
!git clone https://github.com/cocodataset/cocoapi.git
%cd /content/cocoapi/PythonAPI
!make
!sudo make install
!sudo python setup.py install
%cd /contentAttributeError Traceback (most recent call last)
<ipython-input-11-6a1416ecd890> in <module>()
----> 1 new_mask = get_mask(label['segmentations'], mask)
/content/datasets/coco.py in get_mask(segmentations, mask)
17 def get_mask(segmentations, mask):
18 for segmentation in segmentations:
---> 19 rle = pycocotools.mask.frPyObjects(segmentation, mask.shape[0], mask.shape[1])
20 mask[pycocotools.mask.decode(rle) > 0.5] = 0
21 return mask
AttributeError: module 'pycocotools' has no attribute 'mask'抛出此错误的行:pycocotools.mask.frPyObjects(segmentation, mask.shape[0], mask.shape[1])
发布于 2022-05-25 14:55:27
如果您只是导入化茧工具,则不会导入掩码模块。
尝试显式导入掩码:
import pycocotools.maskhttps://stackoverflow.com/questions/57537480
复制相似问题