weecology / DeepForest

Python Package for Airborne RGB machine learning

Home Page:https://deepforest.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CropModel should return labels not numeric values.

bw4sz opened this issue · comments

CropModel should return labels not numeric values.

    raster_path = get_data("SOAP_061.png")
    patch_size = 400
    patch_overlap = 0.05
    iou_threshold = 0.15
    return_plot = False
    mosaic = True


    # Set up the crop model
    crop_model = model.CropModel()

    # Call the predict_tile method with the crop_model
    m.config["train"]["fast_dev_run"] = False
    m.create_trainer()
    result = m.predict_tile(raster_path=raster_path,
                                           patch_size=patch_size,
                                           patch_overlap=patch_overlap,
                                           iou_threshold=iou_threshold,
                                           return_plot=return_plot,
                                           mosaic=mosaic,
                                           crop_model=crop_model)

    # Assert the result
    assert isinstance(result, pd.DataFrame)
    assert set(result.columns) == {"xmin", "ymin", "xmax", "ymax", "label", "score", "cropmodel_label","cropmodel_score","image_path"}

cropmodel_label here is 0 or 1. I think that it should better match result["label"] from the detection as being a string. Users will be happier.

This is related to main.predict_file returning numeric arrays.