def make_unlabeled_img(project, id_): return Image(id=id_, project=project, src=data.img_url(id_), thumbnail=data.img_url(id_), thumbnailWidth=cfg.DEFAULT_WIDTH, thumbnailHeight=cfg.DEFAULT_HEIGHT, tags=[], caption=id_, modelTags=[], modelProbs=[])
def make_image(id_, fold, dset): if dset == cfg.UNLABELED: return make_unlabeled_img(fold['name'], id_) img_meta = fold[dset][id_] tags = [] if img_meta is None else img_meta['labels'] mdl_tags = [] if img_meta is None else img_meta['model_labels'] mdl_probs = [] if img_meta is None else img_meta['model_probs'] return Image(id=id_, project=fold['name'], src=data.img_url(id_), thumbnail=data.img_url(id_), thumbnailWidth=cfg.DEFAULT_WIDTH, thumbnailHeight=cfg.DEFAULT_HEIGHT, tags=tags, caption=id_, modelTags=mdl_tags, modelProbs=mdl_probs)