Ultralytics YOLO27: Join the waitlist.
Get Started

Ultralytics Solutions: Harness YOLO26 to Solve Real-World Problems#

Ultralytics Solutions are ready-to-use applications of Ultralytics YOLO models for common computer vision problems such as object counting, heatmaps, speed estimation, queue management, and object blurring. Most solutions wrap detection, tracking, or pose estimation in a configurable class that you can run from Python or the yolo solutions CLI.

Ultralytics Solutions Thumbnail



Watch: How to Run Ultralytics Solutions from the Command Line (CLI) | Ultralytics YOLO26 🚀

Solutions#

Each solution below has a dedicated guide:

Solutions Arguments#

ArgumentTypeDefaultDescription
modelstrNonePath to an Ultralytics YOLO model file.
regionlist or dictNonePoints defining the region of interest, either a list of (x, y) tuples or a dictionary mapping region names to point lists for multiple regions (RegionCounter only). When None, solutions that require a region fall back to a predefined default.
show_inboolTrueFlag to control whether to display the in counts on the video stream.
show_outboolTrueFlag to control whether to display the out counts on the video stream.
analytics_typestr'line'Type of graph, i.e., line, bar, area, or pie.
colormapintcv2.COLORMAP_DEEPGREENColormap to use for the heatmap.
line_widthint2Line thickness for the boxes, keypoints and counts the solution draws.
verboseboolTrueEnables the solution's per-frame log of input shape, class counts and processing speed. The tracking call itself is always silent.
json_filestrNonePath to the JSON file that contains all parking coordinates data.
up_anglefloat145.0Angle threshold for the 'up' pose.
kptslist[int][6, 8, 10]List of three keypoint indices used for monitoring workouts. These keypoints correspond to body joints or parts, such as shoulders, elbows, and wrists, for exercises like push-ups, pull-ups, squats, and ab-workouts.
down_anglefloat90.0Angle threshold for the 'down' pose.
blur_ratiofloat0.5Adjusts percentage of blur intensity, with values in range 0.1 - 1.0.
crop_dirstr'cropped-detections'Directory name for storing cropped detections.
recordsint5Total detections count to trigger an email with security alarm system.
vision_pointtuple[int, int](20, 20)The point where vision will track objects and draw paths using VisionEye Solution.
sourcestrNonePath to the input source (video, RTSP, etc.). Only usable with Solutions command line interface (CLI).
figsizetuple[float, float](12.8, 7.2)Figure size in inches for Analytics charts; (12.8, 7.2) renders a 1280×720 frame.
fpsfloat30.0Frames per second used for speed calculations.
max_histint5Maximum historical points to track per object for speed/direction calculations.
meter_per_pixelfloat0.05Scaling factor used for converting pixel distance to real-world units.
max_speedint120Maximum speed in km/h; higher estimated speeds are capped at this value.
datastr'images'Path to image directory used for similarity search.
imgszint640Input image size for model inference.
Track args

Solutions forward the inference and tracking arguments below to model.track().

ArgumentTypeDefaultDescription
trackerstr'tracktrack.yaml'Specifies the tracking algorithm to use. Built-in options: botsort.yaml, bytetrack.yaml, ocsort.yaml, deepocsort.yaml, fasttrack.yaml, tracktrack.yaml.
conffloat0.25Sets the confidence threshold for detections; lower values allow more objects to be tracked but may include false positives.
ioufloat0.7Sets the Intersection over Union (IoU) threshold for filtering overlapping detections.
classeslistNoneFilters results by class index. For example, classes=[0, 2, 3] only tracks the specified classes.
devicestrNoneSpecifies the device for inference (e.g., cpu, cuda:0 or 0). Allows users to select between CPU, a specific GPU, or other compute devices for model execution.
imgszint or tuple640Target inference image size: an integer for a square or a (height, width) pair. Shapes are adjusted to the model stride.
max_detint300Maximum number of detections kept per frame before tracking, limiting the objects a solution processes in dense scenes.
quantizeint or strNoneInference precision: 16 (FP16) or 32/unset (FP32) for PyTorch and TorchScript models off CPU; other formats use the precision their artifact and runtime select. Replaces the deprecated half arg.
Visualization args

You can use show_conf, show_labels, and other mentioned arguments to customize the visualization.

ArgumentTypeDefaultDescription
showboolFalseIf True, displays the annotated images or videos in a window. Useful for immediate visual feedback during development or testing.
show_confboolTrueDisplays the confidence score for each detection alongside the label. Gives insight into the model's certainty for each detection.
show_labelsboolTrueDisplays labels for each detection in the visual output. Provides immediate understanding of detected objects.

Usage of SolutionAnnotator#

All Ultralytics Solutions use the SolutionAnnotator class, which extends the main Annotator class and provides the following methods:

MethodReturn TypeDescription
draw_region()NoneDraws a region using specified points, colors, and thickness.
queue_counts_display()NoneDisplays queue counts in the specified region.
display_analytics()NoneDisplays overall statistics for parking lot management.
estimate_pose_angle()floatCalculates the angle between three points in an object pose.
draw_specific_kpts()np.ndarrayDraws specific keypoints on the image.
plot_workout_information()intDraws a labeled text box on the image.
plot_angle_and_count_and_stage()NoneVisualizes angle, step count, and stage for workout monitoring.
plot_distance_and_line()NoneDisplays the distance between centroids and connects them with a line.
display_objects_labels()NoneAnnotates bounding boxes with object class labels.
sweep_annotator()NoneVisualizes a vertical sweep line and optional label.
visioneye()NoneMaps and connects object centroids to a visual "eye" point.
adaptive_label()NoneDraws a circular or rectangular background label in the center of a bounding box.

Working with SolutionResults#

Every solution except Similarity Search returns a SolutionResults object when called.

  • For object counting, the results include in_count, out_count, and classwise_count.
SolutionResults
import cv2

from ultralytics import solutions

im0 = cv2.imread("path/to/img")

region_points = [(20, 400), (1080, 400), (1080, 360), (20, 360)]

counter = solutions.ObjectCounter(
    show=True,  # display the output
    region=region_points,  # pass region points
    model="yolo26n.pt",  # model="yolo26n-obb.pt" for object counting with OBB model.
    # classes=[0, 2],  # count specific classes i.e. person and car with COCO pretrained model.
    # tracker="botsort.yaml"  # Choose trackers i.e "bytetrack.yaml"
)
results = counter(im0)
print(results.in_count)  # display in_counts
print(results.out_count)  # display out_counts
print(results.classwise_count)  # display classwise_count

SolutionResults objects have the following attributes:

AttributeTypeDescription
plot_imnp.ndarrayImage with visual overlays such as counts, blur effects, or solution-specific enhancements.
in_countintTotal number of objects detected entering the defined zone in the video stream.
out_countintTotal number of objects detected exiting the defined zone in the video stream.
classwise_countdict[str, dict[str, int] | int]Per-class counts: {"IN": int, "OUT": int} for ObjectCounter and Heatmap, or an int for Analytics.
queue_countintNumber of objects currently within a predefined queue or waiting area (suitable for queue management).
workout_countlist[int]Per-track workout repetition counts from AI Gym (one entry per currently tracked individual).
workout_anglelist[float]Per-track exercise angles from AI Gym (one entry per currently tracked individual).
workout_stagelist[str]Per-track current workout stage from AI Gym (one entry per currently tracked individual).
pixels_distancefloatPixel-based distance between two objects or points, such as bounding boxes (suitable for distance calculation).
available_slotsintNumber of unoccupied slots in a monitored area (suitable for parking management).
filled_slotsintNumber of occupied slots in a monitored area (suitable for parking management).
email_sentboolIndicates whether a notification or alert email has been successfully sent (suitable for security alarm).
total_tracksintTotal number of unique object tracks observed during video analysis.
region_countsdict[str, int]Object counts within user-defined regions or zones.
speed_dictdict[int, int]Track-wise dictionary of estimated object speeds in km/h from SpeedEstimator, useful for velocity analysis.
total_crop_objectsintTotal number of cropped object images generated by the ObjectCropper solution.
speeddict[str, float]Dictionary containing performance metrics for tracking and solution processing.

For more details, refer to the SolutionResults class documentation.

Solutions Usage via CLI#

Command Info

Most solutions can be run directly from the command-line interface.

Syntax

yolo SOLUTIONS SOLUTION_NAME ARGS
  • SOLUTIONS is a required keyword.
  • SOLUTION_NAME is one of: ['count', 'crop', 'blur', 'workout', 'heatmap', 'isegment', 'queue', 'speed', 'analytics', 'trackzone', 'inference', 'visioneye', 'region', 'security', 'parking'].
  • ARGS (optional) are custom arg=value pairs, such as show_in=True, to override default settings.
yolo solutions count show=True # for object counting

yolo solutions count source="path/to/video.mp4" # specify video file path

Contribute to Our Solutions#

Community contributions are welcome. If you have built a solution with Ultralytics YOLO that is not covered here, consider sharing it as a guide so other users can benefit.

FAQ#

  • Ultralytics YOLO26 counts objects in real time by combining detection with tracking, so each object is counted once as it crosses a line or enters a region. To set up YOLO26 for live video stream analysis, install ultralytics, load a model, and pass video frames to solutions.ObjectCounter.

  • Ultralytics YOLO26 adds real-time object detection and alerting to camera-based security systems. With the Security Alarm System solution, YOLO26 sends an email alert when the number of detected objects in the surveillance area reaches a threshold.

  • Ultralytics YOLO26 counts and tracks people inside a queue region, giving you live queue lengths that help reduce wait times and plan staffing.

  • Yes. Ultralytics YOLO26 pose models track body keypoints in real time, so the workout monitoring solution can measure joint angles, count repetitions, and report the current exercise stage.

  • Ultralytics YOLO26 can generate heatmaps that show where objects appear or move most often in a scene, highlighting regions of high activity. These data visualizations help you understand traffic patterns and trends over time.

Comments23

Ask a question, share your results, or help someone else.

    1. Glenn JocherGlenn JocherUltralytics(edited)

      @ZHIYUAN816 you don't need to set anything: the warning has no effect on training or metrics, only on how many items are drawn on the plotted validation images (optional, for visual review). In current versions that limit follows the max_det argument (default 300).

  1. ZHIYUAN816ZHIYUAN816GitHub

    WARNING ⚠️ Limiting validation plots to first 50 items per image for speed... WARNING ⚠️ Limiting validation plots to first 50 items per image for speed... how to solve this problem bro?

    1. Glenn JocherGlenn JocherUltralytics(edited)

      @ZHIYUAN816 this is not an error but a warning that the plotted prediction images are limited to a maximum number of items per image. It does not affect training. In current versions the limit follows max_det (default 300).

  2. smc0927smc0927GitHub

    If I want a target to be detected only once, is it possible? If so, how can I do it?

    1. RizwanMunawarRizwanMunawarGitHub

      @smc0927 Hi! I’m not entirely sure I understand your question. Could you please clarify a bit?

      Generally, the counting process is designed to occur only once for each track ID. Once an object is counted, it won't be counted again, even if it crosses the same region or line multiple times.

    2. smc0927smc0927GitHub

      ok,I want to print out the coordinates of the target, but that's not what I want because it's going to be printed multiple times over a period of time. I want it to be output only once, is there a way to achieve this?

    3. RizwanMunawarRizwanMunawarGitHub

      @smc0927 Yes it's possible. You can simply iterate over the detection results. BTW, this discussion is more related to Ultralytics solutions, while your question is related to prediction :)

      Sample Code

      from ultralytics import YOLO
      model = YOLO("yolo11n.pt")
      results = model.predict("path/to/im0")
      
      if results[0].boxes.id is not None:
            boxes = results[0].boxes.xyxy.cpu()
            track_ids = results[0].boxes.id.int().cpu().tolist()
            clss = results[0].boxes.cls.cpu().tolist()
      
            for box, cls in enumerate(boxes, clss):
                # Here you can add the logic to display single-time details of the object

      Thanks :)

  3. hodat2608hodat2608GitHub

    Hi everyone, hi @glenn-jocher, I want to install pycuda on my windows 10 using python 3.12, but I still can't do it. It's hard to find any documentation or tutorials like that, @glenn-jocher or anyone can send me a link or tutorial to install pycuda? Please help me. Thanks first

  4. maxexplorermaxexplorerGitHub

    Hi there,

    After updating Ultralytics and using YOLO11, will the YOLOv8 models still work in this virtual environment?

    Thank you in advance for your help and the great work you’re doing!

    1. Glenn JocherGlenn JocherUltralytics

      @maxexplorer yes, YOLOv8 models will continue to work in your virtual environment after updating to YOLO11. If you have further questions, feel free to ask!

  5. yosifsaabyosifsaabGitHub

    hi i have error during using the google colab for classification two classes images by yolov8n
    results = model.train(data=DATA_DIR, epochs=1, imgsz=64)

    1. Glenn JocherGlenn JocherUltralytics

      @yosifsaab it seems you're encountering an error with YOLOv8n in Google Colab. Please ensure your DATA_DIR is correctly set and that your dataset is properly formatted. If the issue persists, check the Colab notebook for any specific error messages that might provide more details. For further assistance, you can refer to the Ultralytics documentation.

  6. NkosiyazimelaniNkosiyazimelaniGitHub

    Hi guys, how do i update the nc that my model can detect without having to train with old and new objects. i have updated my .YAML file but the model is still detecting the old number of objects(20 instead of 46). i have been told to look on the model itself and change the output number of class to the new updated on but there is nothing of that sort in the model file( best.pt). please help.

    1. Glenn JocherGlenn JocherUltralytics(edited)

      @Nkosiyazimelani the number of classes (nc) is part of the trained model's detection head, so editing the .yaml file after training doesn't change what best.pt predicts. You need to train again with a dataset YAML that has all 46 classes. You don't have to start from scratch, you can fine-tune from your existing weights, and the layers whose shapes depend on the class count are reinitialized automatically:

      from ultralytics import YOLO
      
      model = YOLO("best.pt")
      model.train(data="your_46_class_dataset.yaml", epochs=100)

      Make sure your dataset contains labeled examples of both the old and the new classes, otherwise the model will forget the old ones.

    1. Glenn JocherGlenn JocherUltralytics

      @nounotabe to specify the device for running YOLOv8, you can use the device argument. For example, to use the second GPU (cuda:1), you can set device='cuda:1'. This can be done in both the CLI and Python API. If you encounter any issues, please ensure you are using the latest version of the package. For more detailed guidance, you can refer to our documentation at https://docs.ultralytics.com.

    2. cobaltautomationdevcobaltautomationdevGitHub

      lasted version of ultralytics. solutions not works in Windows10, but works in Google Colab. What's wrong with it? How to settle it? from ultralytics import solutions,YOLO , Couldn't import solutions in my windows10.

    3. Glenn JocherGlenn JocherUltralytics

      It seems like there might be an issue with the solutions module on Windows 10. Please ensure you are using the latest version of the Ultralytics package. If the issue persists, try reinstalling the package or running the code in a different environment. For further assistance, you can refer to our documentation at https://docs.ultralytics.com/solutions/.

    4. cobaltautomationdevcobaltautomationdevGitHub

      Just updated to v8.2.78 today ,uninstall and reinstall the latest version. and now it works on Windows10 . it seems there something changed in solutions init.py . this file caused import error in previous version. I noticed that in version 8.2.0, file init.py is blank. now add some code in it.