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_predict_image(download_release):
#Load model
test_model = deepforest.deepforest(weights=get_data("NEON.h5"))
assert isinstance(test_model.model,keras.models.Model)
#Predict test image and return boxes
boxes = test_model.predict_image(image_path=get_data("OSBS_029.tif"), show=False, return_plot = False)
#Returns a 6 column numpy array, xmin, ymin, xmax, ymax, score, label
assert boxes.shape[1] == 6
def test_random_transform(annotations):
test_model = deepforest.deepforest()
test_model.config["random_transform"] = True
arg_list = utilities.format_args(annotations, test_model.config)
assert "--random-transform" in arg_list
def test_use_release(download_release):
test_model = deepforest.deepforest()
test_model.use_release()
#Check for release tag
assert isinstance(test_model.__release_version__, str)
#Assert is model instance
assert isinstance(test_model.model,keras.models.Model)
assert test_model.config["weights"] == test_model.weights
assert test_model.config["weights"] is not "None"
def test_train(annotations):
test_model = deepforest.deepforest()
test_model.config["epochs"] = 1
test_model.config["save-snapshot"] = False
test_model.config["steps"] = 1
test_model.train(annotations=annotations, input_type="fit_generator")
return test_model
def release_model(download_release):
test_model = deepforest.deepforest()
test_model.use_release()
#Check for release tag
assert isinstance(test_model.__release_version__, str)
#Assert is model instance
assert isinstance(test_model.model,keras.models.Model)
return test_model
def test_deepforest():
model = deepforest.deepforest(weights=None)
assert model.weights is None