From f6d255fbe9947040fa12de9e831000d403a4aa6c Mon Sep 17 00:00:00 2001 From: Bijan Haney Date: Fri, 10 Jan 2025 14:17:58 -0500 Subject: [PATCH] Update mlmodel.md Add a missing step where the user needs to convert a PIL image into a Viam image before feeding it into a get_detections method --- docs/operate/reference/services/vision/mlmodel.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/operate/reference/services/vision/mlmodel.md b/docs/operate/reference/services/vision/mlmodel.md index e4c5a6c93a..fa307e857c 100644 --- a/docs/operate/reference/services/vision/mlmodel.md +++ b/docs/operate/reference/services/vision/mlmodel.md @@ -484,6 +484,7 @@ If you would like to test your detector or classifier with existing images, load ```python {class="line-numbers linkable-line-numbers"} from viam.services.vision import VisionClient +from viam.media.utils.pil import pil_to_viam_image from PIL import Image robot = await connect() @@ -491,7 +492,8 @@ robot = await connect() my_detector = VisionClient.from_robot(robot, "my_detector") # Load an image -img = Image.open('test-image.png') +pil_img = Image.open('test-image.png') +img = pil_to_viam_image(pil_img) # Apply the detector to the image detections_from_image = await my_detector.get_detections(img)