Vision AI in Google Cloud: Teaching Computers to See Images, Documents and Video
A friendly, in-depth guide to the Google Cloud services that read images, extract text, understand video and answer questions about pictures, and how to choose, build, secure and pay for them wisely.
Imagine you hire a very fast assistant who can look at a million photos in an afternoon. You hand over a photo of a street, and the assistant tells you there are three cars, a bicycle, a shop sign that says “Bakery” and a clear blue sky. You hand over a scanned invoice, and the assistant types out every line for you. You hand over a video, and the assistant lists each scene and every time a certain logo appears. That assistant is not a person at all, but a set of Google Cloud services, and in this guide we will learn how they work, which one to pick for which job, and how to use them safely, starting from the very basics.
1What Is Vision AI in Google Cloud?
Vision AI is not one product. It is a family of services that help software understand pictures, scanned pages and video.
Computer vision is the field of teaching computers to understand what is in an image or a video. A human looks at a photo and instantly knows there is a dog on a sofa. A computer sees only a grid of numbers describing the color of each tiny dot, called a pixel. Vision AI services turn those numbers into meaning, such as labels, words, shapes and answers.
Google Cloud offers several services for this. The Cloud Vision API recognizes objects, text, faces, logos and more in single images. The Video Intelligence API does similar work across time in video. Document AI focuses on reading structured business documents. Gemini models, offered through Google Cloud, understand images in a flexible conversational way. And for special needs, you can train custom models on your own pictures.
Think of the vision family as a team of specialists in one office. One is a quick inspector who tags every photo. One reads paperwork. One watches video tapes. One is a general expert who can chat about anything in a picture. And you can train a new specialist for your own unusual products.
Why it matters for beginners
Without these services, building even a simple image reader would need a team of researchers, huge training data and expensive hardware. With them, a developer can send an image to an address on the internet and receive a clear answer within seconds. This makes advanced vision available to small teams and students.
Google Cloud renames, merges and retires products from time to time. Use this guide to understand the ideas, and confirm current product names and features on the official pages before you build.
2Why Computers Need Help Seeing
Seeing feels effortless to humans and is surprisingly hard for machines.
When you look at a photo of a cat, you do not count pixels. Your brain recognizes shapes, textures and context in a split second. A computer has none of this built in. It receives a table of numbers, and it must learn that certain patterns of numbers usually mean a cat. This learning needs a huge number of example images and a lot of computing power.
Pictures also vary enormously. The same cat can appear in bright light or shadow, close up or far away, upside down or half hidden behind a chair. A good vision system must recognize it in all of these situations. This is why vision services are trained on enormous collections of varied images.
Lighting and Angle
The same object looks very different in sun, shade or at night, and from the front or the side.
Clutter and Overlap
Real scenes are messy. Objects hide behind each other, and backgrounds distract.
Scale and Resolution
An object may fill the whole image or be a tiny speck in the corner, and photos can be sharp or blurry.
Meaning and Context
A knife in a kitchen means something different from a knife on a stage, and machines must learn such differences.
Teaching a computer to see is like teaching a toddler to recognize dogs. You do not give rules. You show thousands of dogs, big and small, brown and spotted, sleeping and running, until the pattern becomes clear.
Many beginners think a vision service understands pictures the way people do. It does not. It finds statistical patterns, and it can be confidently wrong on unusual images. Always plan for mistakes.
3Core Concepts and Vocabulary
Let us define every word you will meet in the documentation.
Pixel
The smallest dot of an image. An image is a grid of pixels, each with a color value.
Label
A word describing what is in an image, such as “dog” or “mountain”.
Object Detection
Finding individual objects in an image and drawing a box around each one.
Bounding Box
A rectangle, or a set of corner points, that shows where an object or text sits in an image.
OCR
Optical Character Recognition, turning pictures of text into real, searchable text.
Confidence Score
A number, usually between zero and one, showing how sure the model is about an answer.
Classification
Assigning an entire image to a category, such as “damaged” or “undamaged”.
Segmentation
Outlining the exact shape of an object, pixel by pixel, not just a box around it.
Pre-Trained Model
A model already trained by Google on huge data, ready to use without any training from you.
Custom Model
A model you train on your own labeled images for tasks that general models handle poorly.
Multimodal Model
A model that understands more than one kind of input, such as text and images together.
Inference
The act of using a trained model to produce an answer for a new image.
A label is a sticky note on the photo. A bounding box is a rectangle drawn around the item. Segmentation is carefully cutting around the item’s outline with scissors. The confidence score is how sure the person making the note feels.
Training is when a model learns from examples, which is slow and costly. Inference is when it answers a question, which is fast. With pre-trained services, Google handles training and you only pay for inference.
4The Vision Product Family Map
The hardest first step is knowing which service fits which job.
| Service | What It Does | Best For |
|---|---|---|
| Cloud Vision API | Pre-trained analysis of single images with a fixed list of features | Labels, text, logos, landmarks, safe content checks, object locations |
| Video Intelligence API | Pre-trained analysis of video over time | Scene changes, objects in video, speech, moderation of clips |
| Document AI | Reads and structures business documents | Invoices, forms, receipts, identity documents and contracts |
| Gemini models | Flexible understanding of images and other inputs through prompts | Open questions, descriptions, reasoning about pictures, custom extraction |
| Custom models on Vertex AI | Models trained on your own labeled images | Special products, defects and categories general models do not know |
A simple way to decide
Is It a Standard Task?
If you need labels, text, logos or landmarks, try the Cloud Vision API first, because it is simple and predictable.
Is It a Business Document?
If you need fields from invoices or forms, look at Document AI, which understands document structure.
Is It Video?
For scenes and events over time, use the Video Intelligence API.
Do You Need Open Questions?
If you want to ask “what is wrong in this photo?” or extract custom fields, use Gemini.
Is It Very Specialized?
If general models fail on your own products or defects, consider training a custom model.
Choosing a vision service is like choosing a vehicle. A pre-trained API is a taxi for everyday trips. Document AI is a delivery van built for parcels. Gemini is a flexible car that goes almost anywhere. A custom model is a purpose-built machine for one special job.
Try the simplest option first. Many projects that begin with plans for custom training find that a ready-made service already meets most needs.
5How Computer Vision Works Internally
A short look inside the machine makes every later topic easier.
Modern vision systems use neural networks, which are programs loosely inspired by how brain cells connect. A neural network is made of layers. The first layers look at tiny details such as edges and corners. The middle layers combine those into shapes such as wheels, eyes or letters. The final layers combine shapes into whole concepts such as “car” or “face”.
flowchart LR
A["Pixels of the image"] --> B["Early layers find edges and colors"]
B --> C["Middle layers find shapes and parts"]
C --> D["Late layers recognize whole objects"]
D --> E["Answer with confidence score"]
How a model learns
Collect Examples
Gather very many images along with the correct answers, such as labels written by people.
Guess and Compare
The network guesses an answer for each image and compares the guess with the correct one.
Adjust Slightly
Internal numbers are nudged so that the same guess would be a little less wrong next time.
Repeat Millions of Times
After countless rounds, the network becomes good at pictures it has never seen.
Test on Fresh Images
The model is measured on images it did not train on, to check that it truly learned the pattern.
Think of a child learning handwriting. At first the child notices straight and curved lines. Later the lines become letters, then words. The network builds understanding in the same layered way, from small details to full meaning.
A model can only be as good as the examples it learned from. If a type of image was rare in training, the model will be weaker on it. This idea explains most surprising mistakes you will see later.
6Cloud Vision API: A Feature Tour
The Cloud Vision API offers a menu of ready-made image analysis features that you can combine in one request.
You send an image and choose which features you want. Google’s service returns structured results describing what it found. You do not need to train anything, and you do not need to manage servers. The same request format works for a small photo and for thousands of images in a batch.
Label Detection
Describes the general content of an image with words such as “beach”, “vehicle” or “flower”.
Object Localization
Finds multiple objects in an image and returns where each one is located.
Text Detection
Reads text found inside a general photo, such as street signs or product packaging.
Document Text Detection
Reads dense text from scanned documents and pages, keeping structure such as blocks and paragraphs.
Face Detection
Finds faces and describes features such as position and expression likelihoods, without identifying who the person is.
Landmark Detection
Recognizes well-known natural and man-made landmarks.
Logo Detection
Finds popular product and company logos in an image.
Safe Search Detection
Estimates how likely an image is to contain adult, violent or other sensitive content.
Image Properties
Reports facts about the image itself, such as its dominant colors.
Crop Hints
Suggests good crop regions for a chosen shape, useful for thumbnails.
Web Detection
Finds related web content, similar images and entities connected to an image.
Product Search
Matches a photo against your own catalog of product images to find visually similar items.
The Vision API is like a toolbox of single-purpose gadgets: a label maker, a reader, a locator, a color checker and a safety scanner. You pick the tools you need, and the service applies them to your picture.
Google has retired some features over time. Celebrity recognition and an on-premises OCR option were scheduled for shutdown in September 2025. Always check the current deprecation notices before depending on any feature.
7Label Detection and Object Localization
These two features answer the questions “what is in this picture?” and “where is it?”
Label detection gives a list of descriptive words, each with a confidence score. A photo of a beach might return words such as sea, sand, sky, vacation and coast, with scores showing how sure the model is about each. Labels describe the whole picture in a general way and do not say where things are.
Object localization goes further. It finds separate objects and returns a name, a score and an outline showing where each object sits. A street photo might return two cars, one bicycle and a traffic light, each with its own position. Positions are given as relative coordinates, which means numbers between zero and one that stay correct no matter what size the image is.
| Aspect | Label Detection | Object Localization |
|---|---|---|
| Question answered | What is this picture about? | Which objects are here and where? |
| Output | Words with confidence scores | Object names, scores and positions |
| Counts items | No | Yes, by listing each object found |
| Typical use | Tagging and searching photo libraries | Counting, cropping and highlighting objects |
Photo Library Search
A service tags each uploaded photo automatically, so users can search for “sunset” or “dog” without anyone typing tags by hand.
Retail Shelf Checks
A store counts product items visible on a shelf photo to see whether stock is low.
Smart Cropping
An app finds the main object and crops around it to create tidy thumbnails.
Labels are like the title on a photo album page, such as “Beach holiday”. Object localization is like pointing at the picture and saying “there is the umbrella, there is the towel, and there is a boat.”
Ignore labels below a score you choose, for example the weakest ones, so that guesswork does not clutter your results. Tune the threshold using your own sample images.
8Reading Text: OCR and Document Text Detection
OCR turns pictures of words into text that computers can search, copy and analyze.
Optical character recognition is one of the oldest and most useful vision tasks. A photo of a menu, a scanned contract or a picture of a road sign contains words, but to a computer it is just pixels. OCR finds the characters and returns real text, along with positions showing where each word appeared.
The Vision API offers two OCR features for two situations. Text detection is meant for text in everyday photos, such as signs, labels and packaging, where words are sparse. Document text detection is tuned for pages full of dense text, such as scanned books and forms. It keeps the structure of pages, blocks, paragraphs, lines and words, and it handles handwriting in many cases. If both are requested, the document version takes priority.
When OCR Works Well
- Clear, well-lit, straight images
- Printed text in common fonts and languages
- High enough resolution that letters are sharp
- Good contrast between text and background
When It Struggles
- Blurry, tilted or low-resolution photos
- Very decorative fonts or messy handwriting
- Text on busy or low-contrast backgrounds
- Crumpled paper, shadows and glare
OCR is only the first step
OCR gives you text, not meaning. If you scan an invoice, OCR returns every word, but it does not know which number is the total or which is the date. Turning raw text into named fields requires extra logic, or a service built for document structure, which we meet in a later chapter.
OCR is like a typist who copies every word from a page without understanding it. You get a perfect transcript, but somebody else must still decide which words matter.
Better photos give better OCR. Ask users to hold the camera straight, use good light and avoid glare, and consider simple preprocessing such as straightening the image before sending it.
9Faces, Landmarks, Logos and Safe Search
These features analyze sensitive or special content, so they need extra care and thought.
Face detection
Face detection finds where faces are in an image and describes details, such as the position of eyes and the likelihood of expressions like joy or surprise. It does not tell you who a person is. Detecting that a face exists is very different from recognizing a particular individual, and Google’s service is designed for the first, not the second. Use it for tasks such as counting people or cropping around a face, not for identification.
Landmark detection
Landmark detection recognizes famous places, such as well-known monuments and natural wonders. It returns a name, a confidence score and often the geographic location, which is useful for organizing travel photos.
Logo detection
Logo detection finds popular brand logos. Brands use it to measure how visible their sponsors are in photos, and platforms use it to find unauthorized use of a brand mark.
Safe search detection
Safe search estimates how likely an image is to contain categories of sensitive content, such as adult material, violence or medical imagery. It gives each category a likelihood level, from very unlikely to very likely, not a simple yes or no. Platforms use it to review user uploads before showing them to others.
| Feature | Returns | Typical Use | Care Needed |
|---|---|---|---|
| Face detection | Face positions and expression likelihoods | Counting people, cropping | Privacy, consent and fairness |
| Landmark detection | Place name and location | Travel photo organization | Check results for lesser-known places |
| Logo detection | Brand names and positions | Sponsorship tracking | May miss new or unusual logos |
| Safe search | Likelihood levels per category | Moderation of uploads | Use human review for borderline cases |
Safe search is like a security guard at a gate who gives each visitor a quick risk rating. The guard is useful for sorting the crowd, but a manager should still look at the unclear cases.
For moderation and anything that affects people, treat automated scores as a first filter. Add human review for decisions that matter, and offer a way to appeal.
10Image Properties, Crop Hints, Web Detection and Product Search
The remaining features support design, discovery and shopping.
Image Properties
Reports facts about the image, most notably its dominant colors with how much of the picture each covers. Designers use it to build color palettes or to match themes to photos.
Crop Hints
Suggests the most interesting region to keep when you must crop an image to a given shape, which helps create thumbnails that do not cut off the subject.
Web Detection
Finds web pages containing matching or similar images, and related entities. It helps find where an image appears online and what topics it relates to.
Product Search
Lets you create a catalog of your own product images and then find visually similar items from a customer’s photo. This supports “photograph it to find it” shopping experiences.
How product search is organized
Build a Product Set
Create a collection that represents your catalog or a part of it.
Add Products and Reference Images
Each product gets one or more clear reference photos, ideally from several angles.
Index the Catalog
The service processes the images so they can be searched. Changes may take time to appear.
Search with a Customer Photo
The service returns the closest matching products with similarity scores.
Product search is like a shop assistant with a perfect visual memory of the whole catalog. You show a photo of a chair you saw on holiday, and the assistant points to the three most similar chairs in the shop.
Clean reference images on plain backgrounds, taken from several angles, make matches far more accurate than a single cluttered photo.
11How a Vision API Request Works
Every vision request follows the same simple story: send an image, ask for features, receive structured answers.
Your application sends a request that contains two things. First, the image, supplied either as the raw image data or as a location in Cloud Storage, or sometimes a public web address. Second, a list of the features you want. The service analyzes the image and returns a structured response, usually in JSON format, which is a simple text format that programs can read easily.
sequenceDiagram
participant A as Your application
participant V as Vision API
participant M as Pre-trained models
A->>V: Send image and list of features
V->>V: Check permissions and request
V->>M: Run each requested feature
M->>V: Return labels, text, boxes and scores
V->>A: Send structured response
What the response contains
Annotations
One group of results per feature, such as a list of labels or a list of detected objects.
Confidence Scores
Numbers showing the model’s certainty for each result.
Positions
Boxes or polygons telling you where things appear in the image.
Error Information
If something fails for one image or feature, the response says so, without hiding the other results.
Several images in one request
You can send more than one image in a single request, and the service returns a separate answer for each. This reduces the number of network round trips and is the basis of efficient batch processing. Each image and feature combination is counted for billing, which we will cover in the pricing chapter.
Sending a request is like handing a clerk a photo with a form where you tick boxes for the information you want. The clerk returns the filled-in form, with each answer and how sure he was.
Each feature you request adds to cost and response size. Request only the features your application will actually use.
12Confidence Scores and Reading Results Wisely
A result without a sense of its reliability can lead you astray.
Most vision features attach a confidence score to each result. A score near one means the model is quite sure, and a score near zero means it is guessing. But a score is not a promise of correctness. A model can be very confident and still wrong, especially on images unlike its training data. Treat scores as helpful signals, not as proof.
Choosing a threshold
A threshold is the score above which you accept a result. A high threshold gives you fewer results that are mostly correct. A low threshold gives you more results but more mistakes. The right choice depends on the cost of each kind of error in your application.
| Situation | Better Threshold | Reason |
|---|---|---|
| Auto-tagging photos for search | Moderate | A wrong tag is a small nuisance, and missing tags hurts search |
| Blocking unsafe uploads | Lower, with human review | Missing unsafe content is costly, so flag more and review |
| Reading amounts from receipts | High, with checks | A wrong digit can cause real financial errors |
| Counting objects for reports | Moderate to high | False detections inflate the count |
Two kinds of mistakes
False Positive
The system reports something that is not there, such as seeing a dog in a picture of a rug.
False Negative
The system misses something that is there, such as failing to spot a small stop sign.
Reducing one kind of mistake usually increases the other. Deciding which matters more is a business decision, not only a technical one.
An airport metal detector can be set very sensitive, catching every tiny item but beeping at belts and coins, or less sensitive, with fewer beeps but a greater risk of missing something. The setting should match how bad a miss would be.
Published accuracy numbers come from someone else’s test set. Collect a few hundred of your own typical images, check results by hand and choose thresholds based on what you see.
13Video Intelligence API
Video is a long series of images with sound, and understanding it adds the dimension of time.
The Video Intelligence API analyzes video files and reports what appears and when. Instead of a single answer, you get answers tied to time ranges, such as “a dog appears from second 12 to second 20”. This turns a long video into a searchable, structured record.
Label Detection
Identifies objects, places and activities in the video, with timestamps for when they appear.
Shot Change Detection
Finds the moments when the camera cuts to a new scene, helping split the video into segments.
Explicit Content Detection
Flags frames or segments that may contain inappropriate material.
Speech Transcription
Converts spoken words into text with timing, useful for subtitles and search.
Text and Logo Detection
Reads on-screen text and finds logos as they appear over time.
Object Tracking and Person Detection
Follows objects or people as they move through the video.
Typical uses
Content Moderation
A video platform checks uploads before publication and sends risky clips to human reviewers.
Video Search and Cataloging
A media archive finds clips by objects, scenes or spoken words instead of relying on manually written titles.
Sponsor Measurement
A broadcaster measures how long a sponsor’s logo appears on screen during a match.
Analyzing a video is like having an assistant watch a long film and write an index at the back, listing each scene, each object and each spoken line with the exact minute it occurs.
Video is billed by the amount of video analyzed, with each feature priced separately and different rates for stored and streaming video. Estimate your total minutes before processing a large archive.
14Document AI Compared with Vision OCR
Reading words is only half the job when documents have structure and meaning.
Vision OCR returns text and positions. Document AI goes further by understanding document types. It can identify that a page is an invoice and extract named fields such as supplier, invoice number, date, line items and total. For business automation, this is often exactly what is needed.
| Aspect | Vision OCR | Document AI |
|---|---|---|
| Main output | Text, blocks and word positions | Named fields, tables and structured data |
| Understands document type | No | Yes, through specialized processors |
| Best for | General text in images and simple scans | Invoices, receipts, forms, identity documents, contracts |
| Effort after extraction | You must find the fields yourself | Fields arrive labeled, ready to use |
| Flexibility | Works on any image with text | Strongest where a processor exists for the document type |
Vision OCR is a scanner that hands you a pile of loose words. Document AI is a trained clerk who reads the invoice and fills in a tidy form with the supplier, date and total.
When to choose which
Just Need the Text
Use Vision OCR to make scans searchable or to read signs and labels.
Need Specific Fields
Use Document AI when you must pull amounts, dates and names into a system automatically.
Unusual Layouts
Consider a custom processor, or a Gemini-based extraction with validation, when documents do not match standard types.
For money and legal data, check extracted values with rules, such as line items adding up to the total, and route doubtful documents to a person.
15Gemini: Flexible Understanding of Images
Gemini models treat images as part of a conversation, which opens possibilities that fixed feature lists cannot match.
Gemini is a family of multimodal models, meaning they accept images along with text. Instead of choosing from a menu of features, you write a request in plain language, such as “describe this photo”, “which items on this shelf look damaged?” or “list every price on this menu”. The model answers in text, and you can ask it to answer in a fixed format that your program can read.
What Gemini can do with images
Captioning and Description
Writes a natural description of an image for accessibility or search.
Visual Question Answering
Answers specific questions about an image, such as how many people wear helmets.
Object Detection
Returns bounding boxes for objects you ask about, with coordinates scaled to a fixed range that you convert back to the image size.
Segmentation
Newer models can return outlines of objects along with labels, giving more detail than a rectangle.
Multiple Images
Compares several images in one request, such as spotting differences between two photos.
Custom Extraction
Reads text and data from images and returns exactly the fields you define.
Practical points from the documentation
Images can be supplied by web address, as inline data inside the request, or through a file service for large or reused files. Common formats such as PNG, JPEG, WEBP, HEIC and HEIF are supported. Inline requests have a total size limit, so larger files should use the file service, and a single request can include a large number of images. Each image consumes tokens, which are the units in which model usage is measured, and bigger images use more tokens. Some models allow you to limit the resolution used, trading detail for lower cost and faster replies.
A fixed API is a vending machine with set buttons. Gemini is a knowledgeable assistant at the counter, who can answer whatever you ask about the photo, including questions the machine’s designers never imagined.
Use well-rotated, sharp images, be specific about what you want, and when using one image with text, place the text instruction before the image. Ask for a fixed output format so your program can read the answer reliably.
Generative models sometimes describe things that are not in the picture or state wrong details with confidence. For important decisions, add checks, ask for evidence such as locations in the image, and keep humans in the loop.
16Choosing Between Vision API and Gemini
Both read images, but they behave differently, and the best systems often use each where it shines.
| Aspect | Cloud Vision API | Gemini |
|---|---|---|
| Interface style | Choose from fixed features | Describe the task in a prompt |
| Output | Consistent, structured results with scores | Text or structured output you design, may vary between runs |
| Flexibility | Limited to the feature list | Very high, handles custom questions |
| Predictability | High, same input tends to give the same output | Lower, wording and details can change |
| Pricing basis | Per image per feature | Per token of input and output |
| Best for | High-volume, standard tasks with fixed formats | Open tasks, reasoning, custom extraction, explanations |
Combining them
A common pattern uses the Vision API as a cheap, fast first pass at large scale, for example to check safe content or read text. Only the uncertain or complex images are sent to Gemini for deeper reasoning. This keeps cost low and quality high.
flowchart TD
A["Incoming images"] --> B["Vision API fast first pass"]
B --> C{"Clear and simple"}
C -->|"Yes"| D["Accept result"]
C -->|"No"| E["Gemini deeper analysis"]
E --> F{"Still uncertain"}
F -->|"Yes"| G["Human review"]
F -->|"No"| D
Where each approach is strongest
The Vision API shines when the question is standard and the volume is huge. Reading street names from millions of photos, tagging a photo archive, or screening uploads for sensitive content are tasks where a fixed, predictable, low-cost service wins. Results arrive in the same structure every time, which makes downstream code simple and testing easy.
Gemini shines when the question is unusual or needs reasoning. Asking whether a shelf arrangement follows a store’s layout rules, whether a damaged package shows signs of water, or what steps a diagram describes are tasks no fixed feature list can answer. The price is greater variation in output and the need to design prompts carefully and verify answers.
Whichever you choose, keep a test set of real images with correct answers. When a new model version or a new service appears, rerun the test set and compare. This habit turns product changes from a worry into a routine measurement.
It is like a hospital with a nurse who handles routine checks quickly, a doctor who looks at puzzling cases, and a specialist for the hardest ones. Most patients never need the specialist, and no one is overlooked.
Test both on the same set of your own images, measure accuracy and cost, and choose using evidence rather than assumptions.
17Custom Vision Models on Vertex AI
When general services do not know your special products, you can teach a model using your own pictures.
Pre-trained services know common things: cars, cats, food, signs. They do not know your factory’s unique valve, your farm’s rare plant disease, or the subtle scratch pattern that marks a faulty part. For such cases, you train a custom model. Vertex AI is Google Cloud’s platform for building, training and serving machine learning models, and it is where custom vision work lives today.
Older, separate products named AutoML Vision and AutoML Video Intelligence were retired in earlier years, and Google directed customers toward Vertex AI. This is a good reminder that product names move, so always read current documentation before starting a project.
Three ways to get a custom capability
Prompt a Multimodal Model
Describe your task to Gemini and add a few example images in the prompt. No training is needed and you can start in an afternoon.
Tune a Model
Provide labeled examples so a model adapts to your domain. This needs more data and effort, but can raise accuracy and consistency.
Train Your Own Model
Build a dedicated image model with your own training code and data, giving the most control and the most work.
The exact training options on Vertex AI evolve, so treat the list above as the general shape of choices and confirm the current menu in the documentation. The guiding rule stays the same: begin with the cheapest path that could work, measure it, and move to heavier paths only if the numbers demand it.
Using a pre-trained service is like hiring a general doctor. Prompting Gemini with examples is like showing that doctor a few sample cases of a rare condition. Tuning is sending the doctor on a short specialty course. Training your own model is raising a brand-new specialist from scratch.
Each step up costs more time, data and money. Prove that a simpler step fails on your test images before moving up.
18Collecting and Labeling Training Data
Data is the real fuel of any vision project, and most project time goes here.
A custom model learns from examples, and every example needs a correct answer attached, called a label. For classification, the label might be “good” or “defective”. For object detection, the label is a box drawn around each object together with its name. People usually create labels by hand using labeling tools, which makes quality and consistency the central challenge.
What good training data looks like
Realistic
Images should come from the same cameras, lighting and angles your system will face in real life, not perfect studio shots.
Varied
Include different backgrounds, times of day, distances and conditions so the model does not memorize one narrow look.
Balanced
If ninety-nine percent of your images are “good”, a lazy model can say “good” every time and look accurate. Collect enough examples of rare cases.
Consistently Labeled
Write clear labeling rules, with example pictures, so that different people label the same situation the same way.
Split Properly
Divide images into training, validation and test sets. The test set stays untouched until the end, to give an honest score.
Common data traps
One famous trap is the shortcut. If every photo of defective parts was taken on a blue table and every good part on a gray table, the model may learn to read the table color, not the defect. It will then fail the moment the table changes. Another trap is duplicates leaking between training and test sets, which makes scores look better than reality.
Training data is the textbook and the test set is the final exam. If students see the exam questions while studying, a perfect score proves nothing. Keep the exam secret, and make the textbook reflect real life.
No tool can rescue wrong labels. Review a sample of your labeled images yourself before spending money on training.
19Measuring Accuracy: Precision and Recall
A single accuracy number hides the mistakes that matter most, so we use better measures.
Suppose a model checks 1,000 parts and 20 are truly defective. A model that says “good” for everything is right 980 times, a 98 percent accuracy, yet it finds no defects at all. This shows why accuracy alone can mislead, especially when one outcome is rare.
Precision
Of everything the model flagged as defective, how many truly were? High precision means few false alarms.
Recall
Of all the truly defective parts, how many did the model catch? High recall means few misses.
Confusion Matrix
A small table showing which classes get mixed up with which, revealing patterns in the errors.
Overlap Score
For object detection, measures how well the predicted box overlaps the true box. More overlap means a better match.
The seesaw between the two
Precision and recall usually pull against each other. If you make the model stricter, false alarms drop but misses rise. If you make it more eager, misses drop but false alarms rise. The threshold you choose slides you along this seesaw.
| Business Need | Favor | Why |
|---|---|---|
| Safety defects that could hurt people | High recall | Missing a defect is far worse than rechecking a good part |
| Automatic rejection of customer uploads | High precision | Wrongly blocking honest users harms trust |
| Searching a photo library | Balance | Users accept some noise but want most matches found |
Imagine fishing with a net. A wide net with large holes catches only big fish but few boots. A fine net catches nearly every fish, together with a lot of weeds. Precision is the fish share of the catch, and recall is the share of all fish that you caught.
After every evaluation, open the wrong predictions and study them. Patterns in the errors, such as always failing on dark images, show exactly what data to add next.
20A Reference Architecture for Image Processing
Most production systems follow the same event-driven pattern built from a few well-known Google Cloud pieces.
A user or device uploads an image to Cloud Storage. The upload creates an event. A small piece of serverless code reacts to the event, calls a vision service, and stores the results in a database where applications can search them. Because each part does one job, the pipeline is easy to scale, test and replace.
flowchart LR
U["User or device upload"] --> S["Cloud Storage bucket"]
S --> E["Upload event"]
E --> Q["Pub/Sub topic"]
Q --> F["Serverless worker"]
F --> V["Vision API or Gemini"]
V --> F
F --> D["Results database"]
F --> R["Review queue for doubtful cases"]
D --> A["Search and reporting apps"]
Why each piece is there
Cloud Storage
Holds original images durably and cheaply, and can trigger events when new files arrive.
Pub/Sub
A message queue that absorbs bursts and retries failures, so a sudden flood of uploads does not overwhelm the workers.
Serverless Worker
Short-lived code on a managed service that scales up and down automatically with the workload.
Results Database
Stores labels, text and scores so applications can search without calling the vision service again.
It is like a mailroom. Parcels arrive at the front desk, a note goes on a board, a clerk takes the next note, inspects the parcel and files a report. If a hundred parcels arrive together, the notes simply wait their turn.
Store analysis results next to the image identifier. Reanalyzing the same image repeatedly wastes money and time.
21Batch, Asynchronous and Large-Scale Processing
Analyzing a million images is a different problem from analyzing one.
For interactive apps, a synchronous request returns an answer within seconds, and the user waits. For huge archives, waiting on each image one at a time is impractical. The Vision API supports sending several images in one request and also supports asynchronous batch work, where you submit a large set, the service processes it in the background, and the results are written to Cloud Storage for you to pick up later. Documents such as long PDFs and multi-page scans are handled in a similar way, with each page counting as one image for billing.
| Mode | How It Works | Best For |
|---|---|---|
| Synchronous single | One image, immediate answer | Interactive apps and demos |
| Synchronous batch | Several images per request, immediate answers | Moderate volumes and fewer network trips |
| Asynchronous batch | Submit a job, results arrive in storage | Large archives, nightly processing, long PDFs |
Staying within limits
Every cloud service has quotas, which are limits on request rate and size. A bulk job that sends requests too quickly will receive rate-limit errors. A well-built worker slows down and retries politely, waiting a little longer after each failure, a method called exponential backoff. It also sets a maximum concurrency so that it never floods the service.
Making retries safe
Retrying can cause duplicates, such as saving the same results twice. A safe design makes each step repeatable without harm. For instance, store results under the image’s unique identifier, so a second write simply overwrites the first.
Synchronous calls are like ordering coffee at the counter and waiting for it. Asynchronous batch is like dropping off a big pile of laundry and collecting it tomorrow. For a huge pile, the laundry service is far more sensible.
Before processing a whole archive, run a few hundred images and check both results and cost. A mistaken setting multiplied by millions can be an expensive lesson.
22Understanding Pricing and Controlling Cost
Vision services are billed by usage, so a clear mental model prevents surprises.
For the Cloud Vision API, the unit of billing is the feature applied to one image. One image with three requested features counts as three units. The first 1,000 units of each feature every month are free, and after that, a price per thousand units applies. Prices differ by feature, with common ones such as label detection and text detection costing about a dollar or two per thousand units at standard volume, while some features, such as web detection and object localization, cost more. Volume discounts apply at very large scale. Each page of a PDF or TIFF counts as one image.
Gemini works differently. It is billed by tokens, the units of input and output text, with images converted into a number of tokens that depends on their size. Video Intelligence is billed by minutes of video analyzed for each feature. Because prices and free allowances change, always read the current pricing pages and use the official pricing calculator for your own estimates.
| Service | Billing Unit | Cost Driver |
|---|---|---|
| Cloud Vision API | Per feature per image | Number of images times number of features |
| Video Intelligence API | Per minute per feature | Length of video and features chosen |
| Gemini | Per token of input and output | Image size, prompt length and answer length |
| Custom models | Training time plus serving time | Data size, model size and hours of endpoint use |
Practical ways to save
Request Fewer Features
Ask only for what your app uses. Each extra feature multiplies the cost.
Resize Large Images
Very large photos add upload time and, for token-based models, cost. Shrink them to the detail you truly need.
Cache Results
Never analyze the same image twice. Use a hash of the image as a key to find earlier results.
Use Tiers
Run a cheap check first and use expensive analysis only on cases that need it.
Set Budgets and Alerts
Create billing budgets that email you when spending crosses a threshold, and set quotas to cap runaway loops.
Vision billing resembles a photo lab that charges for each print and each special effect. Ask for five effects on a thousand prints, and you pay for five thousand jobs. Trim the effects you do not need, and the bill shrinks at once.
Numbers quoted in articles go out of date. Treat any figure here as an illustration and confirm on the official pricing pages before planning a budget.
23Security, Identity and Access Control
Images can contain faces, documents and secrets, so protect them from the first upload.
Google Cloud controls who may do what through Identity and Access Management, usually called IAM. Instead of sharing passwords, you give each program its own identity, called a service account, and grant it only the permissions it needs. This idea is called least privilege. A worker that only reads images and calls the vision service should not be able to delete buckets or change billing.
Service Accounts
Give every pipeline stage its own identity with narrow roles, so a problem in one stage cannot spread widely.
Private Buckets
Keep image buckets private and avoid public access. Use short-lived access links when users must download files.
Encryption
Data is encrypted in storage and in transit by default on Google Cloud. Stricter needs can use keys you manage yourself.
Audit Logging
Record who accessed what and when, so unusual behavior can be investigated.
Network Boundaries
For sensitive workloads, consider perimeter controls that limit which networks and projects can reach your data.
Secret Handling
Never put keys inside code or image metadata. Use a secret manager and rotate credentials.
Least privilege is like giving a cleaner the key to the office floor only, not the safe room. If the key is lost, the damage stays small.
Photos often hide extra information, such as embedded location data or visible personal details. Decide what you keep, what you strip, and how long you retain images, and follow the rules for your region and industry.
24Responsible AI, Privacy and Fairness
Technology that looks at people carries duties beyond accuracy.
Vision systems can hurt people when they are used carelessly. A model trained mostly on images of certain people, places or skin tones may work noticeably worse for others. A system that analyzes faces can intrude on privacy even when it does nothing illegal. Thinking about these matters early is cheaper and kinder than fixing a harmful launch later.
Questions to ask before building
Is It Necessary?
Could you reach the goal without analyzing people’s images at all? The least intrusive design is often the best.
Do People Know?
Are people informed that images are analyzed, and have they agreed where law or fairness requires it?
Does It Work for Everyone?
Test accuracy separately across different groups and conditions, and look for gaps.
What If It Is Wrong?
Plan human review and an appeals path, especially when a decision affects someone’s access, money or safety.
How Long Do You Keep It?
Delete images and results you no longer need, and limit who can see them.
Google has published policies and guidance on acceptable use of its AI services, and some capabilities, such as identifying real people from faces, have been restricted or retired. Read the terms and policies that apply to your use, and involve legal and ethics reviewers for sensitive projects.
A camera on a building entrance is like a tool in a workshop. The same saw can build a table or cause an injury. Safety rules, training and care decide which one happens.
Write down what data you use, what you tested, and what limits you set. This record helps teams, auditors and users understand and trust your system.
25Preparing Images for Better Results
The best fix for a poor result is often a better input image.
Models are sensitive to image quality. A little care before sending an image can improve accuracy more than switching services. Preparation steps are cheap and can run in your worker before the vision call.
Fix Rotation
Phones often store a rotation flag instead of rotating the pixels. Apply it, because upside-down text confuses OCR and models alike.
Resize Sensibly
Too small loses detail. Too big wastes time and money. Aim for enough resolution that the smallest important thing is clearly visible.
Improve Contrast
For scanned pages, straightening, cleaning the background and boosting contrast can help text recognition.
Check Sharpness
Detect blurry images early and ask the user to retake the photo instead of paying to analyze a bad one.
Use Lossless or High-Quality Formats
Heavy compression adds artifacts around text and edges. Keep quality high for important images.
Crop to the Subject
If only part of the image matters, send that part so the model focuses on it and tiny details become larger.
Preparing an image is like cleaning your glasses before reading. The words did not change, but the reader will do much better.
In a mobile app, show a frame guide, warn about low light, and capture automatically when the image is steady. Good capture design beats clever post-processing.
26Monitoring and Operating a Vision System
Launching is only the beginning, because the real world keeps changing.
A vision system that worked on launch day can quietly get worse. Customers buy new phones with different cameras, the packaging changes, the lighting in a warehouse is rearranged, or a new product line appears. When live images drift away from the examples a model knows, accuracy falls. This slow decline is called drift, and you notice it only if you watch.
| What to Watch | Why | Example Signal |
|---|---|---|
| Request volume and errors | Detect outages and bugs quickly | Spike in failed calls or timeouts |
| Latency | Keep users from waiting too long | Slower responses at busy hours |
| Cost per day | Catch loops and misuse early | Sudden jump in billed units |
| Score distribution | Detect drift in image quality or content | More low-confidence results than usual |
| Human review outcomes | Measure true accuracy over time | Reviewers overturning more machine decisions |
Build a feedback loop
The best sign of real accuracy is what human reviewers decide on the cases sent to them. Save these decisions with the images. They form a fresh, realistic test set and, later, extra training data. Review a small random sample of automatically accepted cases too, since problems hide among the confident answers.
Running a model without monitoring is like driving without looking at the dashboard. The car may feel fine until the fuel is gone. Dashboards and warning lights let you act before a breakdown.
Record which model, prompt and threshold produced each result. When quality changes, you can then trace the cause and roll back safely.
27Real-World Scenarios
Concrete stories show how the pieces combine.
Scenario 1: Online Marketplace Photo Moderation
Sellers upload thousands of listing photos daily. The marketplace runs safe search on every photo, reads any text to catch contact details hidden in images, and tags the main objects for search. Photos with high risk scores are blocked, uncertain ones go to a review queue, and the rest publish immediately. Gemini handles tricky cases such as unclear, borderline images.
Scenario 2: Expense Receipt Capture
Employees photograph receipts in a mobile app. The app checks sharpness, straightens the picture, and sends it to a document-processing service to extract merchant, date and total. Rules check the extracted values against company policy, and unclear cases are shown back to the employee for confirmation before submission.
Scenario 3: Manufacturing Quality Inspection
Cameras photograph each part on a production line. A custom model trained on thousands of labeled good and defective parts flags suspicious items. Because missing a defect is costly, the threshold favors recall, and flagged parts are rechecked by a worker. Reviewer decisions return to the training set every month.
Scenario 4: Media Archive Search
A broadcaster has decades of video. The Video Intelligence service tags scenes, objects, on-screen text and speech, and the results go into a search index. Producers can find every clip of a stadium at night within seconds, instead of watching tapes.
Scenario 5: Retail Visual Search
A fashion store lets shoppers photograph an outfit they like. Product search compares the photo with the store’s catalog and returns visually similar items with links to buy. Good catalog photos from several angles lift match quality.
Scenario 6: Accessibility Descriptions
A news site uses Gemini to draft short descriptions for images, which editors check and publish as alternative text. This helps people who use screen readers while keeping a human responsible for accuracy.
Each scenario mixes the same few ingredients, like a kitchen cooking many dishes from a shared pantry. Only the recipe, meaning the choice of services and thresholds, changes.
28Key Design Decisions
Architects record important choices so that future teams understand the reasoning.
Tiered analysis instead of one expensive model for every image
Run a low-cost pre-trained service first and send only unclear cases to a more capable model, then to a person if still unclear.
Reason: most images are simple, so spending the highest cost on all of them is wasteful. The trade-off is added pipeline complexity and the need to tune the hand-off thresholds.
Queue-based processing instead of calling vision directly from uploads
Place a message queue between storage events and the workers.
Reason: queues absorb bursts, allow retries and protect quotas. The trade-off is slightly higher delay and one more component to operate.
Prompt a multimodal model before training a custom one
Prove value with prompts and examples before collecting a large labeled dataset.
Reason: it takes days, not months, and exposes whether the task is feasible. The trade-off is less consistent output and per-call costs that may be higher at huge volume.
Human review for high-impact decisions
No automated vision result alone may deny a person service, money or access.
Reason: errors are inevitable and can be unfair. The trade-off is staff cost, balanced by reviewing only uncertain or high-stakes cases.
A decision record is like a ship’s log. Years later, a new captain reads why the ship changed course at a certain point and avoids sailing back into the same rocks.
29Common Mistakes and Anti-Patterns
Learning from other teams’ mistakes is the cheapest education available.
Healthy Habits
- Test on your own images before choosing a service
- Cache results and store them with image identifiers
- Use thresholds chosen by evidence
- Keep humans in loops that affect people
- Watch cost, errors and score distributions
Risky Habits
- Trusting vendor accuracy claims without testing
- Requesting every feature just in case
- Analyzing the same image again and again
- Using face analysis where it is not necessary
- Ignoring retired features and deprecation notices
Five classic traps in detail
Demo-Driven Decisions
A tool works wonderfully on five hand-picked pictures and poorly on real uploads. Always test with a realistic sample.
Treating Scores as Truth
A score of ninety-nine percent can still be wrong. Combine scores with business rules and sample checks.
Building Custom Too Early
Teams collect thousands of labels before discovering that a ready-made service would have been enough.
No Plan for Change
Services, features and prices change. A design that hard-wires one feature may need rewrites. Keep vision calls behind a small interface in your code.
Forgetting Bad Inputs
Empty files, huge files, corrupted images and unsupported formats appear in real traffic. Validate inputs early.
Building without these checks is like crossing a river on stones you only glanced at. Most stones hold. The one that does not decides how your day ends.
30Troubleshooting Guide
When results look wrong, work through causes from simplest to hardest.
| Symptom | Likely Cause | What To Try |
|---|---|---|
| Permission denied errors | Service account lacks a role, or the API is not enabled | Enable the API in the project and grant the narrow role needed |
| Quota or rate-limit errors | Requests sent too fast | Add backoff and concurrency limits, or request a quota increase |
| Empty text result | Blurry, tilted or very small text | Fix rotation, raise resolution, try document text detection |
| Wrong or missing labels | Subject is unusual or small in the frame | Crop to the subject, or try a flexible model with a clear prompt |
| Inconsistent Gemini answers | Open-ended prompt or high randomness | Ask for a fixed format, give examples, lower randomness settings |
| Image rejected | Unsupported format or size over the limit | Convert the format, compress or use a storage location instead of inline data |
| Costs higher than expected | Too many features, repeated analysis or retry loops | Review billing by service, add caching and request fewer features |
| Accuracy dropped over time | Drift in images or new product types | Collect recent examples, retest, adjust thresholds or retrain |
A calm method
Reproduce It
Save one failing image and call the service by hand to confirm the problem is real and repeatable.
Check the Input
Open the image exactly as the service sees it. Many mysteries end here.
Read the Error Message
Responses and logs usually name the cause, such as a missing permission or an exceeded limit.
Change One Thing at a Time
Alter a single setting and compare, so you know what helped.
Troubleshooting is like a doctor’s visit. You describe the symptom, check the simple causes first, run tests, and treat one thing at a time.
31Best Practices Checklist
A short list to review before every launch.
Define Success First
Write down what accuracy, speed and cost you need, and which mistakes matter most, before choosing any tool.
Collect a Test Set
Gather a few hundred realistic labeled images and use them to compare every option fairly.
Start with the Simplest Service
Try a pre-trained API first, then a flexible model, then custom training only if needed.
Wrap Vision Calls
Hide the vision provider behind a small interface so you can swap or add services without rewriting the application.
Design for Failure
Use queues, retries with backoff, safe repeats and clear fallbacks when the service is unavailable.
Apply Least Privilege
Use separate service accounts, private buckets, audit logs and sensible retention limits.
Review Fairness and Privacy
Test across groups and conditions, limit sensitive analysis, and be open with users.
Watch Quality and Cost
Track errors, latency, daily spend and score distributions. Sample human reviews to detect drift.
Follow Product Notices
Subscribe to release and deprecation notes so a retired feature never surprises you.
A pilot walks through a checklist before every flight, however many hours she has flown. The list is not a sign of doubt, but of respect for what could go wrong.
32Frequently Asked Questions
Quick answers to the questions beginners ask most often.
The Vision API is a ready-made service with fixed image features that you call directly. Vertex AI is the broader platform where you build, tune, train and serve your own models and access models such as Gemini. Think of the first as a finished appliance and the second as a workshop.
No. You send an image, list the features you want and read the structured response. Understanding concepts such as confidence scores and thresholds helps you use results wisely, but you do not need to train anything.
The Cloud Vision API has offered a free allowance of its first 1,000 units per feature each month, with billing afterwards. Free allowances and prices can change, so confirm the current terms on the official pricing page.
Face detection finds faces and describes features like expression likelihood, but it is not designed to name individuals. A celebrity recognition feature that once existed was scheduled for shutdown in September 2025. For any identity-related use, consult legal and policy guidance first.
Google retired the older AutoML Vision and AutoML Video Intelligence products on published dates and pointed users to Vertex AI for custom model work. If you find tutorials mentioning them, treat those as historical and check current Vertex AI documentation.
It depends heavily on image quality, language, font and layout. Clear printed text can be read very well, while blurry, tilted or handwritten text is harder. Test on your own documents rather than rely on general claims.
Use Vision OCR for predictable, high-volume text extraction at a fixed price per image. Use Document AI when you need named fields from known document types. Use Gemini when documents are unusual or when you need custom interpretation, and validate its output carefully.
Use asynchronous batch processing or a queue-based pipeline with workers that scale automatically, limit concurrency, retry with backoff and store results under unique image identifiers.
Request only needed features, resize images, cache results, use a cheap first pass before expensive analysis, and set billing budgets with alerts. Estimate with the official pricing calculator before a big job.
Google Cloud provides encryption and access controls, but safety also depends on your own settings: private buckets, narrow permissions, retention limits and compliance with privacy law. Review the data processing terms that apply to the specific service you choose.
Common formats such as JPEG and PNG are widely supported, and Gemini lists support for formats including WEBP, HEIC and HEIF. Each service documents its supported formats and size limits, so check before building an upload flow.
There is no single number. It depends on how different the classes look and how varied your conditions are. Start with a modest set, measure, and add data where the errors cluster. Quality and variety beat sheer quantity.
Generative models produce text with some randomness, and wording can shift. Lower the randomness setting, give clear instructions and examples, and request a fixed output structure to improve consistency.
Video Intelligence has offered a streaming mode with a smaller set of features than stored video analysis. Other Google Cloud offerings also address video analytics. Check which options are currently available and supported for your needs.
Keep vision calls behind a small interface in your code, follow product release and deprecation notices, and keep a test set so you can quickly evaluate a replacement service.
Not for low-risk tasks such as photo tagging. For decisions that affect people’s money, access or safety, include human review for uncertain or high-impact cases and give people a way to appeal.
Enable the Vision API in a test project, try the browser-based demo or a single request with a few of your own images, then test a Gemini prompt on the same images. Compare accuracy and cost, and pick the simplest option that meets your goals.
Classification gives one answer for the whole picture, such as “damaged” or “not damaged”. Object detection finds each separate item and tells you where it sits, so it can count items and highlight them. Choose classification when the whole image has one verdict, and detection when location or counting matters.
Yes, and many strong designs do. A common mix reads text with a document service, checks safety with the Vision API, and uses Gemini only for puzzling images. Keep each service behind a clear interface, record which one produced each result, and compare their accuracy and cost regularly.
Collect a few hundred representative images with correct answers, run the service, and try several thresholds. For each, count false alarms and misses. Pick the point where the mix of mistakes matches what your business can tolerate, then revisit the choice after launch using reviewer decisions.
The managed APIs described here run in Google Cloud and need an internet connection. Some projects need models near cameras, for speed or privacy. Options for that exist, but they change often, so check current Google documentation for edge deployment before planning around them.
Use a throwaway project with a billing budget and alert, enable the Vision API, and try a dozen of your own photos: a street scene, a receipt, a product label and a landscape. Compare label, text and object results, then ask Gemini the same questions about those photos and note where each service is stronger.
33Summary and Key Takeaways
Everything in this guide in one short page.
Vision AI in Google Cloud is a family of services for understanding images, documents and video. Pre-trained APIs give fast, predictable answers for standard tasks. Gemini offers flexible, conversational understanding for open and custom tasks. Document AI structures business paperwork. Custom models on Vertex AI cover special needs when general services fall short. Success comes less from the cleverness of a model than from clean inputs, honest testing, careful thresholds, secure handling and steady monitoring.
Key Takeaways
- Start with the simplest service that could work: Vision API for standard tasks, Document AI for business documents, Gemini for open questions, custom models only when proven necessary.
- Treat confidence scores as signals, choose thresholds using your own labeled test images, and weigh false alarms against misses according to business impact.
- Build event-driven pipelines with queues, retries, caching and saved results, and process large archives with asynchronous batch methods.
- Control cost by requesting only needed features, resizing images, avoiding repeat analysis, using tiered checks and setting budget alerts, and confirm current prices on official pages.
- Protect data with least privilege, private storage, audit logs and sensible retention, and treat faces and personal images with extra care.
- Plan for fairness and human review, test across different groups and conditions, and monitor for drift after launch.
- Expect change: products are renamed and features retired, so wrap vision calls in a small interface and follow official deprecation notices.