def get_annotation(project_id, image_id, optimize=False):
    if ((image_id not in g.image2ann) or (not optimize)):
        ann_json = g.spawn_api.annotation.download(image_id).annotation
        ann = sly.Annotation.from_json(ann_json, get_meta(project_id))
        g.image2ann[image_id] = ann
    else:
        ann = g.image2ann[image_id]
    g.figures_on_frame_count = len(ann.labels)
    return ann
def get_annotation(project_id, image_id, optimize=False):
    if ((image_id not in g.image2ann) or (not optimize)):
        ann_json = g.spawn_api.annotation.download(image_id).annotation
        ann = sly.Annotation.from_json(ann_json, get_meta(project_id))
        g.image2ann[image_id] = ann
    else:
        ann = g.image2ann[image_id]
    g.figures_on_frame_count = len(ann.labels)
    return ann