Exemplo n.º 1
0
 def test_bad_label_format(self, tmpdir, datadir):
     labeled_data = datadir.join('labelbox_xy_1.json')
     with pytest.raises(lb2pa.UnknownFormatError):
         lb2pa.from_json(labeled_data,
                         tmpdir,
                         tmpdir,
                         label_format='INVALID')
Exemplo n.º 2
0
def json2voc(input_file, output_dir):
    labeled_data = input_file  # file path to JSON export with XY paths
    # where to write VOC annotation and image outputs
    annotations_output_dir = output_dir
    images_output_dir = output_dir
    lb2pa.from_json(labeled_data,
                    annotations_output_dir,
                    images_output_dir,
                    label_format='XY')
Exemplo n.º 3
0
    def test_v3_wkt_bndbox(self, tmpdir, datadir):
        labeled_data = datadir.join('v3_wkt_rectangle.json')
        lb2pa.from_json(labeled_data, tmpdir, tmpdir, label_format='WKT')

        with open(labeled_data, 'r') as f:
            annotation_file_path = os.path.join(tmpdir,
                                                json.load(f)[0]['ID'] + '.xml')
            with open(annotation_file_path, 'r') as f:
                annotation = xmltodict.parse(f.read())
                assert 'bndbox' in annotation['annotation']['object']
Exemplo n.º 4
0
 def test_empty_skipped(self, tmpdir, datadir):
     labeled_data = datadir.join('empty_skipped.json')
     lb2pa.from_json(labeled_data, tmpdir, tmpdir, label_format='WKT')
Exemplo n.º 5
0
 def test_v3_xy(self, tmpdir, datadir):
     labeled_data = datadir.join('v3_xy.json')
     lb2pa.from_json(labeled_data, tmpdir, tmpdir, label_format='XY')
Exemplo n.º 6
0
 def test_xy_1(self, tmpdir, datadir):
     labeled_data = datadir.join('labelbox_xy_1.json')
     lb2pa.from_json(labeled_data, tmpdir, tmpdir, label_format='XY')
Exemplo n.º 7
0
 def test_v3_wkt(self, tmpdir, datadir):
     labeled_data = datadir.join('v3_wkt.json')
     lb2pa.from_json(labeled_data, tmpdir, tmpdir)
Exemplo n.º 8
0
 def test_wkt_2(self, tmpdir, datadir):
     labeled_data = datadir.join('labelbox_2.json')
     lb2pa.from_json(labeled_data, tmpdir, tmpdir)
Exemplo n.º 9
0
 def test_non_polygons(self, tmpdir, datadir):
     labeled_data = datadir.join('non_polygon.json')
     lb2pa.from_json(labeled_data, tmpdir, tmpdir, label_format='XY')