open-mmlab/mmdetection

获取实例分割结果时报错

yeyujujishou opened this issue · 0 comments

bboxes = np.vstack(bbox_result)

File "<array_function internals>", line 200, in vstack
TypeError: dispatcher for array_function did not return an iterable

result = inference_detector(seg_model, src_image)

返回labelmejson格式

def seg_return_labelmejson(result, srcImg, score_thr):
shapes=[]
if isinstance(result, tuple):
bbox_result, segm_result = result
else:
bbox_result, segm_result = result, None

print("bbox_result:",bbox_result)

# 分割
bboxes = np.vstack(bbox_result)
if segm_result is not None:
    segms = mmcv.concat_list(segm_result)
    inds = np.where(bboxes[:, -1] > score_thr)[0]
    task_list = []
    for i in inds: # 先统一创建,启动
        task = MyThread(contours2points, (i, srcImg, segms))
        task.start()
        task_list.append(task)

    for ia in inds: # 获取结果
        shape=task_list[ia].get_result()
        shapes.append(shape)

return shapes