mmdetection在訓練有segmentation資料的時候,發生 File "pycocotools/_mask.pyx", line 307, in pycocotools._mask.frPyObjects Exception: input type is not supported. 主要原因為自製的segmentation資料中,可能有不符合規則的資料,coco格式中,segmentation的格式為list(list(x,y,x,y,....))每個seg至少要有四個值且必須為偶數。 下列code移除不符規定的seg def check_coco_seg_format(json_path): """ check there is invalid segmentation data in coco json file and remove invalid seg then resave it Args: json_path: path to json file Returns: None """ with open(json_path) as fid: json_data = json.load(fid) annotations = json_data['annotations'] for annotation in tqdm(annotations): segs = annotation['segmentation'] new_segs = [] for seg in segs: len_seg = len(seg) ...