Inferences

A Deployment is only as useful as the inferences logged in it: the Dashboard, the Predictions tab, the Alerts, and the Pipeline are all fed by the PredictedAsset and the associated Prediction that your ModelVersion produces. Once the Deployment is configured, this page explains how to get these inferences logged, so that a Computer Vision team can start to monitor and review what the model does in production.

The way you log them depends on where the ModelVersion is served, as chosen when deploying it:

1. What is logged with an inference

Whatever the way you log it, an inference creates a PredictedAsset with its Prediction on the Deployment, together with the latency of the inference. A few rules are worth knowing before you start:

  • Each PredictedAsset is backed by a Data of the target Datalake selected when deploying the ModelVersion: logging an image creates it, as detailed here. When you log an image, you can attach tags, a source and Metadata to this Data, which makes the PredictedAsset easier to find afterward.
  • Only the Shape predicted above the Confidence Threshold of the Deployment are stored and monitored. If a PredictedAsset shows fewer Shape than your model outputs, check this threshold in the General section of the Settings tab first.
  • An inference can be logged from an image file, from the bytes of an image, from an image already stored in the storage of the target Datalake, or from a Data that is already in this Datalake.

To check that the inferences are reaching the Deployment, look at the Last inference column of the Deployments list, at the Total Inferences and Mean Latency of the Overview card of the Dashboard, or at the number displayed next to the Predictions tab.

2. If the ModelVersion is deployed on the Picsellia Serving Engine

When the ModelVersion is deployed on the Picsellia Serving Engine, you ask it to infer on your image from the Deployment itself or with the Picsellia Python SDK: Picsellia runs the ModelVersion on its GPUs and logs the PredictedAsset and the associated Prediction on the Deployment for you. Nothing else has to be implemented on your side.

A. From the Deployment

The Predict button, at the top right of every page of a Deployment, runs the ModelVersion on images you give it, without writing a line of code. It opens the Run predictions with … modal, which offers two sources:

  • Upload images: click on Upload file to send images from your computer.
  • Data from a datalake: choose a Datalake in the dropdown, then select its Data in the grid below, which you can order and filter with the Query Language as in the Datalake itself (see Query Language).

Run predictions only accepts images: the grid of Data from a datalake can also list videos, so select images only.

The Monitoring toggle, described as Save the predictions in this deployment., decides whether the result is logged on the Deployment. It is on by default on a Deployment that is monitored, so that what you try out is kept with the rest of the production history. Click on Predict to launch the prediction, or on Cancel to close the modal.

The predictions run asynchronously: the modal closes with a message such as 5 data sent for prediction, they will appear in the list shortly, and the number of PredictedAsset of the Predictions tab is updated once you refresh the page.

This is the fastest way to answer "what does this model actually do on this image?" — when qualifying a freshly deployed ModelVersion, or when a customer sends over the picture of a case that went wrong — without wiring a script first.

Run predictions on uploaded images

Run predictions on Data from a Datalake

B. With the SDK

The SDK offers one method for each way of providing the image (a file, the bytes of an image, an image stored in the storage of the target Datalake, or a Data of this Datalake), as detailed in the Deployment reference. The tags, source and Metadata mentioned above are parameters of these methods, and logging is done by default.

Here is the recipe to follow to make your ModelVersion deployed on the Picsellia Serving Engine do an inference:

📘

The Picsellia Serving Engine is tracked by MPU. As making predictions requires GPU usage, this usage is tracked and billed through MPU. You can follow your consumption in the Plans and usage page, as detailed in Track your usage.

3. If the ModelVersion is deployed on your own serving infrastructure

When the ModelVersion is deployed on your own serving infrastructure, you are in charge of running the inference. In exchange, no MPU is consumed on the Picsellia side. To benefit from the Deployment features, adapt the script that performs the inference so that it logs the result with the SDK, right after each inference. For each one, you send:

  • The image, provided the same ways as above.
  • The Prediction, formatted the way Picsellia expects it for the Detection Type of the ModelVersion (classes, scores, and boxes, masks, lines or points depending on the type).
  • The latency of the inference, and the height and width of the image.
  • Optionally the tags, source, Metadata, and timestamp of the inference. Sending the real timestamp keeps the history of the Dashboard faithful to when the inferences actually happened.

Here is the procedure to apply to log the result of your inference on a dedicated Picsellia Deployment.

📘

If a Shadow Model is deployed next to the Champion Model and you serve them yourself, you need to make both ModelVersion infer on the same image and log both Prediction, otherwise the comparison between them is not possible.

4. Visualize and review the inferences

Once logged, the PredictedAsset and the associated Prediction are available in the Predictions overview. From there, you can open the Prediction Review tool to review them, and send the reviewed Prediction to the Pipeline through the Feedback Loop, as detailed in Pipeline.


Did this page help you?