Example #1
0
def test_remove_categories():
    ds = CocoDataset(BASE_PATH / 'new_coco.json')
    cat_id = ds.add_category('dog', 'animal')
    assert len(ds.cats) == 1
    ds.remove_categories([cat_id])

    assert len(ds.cats) == 0
Example #2
0
def test_remove_categories():
    ds = CocoDataset(BASE_PATH / "new_coco.json")
    cat_id = ds.add_category("dog", "animal")
    assert len(ds.cats) == 1
    ds.remove_categories([cat_id])

    assert len(ds.cats) == 0
Example #3
0
def test_remove_categories_and_annotations():
    ds = CocoDataset(BASE_PATH / 'new_coco.json')
    cat_id = ds.add_category('dog', 'animal')
    img_id = ds.add_image((BASE_PATH / 'test_nodamage.jpg').as_posix())
    ds.add_annotation(img_id, cat_id, [1, 2, 3, 4, 5], 10, [0, 0, 256, 256], 0)

    assert len(ds.cats) == 1
    ds.remove_categories([cat_id])

    assert len(ds.cats) == 0
Example #4
0
def test_remove_categories_and_annotations():
    ds = CocoDataset(BASE_PATH / "new_coco.json")
    cat_id = ds.add_category("dog", "animal")
    img_id = ds.add_image((BASE_PATH / "test_nodamage.jpg").as_posix(), 100,
                          100)
    ds.add_annotation(img_id, cat_id, [1, 2, 3, 4, 5], 10, [0, 0, 256, 256], 0)

    assert len(ds.cats) == 1
    ds.remove_categories([cat_id])

    assert len(ds.cats) == 0