utils.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:kaggle-dstl-satellite-imagery-feature-detection 作者: u1234x1234 项目源码 文件源码
def polygonize(im):
    assert len(im.shape) == 2
    shapes = features.shapes(im)
    polygons = []
    for i, shape in enumerate(shapes):
#        if i % 10000 == 0:
#            print(i)
        if shape[1] == 0:
            continue
        polygons.append(geometry.shape(shape[0]))
#    polygons = [geometry.shape(shape[0]) for shape in shapes if shape[1] > 0]
    mp = geometry.MultiPolygon(polygons)
    return mp
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号