How to use the deepforest.preprocess.select_annotations function in deepforest

To help you get started, we’ve selected a few deepforest examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github weecology / DeepForest / tests / test_preprocess.py View on Github external
def test_select_annotations(config, numpy_image):      
    windows = preprocess.compute_windows(numpy_image, config["patch_size"], config["patch_overlap"])
    image_annotations = pd.read_csv("tests/data/OSBS_029.csv")
    selected_annotations = preprocess.select_annotations(image_annotations, windows, index=7)
    
    #Returns a 5 column matrix
    assert selected_annotations.shape[0] == 17
    
    #image name should be name of image plus the index .tif
    assert selected_annotations.image_path.unique()[0] == "OSBS_029_7.jpg"
github weecology / DeepForest / tests / test_preprocess.py View on Github external
def test_select_annotations_tile(config, numpy_image):
    config["patch_size"] = 50
    windows = preprocess.compute_windows(numpy_image, config["patch_size"], config["patch_overlap"])
    image_annotations = pd.read_csv("tests/data/OSBS_029.csv")    
    selected_annotations = preprocess.select_annotations(image_annotations, windows, index=10)
    
    #The largest box cannot be off the edge of the window
    assert selected_annotations.xmin.min() >= 0
    assert selected_annotations.ymin.min() >= 0
    assert selected_annotations.xmax.max() <= config["patch_size"]
    assert selected_annotations.ymax.max() <= config["patch_size"]