open-mmlab / mmdetection

OpenMMLab Detection Toolbox and Benchmark
https://mmdetection.readthedocs.io
Apache License 2.0
28.52k stars 9.29k forks source link

获取实例分割结果时报错 #11695

Open yeyujujishou opened 1 month ago

yeyujujishou commented 1 month ago
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