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')
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')
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']
def test_empty_skipped(self, tmpdir, datadir): labeled_data = datadir.join('empty_skipped.json') lb2pa.from_json(labeled_data, tmpdir, tmpdir, label_format='WKT')
def test_v3_xy(self, tmpdir, datadir): labeled_data = datadir.join('v3_xy.json') lb2pa.from_json(labeled_data, tmpdir, tmpdir, label_format='XY')
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')
def test_v3_wkt(self, tmpdir, datadir): labeled_data = datadir.join('v3_wkt.json') lb2pa.from_json(labeled_data, tmpdir, tmpdir)
def test_wkt_2(self, tmpdir, datadir): labeled_data = datadir.join('labelbox_2.json') lb2pa.from_json(labeled_data, tmpdir, tmpdir)
def test_non_polygons(self, tmpdir, datadir): labeled_data = datadir.join('non_polygon.json') lb2pa.from_json(labeled_data, tmpdir, tmpdir, label_format='XY')