Skip to content

Instantly share code, notes, and snippets.

View RizwanMunawar's full-sized avatar
❄️
Building something cool in computer vision 🚀

Muhammad Rizwan Munawar RizwanMunawar

❄️
Building something cool in computer vision 🚀
View GitHub Profile
@RizwanMunawar
RizwanMunawar / predict.py
Created October 29, 2024 16:49
Object Detection using Ultralytics YOLO11
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
@RizwanMunawar
RizwanMunawar / segment.py
Created October 29, 2024 16:51
Instance Segmentation using Ultralytics YOLO11
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
@RizwanMunawar
RizwanMunawar / pose.py
Created October 29, 2024 16:53
Pose Estimation using Ultralytics YOLO11
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
@RizwanMunawar
RizwanMunawar / obb.py
Created October 29, 2024 16:54
Oriented Bounding Boxes using Ultralytics YOLO11
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