A common task in working with computer vision models is visualizing model predictions. Being able to qualitatively visualize predictions is useful in in model development, testing, and work to prepare a model for production.
Using the supervision Python package, you can plot and visualize
YOLO-NAS
predictions in a few lines of code. In this guide, we will show how to plot and visualize model predictions.
We will:
1. Install supervision
2. Load data
3. Plot predictions with a supervision Annotator
Without further ado, let's get started!
First, install the supervision pip package:
Once you have installed supervision, you are ready to load your data and start writing logic to filter detections.
First, we are going to load our dataset into a supervision.Detections() object. We will then be able to use the coordinates in the Detections object to crop instances of each detection from our original image.
You can load data using the following code:
Replace the ... with the response object from your model.
You can crop detections using the supervision ImageSink and crop_image methods.
Use the code below to crop detections:
This code will crop all instances of each detection and save them as a new image. You can also process the predictions in memory by manipulating the cropped_image object.
supervision provides an extensive range of functionalities for working with computer vision models. With supervision, you can:
1. Process and filter detections and segmentation masks from a range of popular models (YOLOv5, Ultralytics YOLOv8, MMDetection, and more).
2. Process and filter classifications.
3. Compute confusion matrices.
And more! To learn about the full range of functionality in supervision, check out the supervision documentation.