def get_annot_chip_thumbpath(ibs, aid_list, thumbsize=None, config2_=None): r""" just constructs the path. does not compute it. that is done by api_thumb_delegate RESTful: Method: GET URL: /api/annot_chip/thumbpath/ """ if thumbsize is None: thumbsize = ibs.cfg.other_cfg.thumb_size thumb_dpath = ibs.thumb_dpath thumb_suffix = '_' + str(thumbsize) + const.CHIP_THUMB_SUFFIX annot_uuid_list = ibs.get_annot_visual_uuids(aid_list) thumbpath_list = [join(thumb_dpath, const.__STR__(uuid) + thumb_suffix) for uuid in annot_uuid_list] return thumbpath_list
def fix_tags(tags): from ibeis import constants as const return {const.__STR__(t.lower()) for t in tags}
def generate_annot_properties(ibs, gid_list, bbox_list=None, theta_list=None, species_list=None, nid_list=None, name_list=None, detect_confidence_list=None, notes_list=None, vert_list=None, annot_uuid_list=None, yaw_list=None, quiet_delete_thumbs=False): #annot_uuid_list = ibsfuncs.make_annotation_uuids(image_uuid_list, bbox_list, # theta_list, deterministic=False) image_uuid_list = ibs.get_image_uuids(gid_list) if annot_uuid_list is None: annot_uuid_list = [uuid.uuid4() for _ in range(len(image_uuid_list))] # Prepare the SQL input assert name_list is None or nid_list is None, ( 'cannot specify both names and nids') # For import only, we can specify both by setting import_override to True assert bool(bbox_list is None) != bool(vert_list is None), ( 'must specify exactly one of bbox_list or vert_list') if theta_list is None: theta_list = [0.0 for _ in range(len(gid_list))] if name_list is not None: nid_list = ibs.add_names(name_list) if detect_confidence_list is None: detect_confidence_list = [0.0 for _ in range(len(gid_list))] if notes_list is None: notes_list = ['' for _ in range(len(gid_list))] if vert_list is None: vert_list = geometry.verts_list_from_bboxes_list(bbox_list) elif bbox_list is None: bbox_list = geometry.bboxes_from_vert_list(vert_list) len_bbox = len(bbox_list) len_vert = len(vert_list) len_gid = len(gid_list) len_notes = len(notes_list) len_theta = len(theta_list) try: assert len_vert == len_bbox, 'bbox and verts are not of same size' assert len_gid == len_bbox, 'bbox and gid are not of same size' assert len_gid == len_theta, 'bbox and gid are not of same size' assert len_notes == len_gid, 'notes and gids are not of same size' except AssertionError as ex: ut.printex(ex, key_list=[ 'len_vert', 'len_gid', 'len_bbox' 'len_theta', 'len_notes' ]) raise if len(gid_list) == 0: # nothing is being added print('[ibs] WARNING: 0 annotations are beign added!') print(ut.dict_str(locals())) return [] # Build ~~deterministic?~~ random and unique ANNOTATION ids image_uuid_list = ibs.get_image_uuids(gid_list) #annot_uuid_list = ibsfuncs.make_annotation_uuids(image_uuid_list, bbox_list, # theta_list, deterministic=False) if annot_uuid_list is None: annot_uuid_list = [uuid.uuid4() for _ in range(len(image_uuid_list))] if yaw_list is None: yaw_list = [-1.0] * len(image_uuid_list) nVert_list = [len(verts) for verts in vert_list] vertstr_list = [const.__STR__(verts) for verts in vert_list] xtl_list, ytl_list, width_list, height_list = list(zip(*bbox_list)) assert len(nVert_list) == len(vertstr_list)
def generate_annot_properties(ibs, gid_list, bbox_list=None, theta_list=None, species_list=None, nid_list=None, name_list=None, detect_confidence_list=None, notes_list=None, vert_list=None, annot_uuid_list=None, yaw_list=None, quiet_delete_thumbs=False): #annot_uuid_list = ibsfuncs.make_annotation_uuids(image_uuid_list, bbox_list, # theta_list, deterministic=False) image_uuid_list = ibs.get_image_uuids(gid_list) if annot_uuid_list is None: annot_uuid_list = [uuid.uuid4() for _ in range(len(image_uuid_list))] # Prepare the SQL input assert name_list is None or nid_list is None, ( 'cannot specify both names and nids') # For import only, we can specify both by setting import_override to True assert bool(bbox_list is None) != bool(vert_list is None), ( 'must specify exactly one of bbox_list or vert_list') if theta_list is None: theta_list = [0.0 for _ in range(len(gid_list))] if name_list is not None: nid_list = ibs.add_names(name_list) if detect_confidence_list is None: detect_confidence_list = [0.0 for _ in range(len(gid_list))] if notes_list is None: notes_list = ['' for _ in range(len(gid_list))] if vert_list is None: vert_list = geometry.verts_list_from_bboxes_list(bbox_list) elif bbox_list is None: bbox_list = geometry.bboxes_from_vert_list(vert_list) len_bbox = len(bbox_list) len_vert = len(vert_list) len_gid = len(gid_list) len_notes = len(notes_list) len_theta = len(theta_list) try: assert len_vert == len_bbox, 'bbox and verts are not of same size' assert len_gid == len_bbox, 'bbox and gid are not of same size' assert len_gid == len_theta, 'bbox and gid are not of same size' assert len_notes == len_gid, 'notes and gids are not of same size' except AssertionError as ex: ut.printex(ex, key_list=['len_vert', 'len_gid', 'len_bbox' 'len_theta', 'len_notes']) raise if len(gid_list) == 0: # nothing is being added print('[ibs] WARNING: 0 annotations are beign added!') print(ut.dict_str(locals())) return [] # Build ~~deterministic?~~ random and unique ANNOTATION ids image_uuid_list = ibs.get_image_uuids(gid_list) #annot_uuid_list = ibsfuncs.make_annotation_uuids(image_uuid_list, bbox_list, # theta_list, deterministic=False) if annot_uuid_list is None: annot_uuid_list = [uuid.uuid4() for _ in range(len(image_uuid_list))] if yaw_list is None: yaw_list = [-1.0] * len(image_uuid_list) nVert_list = [len(verts) for verts in vert_list] vertstr_list = [const.__STR__(verts) for verts in vert_list] xtl_list, ytl_list, width_list, height_list = list(zip(*bbox_list)) assert len(nVert_list) == len(vertstr_list)