Computer vision and image generation
Send images to a multimodal model, generate new images from text, and build a small app with vision capabilities.
In this lesson you'll learn
- Interpreting images in prompts with a multimodal model
- Generating and editing images with an image generation model
- Ready-made vision features: captions, tags, objects and OCR
- Responsible use of vision and image generation
1. Images in prompts
New to computer vision? Start here
Computer vision lets software understand images: what's in them, where objects are, and what text they contain. Modern multimodal models can look at an image and answer questions about it in plain language.
With a multimodal model, a prompt can contain text and an image (as a URL or base64 data). Ask questions such as "What's damaged in this photo?" or "Turn this whiteboard sketch into a to-do list."
reply = client.responses.create(
model="my-multimodal-deployment",
input=[{"role": "user", "content": [
{"type": "input_text", "text": "Describe any damage to this car."},
{"type": "input_image", "image_url": "https://example.com/car.jpg"}]}])
print(reply.output_text)
2. Generating images
Image generation models create new images from a text description, and some can edit an existing image from instructions. Give clear prompts that describe the subject, style, setting and composition. Guardrails block harmful requests and generated content may carry provenance credentials to show it was AI-generated.
3. Ready-made vision features
| Feature | Returns |
|---|---|
| Captions and dense captions | A sentence describing the image, or several regions |
| Tags | Keywords for things in the image |
| Object detection | Objects with bounding boxes |
| OCR (Read) | Printed and handwritten text, with positions |
| Face detection | Face locations and attributes (identification features need approval) |
Example
An online furniture shop lets customers upload a photo of their living room. A multimodal model describes the style and colours, and an image generation model shows a sofa from the catalogue in a matching setting. Every generated image is labelled as AI-generated.
Exam traps to remember
- Interpreting an image (describing, answering questions) is different from generating a new one.
- OCR extracts text. It doesn't explain what a picture shows.
- Facial recognition that identifies people is a limited-access feature, for responsible AI reasons.
Test yourself: 3 check questions and exam-style practice questions on this topic are in the AI-901 Azure AI Fundamentals app.
Practise in the app