我有一个脑肿瘤分类的项目,但是我要处理这个错误大约3个星期,这是错误信息
ERROR:
root:Error processing image {'id': 'tumor-44.png', 'source': 'Meningioma',
'path': 'D:\Belajar Machine Learning\Coba Mask Tumor\dataset\images\tumor-44.png'}
Traceback (most recent call last):
File "D:\Belajar Machine Learning\Coba Mask Tumor\mrcnn\model.py", line 1709, in data_generator use_mini_mask=config.USE_MINI_MASK)
File "D:\Belajar Machine Learning\Coba Mask Tumor\mrcnn\model.py", line 1212, in load_image_gt
mask, class_ids = dataset.load_mask(image_id) File "tumor.py", line 228, in load_mask
mask = np.zeros([info["height"], info["width"], len(info["polygons"])],
KeyError: 'height'
我对这个错误消息很困惑,有人说是因为当我屏蔽图像时json文件出了问题,因为没有使用多边形屏蔽,即使我已经使用多边形进行屏蔽。你知道吗
我要在这里加载我的JSON代码:
DATASET_PATH = os.path.abspath("dataset")
IMAGES_PATH = os.path.sep.join([DATASET_PATH, "images"])
ANNOT_PATH = os.path.sep.join([DATASET_PATH, "fix.json"])
这是load_mask
代码:
def load_mask(self, imageID):
# Convert polygons to a bitmap mask of shape
# [height, width, instance_count]
info = self.image_info[imageID]
mask = np.zeros([info["height"], info["width"], len(info["polygons"])],
dtype=np.uint8)
for i, p in enumerate(info["polygons"]):
# Get indexes of pixels inside the polygon and set them to 1
rr, cc = skimage.draw.polygon(p['all_points_y'], p['all_points_x'])
## Note that this modifies the existing array arr, instead of creating a result array
## Ref: https://stackoverflow.com/questions/19666626/replace-all-elements-of-python-numpy-array-that-are-greater-than-some-value
rr[rr > mask.shape[0] - 1] = mask.shape[0] - 1
cc[cc > mask.shape[1] - 1] = mask.shape[1] - 1
mask[rr, cc, i] = 1
return mask.astype(np.bool), np.ones([mask.shape[-1]], dtype=np.int32)
我已经成功的训练,但我实现了圆形掩蔽,但我希望它与多边形掩蔽虽然。你知道吗
谢谢你。你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐