# Visualization To view the results of DeepForest models, we use Roboflow's [supervision](https://supervision.roboflow.com/latest/) library. Thanks to this team for making a nice set of tools. After making predictions, use :func:`deepforest.visualize.plot_results`. ## Predict ```python from deepforest import main, get_data from deepforest.visualize import plot_results model = main.deepforest() model.load_model(model_name="weecology/deepforest-tree", revision="main") sample_image_path = get_data("OSBS_029.png") results = model.predict_image(path=sample_image_path) plot_results(results) ``` The same works with deepforest.main.predict_tile ```python import os from deepforest import main, get_data from deepforest.visualize import plot_results model = main.deepforest() model.load_model(model_name="weecology/deepforest-tree", revision="main") img_path = get_data(path="2019_YELL_2_528000_4978000_image_crop2.png") results = model.predict_tile(img_path, patch_overlap=0, patch_size=400) plot_results(results) ``` ![sample_image](../../www/Visualization1.png) ### Customizing outputs The colors and thickness of annotations can be updated. ```python # Orange boxes and thicker lines plot_results(results, results_color=[109,50,168], thickness=2) ``` ![sample_image](../../www/Visualization2.png) ### Overlaying predictions and ground truth ```python from deepforest.utilities import read_file ground_truth = read_file(get_data(path="2019_YELL_2_528000_4978000_image_crop2.xml")) plot_results(results, ground_truth=ground_truth) ``` ![sample_image](../../www/Visualization3.png) ## Multi-class visualization For results with more than one predicted class, the plot_results function will detect multiple classes and use a color palette instead of a single class. For control over the color palette see [supervision.draw.color](https://supervision.roboflow.com/draw/color/) ```python from supervision.draw.color import ColorPalette import supervision as sv color_palette = sv.ColorPalette.from_matplotlib('viridis', 6) plot_results(results, ground_truth=ground_truth, results_color=color_palette) ```