【深度学习】COCO API源码解读

COCO API

从C、cython,到Python API:
实现语义分割标注mask的解析,从具体实现
cocoapi/common/maskApi.h
cocoapi/common/maskApi.c
到Cython封装实现 pycocotools._mask
cocoapi/PythonAPI/pycocotools/_mask.pyx

# distutils: language = c
# distutils: sources = ../common/maskApi.c

再到API

import pycocotools._mask as _mask

iou = _mask.iou
merge = _mask.merge
frPyObjects = _mask.frPyObjects

def encode(bimask):
    if len(bimask.shape) == 3:
        return _mask.encode(bimask)
    elif len(bimask.shape) == 2:
        h, w = bimask.shape
        return _mask.encode(bimask.reshape((h, w, 1), order='F'))[0]

你可能感兴趣的:(深度学习,人工智能)