examples/heatmaps.ipynb
中文 | 한국어 | 日本語 | Русский | Deutsch | Français | Español | Português | Türkçe | Tiếng Việt | العربية
<a href="https://github.com/ultralytics/ultralytics/actions/workflows/ci.yml"></a> <a href="https://console.paperspace.com/github/ultralytics/ultralytics"></a> <a href="https://colab.research.google.com/github/ultralytics/ultralytics/blob/main/examples/heatmaps.ipynb"></a> <a href="https://www.kaggle.com/models/ultralytics/yolo26"></a> <a href="https://ultralytics.com/discord"></a>
Welcome to the Ultralytics YOLO26 🚀 notebook! <a href="https://github.com/ultralytics/ultralytics">YOLO26</a> is the latest version of the YOLO (You Only Look Once) AI models developed by <a href="https://ultralytics.com">Ultralytics</a>. This notebook serves as the starting point for exploring the various resources available to help you get started with YOLO26 and understand its features and capabilities.
YOLO26 models are fast, accurate, and easy to use, making them ideal for various object detection and image segmentation tasks. They can be trained on large datasets and run on diverse hardware platforms, from CPUs to GPUs.
We hope that the resources in this notebook will help you get the most out of YOLO26. Please browse the YOLO26 <a href="https://docs.ultralytics.com/guides/heatmaps">Heatmap Docs</a> for details, raise an issue on <a href="https://github.com/ultralytics/ultralytics">GitHub</a> for support, and join our <a href="https://ultralytics.com/discord">Discord</a> community for questions and discussions!
</div>pip install ultralytics and dependencies and check software and hardware.
!uv pip install ultralytics
import ultralytics
ultralytics.checks()
A heatmap generated with Ultralytics YOLO26 transforms complex data into a vibrant, color-coded matrix. This visual tool employs a spectrum of colors to represent varying data values, where warmer hues indicate higher intensities and cooler tones signify lower values. Heatmaps excel in visualizing intricate data patterns, correlations, and anomalies, offering an accessible and engaging approach to data interpretation across diverse domains.
| Transportation | Retail |
|---|---|
| Ultralytics YOLO11 Transportation Heatmap | Ultralytics YOLO11 Retail Heatmap |
import cv2
from ultralytics import solutions
# Open video file
cap = cv2.VideoCapture("path/to/video.mp4")
assert cap.isOpened(), "Error reading video file"
# Get video properties
w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS))
# Initialize video writer
video_writer = cv2.VideoWriter("heatmap_output.avi", cv2.VideoWriter_fourcc(*"mp4v"), fps, (w, h))
# Initialize heatmap object
heatmap_obj = solutions.Heatmap(
colormap=cv2.COLORMAP_PARULA, # Color of the heatmap
show=True, # Display the image during processing
model="yolo26n.pt", # Ultralytics YOLO26 model file
)
while cap.isOpened():
success, im0 = cap.read()
if not success:
print("Video frame is empty or video processing has been successfully completed.")
break
# Generate heatmap on the frame
results = heatmap_obj(im0)
# Write the frame to the output video
video_writer.write(results.plot_im)
# Release resources
cap.release()
video_writer.release()
cv2.destroyAllWindows()
For more information on using heatmaps with Ultralytics, you can explore the comprehensive Ultralytics Heatmaps Docs. This guide covers everything from basic concepts to advanced techniques, ensuring you get the most out of your heatmap visualizations.
At Ultralytics, we are committed to providing cutting-edge AI solutions. Here are some key resources to learn more about our company and get involved with our community:
YOLO26 is the latest evolution in the YOLO series, offering state-of-the-art performance in object detection and image segmentation. Here are some essential resources to help you get started with YOLO26:
These resources are designed to help you leverage the full potential of Ultralytics' offerings and YOLO26. Whether you're a beginner or an experienced developer, you'll find the information and support you need to succeed.