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 / crop_and_display_objects.py
Created April 19, 2026 07:32
crop and display objects
import cv2
import numpy as np
from ultralytics import YOLO
from ultralytics.utils.plotting import Annotator, colors
class YOLOSpotlight:
"""
YOLO Interactive Object Tracker with Live Crop Display. Click on any detected object to track
@RizwanMunawar
RizwanMunawar / trajectory-forecasting-using-movingpandas-yolo26.py
Last active April 19, 2026 07:29
trajectory-forecasting-using-movingpandas-yolo26
# ======================================
# Ultralytics YOLO + Tracking + Forecast
# ======================================
import cv2
import torch
import numpy as np
from collections import defaultdict, deque
from ultralytics import YOLO
from ultralytics.utils.plotting import colors
@RizwanMunawar
RizwanMunawar / obb.py
Last active April 19, 2026 07:25
Oriented Bounding Boxes using Ultralytics YOLO26
from ultralytics import YOLO
# Load a model
model = YOLO("yolo26n-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
@RizwanMunawar
RizwanMunawar / pose.py
Last active April 19, 2026 07:26
Pose Estimation using Ultralytics YOLO11
from ultralytics import YOLO
# Load a model
model = YOLO("yolo26n-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 / segment.py
Last active April 19, 2026 07:26
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("yolo26n-seg.pt")
# Get the class names from the model
names = model.model.names
@RizwanMunawar
RizwanMunawar / predict.py
Last active April 19, 2026 07:26
Object Detection using Ultralytics YOLO11
from ultralytics import YOLO
# Load a model
model = YOLO("yolo26n.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