![]() Higher values result in fewer detections by eliminating overlapping boxes, useful for reducing duplicates.ĭefines the image size for inference. Intersection Over Union (IoU) threshold for Non-Maximum Suppression (NMS). Adjusting this value can help reduce false positives. Objects detected with confidence below this threshold will be disregarded. ![]() Sets the minimum confidence threshold for detections. Supports a wide range of formats and sources, enabling flexible application across different types of input. Can be an image path, video file, directory, URL, or device ID for live feeds. 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. Streaming mode is beneficial for processing videos or live streams as it creates a generator of results instead of loading all frames into memory. The table also indicates whether each source can be used in streaming mode with the argument stream=True ✅. The sources include static images, video streams, and various data formats. YOLOv8 can process different types of input sources for inference, as shown in the table below. save ( filename = 'result.jpg' ) # save to disk Inference Sources probs # Probs object for classification outputs result. keypoints # Keypoints object for pose outputs probs = result. masks # Masks object for segmentation masks outputs keypoints = result. boxes # Boxes object for bounding box outputs masks = result. ![]() 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:įrom ultralytics import YOLO # Load a model model = YOLO ( 'yolov8n.pt' ) # pretrained YOLOv8n model # Run batched inference on a list of images results = model (, stream = True ) # return a generator of Results objects # Process results generator for result in results : boxes = result. 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. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |