This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ultralytics import YOLO | |
# Load a model | |
model = YOLO("yolo11n-obb.pt") # load an official model | |
model = YOLO("path/to/best.pt") # load a custom model | |
# Predict with the model | |
results = model("https://ultralytics.com/images/boats.jpg") # predict on an image | |
results = model("Path/to/video/file.mp4") # predict on a video |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ultralytics import YOLO | |
# Load a model | |
model = YOLO("yolo11n-pose.pt") # load an official model | |
# Predict with the model | |
results = model("https://ultralytics.com/images/bus.jpg") # predict on an image | |
results = model("Path/to/video/file.mp4") # predict on a video |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 # OpenCV library for image/video processing | |
from ultralytics import YOLO # Ultralytics YOLO model for object detection/segmentation | |
from ultralytics.utils.plotting import Annotator, colors # Utilities for annotating and visualizing YOLO results | |
# Load the Ultralytics YOLO11 segmentation model | |
model = YOLO("yolo11n-seg.pt") | |
# Get the class names from the model | |
names = model.model.names |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ultralytics import YOLO | |
# Load a model | |
model = YOLO("yolo11n.pt") # load an official model | |
# Predict with the model | |
results = model("https://ultralytics.com/images/bus.jpg") # predict on an image | |
results = model("path/to/video/file.mp4") # predict on a video |