![]() Return a copy of the Results object with all tensors as numpy arrays. Return a copy of the Results object with all tensors on CPU memory. Update the boxes, masks, and probs attributes of the Results object. Return the number of detections in the Results object. Return a Results object for the specified index. Results objects have the following methods: Method The original image shape in (height, width) format.Ī Boxes object containing the detection bounding boxes.Ī Masks object containing the detection masks.Ī Probs object containing probabilities of each class for classification task.Ī Keypoints object containing detected keypoints for each object.Ī OBB object containing the oriented detection bounding boxes.Ī dictionary of preprocess, inference, and postprocess speeds in milliseconds per image. Results objects have the following attributes: Attribute Video SuffixesĪll Ultralytics predict() calls will return a list of Results objects:įrom ultralytics import YOLO # Load a pretrained YOLOv8n model model = YOLO ( 'yolov8n.pt' ) # Run inference on an image results = model ( 'bus.jpg' ) # list of 1 Results object results = model () # list of 2 Results objects The below table contains valid Ultralytics video formats. The below table contains valid Ultralytics image formats. See the tables below for the valid suffixes and example predict commands. YOLOv8 supports various image and video formats, as specified in data/utils.py. Show predicted images and videos if environment allows Return feature vectors/embeddings from given layers cuda device=0/1/2/3 or device=cpuīuffer all streaming frames (True) or return the most recent frame (False)Īpply image augmentation to prediction sourcesįilter results by class, i.e. Image size as scalar or (h, w) list, i.e. Intersection over union (IoU) threshold for NMS Object confidence threshold for detection predict ( 'bus.jpg', save = True, imgsz = 320, conf = 0.5 ) 8 streams will run at batch-size 8.īelow are code examples for using each source type:įrom ultralytics import YOLO # Load a pretrained YOLOv8n model model = YOLO ( 'yolov8n.pt' ) # Run inference on 'bus.jpg' with arguments model. *.streams text file with one stream URL per row, i.e. URL for streaming protocols such as RTSP, RTMP, TCP, or an IP address. Path to a directory containing images or videos. Video file in formats like MP4, AVI, etc. HWC format with BGR channels uint8 (0-255).īCHW format with RGB channels float32 (0.0-1.0).ĬSV file containing paths to images, videos, or directories. In contrast, stream=True utilizes a generator, which only keeps the results of the current frame or data point in memory, significantly reducing memory consumption and preventing out-of-memory issues. When stream=False, the results for all frames or data points are stored in memory, which can quickly add up and cause out-of-memory errors for large inputs. Use stream=True for processing long videos or large datasets to efficiently manage memory. Ultralytics YOLO models return either a Python list of Results objects, or a memory-efficient Python generator of Results objects when stream=True is passed to the model during inference: Integration Friendly: Easily integrate with existing data pipelines and other software components, thanks to its flexible API.Batch Processing: The ability to process multiple images or video frames in a single batch, further speeding up inference time.Enable this by setting stream=True in the predictor's call method. Streaming Mode: Use the streaming feature to generate a memory-efficient generator of Results objects. ![]() Multiple Data Source Compatibility: Whether your data is in the form of individual images, a collection of images, video files, or real-time video streams, predict mode has you covered.YOLOv8's predict mode is designed to be robust and versatile, featuring: Highly Customizable: Various settings and parameters to tune the model's inference behavior according to your specific requirements.Ease of Use: Intuitive Python and CLI interfaces for rapid deployment and testing.Performance: Engineered for real-time, high-speed processing without sacrificing accuracy.Versatility: Capable of making inferences on images, videos, and even live streams.Here's why you should consider YOLOv8's predict mode for your various inference needs: Watch: How to Extract the Outputs from Ultralytics YOLOv8 Model for Custom Projects. Ultralytics YOLOv8 offers a powerful feature known as predict mode that is tailored for high-performance, real-time inference on a wide range of data sources. In the world of machine learning and computer vision, the process of making sense out of visual data is called 'inference' or 'prediction'.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |