Skip to content

Commit

Permalink
Update mlmodel.md
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bhaney authored Jan 10, 2025
1 parent 382ba14 commit f6d255f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/operate/reference/services/vision/mlmodel.md
Original file line number Diff line number Diff line change
Expand Up @@ -484,14 +484,16 @@ 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()
# Grab Viam's vision service for the detector
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)
Expand Down

0 comments on commit f6d255f

Please sign in to comment.