示例#1
0
def empty_img_anno():
    dbm = DBMan(config.LOSTConfig())
    img_anno = model.ImageAnno(img_path='path/to/img1.jpg')
    fs = add_local_fs(dbm, 'local_fs_for_empty_img_anno')
    img_anno.fs_id = fs.idx
    dbm.add(img_anno)
    dbm.commit()
    yield img_anno
    dbm.delete(img_anno)
    dbm.commit()
    delete_local_fs(dbm, fs)
示例#2
0
def empty_img_anno():
    dbm = DBMan(config.LOSTConfig())
    test_user = testils.get_user(dbm)
    tree = testils.get_voc_label_tree(dbm)
    label_leaf_id = tree.get_child_vec(tree.root.idx)[0]
    img_anno = model.ImageAnno(img_path='path/to/img1.jpg')
    dbm.add(img_anno)
    dbm.commit()
    yield img_anno
    dbm.delete(img_anno)
    dbm.commit()
示例#3
0
def simple_bbox_anno():
    dbm = DBMan(config.LOSTConfig())
    twod_anno = model.TwoDAnno(data=json.dumps({
        'x': REF_BBOX[0],
        'y': REF_BBOX[1],
        'w': REF_BBOX[2],
        'h': REF_BBOX[3]
    }),
                               dtype=dtype.TwoDAnno.BBOX)
    dbm.add(twod_anno)
    dbm.commit()
    yield twod_anno
    dbm.delete(twod_anno)
    dbm.commit()
示例#4
0
def full_bbox_anno():
    dbm = DBMan(config.LOSTConfig())
    test_user = testils.get_user(dbm)
    tree = testils.get_voc_label_tree(dbm)
    label_leaf_id = tree.get_child_vec(tree.root.idx)[0]
    twod_anno = model.TwoDAnno(data=json.dumps({
        'x': REF_BBOX[0],
        'y': REF_BBOX[1],
        'w': REF_BBOX[2],
        'h': REF_BBOX[3]
    }),
                               dtype=dtype.TwoDAnno.BBOX)
    lbl = model.Label(label_leaf_id=label_leaf_id)
    twod_anno.labels.append(lbl)
    twod_anno.annotator = test_user
    dbm.add(twod_anno)
    dbm.commit()
    yield twod_anno
    dbm.delete(twod_anno)
    dbm.commit()
示例#5
0
def full_img_anno():
    dbm = DBMan(config.LOSTConfig())
    test_user = testils.get_user(dbm)
    tree = testils.get_voc_label_tree(dbm)
    label_vec = tree.get_child_vec(tree.root.idx)
    twod_anno = model.TwoDAnno(data=json.dumps({
        'x': REF_BBOX[0],
        'y': REF_BBOX[1],
        'w': REF_BBOX[2],
        'h': REF_BBOX[3]
    }),
                               dtype=dtype.TwoDAnno.BBOX)
    lbl = model.Label(label_leaf_id=label_vec[0])
    dbm.add(lbl)
    twod_anno.labels.append(lbl)
    twod_anno.annotator = test_user
    twod_anno2 = model.TwoDAnno(data=json.dumps({
        'x': REF_POINT[0],
        'y': REF_POINT[1]
    }),
                                dtype=dtype.TwoDAnno.POINT)
    lbl = model.Label(label_leaf_id=label_vec[1])
    dbm.add(lbl)
    twod_anno2.labels.append(lbl)
    twod_anno2.annotator = test_user
    line = model.TwoDAnno()
    lbl = model.Label(label_leaf_id=label_vec[4])
    line.labels.append(lbl)
    dbm.add(lbl)
    line.annotator = test_user
    line.line = REF_LINE
    img_anno = model.ImageAnno(img_path='path/to/img1.jpg')
    fs = add_local_fs(dbm, 'local_fs_for_full_img_anno')
    img_anno.fs_id = fs.idx
    lbl = model.Label(label_leaf_id=label_vec[3])
    dbm.add(lbl)
    img_anno.labels.append(lbl)
    dbm.commit()
    img_anno.twod_annos.append(twod_anno)
    img_anno.twod_annos.append(twod_anno2)
    img_anno.twod_annos.append(line)
    # dbm.add(img_anno.labels)
    dbm.add(img_anno)
    # dbm.add(twod_anno)
    dbm.commit()
    yield img_anno
    # dbm.delete(twod_anno.labels)
    dbm.delete(twod_anno)
    # dbm.delete(twod_anno2.labels)
    dbm.delete(twod_anno2)
    # dbm.delete(img_anno.labels)
    dbm.delete(img_anno)
    dbm.commit()
    delete_local_fs(dbm, fs)