0
0
Computer Visionml~5 mins

YOLO architecture concept in Computer Vision

Choose your learning style9 modes available
Introduction
YOLO helps computers find and recognize many objects in a picture quickly and all at once.
When you want to detect objects like cars, people, or animals in photos or videos.
When you need fast object detection for real-time tasks like self-driving cars or security cameras.
When you want to count or track objects moving in a video.
When you want to build apps that understand scenes by spotting many things at once.
When you need a simple model that works well on devices with limited power.
Syntax
Computer Vision
model = YOLO(input_image)
predictions = model.detect_objects()
YOLO stands for 'You Only Look Once' because it looks at the image just one time to find objects.
The model splits the image into a grid and predicts bounding boxes and labels for each grid cell.
Examples
This example shows using the YOLO version 3 model to detect objects in an image.
Computer Vision
model = YOLOv3()
predictions = model.detect(image)
YOLOv5 is a newer, faster version that can also detect objects in images.
Computer Vision
model = YOLOv5()
predictions = model.detect(image)
Sample Model
This code loads a small YOLOv5 model, runs it on a sample image, and prints the detected object names and confidence scores.
Computer Vision
import torch
from PIL import Image

# Load a pre-trained YOLOv5s model from torch hub
model = torch.hub.load('ultralytics/yolov5', 'yolov5s', pretrained=True)

# Run detection on example image from URL
results = model('https://ultralytics.com/images/zidane.jpg')

# Print detected objects
print(results.pandas().xyxy[0][['name', 'confidence']])
OutputSuccess
Important Notes
YOLO models are fast because they predict all objects in one pass over the image.
YOLO divides the image into a grid and predicts bounding boxes and class probabilities for each grid cell.
Different versions of YOLO improve speed and accuracy, like YOLOv3, YOLOv4, YOLOv5, and YOLOv8.
Summary
YOLO finds many objects in an image quickly by looking once.
It splits the image into grids and predicts boxes and labels for each part.
YOLO is great for real-time object detection tasks.