<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ultralytics on Medium]]></title>
        <description><![CDATA[Stories by Ultralytics on Medium]]></description>
        <link>https://medium.com/@ultralytics?source=rss-cf98340994cc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*DS73Nbs_zi7wnPDhIKw-GQ.jpeg</url>
            <title>Stories by Ultralytics on Medium</title>
            <link>https://medium.com/@ultralytics?source=rss-cf98340994cc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 14:34:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ultralytics/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Ultralytics HUB: Train Computer Vision Models on the Cloud ]]></title>
            <link>https://ultralytics.medium.com/ultralytics-hub-train-computer-vision-models-on-the-cloud-181b56c8a0aa?source=rss-cf98340994cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/181b56c8a0aa</guid>
            <category><![CDATA[research-and-development]]></category>
            <category><![CDATA[cloud-services]]></category>
            <category><![CDATA[object-detection]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[yolov8]]></category>
            <dc:creator><![CDATA[Ultralytics]]></dc:creator>
            <pubDate>Wed, 24 Apr 2024 08:44:40 GMT</pubDate>
            <atom:updated>2024-04-24T08:44:40.602Z</atom:updated>
            <content:encoded><![CDATA[<p>As the computer vision industry undergoes rapid transformation, we enter an era where the AI industry is soaring, much like a plane flying in the air. With the industry expanding at a remarkable pace, the demand from end-users is insatiable, particularly in the realm of deep learning algorithms such as <a href="https://github.com/ultralytics/yolov5">Ultralytics YOLOv5</a>, <a href="https://github.com/ultralytics/ultralytics">YOLOv8</a>, and more.</p><p>Some clients seek to avoid the expenses associated with purchasing extensive GPU resources, while others prefer to save on dataset creation costs, opting to leverage pre-trained models for their specific use cases.</p><figure><img alt="Ultralytics HUB Cloud Training" src="https://cdn-images-1.medium.com/max/700/1*PZ1SlnadGJanglu2cYGJKg.png" /><figcaption><strong>Fig-1.1: Ultralytics HUB Cloud Training</strong></figcaption></figure><p>In this article, we’ll explore the newly launched cloud training feature in Ultralytics HUB:</p><ul><li><strong>Ultralytics HUB Cloud Training Overview:</strong> Our no-code feature simplifies Ultralytics YOLO model training, enabling effortless use for non-coders and business owners. Just cover training costs, and we handle the rest, aligning with client goals.</li><li><strong>HUB Cloud Training Workflow:</strong> Ultralytics HUB cloud training simplifies the process with dataset uploading, model selection, and cloud instance setup. It involves an easy process to fine-tune pretrained models and export them for various applications.</li></ul><p>Let’s dive in :)</p><h4><strong>Ultralytics HUB Cloud Training Overview</strong></h4><p>Typically, training deep learning models involves utilizing Python code or CLI commands. This process demands coding expertise to establish a suitable environment, and configuring GPU settings can be a challenge.</p><p>Our team acknowledges this challenge, and over the past 6 months, we’ve dedicated time to implementing a feature designed to offer a seamless no-code experience for end-users when they don’t want to utilize costly GPU systems for training the <a href="https://www.ultralytics.com/yolo">Ultralytics YOLO</a> models and it supports various models, including YOLOv8 for <a href="https://docs.ultralytics.com/tasks/detect/">object detection</a>, <a href="https://docs.ultralytics.com/tasks/segment/">object segmentation</a>, <a href="https://docs.ultralytics.com/tasks/pose/">pose estimation</a>, and <a href="https://docs.ultralytics.com/tasks/obb/">OBB</a> models.</p><p>This means even a business owner with no coding experience can effortlessly leverage this feature. You only need to cover the training costs. This implementation aligns with the client’s goals, proving highly effective, as we handle everything else for you.</p><h4><strong>HUB Cloud Training Workflow</strong></h4><p>The Ultralytics HUB cloud training feature includes uploading datasets, creating projects, selecting models, and initializing cloud instances. Visual samples accompany each step to enhance comprehension.</p><p><strong>Dataset Upload: </strong>This option allows users to upload their custom datasets for training purposes. For dataset format and detailed guidelines, you can refer to <a href="https://docs.ultralytics.com/datasets/detect/coco/#dataset-yaml">HUB dataset format</a></p><figure><img alt="Upload Datasets to Ultralytics HUB" src="https://cdn-images-1.medium.com/max/1024/1*qyNv9pjKPDfrI67kSVwRuw.png" /><figcaption><strong>Fig-1.2: Upload Datasets to Ultralytics HUB</strong></figcaption></figure><p><strong>Model Selection: </strong>After uploading the dataset, users can choose the dataset and access the model selection page. This phase, the second and pivotal step in cloud training, empowers users to select pre-trained models for fine-tuning on their custom data.</p><figure><img alt="Selection of Ultralytics YOLOv8 Model" src="https://cdn-images-1.medium.com/max/1024/1*gIKVddr75QXsOoVuSNHe3A.png" /><figcaption><strong>Fig-1.3: Selection of Ultralytics YOLOv8 Model</strong></figcaption></figure><p><strong>Selection of Cloud Instance: </strong>Selecting the cloud instance marks the crucial final step, encompassing payment options and the chosen plan for utilization as shown in the mentioned figure below. It will then initialize the cloud training instance and can take ~5 minutes</p><figure><img alt="Ultralytics HUB Cloud Instance Selection and Pricing" src="https://cdn-images-1.medium.com/max/1024/1*Vf5tINsinlCPVjj2UAlsDg.png" /><figcaption><strong>Fig-1.4: Ultralytics HUB Cloud Instance Selection and Pricing</strong></figcaption></figure><p>Once you’ve chosen an instance, simply click the <strong>“Start Training” </strong>button to initialize the training process. Various training metrics will then be displayed, as shown in the figure below.</p><figure><img alt="Cloud Training Demo Ultralytics HUB" src="https://cdn-images-1.medium.com/max/1024/1*ooi55jDqe-sjyWNwa5KxFQ.png" /><figcaption><strong>Fig-1.5: Cloud Training Demo Ultralytics HUB</strong></figcaption></figure><p>After the training, you can export or download the model for use in various applications such as Android or desktop applications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O8AMM18EV6FJ6OYH-CnPMw.png" /><figcaption><strong>Fig-1.6: Ultralytics HUB Model Export Feature</strong></figcaption></figure><p>Feel free to delve into the features of <a href="https://hub.ultralytics.com/">Ultralytics HUB</a>. We can’t wait to see how you leverage these tools in your projects. Share your progress and discoveries with the community — dive in and showcase your work! 🚀</p><h4>Our Trending Articles</h4><ul><li><a href="https://ultralytics.medium.com/pose-estimation-on-custom-data-using-ultralytics-yolov8-ef63e103daea"><em>Pose Estimation on Custom Data using Ultralytics YOLOv8</em></a></li><li><a href="https://ultralytics.medium.com/object-tracking-across-multiple-streams-using-ultralytics-yolov8-7934618ddd2"><em>Object Tracking Across Multiple Streams using Ultralytics YOLOv8</em></a></li><li><a href="https://medium.com/@ultralytics/using-ultralytics-yolov8-with-sahi-on-videos-3d524087dd33"><em>Using Ultralytics YOLOv8 with SAHI on Videos</em></a></li><li><a href="https://ultralytics.medium.com/object-detection-and-advanced-region-based-counting-with-ultralytics-yolov8-96f30d52ec1c"><em>Object Detection and Advanced Region-Based Counting with Ultralytics YOLOv8</em></a></li><li><a href="https://ultralytics.medium.com/ultralytics-yolov8-solutions-quick-walkthrough-b802fd6da5d7"><em>Ultralytics YOLOv8 Solutions: Quick Walkthrough</em></a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*AidfjSaDUeeAVd9c69zVEw.png" /><figcaption><strong>Ultralytics</strong></figcaption></figure><p><a href="https://ultralytics.com/">Ultralytics</a> is on a mission to empower people and companies to unleash the positive potential of vision AI. With a commitment to simplicity, flexibility, and usability, <a href="https://github.com/ultralytics/ultralytics">Ultralytics YOLO</a> and <a href="http://hub.ultralytics.com/">Ultralytics HUB</a> lower the barriers to getting started solving the world’s challenges. Ultralytics technology enables businesses to transform their operations, enhance customer experiences, and drive innovation by seamlessly integrating state-of-the-art models and user-friendly platforms. It’s been a remarkable journey, but we’re just getting started.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=181b56c8a0aa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ultralytics YOLOv8 Solutions: Quick Walkthrough]]></title>
            <link>https://ultralytics.medium.com/ultralytics-yolov8-solutions-quick-walkthrough-b802fd6da5d7?source=rss-cf98340994cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/b802fd6da5d7</guid>
            <category><![CDATA[yolov8]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[research-and-development]]></category>
            <category><![CDATA[object-detection]]></category>
            <category><![CDATA[computer-vision]]></category>
            <dc:creator><![CDATA[Ultralytics]]></dc:creator>
            <pubDate>Wed, 24 Jan 2024 10:40:38 GMT</pubDate>
            <atom:updated>2024-01-24T10:40:38.708Z</atom:updated>
            <content:encoded><![CDATA[<p>Computer vision continues to expand steadily, unveiling numerous compelling use cases across various industries. Object detection stands out as a foundational and indispensable task when using diverse scenarios such as monitoring different activities or collecting analytics.</p><p>However, relying solely on object detection proves insufficient. To cater to the multifaceted requirements of computer vision across industries, one must embrace top-level concepts like object counting, object tracking, vehicle speed estimation, distance calculation, heatmap analytics, and more.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*jXJvOxExoStRdzQEoNZpmg.jpeg" /><figcaption><strong>Fig-1.1: </strong><a href="https://docs.ultralytics.com/guides/"><strong>Ultralytics YOLOv8 Solutions</strong></a></figcaption></figure><p><a href="https://www.ultralytics.com/">Ultralytics YOLOv8</a> has significantly streamlined the workflow by not only offering robust object detection through YOLOv8 but also providing multiple integrated solutions for additional tasks (i.e. object counting, heatmaps, vehicle speed estimation, and so on …). The convenience is amplified by the fact that there’s no need for the installation of third-party libraries — the <a href="https://pypi.org/project/ultralytics/">Ultralytics pip package</a>.</p><p>In this article, we will provide an overview of various solutions offered by Ultralytics and outline their respective advantages.</p><ul><li><a href="https://docs.ultralytics.com/guides/object-counting/"><strong>Object Counting</strong></a><strong>: </strong>Determining the quantity of objects in a scene, is crucial for tasks like crowd management and inventory monitoring.</li><li><a href="https://docs.ultralytics.com/guides/heatmaps/"><strong>Heatmaps</strong></a><strong>: </strong>Graphical representations highlighting feature intensity in an image, resulting useful in areas like surveillance and medical imaging.</li><li><a href="https://docs.ultralytics.com/guides/speed-estimation/"><strong>Speed Estimation</strong></a><strong>:</strong> Analyzing object motion for velocity determination, vital in traffic monitoring and surveillance.</li><li><a href="https://docs.ultralytics.com/guides/object-blurring/"><strong>Object Blurring</strong></a><strong>:</strong> Privacy-enhancing technique concealing specific objects in images or videos for ethical use in surveillance and data sharing.</li></ul><p>Let’s get started 🚀</p><p><strong>Object Counting using Ultralytics YOLOv8</strong></p><p>Object counting involves tallying identified objects within a designated video stream. This method seamlessly integrates with object tracking, assigning each track a unique ID. The procedure entails delineating a centroid line, facilitating object counting as objects traverse this designated line within the frame.</p><p>This versatile technique finds applications across various domains, such as retail for monitoring customer traffic, smart cities for optimizing crowd management, and industrial settings for tracking the movement of components on assembly lines.</p><p>Get started by employing the provided code, and for a broader array of code samples,<strong> </strong>don’t hesitate to explore our documentation on <a href="https://docs.ultralytics.com/guides/object-counting/">object counting</a>.</p><pre>from ultralytics import YOLO<br>from ultralytics.solutions import object_counter<br>import cv2<br><br>model = YOLO(&quot;yolov8n.pt&quot;)<br>cap = cv2.VideoCapture(&quot;path/to/video/file.mp4&quot;)<br>assert cap.isOpened(), &quot;Error reading video file&quot;<br>w, h, fps = (int(cap.get(x))<br>                     for x in (cv2.CAP_PROP_FRAME_WIDTH,<br>                               cv2.CAP_PROP_FRAME_HEIGHT,<br>                               cv2.CAP_PROP_FPS))<br><br># Define region points<br>region_points = [(20, 400), (1080, 404), (1080, 360), (20, 360)]<br><br># Video writer<br>video_writer = cv2.VideoWriter(&quot;object_counting_output.avi&quot;,<br>                       cv2.VideoWriter_fourcc(*&#39;mp4v&#39;),<br>                       fps,<br>                       (w, h))<br><br># Init Object Counter<br>counter = object_counter.ObjectCounter()<br>counter.set_args(view_img=True,<br>                 reg_pts=region_points,<br>                 classes_names=model.names,<br>                 draw_tracks=True)<br><br>while cap.isOpened():<br>    success, im0 = cap.read()<br><br>    if not success:<br>        print(&quot;Video frame is empty or video processing has \<br>        been successfully completed.&quot;)<br>        break<br><br>    tracks = model.track(im0, persist=True, show=False)<br><br>    im0 = counter.start_counting(im0, tracks)<br>    video_writer.write(im0)<br><br>cap.release()<br>video_writer.release()<br>cv2.destroyAllWindows()</pre><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FO1hSn5EYtAbK0%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fdollar-bills-O1hSn5EYtAbK0&amp;image=https%3A%2F%2Fmedia3.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExNHZlOG5uZTRjbjFjczY3YnF3NDVhaDJ3YmVvcGMxeG94bGRmdW94biZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw%2FO1hSn5EYtAbK0%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/eb3faf470bcc711f88d3f47472b93cbd/href">https://medium.com/media/eb3faf470bcc711f88d3f47472b93cbd/href</a></iframe><p><strong>Heatmaps using YOLOv8</strong></p><p>Heatmaps deliver a comprehensive visualization of densely populated areas. This involves meticulously tracking objects and, based on this tracking data, generating heatmaps utilizing OpenCV COLORMAPS. This dynamic approach finds practical use in diverse domains, such as urban planning, where it aids in identifying high-traffic zones for optimal city infrastructure development.</p><p>In healthcare, heatmaps can be applied to analyze patient movement within a medical facility, enhancing operational efficiency and resource allocation. Additionally, in retail, heatmaps prove invaluable for identifying hotspots within stores, enabling strategic product placement, and improving the overall shopping experience.</p><p>You can utilize the mentioned code to get started, for more code samples, you can refer to our <a href="https://docs.ultralytics.com/guides/heatmaps/">Heatmaps documentation</a>.</p><pre>from ultralytics import YOLO<br>from ultralytics.solutions import heatmap<br>import cv2<br><br>model = YOLO(&quot;yolov8n.pt&quot;)<br>cap = cv2.VideoCapture(&quot;path/to/video/file.mp4&quot;)<br>assert cap.isOpened(), &quot;Error reading video file&quot;<br>w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, <br>cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS))<br><br># Video writer<br>video_writer = cv2.VideoWriter(&quot;heatmap_output.avi&quot;,<br>                               cv2.VideoWriter_fourcc(*&#39;mp4v&#39;),<br>                               fps,<br>                               (w, h))<br><br># Init heatmap<br>heatmap_obj = heatmap.Heatmap()<br>heatmap_obj.set_args(colormap=cv2.COLORMAP_PARULA,<br>                     imw=w,<br>                     imh=h,<br>                     view_img=True,<br>                     shape=&quot;circle&quot;)<br><br>while cap.isOpened():<br>    success, im0 = cap.read()<br>    if not success:<br>        print(&quot;Video frame is empty or video processing has \<br>                been successfully completed.&quot;)<br>        break<br>    tracks = model.track(im0, persist=True, show=False)<br><br>    im0 = heatmap_obj.generate_heatmap(im0, tracks)<br>    video_writer.write(im0)<br><br>cap.release()<br>video_writer.release()<br>cv2.destroyAllWindows()</pre><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FtFDgGdr2ftPD8d1ibh%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2FZEE5-wow-what-omg-tFDgGdr2ftPD8d1ibh&amp;image=https%3A%2F%2Fmedia4.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExeXQwc2szZ2pnd2JscnI1ejhnamxmcHZkcWM2NTd6MzRkdGJzeWthbyZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw%2FtFDgGdr2ftPD8d1ibh%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/1a8355d96c2188ec8f5a59d5ac7285b7/href">https://medium.com/media/1a8355d96c2188ec8f5a59d5ac7285b7/href</a></iframe><p><strong>Speed Estimation using YOLOv8</strong></p><p>Speed estimation, a pivotal process in computer vision applications, involves determining the rate of movement of an object within a specified context. With the capabilities of Ultralytics YOLOv8, one can seamlessly calculate the speed of objects by integrating object tracking with distance and time data. This functionality is particularly valuable in applications such as traffic management and surveillance, where understanding the speed of moving objects is essential for informed decision-making.</p><p>The precision of speed estimation plays a critical role in shaping the effectiveness and dependability of diverse applications. It stands as a fundamental component in advancing intelligent systems, contributing to the enhancement of real-time decision-making processes. As computer vision technologies continue to evolve, accurate speed estimation becomes increasingly integral to the seamless operation of systems that rely on understanding and responding to dynamic movements in their surroundings.</p><p>To initiate your work, you can make use of the provided code. For additional code samples, you can refer to our documentation page for <a href="https://docs.ultralytics.com/guides/speed-estimation/">Speed Estimation.</a></p><pre>from ultralytics import YOLO<br>from ultralytics.solutions import speed_estimation<br>import cv2<br><br>model = YOLO(&quot;yolov8n.pt&quot;)<br>names = model.model.names<br><br>cap = cv2.VideoCapture(&quot;path/to/video/file.mp4&quot;)<br>assert cap.isOpened(), &quot;Error reading video file&quot;<br>w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, <br>cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS))<br><br># Video writer<br>video_writer = cv2.VideoWriter(&quot;speed_estimation.avi&quot;,<br>                               cv2.VideoWriter_fourcc(*&#39;mp4v&#39;),<br>                               fps,<br>                               (w, h))<br><br>line_pts = [(0, 360), (1280, 360)]<br><br># Init speed-estimation obj<br>speed_obj = speed_estimation.SpeedEstimator()<br>speed_obj.set_args(reg_pts=line_pts,<br>                   names=names,<br>                   view_img=True)<br><br>while cap.isOpened():<br><br>    success, im0 = cap.read()<br>    if not success:<br>        print(&quot;Video frame is empty or video processing has been \<br>        successfully completed.&quot;)<br>        break<br><br>    tracks = model.track(im0, persist=True, show=False)<br><br>    im0 = speed_obj.estimate_speed(im0, tracks)<br>    video_writer.write(im0)<br><br>cap.release()<br>video_writer.release()<br>cv2.destroyAllWindows()</pre><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FZYr1xhbD2EEu0YaukN%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fsaweetie-up-now-ZYr1xhbD2EEu0YaukN&amp;image=https%3A%2F%2Fmedia4.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExZ2J0cjIycHc1MXM0OXZub2hnNzNsbzUzMGVlbnY4c21tOGk2aXFlNCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw%2FZYr1xhbD2EEu0YaukN%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/05948f7ae1b37da1da2ccdd5754bf2d5/href">https://medium.com/media/05948f7ae1b37da1da2ccdd5754bf2d5/href</a></iframe><p><strong>Object Blurring using YOLOv8</strong></p><p>In the current digital era, prioritizing personal identity protection is crucial as privacy concerns become increasingly prevalent. The implementation of object blurring serves as a robust solution to shield individuals’ identities across diverse visual content. Leveraging the object blurring feature in Ultralytics YOLOv8, sensitive information, including faces or identifiable features, can be strategically concealed, ensuring the disguise of personal details while maintaining the overall integrity of the content.</p><p>This approach is commonly employed in scenarios like image and video sharing, enhancing privacy and mitigating the risk of unauthorized identification. Object blurring stands as a practical and ethical solution in the realm of personal identity protection, contributing to a safer and more secure online environment.</p><p>To kickstart your project, you can utilize the provided code. For more examples of code, you can refer to our documentation page for <a href="https://docs.ultralytics.com/guides/object-blurring/">Object blurring.</a></p><pre>from ultralytics import YOLO<br>from ultralytics.utils.plotting import Annotator, colors<br>import cv2<br><br>model = YOLO(&quot;yolov8n.pt&quot;)<br>names = model.names<br><br>cap = cv2.VideoCapture(&quot;path/to/video/file.mp4&quot;)<br>assert cap.isOpened(), &quot;Error reading video file&quot;<br>w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH,<br>                                               cv2.CAP_PROP_FRAME_HEIGHT, <br>                                                cv2.CAP_PROP_FPS))<br># Blur ratio<br>blur_ratio = 50<br><br># Video writer<br>video_writer = cv2.VideoWriter(&quot;object_blurring_output.avi&quot;,<br>                               cv2.VideoWriter_fourcc(*&#39;mp4v&#39;),<br>                               fps, (w, h))<br><br>while cap.isOpened():<br>    success, im0 = cap.read()<br>    if not success:<br>        print(&quot;Video frame is empty or video processing has \<br>              been successfully completed.&quot;)<br>        break<br><br>    results = model.predict(im0, show=False)<br>    boxes = results[0].boxes.xyxy.cpu().tolist()<br>    clss = results[0].boxes.cls.cpu().tolist()<br>    annotator = Annotator(im0, line_width=2, example=names)<br><br>    if boxes is not None:<br>        for box, cls in zip(boxes, clss):<br>            annotator.box_label(box, color=colors(int(cls), True), <br>                                label=names[int(cls)])<br><br>            obj = im0[int(box[1]):int(box[3]), int(box[0]):int(box[2])]<br>            blur_obj = cv2.blur(obj, (blur_ratio, blur_ratio))<br><br>            im0[int(box[1]):int(box[3]),<br>            int(box[0]):int(box[2])] = blur_obj<br><br>    cv2.imshow(&quot;ultralytics&quot;, im0)<br>    video_writer.write(im0)<br>    if cv2.waitKey(1) &amp; 0xFF == ord(&#39;q&#39;):<br>        break<br><br>cap.release()<br>video_writer.release()<br>cv2.destroyAllWindows()</pre><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FKPEpqHiJVrSVCOjyCP%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Ftherokuchannel-roku-the-channel-50-states-of-fright-KPEpqHiJVrSVCOjyCP&amp;image=https%3A%2F%2Fmedia0.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExd2NvcmUwcTAzYWR0ZHplcG1tdndsbnQ0cXNlc3QyazBhZ3l6ZXQyeCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw%2FKPEpqHiJVrSVCOjyCP%2Fgiphy_s.gif&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/7ce8c39539877989788d34e6d184ae37/href">https://medium.com/media/7ce8c39539877989788d34e6d184ae37/href</a></iframe><p>That’s a wrap! We encourage you to explore the capabilities of Ultralytics YOLOv8 solutions. We look forward to witnessing your projects’ utilization of these tools. Share your advancements and findings with the community — dive in and showcase your work! 🚀</p><h4>Our Trending Articles</h4><ul><li><a href="https://ultralytics.medium.com/pose-estimation-on-custom-data-using-ultralytics-yolov8-ef63e103daea"><em>Pose Estimation on Custom Data using Ultralytics YOLOv8</em></a></li><li><a href="https://ultralytics.medium.com/object-tracking-across-multiple-streams-using-ultralytics-yolov8-7934618ddd2"><em>Object Tracking Across Multiple Streams using Ultralytics YOLOv8</em></a></li><li><a href="https://medium.com/@ultralytics/using-ultralytics-yolov8-with-sahi-on-videos-3d524087dd33"><em>Using Ultralytics YOLOv8 with SAHI on Videos</em></a></li><li><a href="https://ultralytics.medium.com/object-detection-and-advanced-region-based-counting-with-ultralytics-yolov8-96f30d52ec1c"><em>Object Detection and Advanced Region-Based Counting with Ultralytics YOLOv8</em></a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*AidfjSaDUeeAVd9c69zVEw.png" /><figcaption><strong>Ultralytics</strong></figcaption></figure><p><a href="https://ultralytics.com/">Ultralytics</a> is on a mission to empower people and companies to unleash the positive potential of vision AI. With a commitment to simplicity, flexibility, and usability, <a href="https://github.com/ultralytics/ultralytics">Ultralytics YOLO</a> and <a href="http://hub.ultralytics.com/">Ultralytics HUB</a> lower the barriers to getting started solving the world’s challenges. Ultralytics technology enables businesses to transform their operations, enhance customer experiences, and drive innovation by seamlessly integrating state-of-the-art models and user-friendly platforms. It’s been a remarkable journey, but we’re just getting started.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b802fd6da5d7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pose Estimation on Custom Data using Ultralytics YOLOv8]]></title>
            <link>https://ultralytics.medium.com/pose-estimation-on-custom-data-using-ultralytics-yolov8-ef63e103daea?source=rss-cf98340994cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef63e103daea</guid>
            <category><![CDATA[object-detection]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[pose-estimation]]></category>
            <category><![CDATA[yolov8]]></category>
            <dc:creator><![CDATA[Ultralytics]]></dc:creator>
            <pubDate>Mon, 13 Nov 2023 12:00:31 GMT</pubDate>
            <atom:updated>2023-11-13T12:00:31.786Z</atom:updated>
            <content:encoded><![CDATA[<p>In the evolving landscape of computer vision, pose estimation stands out as a pivotal innovation, transforming how we understand and interact with visual data. Ultralytics YOLOv8 is at the forefront of this transformation, providing a powerful tool that captures the subtleties of object orientation and movement within images.</p><p>Traditionally, tracking the keypoints of objects in images has been complex, but with YOLOv8, it’s becoming seamless and intuitive. This advancement is not just exciting — it opens up a world of possibilities across various sectors, including sports analytics, healthcare, and retail, to name a few.</p><figure><img alt="Tiger Keypoints Estimation Using Ultralytics YOLOv8" src="https://cdn-images-1.medium.com/max/700/1*tIBBsl5INYYdFhhlpuEhMw.png" /><figcaption><strong>Fig-1.1: Tiger Keypoints Estimation Using Ultralytics YOLOv8</strong></figcaption></figure><p>In this article, we’re going to explore the process of pose estimation using YOLOv8. Here’s what we’ll cover:</p><ul><li><strong>Data Annotation for Pose Estimation using CVAT:</strong> We’ll begin by uploading our dataset to the CVAT platform, configuring the tool, annotating keypoints, and exporting our data.</li><li><strong>Converting Annotations for Ultralytics YOLOv8: </strong>After annotation, we’ll convert the data into a format that’s compatible with YOLOv8, ensuring our model can interpret it correctly.</li><li><strong>Data Splitting:</strong> It’s essential to structure our data, so we’ll divide it into training, validation, and testing sets to facilitate effective model training.</li><li><strong>Training the YOLOv8 Model for Pose Estimation:</strong> With our data organized, we’ll train the YOLOv8 model to recognize and estimate poses.</li><li><strong>Performing Inference with YOLOv8:</strong> Finally, we’ll use our trained model to perform pose estimation on new data, seeing the results of our efforts in action. You can also explore our YouTube video on <a href="https://youtu.be/Y28xXQmju64"><em>Pose Estimation with Ultralytics YOLOv8</em></a></li></ul><p>Let’s get started 🚀</p><h4>Annotation of Data using CVAT for Pose Estimation</h4><p>The process of data annotation is crucial in the field of computer vision. We’ll be using the tiger dataset in this tutorial to demonstrate how to accurately annotate keypoints, which is an essential step in training our model for pose estimation.</p><figure><img alt="Ultralytics Tiger-Pose Dataset" src="https://cdn-images-1.medium.com/max/1024/1*5BCW1m8WrqrchuPo5bi4Ng.png" /><figcaption><strong>Fig-1.2: </strong><a href="https://drive.google.com/drive/folders/1Gpb6XDS8z5Uc-dw7EpxRgNXLnWNrWpVm?usp=drive_link"><strong>Ultralytics Tiger-Pose Dataset</strong></a></figcaption></figure><blockquote><strong>Note: </strong>The tiger dataset, which can be accessed from the <a href="https://drive.google.com/drive/folders/1Gpb6XDS8z5Uc-dw7EpxRgNXLnWNrWpVm?usp=drive_link">Ultralytics Tiger-Pose Dataset</a>, should be downloaded and unzipped, preparing it for the upcoming tasks. These images will serve as the basis for our training process, so ensure they’re stored conveniently.</blockquote><p>If you’re new to CVAT, it’s worth taking the time to familiarize yourself with its features by reviewing the <a href="https://opencv.github.io/cvat/docs/">CVAT Documentation</a>. This will provide a foundation for a more streamlined annotation process.</p><p><strong>Uploading the Dataset</strong></p><p>After downloading the tiger images, be sure to unzip the file. Next, upload all the images onto the <a href="https://www.cvat.ai/">CVAT platform</a> as a new task and click “submit and open.”</p><p>Once done, you will be directed to a page as displayed below.</p><figure><img alt="Ultralytics Tiger-pose Dataset upload" src="https://cdn-images-1.medium.com/max/828/1*usBO2QE5_CxxBvxqHPSt8A.png" /><figcaption><strong>Fig-1.3: Ultralytics </strong><a href="https://docs.ultralytics.com/datasets/pose/tiger-pose"><strong>Tiger-pose Dataset</strong></a><strong> upload</strong></figcaption></figure><p><strong>Setting Up the Annotation Tool CVAT</strong></p><p>Upon opening your task in CVAT, you’ll be prompted to select a specific job, which will be your workspace for annotations. The job number, like <strong>“Job #391317”</strong> mentioned here, will differ for each user. This will lead you to the annotation interface, where the setup will be complete, and you can begin labeling your data.</p><figure><img alt="Ultralytics YOLOv8 Tiger-pose Dataset Annotation Workflow using CVAT" src="https://cdn-images-1.medium.com/max/828/1*q0HK-6f0EGs_mhxnFA-D7w.png" /><figcaption><strong>Fig-1.4: Ultralytics YOLOv8 Tiger-pose Dataset Annotation Workflow using CVAT</strong></figcaption></figure><p><strong>Data Annotation</strong></p><p>With CVAT, you have the option to annotate using different formats. For the tiger dataset, we’ll utilize point annotation to mark keypoints. The process is visualized in a detailed gif provided in the tutorial, guiding you through each step of the annotation.</p><figure><img alt="Data Annotation Process of Ultralytics Tiger-pose using CVAT" src="https://cdn-images-1.medium.com/max/828/1*qFZ8MfBxIOrRx8emz-z8Aw.gif" /><figcaption><strong>Fig-1.5: Data Annotation Process of Ultralytics Tiger-pose using CVAT</strong></figcaption></figure><p><strong>Data Export</strong></p><p>After completing the annotation, the dataset can be exported using the <strong>“CVAT for images 1:1”</strong> format, which will be suitable for converting to the YOLOv8 format later in the workflow.</p><h4>Converting Annotations to Ultralytics YOLOv8 Format</h4><p>Once you’ve exported your annotations from CVAT, you’ll receive a zip file. Unzip this to reveal an “annotations.xml” file, which houses the keypoints and labels you’ve assigned. This file is crucial as it contains the structured data that YOLOv8 will learn from.</p><blockquote>To integrate this with YOLOv8, place the <strong>“annotations.xml”</strong> file into the same directory as your image dataset. If you need to re-download the dataset, it’s available at the <a href="https://drive.google.com/drive/folders/1Gpb6XDS8z5Uc-dw7EpxRgNXLnWNrWpVm?usp=sharing"><strong>Ultralytics Tiger-Pose Dataset</strong></a>. Make sure that after downloading, you unzip the files, readying them for the next step.</blockquote><p>Now, create a Python script titled <strong><em>“cvat_to_ultralytics_yolov8.py”</em></strong>. Copy the provided code into this new file. Running this script will convert your annotations into the YOLOv8 format, setting the stage for training your model.</p><pre>import ast<br>import os.path<br>from xml.dom import minidom<br><br>out_dir = &#39;./out&#39;<br>if not os.path.exists(out_dir):<br>    os.makedirs(out_dir)<br><br>file = minidom.parse(&#39;annotations.xml&#39;)<br><br>images = file.getElementsByTagName(&#39;image&#39;)<br><br>for image in images:<br>    width = int(image.getAttribute(&#39;width&#39;))<br>    height = int(image.getAttribute(&#39;height&#39;))<br>    name = image.getAttribute(&#39;name&#39;)<br>    elem = image.getElementsByTagName(&#39;points&#39;)<br>    bbox = image.getElementsByTagName(&#39;box&#39;)[0]<br>    xtl = int(float(bbox.getAttribute(&#39;xtl&#39;)))<br>    ytl = int(float(bbox.getAttribute(&#39;ytl&#39;)))<br>    xbr = int(float(bbox.getAttribute(&#39;xbr&#39;)))<br>    ybr = int(float(bbox.getAttribute(&#39;ybr&#39;)))<br>    w = xbr - xtl<br>    h = ybr - ytl<br>    label_file = open(os.path.join(out_dir, name + &#39;.txt&#39;), &#39;w&#39;)<br><br>    for e in elem:<br><br>        label_file.write(&#39;0 {} {} {} {} &#39;.format(<br>            str((xtl + (w / 2)) / width),<br>             str((ytl + (h / 2)) / height),<br>             str(w / width),<br>             str(h / height)))<br><br>        points = e.attributes[&#39;points&#39;]<br>        points = points.value.split(&#39;;&#39;)<br>        points_ = []<br>        for p in points:<br>            p = p.split(&#39;,&#39;)<br>            p1, p2 = p<br>            points_.append([int(float(p1)), int(float(p2))])<br>        for p_, p in enumerate(points_):<br>            label_file.write(&#39;{} {}&#39;.format(p[0] / width, p[1] / height))<br>            if p_ &lt; len(points_) - 1:<br>                label_file.write(&#39; &#39;)<br>            else:<br>                label_file.write(&#39;\n&#39;)</pre><p>After running the script, remove the “annotations.xml” to avoid any potential confusion in later steps.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FRBcECYFxrKqSrslOJ3%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fthefastsaga-RBcECYFxrKqSrslOJ3&amp;image=https%3A%2F%2Fmedia4.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExbW80N2RpbXpwdHhpbWxxYzdhdmo5M3NheTV0MWxidWxwemxmdW00YyZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw%2FRBcECYFxrKqSrslOJ3%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="181" frameborder="0" scrolling="no"><a href="https://medium.com/media/4720640163323415abb91929752e2f91/href">https://medium.com/media/4720640163323415abb91929752e2f91/href</a></iframe><h4>Data Splitting (Train, Val, Test)</h4><p>With your dataset annotated and converted, the next step is to organize the images and annotations into distinct sets for training and evaluation.</p><ul><li>Create two directories within your project: one named “images” and another “labels”.</li><li>Distribute the images and their corresponding annotation files into these folders respectively.</li><li>To facilitate this data-splitting process, create a Python file named “splitdata.py.”</li><li>Copy and paste the provided code into the “splitdata.py” file.</li><li>Execute the Python script by running the file.</li></ul><p>This procedure ensures that your data is appropriately divided into training and testing subsets, primed for Ultralytics YOLOv8 training.</p><pre>import splitfolders<br><br>input_fol_path = &quot;path to folder, that includes images and labels folder&quot;<br>splitfolders.ratio(input_fold_path, output=&quot;output&quot;,<br>    seed=1337, ratio=(.8, .2, .0), group_prefix=None, move=False)</pre><p>The result will be an output folder comprising two distinct directories: “train” and “test.” These folders are ready for utilization in your YOLOv8 training process.</p><h4>Training the YOLOv8 Model for Pose Estimation</h4><p>The next phase involves crafting a “data.yaml” file, which acts as a roadmap for YOLOv8, directing it to your dataset and defining the classes for training. Insert the necessary code into ‘data.yaml’, customizing the path to your dataset directory.</p><blockquote>For detailed guidance on configuring your tiger-pose dataset, refer to the Ultralytics documentation at: <a href="https://docs.ultralytics.com/datasets/pose/tiger-pose/#dataset-yaml">https://docs.ultralytics.com/datasets/pose/tiger-pose/#dataset-yaml</a></blockquote><p>Please remember to adjust the dataset directory path as needed. With ‘data.yaml’ configured, you’re ready to commence training your model.</p><pre>path: &quot;path to the dataset directory&quot;<br>train: train<br>val: val <br><br>kpt_shape: [12, 2]<br>flip_idx: [0,1,2,3,4,5,6,7,8,9,10,11]<br>names:<br>  0: tiger</pre><p>Once this is completed, you’re all set to begin! You can employ the provided command to initiate the training of the YOLOv8 model for tiger-pose estimation.</p><pre>yolo task=pose mode=train data=&quot;path/data.yaml&quot; model=yolov8n.pt imgsz=640</pre><p>The training duration will vary, and it’s contingent on the GPU device you have.</p><h4>Performing Inference with YOLOv8</h4><p>Following training, put your model to the test by performing inference on new data. Run the provided command to apply your pose estimation model to detect and analyze poses.</p><pre># Run inference using a tiger-pose trained model<br>yolo task=pose mode=predict \<br>source=&quot;https://www.youtube.com/watch?v=MIBAT6BGE6U&quot; \<br>show=True model=&quot;path/to/best.pt&quot;</pre><p>The inference results will be displayed, demonstrating the model’s ability to apply what it has learned to real-world scenarios. See below:</p><figure><img alt="Ultralytics YOLOv8 Pose Inference with Tiger-Pose Estimation Model" src="https://cdn-images-1.medium.com/max/825/1*nvBwuRLHmYUYmqrB-xMWUQ.gif" /><figcaption><strong>Fig-1.7: Ultralytics YOLOv8 Pose Inference with Tiger-Pose Estimation Model</strong></figcaption></figure><p>As we wrap up this tutorial, we invite you to immerse yourself in the potential of pose estimation using Ultralytics YOLOv8. We’re excited to see how you apply these tools to your projects. Share your progress and discoveries with the community. Dive in and share your work with us! 🚀</p><h4><strong>Our Trending Articles</strong></h4><ul><li><a href="https://medium.com/@ultralytics/using-ultralytics-yolov8-with-sahi-on-videos-3d524087dd33"><em>Using Ultralytics YOLOv8 with SAHI on Videos</em></a></li><li><a href="https://ultralytics.medium.com/object-tracking-across-multiple-streams-using-ultralytics-yolov8-7934618ddd2"><em>Object Tracking Across Multiple Streams using Ultralytics YOLOv8</em></a></li><li><a href="https://ultralytics.medium.com/object-detection-and-advanced-region-based-counting-with-ultralytics-yolov8-96f30d52ec1c"><em>Object Detection and Advanced Region-Based Counting with Ultralytics YOLOv8</em></a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*AidfjSaDUeeAVd9c69zVEw.png" /><figcaption><strong>Ultralytics</strong></figcaption></figure><p><a href="https://ultralytics.com/">Ultralytics</a> is on a mission to empower people and companies to unleash the positive potential of vision AI. With a commitment to simplicity, flexibility, and usability, Ultralytics YOLO and <a href="http://hub.ultralytics.com/">Ultralytics HUB</a> lower the barriers to getting started solving the world’s challenges. Ultralytics technology enables businesses to transform their operations, enhance customer experiences, and drive innovation by seamlessly integrating state-of-the-art models and user-friendly platforms. It’s been a remarkable journey, but we’re just getting started.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef63e103daea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Object Detection and Advanced Region-Based Counting with Ultralytics YOLOv8]]></title>
            <link>https://ultralytics.medium.com/object-detection-and-advanced-region-based-counting-with-ultralytics-yolov8-96f30d52ec1c?source=rss-cf98340994cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/96f30d52ec1c</guid>
            <category><![CDATA[yolov8]]></category>
            <category><![CDATA[retail]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[object-detection]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Ultralytics]]></dc:creator>
            <pubDate>Tue, 24 Oct 2023 20:19:21 GMT</pubDate>
            <atom:updated>2023-10-24T20:19:21.380Z</atom:updated>
            <content:encoded><![CDATA[<p>Object detection stands as a cornerstone in computer vision. This entails the identification and precise localization of objects within images or videos. Building upon this, region-based object counting with Ultralytics YOLOv8 augments object detection by quantifying objects in designated areas. Such advancements have transformative applications, ranging from accurately counting pedestrians in city crosswalks to refining inventory management by counting products on shelves.</p><p>Harnessing YOLOv8 for object-counting not only propels businesses towards automation but also improves security measures and data-driven decision-making.</p><figure><img alt="Object Detection and Advanced Region-Based Counting with Ultralytics YOLOv8" src="https://cdn-images-1.medium.com/max/700/1*4XrVTEZdp5n9PCY_DkT8Ig.png" /><figcaption><strong>Fig-1.1: Object Detection and Advanced Region-Based Counting with Ultralytics YOLOv8</strong></figcaption></figure><p>In this deep dive, we explore the real-world applications of Ultralytics’ latest article <em>Object Detection and Advanced Region-Based Counting with Ultralytics YOLOv8</em>. Here, we will cover:</p><ul><li>Features of multi-region object counting</li><li>Real-world use cases</li></ul><p>Let’s dive in 🚀</p><h4><strong>Features of Multi-Region Object Counting</strong></h4><p>Object counting tallies objects in videos or images. Region-based counting, on the other hand, focuses on counting objects within specific areas. YOLOv8’s region counting shifts the focus to specific designated areas within frames. It’s not just about counting; it’s about counting right, and counting where it matters. This module comes equipped with several features:</p><ul><li><strong>Moveable Regions: </strong>Once<strong> </strong>coordinates for a region are set and inference with the YOLOv8 region counting module is initiated, YOLOv8 permits real-time adjustments, meaning regions can be repositioned on-the-fly without delving into code edits. Plus, for those less technically inclined, a simple drag of the mouse suffices.</li><li><strong>Region In Multiple Forms: </strong>From rectangles to intricate polygons, regions can be tailored to fit diverse counting scenarios.</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FXeGUOwWa6eV8Q0tR3o%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Foriginals-XeGUOwWa6eV8Q0tR3o&amp;image=https%3A%2F%2Fmedia3.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExNWtwMmZ2a2s1YmFuaGw3cWd2eXVzaTNkdzBicG5rNW9lcm16N3NzaCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw%2FXeGUOwWa6eV8Q0tR3o%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/b9c23439d9d2eae2fc9bcc9ac25c97e9/href">https://medium.com/media/b9c23439d9d2eae2fc9bcc9ac25c97e9/href</a></iframe><ul><li><strong>Real-Time Performance: </strong>YOLOv8 already established a reputation for real-time performance, incorporating the region counting module does not affect YOLOv8’s real-time capability.</li><li><strong>Ultralytics Community Support: </strong>At Ultralytics, we are committed to user success with YOLOv8. Questions? Concerns? Join the conversation on our <a href="https://github.com/ultralytics/ultralytics">Ultralytics GitHub</a> or become a part of our <a href="https://ultralytics.com/discord">Discord community</a>!</li></ul><h4><strong>Real-world Applications of Ultralytics </strong>YOLOv8 Region-Based Counting</h4><p>There are numerous applications where object counting within designated regions is applicable, and we will highlight three of them with accompanying visual examples.</p><p><strong>Retail — People Counting</strong></p><p>Retail owners use tools to track daily foot traffic in their stores, optimizing both customer experience and revenue streams. Applications that count people can provide valuable data. Additionally, being able to focus on specific store areas offers even more precise insights, and that’s where YOLOv8 region counting comes in handy.</p><figure><img alt="People Counting In Specific Areas using Ultralytics YOLOv8 Region Counting" src="https://cdn-images-1.medium.com/max/828/1*NouZ-QDHivuveA3l_by-dQ.gif" /><figcaption><strong>Fig-1.3: Tracking Store Foot Traffic with YOLOv8 Region Counting</strong></figcaption></figure><p><strong>Inventory Management — Product Counting on Shelves</strong></p><p>The YOLOv8 region counting module offers a highly efficient and straightforward method for counting products in designated store sections. Especially in dynamic retail environments where product placements shift every 2–3 weeks, this tool stands out. It allows for real-time adjustments, ensuring that inventory counts remain accurate and reflective of what’s actually on the shelves. This not only helps in restocking decisions but also enhances overall store efficiency.</p><figure><img alt="Products Counting on Shelf using Ultralytics YOLOv8 Region Counting" src="https://cdn-images-1.medium.com/max/828/1*pMJU96gOYEjyyRyHb5k2kQ.gif" /><figcaption><strong>Fig-1.4: Inventory Tracking on Shelves with YOLOv8 Region Counting</strong></figcaption></figure><p><strong>Sports Analytics — Player Counting</strong></p><p>With YOLOv8 region counting, sports analysts can achieve accurate tracking of players within specific areas. This technology not only counts players but also feeds this data into comprehensive analytics, offering deeper insights into player behaviors and strategies.</p><figure><img alt="Players Counting in Regions using Ultralytics YOLOv8 Region Counting" src="https://cdn-images-1.medium.com/max/828/1*aGWhkLmg9SZfhuCGFr0lNA.gif" /><figcaption><strong>Fig-1.5: Player Counting using Ultralytics YOLOv8 Region Counting</strong></figcaption></figure><p>Thank you for joining us on this journey into <em>Object Detection and Advanced Region-Based Counting with Ultralytics YOLOv8</em>. Dive in and share your work with us! 🚀</p><h4>Our Trending Articles</h4><ul><li><a href="https://medium.com/@ultralytics/using-ultralytics-yolov8-with-sahi-on-videos-3d524087dd33"><em>Using Ultralytics YOLOv8 with SAHI on Videos</em></a></li><li><a href="https://ultralytics.medium.com/object-tracking-across-multiple-streams-using-ultralytics-yolov8-7934618ddd2"><em>Object Tracking Across Multiple Streams using Ultralytics YOLOv8</em></a></li></ul><figure><img alt="Ultralytics" src="https://cdn-images-1.medium.com/max/250/1*AidfjSaDUeeAVd9c69zVEw.png" /><figcaption><strong>Ultralytics</strong></figcaption></figure><p><a href="https://ultralytics.com/">Ultralytics</a> is on a mission to empower people and companies to unleash the positive potential of vision AI. With a commitment to simplicity, flexibility, and usability, Ultralytics YOLO and <a href="http://hub.ultralytics.com/">Ultralytics HUB</a> lower the barriers to getting started solving the world’s challenges. Ultralytics technology enables businesses to transform their operations, enhance customer experiences, and drive innovation by seamlessly integrating state-of-the-art models and user-friendly platforms. It’s been a remarkable journey, but we’re just getting started.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=96f30d52ec1c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Object Tracking Across Multiple Streams using Ultralytics YOLOv8]]></title>
            <link>https://ultralytics.medium.com/object-tracking-across-multiple-streams-using-ultralytics-yolov8-7934618ddd2?source=rss-cf98340994cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/7934618ddd2</guid>
            <category><![CDATA[yolov8]]></category>
            <category><![CDATA[object-detection]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[multistreaming]]></category>
            <category><![CDATA[object-tracking]]></category>
            <dc:creator><![CDATA[Ultralytics]]></dc:creator>
            <pubDate>Tue, 03 Oct 2023 09:47:08 GMT</pubDate>
            <atom:updated>2023-10-03T09:47:08.876Z</atom:updated>
            <content:encoded><![CDATA[<p>Object tracking across multiple streams plays an important role in computer vision, particularly in real-world applications. It extends beyond mere problem-solving, offering valuable insights and serving as a prerequisite for object-counting modules. It empowers systems to observe and analyze the movements of objects, a fundamental requirement in scenarios such as surveillance, autonomous vehicles, and retail analytics. Ultimately, object tracking enriches comprehension and decision-making in complex environments.</p><figure><img alt="Ultralytics YOLOv8 Object Tracking Across Multiple Streams" src="https://cdn-images-1.medium.com/max/828/1*FhxmBSaTPotSCpwTxbMTGQ.png" /><figcaption><strong>Fig-1.1: Ultralytics YOLOv8 Object Tracking Across Multiple Streams</strong></figcaption></figure><p>In this article, you will learn how to perform object tracking on multiple streams using Ultralytics YOLOv8. The key components covered include:</p><ul><li>Importing Required Libraries</li><li>Object Tracking Code for Multistreaming</li><li>Inference</li></ul><p>Let’s dive in!</p><h4>Import Required Libraries</h4><p>Before diving into object tracking with Ultralytics YOLOv8, we need to set up the necessary libraries and dependencies. Follow these steps:</p><p><strong>Step 1.1: Install the Ultralytics Package</strong></p><p>Ensure you have the Ultralytics package installed by running the following command:</p><pre>pip install ultralytics # Install Ultralytics Package</pre><p><strong>Step 1.2: Create a Python File and Import Libraries</strong></p><p>Create a Python file for your project and import the essential libraries. In this project, we’ll be using OpenCV for displaying frames and Ultralytics for object detection, segmentation, and tracking.</p><pre>import cv2 # Import OpenCV Library<br>from ultralytics import YOLO # Import Ultralytics Package</pre><p><strong>Step 1.3: Import the Threading Module</strong></p><p>To facilitate multi-streaming, we’ll be using threading. Import the threading module as follows:</p><pre>import threading # Threading module import</pre><p>With these initial steps completed, we’re now ready to proceed with object tracking on multiple streams.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FWs6T5PN7wHv3cY8xy8%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fnounish-dao-nouns-noggles-Ws6T5PN7wHv3cY8xy8&amp;image=https%3A%2F%2Fmedia3.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExM3QzYTl1NTA2bGhvcnFrNjZ2MXpicnlpMzlhZnZuMWFtaHI5cXN5MiZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw%2FWs6T5PN7wHv3cY8xy8%2Fgiphy_s.gif&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="261" frameborder="0" scrolling="no"><a href="https://medium.com/media/ea2be8a1ec2f539055ad8ffd3be0ee72/href">https://medium.com/media/ea2be8a1ec2f539055ad8ffd3be0ee72/href</a></iframe><h4>Object Tracking Code for Multistreaming</h4><p>In this section, we’ll focus on setting up object tracking for two video streams: one from a video file and another from a webcam or IP camera.</p><p><strong>Step 2.1: Define Video File Paths</strong></p><p>Now, let’s define the file paths for the video streams we want to track objects on. In this example, we’ll use one video file and one webcam feed.</p><pre># Define the video files for the trackers<br>video_file1 = ‘ultralytics\\test.mp4’ # Video file path<br>video_file2 = 0  # WebCam Path</pre><p><strong>Step 2.2: Load YOLOv8 Models</strong></p><p>First, we need to load the YOLOv8 models, which will be the backbone of our object-tracking system. We will load two models: one for object detection and another for object segmentation. The models are closely linked to the video sources; the more the number of video sources, the more models will be utilized in parallel.</p><pre># Load the YOLOv8 models<br>model1 = YOLO(‘yolov8n.pt’) # YOLOv8n Model<br>model2 = YOLO(‘yolov8s.pt’) # YOLOv8s Model</pre><p><strong>Step 2.3: Target Function for Thread</strong></p><p>Next, let’s establish a target for our threading operation. This target will be a function responsible for running the video file and applying the YOLOv8 object-tracking algorithm. The mentioned code will act as the target function for our thread.</p><pre>def run_tracker_in_thread(filename, model, file_index):<br>    &quot;&quot;&quot;<br>    This function is designed to run a video file or webcam stream<br>    concurrently with the YOLOv8 model, utilizing threading.<br><br>    - filename: The path to the video file or the webcam/external<br>    camera source.<br>    - model: The file path to the YOLOv8 model.<br>    - file_index: An argument to specify the count of the<br>    file being processed.<br>    &quot;&quot;&quot;<br><br>    video = cv2.VideoCapture(filename)  # Read the video file<br><br>    while True:<br>        ret, frame = video.read()  # Read the video frames<br><br>        # Exit the loop if no more frames in either video<br>        if not ret:<br>            break<br><br>        # Track objects in frames if available<br>        results = model.track(frame, persist=True)<br>        res_plotted = results[0].plot()<br>        cv2.imshow(&quot;Tracking_Stream_&quot;+str(file_index), res_plotted)<br><br>        key = cv2.waitKey(1)<br>        if key == ord(&#39;q&#39;):<br>            break<br><br>    # Release video sources<br>    video.release()</pre><blockquote><strong><em>Note:</em> </strong><em>The </em><strong><em>file_index</em></strong> <em>parameter represents the index of the file that can be assigned to each thread. For example, if you are processing two videos concurrently, the first thread will be assigned file_index as 1, while the second thread will use file_index as 2. In the case of a third thread, it will have file_index set to 3.</em></blockquote><blockquote><strong><em>Hint:</em></strong> <em>If you want to do Object Detection on Multiple streams, you can replace </em><strong>model.track</strong><em> with </em><strong>model.predict </strong><em>in the above function.</em></blockquote><p><strong>Step-2.4: Create the Object Tracking Threads</strong></p><p>Now, let’s generate the threads for object tracking. The number of threads will correspond to the number of video sources you intend to run. The provided code will create two threads to handle two video streams.</p><pre># Create the tracker thread<br><br># Thread used for the video file<br>tracker_thread1 = threading.Thread(target=run_tracker_in_thread,<br>                                   args=(video_file1, model1, 1),<br>                                   daemon=True)<br><br># Thread used for the webcam<br>tracker_thread2 = threading.Thread(target=run_tracker_in_thread,<br>                                   args=(video_file2, model2, 2),<br>                                   daemon=True)</pre><p><strong>Step-2.5: Start the Object Tracking Threads</strong></p><p>Everything is set up and ready to go. Now, it’s time to initiate the object tracking threads.</p><pre># Start the tracker thread<br><br># Start thread that run video file<br>tracker_thread1.start()<br><br># Start thread that run webcam<br>tracker_thread2.start()</pre><p><strong>Step-2.6: Thread Handling and Destroy Windows</strong></p><p>Following the thread’s activation, it’s equally important to manage it when it concludes its task. The mentioned code snippet serves the purpose of waiting for the object tracking thread to complete its execution.</p><pre># Wait for the tracker thread to finish<br><br># Tracker thread 1<br>tracker_thread1.join()<br><br># Tracker thread 2<br>tracker_thread2.join()<br><br># Clean up and close windows<br>cv2.destroyAllWindows()</pre><blockquote><strong><em>Note: </em></strong><em>If you need the complete code for Object Tracking Across Multiple Streams using YOLOv8, you can check </em><a href="https://docs.ultralytics.com/modes/track/#multithreaded-tracking"><strong><em>https://docs.ultralytics.com/</em></strong></a></blockquote><h4><strong>Inference</strong></h4><p>We have now crafted a comprehensive code for handling multiple streams with YOLOv8 for object tracking. The next step is to put this code into action. Save the file where you’ve incorporated the provided code as ‘ultralytics_multi_stream_object_tracking.py’ and proceed to execute it using the following command.</p><pre># run the code file<br>python &#39;ultralytics_multi_stream_object_tracking.py&#39;</pre><p>In a matter of seconds, the processing will start, and you’ll observe the inference results on both the video file and the webcam feed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*g4-ZhZ1_EDxzucbbaEGK_w.gif" /><figcaption><strong>Fig-1.3: Ultralytics YOLOv8 Object Tracking on Video Feed and WebCam</strong></figcaption></figure><p>Thank you for journeying with us through the realms of “Object Tracking Across Multiple Streams using Ultralytics YOLOv8.” Take it for a spin on your content. We’re all ears (and eyes!) for your creations! 🚀</p><h4>Our Trending Articles</h4><ul><li><a href="https://medium.com/@ultralytics/using-ultralytics-yolov8-with-sahi-on-videos-3d524087dd33"><em>Using Ultralytics YOLOv8 with SAHI on Videos</em></a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*AidfjSaDUeeAVd9c69zVEw.png" /><figcaption><strong>Ultralytics</strong></figcaption></figure><p><a href="https://ultralytics.com/">Ultralytics</a> is on a mission to empower people and companies to unleash the positive potential of vision AI. With a commitment to simplicity, flexibility, and usability, Ultralytics YOLO and HUB lower the barriers to getting started solving the world’s challenges. Ultralytics technology enables businesses to transform their operations, enhance customer experiences, and drive innovation by seamlessly integrating state-of-the-art models and user-friendly platforms. It’s been a remarkable journey, but we’re just getting started.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7934618ddd2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Ultralytics YOLOv8 with SAHI on Videos]]></title>
            <link>https://ultralytics.medium.com/using-ultralytics-yolov8-with-sahi-on-videos-3d524087dd33?source=rss-cf98340994cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/3d524087dd33</guid>
            <category><![CDATA[research-and-development]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[yolov8]]></category>
            <category><![CDATA[sahi]]></category>
            <category><![CDATA[object-detection]]></category>
            <dc:creator><![CDATA[Ultralytics]]></dc:creator>
            <pubDate>Tue, 19 Sep 2023 12:54:13 GMT</pubDate>
            <atom:updated>2023-09-19T12:54:13.153Z</atom:updated>
            <content:encoded><![CDATA[<p>Object detection is a crucial aspect, particularly when handling small objects. However, it’s not uncommon for the model’s performance to fall short of expectations even after successful detection. There can be various factors contributing to this, such as the presence of blurry or noisy objects, limitations in dataset size, or image quality issues.</p><p>This is where the concept of SAHI comes into play. SAHI splits the image into slices, running the object detection model on each slice, and then consolidating the results from these slices to generate an output image. In this article, we will explore the process of implementing SAHI with Ultralytics YOLOv8 for analyzing video files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*1qEfu2OfXWlojlUNeH_mNQ.png" /><figcaption><strong>Fig-1.1: Using Ultralytics YOLOv8 with SAHI on Videos</strong></figcaption></figure><p>If you just want to run on images, you can check our guide <a href="https://docs.ultralytics.com/guides/sahi-tiled-inference/">Ultralytics Docs: Using YOLOv8 with SAHI for Sliced Inference</a>.</p><p>To utilize SAHI with YOLOv8 for video analysis, you can embark on the following comprehensive steps. These instructions have been tested on multiple platforms, including Ubuntu 18.04, 20.04, and Windows 10.</p><ul><li>Installation of required libraries</li><li>Inference with YOLOv8</li><li>Inference with YOLOv8 and SAHI</li><li>Speed and Accuracy Comparision of SAHI with YOLOv8</li></ul><h4><strong>Installation of Required Libraries</strong></h4><p>Begin by setting up the essential modules and dependencies to ensure a seamless workflow. This step is crucial for preparing your environment for subsequent inference tasks.</p><p>Clone the Ultralytics repository and navigate to the cloned directory using the provided command below.</p><pre># Clone the ultralytics repository<br>git clone https://github.com/ultralytics/ultralytics/tree/main <br><br># Navigate to the cloned directory<br>cd ultralytics</pre><p>Execute the provided command to install the Ultralytics and SAHI packages.</p><pre># Install the ultralytics package<br>pip install sahi ultralytics</pre><h4>Inference with YOLOv8</h4><p>After completing the module installation, you can proceed with performing inference using the YOLOv8 model. This stage will involve the detection and identification of objects in different videos, utilizing the power and capabilities of YOLOv8, and verifying If the ultralytics package is installed correctly.</p><p>You can use the mentioned command below for inference using YOLOv8.</p><pre># Inference command for YOLOv8<br>yolo task=detect mode=predict source=&quot;https://youtu.be/8r8hYenr5j8&quot; \<br> model=yolov8n.pt show=True</pre><figure><img alt="Object Detection Using YOLOv8 Ultralytics (Inference)" src="https://cdn-images-1.medium.com/max/700/1*UyVa0UqgOIEEaOdzODanJA.gif" /><figcaption><strong>Fig-1.2: Object Detection Using Ultralytics YOLOv8 (Inference)</strong></figcaption></figure><h4>Inference with YOLOv8 and SAHI</h4><p>You can proceed with the steps outlined below to perform inference with SAHI using YOLOv8. Begin by navigating to the examples directory using the following command:</p><pre># Move to the examples directory<br>cd examples<br><br># Move to SAHI code directory<br>cd &quot;YOLOv8-SAHI-Inference-Video&quot;</pre><p>Use the mentioned command to run the SAHI on a video file.</p><pre><br># The --save-img flag is used to indicate that you want to save the results<br>python yolov8_sahi.py — source “path/to/video.mp4” — save-img<br><br># If you want to change weights file<br>python yolov8_sahi.py - source &quot;path/to/video.mp4&quot; - save-img \<br>--weights yolov8n.pt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*9KflZqKQLdeoPR3_M4DDfg.gif" /><figcaption><strong>Fig-1.3: Object Detection Using YOLOv8 and SAHI (Inference)</strong></figcaption></figure><h4>Speed and Accuracy Comparision</h4><p>The crucial aspects of computer vision models revolve around the balance between speed and accuracy, and it’s important to take several key considerations into account:</p><ul><li>SAHI with YOLOv8 excels in superior object detection by dividing images into segments and applying the detection model sequentially. This method, while effective, is hardware-intensive and not suitable for real-time processing. In contrast, YOLOv8 operates efficiently on a CPU, providing faster performance compared to the SAHI integration.</li><li>Certain use cases and applications prioritize accuracy over speed, where the precision of results is paramount. In such scenarios, SAHI emerges as an ideal technique to achieve favorable outcomes.</li><li>With SAHI, the accuracy is directly impacted by the image slices created, with greater slices leading to improved precision. However, this results in slower inference speeds due to the increased computational demands of processing more slices.</li></ul><p>In essence, striking the right balance between speed and accuracy is important when choosing the best methodology for computer vision tasks.</p><p>Thank you for joining us on this exploration of <strong>“Using Ultralytics YOLOv8 with SAHI on Videos”</strong>.</p><p>Feel free to try it out in your own video content; we look forward to seeing your results!</p><figure><img alt="Ultralytics" src="https://cdn-images-1.medium.com/max/250/1*jKAxlojm_9n7GfCxKLI68A.png" /><figcaption><strong>Ultralytics</strong></figcaption></figure><p><a href="https://ultralytics.com/">Ultralytics</a> is on a mission to empower people and companies to unleash the positive potential of vision AI. With a commitment to simplicity, flexibility, and usability, Ultralytics YOLO and HUB lower the barriers to getting started solving the world’s challenges. Ultralytics technology enables businesses to transform their operations, enhance customer experiences, and drive innovation by seamlessly integrating state-of-the-art models and user-friendly platforms. It’s been a remarkable journey, but we’re just getting started.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3d524087dd33" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>