A camera captures an image in milliseconds. Recognizing what is inside that image, however, is a much more interesting problem.
When you upload a photograph to Google Lens or use your phone's camera to identify an object, the software is doing more than comparing colors or matching shapes. It uses models trained on visual data to recognize patterns that are associated with objects, people, places, and other things.
This field is called computer vision. What makes it interesting is that a computer does not need a programmer to manually describe every possible object. A trained model can learn useful visual features from examples and apply them to images it has never seen before.
So, how does that actually work?
An image is data, not meaning
Every digital photograph is made up of pixels. In a typical RGB image, each pixel contains red, green, and blue values. A model receives these numbers as input, usually after the image has been resized and normalized.
But a collection of pixel values does not automatically tell a computer that it is looking at a dog.
Consider two photographs of the same dog. One is taken outdoors in bright sunlight; the other is captured in a dimly lit room. The colors, shadows, and background may look very different, even though the subject is the same.
A useful recognition system must learn patterns that remain meaningful despite these changes.
This is one reason deep learning became so important to computer vision. Instead of relying entirely on features manually designed by developers, neural networks can learn visual representations from training data.
Stanford University's CS231n course on computer vision explains the foundations of image classification, neural networks, convolutional networks, and object detection in greater depth.
How does a model learn what it is looking at?
Imagine building a system that distinguishes cats from dogs.
The first step is collecting a dataset containing images of both animals. During supervised training, the images are associated with labels so the model can learn which patterns help distinguish the categories.
The dataset matters more than it might initially seem. If the model mostly sees cats indoors and dogs outdoors, it could learn misleading associations between the background and the animal. It might perform well on familiar examples but fail when those conditions change.
During training, the model makes predictions and compares them with the expected labels. An optimization process adjusts its parameters to reduce prediction errors over many iterations.
Eventually, the model learns visual patterns that help it distinguish the categories. It is not memorizing a single definition of a cat; it is learning statistical relationships from the examples it receives.
Convolutional neural networks, commonly called CNNs, have played a major role in this process. Their convolution operations help extract local patterns from images, while deeper layers combine information into more complex representations.
Modern computer vision also uses Vision Transformers and other architectures. The best choice depends on the problem, available training data, accuracy requirements, and computing resources.
Once training is complete, the model can be used for inference: processing a new image and producing a prediction.
The distinction is important. Training teaches the model; inference uses what it has learned.
Recognizing an object is different from locating it
There is another detail that often gets overlooked when discussing image recognition: identifying an object and finding its position are separate tasks.
An image classifier might look at a photograph and return the label bicycle. That is enough if an application only needs to categorize the image.
An object detector does something more. It can identify a bicycle, a person, and a car in the same photograph and estimate where each object appears.
Those locations are often represented by bounding boxes: rectangles drawn around detected objects.
This distinction matters in practical applications. A photo-organizing application might need image classification, while a traffic monitoring system needs to know where each vehicle is located. A manufacturing system may need to locate a small defect on a product rather than simply classify the entire product as defective.
The model should be selected according to what the application needs to do, not just whether it supports the general idea of object recognition.
What changes when the input is a video?
A video is a sequence of frames. A recording captured at 30 frames per second contains 30 images for every second of footage.
One way to analyze a video is to run an object detector on its individual frames. This can identify objects as they appear, but it does not automatically maintain their identities over time.
For example, imagine a camera recording two cars driving through an intersection. The detector may identify both cars in successive frames, but the system still needs a way to determine which detection corresponds to which car.
This is where object tracking comes in.
Tracking algorithms associate detections across frames using information such as location, movement, and visual appearance. A tracking system can then maintain an identifier for an object as it moves through the scene.
That makes it possible to count vehicles, estimate movement, or follow objects across a camera feed.
There is a further distinction between tracking an object and understanding an activity. Detecting a person does not tell a system whether that person is walking, running, or falling. Activity recognition requires analyzing movement and changes across multiple frames.
In other words, video understanding involves more than repeatedly running an image classifier. The application must also account for time and relationships between observations.
Let's build a small object detector
You do not need to train a neural network from scratch to try computer vision. Pretrained models are available for common tasks, including detecting objects in photographs and videos.
One option is Ultralytics YOLO, which provides a Python interface for running predictions on different input sources.
Install the package first:
pip install ultralytics
Then create a Python file and run the following example:
from ultralytics import YOLO
model = YOLO("yolo26n.pt")
results = model.predict(
source="street.jpg",
conf=0.4,
save=True
)
for result in results:
for box in result.boxes:
class_id = int(box.cls[0])
confidence = float(box.conf[0])
label = model.names[class_id]
print(f"{label}: {confidence:.2f}")
Use a checkpoint supported by your installed Ultralytics version, and replace street.jpg with the path to your image.
The model processes the photograph and returns detections for the object categories it recognizes. The confidence threshold controls which predictions are retained, while save=True requests an annotated output image.
The confidence value should not be interpreted as a guarantee that a prediction is correct. A model can confidently misidentify an object, especially when the image differs from the examples it learned from.
The same prediction interface supports video inputs. For example, changing the source to traffic.mp4 lets the model process a video file. Persistent object tracking is a separate capability that can be explored through the library's tracking functionality.
The example is a starting point, not a complete production system. A real application may also need input validation, error handling, performance monitoring, and a way to evaluate incorrect or missed detections.
Why computer vision still makes mistakes
A model can work well on a collection of test images and still struggle when it encounters unfamiliar conditions.
Poor lighting may hide important details. Motion blur can make a moving object difficult to identify. An object partially hidden behind another object may not provide enough visible information for reliable detection.
Training data creates another challenge. If certain objects, environments, or viewpoints are underrepresented, the model may perform poorly on them. This is why evaluation on realistic data is essential.
There are also practical trade-offs. A smaller model may be easier to run on a phone or an inexpensive camera, but it may not detect small objects as reliably as a larger model. Processing every frame of a high-resolution video can also demand more computing power than the application can afford.
Developers must decide what level of accuracy is necessary, how quickly results are needed, and what should happen when the model is uncertain.
For a personal photo-organizing tool, an occasional incorrect label may be manageable. In a medical or safety-critical application, incorrect predictions can have much more serious consequences and require appropriate validation and human oversight.
Where is the technology heading?
Computer vision is moving beyond detecting individual objects. Vision-language models can connect visual information with natural language, allowing applications to answer questions about images or search for visual content using text. Video models are also being developed to reason about events across longer sequences.
At the same time, smaller models are making it increasingly practical to process images directly on phones, cameras, and embedded devices. Local processing can reduce dependence on network connectivity, although hardware constraints still matter.
These developments do not remove the underlying challenges. Models still need representative data, careful evaluation, and responsible deployment.
The more capable the system becomes, the more important it is to understand what its predictions actually mean and where they can fail.
Final thoughts
Artificial intelligence recognizes objects by learning useful patterns from visual data. Deep learning models transform pixel values into representations that help them classify images or locate objects. Video systems build on these capabilities by connecting observations across frames and analyzing movement over time.
For developers, the best way to understand the process is to experiment with a pretrained model, test it on different images, and investigate its mistakes. A successful detection demonstrates what the model can do; a failed detection often reveals what still needs to be improved.
Computer vision is not simply about teaching a machine to recognize a cat or a car. It is about building software that can extract useful information from visual data and use it reliably in the real world.
Sources
- Stanford CS231n: Convolutional Neural Networks for Visual Recognition — foundations of deep learning and visual recognition.
- Ultralytics YOLO: Predict Mode Documentation — practical examples for running inference on images and videos.
- Ultralytics YOLO: Tracking Documentation — how object tracking extends detection across video frames.
Top comments (0)