目标是将包含成对灰度+地面真实图像的numpy阵列(21641901892)转换为COCO格式:
我试图以coco格式生成一个极简注释,如下所示:
from pycococreatortools import pycococreatortools
N = 1
grey = data[N,:,:,0]
labels = data[N,:,:,1]
mask1 = labels == 1
mask2 = labels == 2
mask3 = labels == 3
segmentation_id = "chromosome1_1"
image_id = "0001"
category_info = "chromosome1"
binary_mask = mask1
image = grey
print(image.size, image.shape)
annotation_info_mask1 = pycococreatortools.create_annotation_info(segmentation_id, image_id,
category_info,
binary_mask,
image.size, tolerance=2)
我得到以下错误:
TypeError Traceback (most recent call last)
in () 2 category_info, 3 binary_mask, ----> 4 image.size, tolerance=2)
2 frames
/usr/local/lib/python3.6/dist-packages/PIL/Image.py in resize(self, size, resample, box) 1866 ) 1867 -> 1868 size = tuple(size) 1869 1870 if box is None:
TypeError: 'int' object is not iterable
这里image.size等于35910,image.shape等于(190189)
似乎create\u annotation\u info()正在等待一个元组或列表。对吗? 正确的方法是什么
colab笔记本草稿is here to get the whole dataset.
目前没有回答
相关问题 更多 >
编程相关推荐