def plot_inference()

in src/plot_utils.py [0:0]


def plot_inference(img_region, df_preds, plot_feats, plot_class, legend_dict=None):
    """"""
    region_map = geemap.Map()
    region_map.add_basemap('SATELLITE')
    
    if legend_dict is None:
        legend_dict = {
            "Mangrove Area": (255, 1, 1),
            "Non-mangrove Area": (128, 128, 128),
            "Incorrect Prediction": (0, 0, 0),
            'Correct Prediction': (1, 1, 255)
        }
    
    mangroves_vis = {
        min: 0,
        max: 1.0,
        'palette': ['d40115'],
    }
    
    # collect the correct and incorrect predictions
    df_correct = df_preds.loc[df_preds["y_true"] == df_preds["y_pred"]].copy()
    df_incorrect = df_preds.loc[df_preds["y_true"] != df_preds["y_pred"]].copy()
    
    # convert the pixels into an ee feature collection
    points_correct = ee.FeatureCollection(df_correct[df_correct.y_pred==plot_class].geometry.tolist())
    points_incorrect = ee.FeatureCollection(df_incorrect[df_incorrect.y_pred==plot_class].geometry.tolist())

    # plot the mangrove image for the region
    if plot_class:
        region_map.addLayer(img_region, mangroves_vis, 'Mangroves: Actual')
        legend_dict.pop("Non-mangrove Area")
    else:
        region_map.addLayer(img_region, {}, 'Other: Actual')
        legend_dict.pop("Mangrove Area")

    # plot the plot_class pixels predicted correctly
    region_map.addLayer(points_correct, 
                          {'color': 'blue'}, 
                          'Correct Prediction', 
                          True)
    
    # plot the plot_class pixels predicted incorrectly
    region_map.addLayer(points_incorrect, 
                          {'color': 'black'}, 
                          "Incorrect Prediction", 
                          True)
    
    # center the map and add legend
    region_map.centerObject(plot_feats["poi"], plot_feats["zoom"])
    region_map.add_legend(legend_dict=legend_dict)

    return region_map