Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_xml_to_annotations():
annotations = utilities.xml_to_annotations(xml_path = get_data("OSBS_029.xml"))
print(annotations.shape)
assert annotations.shape == (61 ,6)
#bounding box extents should be int
assert annotations["xmin"].dtype == "int"
def bad_annotations():
annotations = utilities.xml_to_annotations(get_data("OSBS_029.xml"))
f = "tests/data/testfile_error_deepforest.csv"
annotations.to_csv(f,index=False,header=False)
return f
def config():
config = utilities.read_config(get_data("deepforest_config.yml"))
config["patch_size"] = 200
config["patch_overlap"] = 0.25
config["annotations_xml"] = get_data("OSBS_029.xml")
config["rgb_dir"] = "tests/data"
config["annotations_file"] = "tests/data/OSBS_029.csv"
config["path_to_raster"] = get_data("OSBS_029.tif")
#Create a clean config test data
annotations = utilities.xml_to_annotations(xml_path = config["annotations_xml"])
annotations.to_csv("tests/data/OSBS_029.csv",index=False)
return config
def config():
print("Configuring tfrecord tests")
config = {}
config["patch_size"] = 200
config["patch_overlap"] = 0.05
config["annotations_xml"] = get_data("OSBS_029.xml")
config["rgb_dir"] = "tests/data"
config["annotations_file"] = "tests/data/OSBS_029.csv"
config["path_to_raster"] =get_data("OSBS_029.tif")
config["image-min-side"] = 800
config["backbone"] = "resnet50"
#Create a clean config test data
annotations = utilities.xml_to_annotations(xml_path=config["annotations_xml"])
annotations.to_csv("tests/data/testtfrecords_OSBS_029.csv",index=False)
annotations_file = preprocess.split_raster(path_to_raster=config["path_to_raster"],
annotations_file="tests/data/testtfrecords_OSBS_029.csv",
base_dir= "tests/data/",
patch_size=config["patch_size"],
patch_overlap=config["patch_overlap"])
annotations_file.to_csv("tests/data/testfile_tfrecords.csv", index=False,header=False)
return config
def annotations():
annotations = utilities.xml_to_annotations(get_data("OSBS_029.xml"))
annotations_file = "tests/data/OSBS_029.csv"
annotations.to_csv(annotations_file,index=False, header=False)
return annotations_file
def annotations():
annotations = utilities.xml_to_annotations(get_data("OSBS_029.xml"))
#Point at the jpg version for tfrecords
annotations.image_path = annotations.image_path.str.replace(".tif",".jpg")
annotations_file = get_data("testfile_deepforest.csv")
annotations.to_csv(annotations_file,index=False,header=False)
return annotations_file