def __init__(self, frame=None):
"""
Load annotation from json
"""
self.annotations_ = []
# Retrieve polygons
try:
polygons = frame['polygon']
except:
return
# For each polygon
for poly in polygons:
# Get coordinates
xy = np.vstack([np.float32(poly['x']),
np.float32(poly['y'])]).T
# Object ID (from local annotation file)
object_id = poly['object']
self.add(poly['object'], xy)
评论列表
文章目录