الشيك الأخضر
تم نسخ الرابط إلى الحافظة

How to Use Ultralytics YOLO11 for Instance Segmentation

Understand how the new Ultralytics YOLO11 model can be used for instance segmentation to achieve higher precision in applications like waste management and flare monitoring.

Computer vision, a field within artificial intelligence (AI) that helps machines interpret and understand visual information, enables tasks like instance segmentation. Instance segmentation can be used to analyze an image or video frame to mark the exact boundaries of each distinct object in the image, even when multiple objects of the same type are present. With its high level of precision, instance segmentation has a wide range of applications, from helping self-driving cars detect obstacles on the road to identifying tumors in medical scans.

Over the years, instance segmentation has evolved significantly. A recent development was introduced during Ultralytics’ annual hybrid event, YOLO Vision 2024 (YV24), in the form of the Ultralytics YOLO11 model. The new model supports the same computer vision tasks (including instance segmentation) as the Ultralytics YOLOv8 model, so users familiar with previous versions can adopt the new model seamlessly.

Fig 1. An example of using the Ultralytics YOLO11 model for instance segmentation.

In this article, we’ll explore instance segmentation and how it differs from other computer vision tasks like semantic segmentation, as well as discuss some of its applications. We’ll also walk through how you can use the YOLO11 instance segmentation model using the Ultralytics Python package and the Ultralytics HUB platform. Let’s get started!

What is Instance Segmentation?

Instance segmentation can be used to identify objects in an image and outline them at the pixel level. The process typically involves first detecting objects and drawing bounding boxes around them. Then, a segmentation algorithm classifies each pixel within the bounding box to create a precise mask for each object.

Instance segmentation is also different from tasks like semantic segmentation and panoptic segmentation. Semantic segmentation labels each pixel based on the general category of an object, without distinguishing individual instances. Panoptic segmentation, on the other hand, combines both instance and semantic segmentation by labeling each pixel with both a class and an instance ID, identifying individual objects within each category.

Fig 2. Using YOLO11 to detect and segment a person and a dog.

Instance segmentation's capabilities can be applied in various scenarios that may require different models. For example, a lightweight model might be ideal for real-time processing in mobile applications, while a more complex model could be used for high-precision tasks like quality control in manufacturing.

Like previous models, the YOLO11 instance segmentation model also comes with several variations depending on your needs. These variations include the YOLO11n-seg (Nano), YOLO11s-seg (Small), YOLO11m-seg (Medium), YOLO11l-seg (Large), and YOLO11x-seg (Extra Large). These models vary in terms of their size, processing speed, accuracy, and the amount of computational power they require. Based on your specific requirements, you can choose the model that best fits your application.

Instance Segmentation Applications for YOLO11

The advanced instance segmentation capabilities of YOLO11 open up a range of applications across various industries. Let’s take a closer look at some of these applications.

Using YOLO11 Segmentation in the Oil and Gas Industry

Oil and gas extraction involves managing extremely high fluctuations of pressure. Techniques like gas flaring help burn away the natural gas that is produced during oil extraction. It is necessary for safety reasons. For instance, in crude oil extraction, a sudden or significant pressure spike could lead to an explosion. Although uncommon, industrial accidents in the oil and gas manufacturing sector can result in intense fires that are difficult to contain and control. Gas flaring helps operators to safely depressurize equipment and manage unpredictable, large pressure fluctuations by burning off the excess gas.

AI systems can improve this monitoring process, and the risk of accidents can be reduced by using an instance segmentation-based flare monitoring system. Monitoring gas flaring is also important for environmental reasons, as too much flaring can negatively impact the environment. 

Ultralytics YOLO11 instance segmentation models can be used to monitor the amount of fire and smoke caused by flaring. The pixel area of the detected and segmented flare and smoke can be calculated. Using this information, operators can gain real-time insights into the flare and smoke caused by flaring, helping them prevent accidents and negative environmental impacts. 

Fig 3. An example of flare monitoring using YOLO11 in oil and gas manufacturing.

Instance Segmentation with YOLO11 for Plastic Waste Management 

Workers at waste management and recycling facilities can use YOLO11 instance segmentation-based systems to identify plastic waste materials. YOLO11 can be integrated with robotic sorting systems to accurately identify different waste materials, like cardboard and plastic (to be processed separately). It’s especially important considering out of 7 billion tonnes of plastic waste generated globally, only about 10% gets recycled.

Automating the identification and sorting of plastic waste significantly reduces the time needed compared to traditional methods, where workers sort items by hand. Computer vision models can even segment soft plastics like wraps and bags, which are particularly challenging because they often get tangled. YOLO11 models can also be custom-trained to segment different types of plastics. We will learn more about how you can custom-train a YOLO11 model in the following sections.

Fig 4. Identifying plastic waste using Ultralytics YOLO11. 

YOLO11 Segmentation in Autonomous Vehicles

Another interesting use case of instance segmentation is in autonomous cars. YOLO11 enables self-driving cars to improve passenger safety and the safety of others on the road by accurately recognizing objects at the pixel level. The car’s onboard camera system can capture images of the surroundings and analyze them using YOLO11 and instance segmentation. Each object (pedestrians, traffic lights, other vehicles, etc.) within the image is segmented, and it’s given a label. Such a level of precision gives autonomous cars the ability to identify each and every object around them. 

Fig 5. Using YOLO11 and instance segmentation to identify vehicles and pedestrians on the road.

Trying Out Instance Segmentation with the YOLO11 Model

Now that we’ve explored instance segmentation and discussed some of its applications, Let’s see how you can try it out using the Ultralytics YOLO11 model. 

There are two ways to do this: you can either use the Ultralytics Python package or the Ultralytics HUB. We’ll be exploring both, starting with the Python package.

Running Inferences using YOLO11

Running an inference involves using the model to analyze new, previously unseen data. To run an inference using the YOLO11 instance segmentation model through code, we need to install the Ultralytics Python package using pip, conda, or docker. In case you face any issues during installation, you can refer to our Common Issues Guide for assistance with troubleshooting. Once the package is installed, you can run the code shown below to load the YOLO11 instance segmentation model and run predictions on an image.

Fig 6. Running an inference on an image using YOLO11n-seg.

Training a Custom YOLO11 Model

With the same code setup, you can also train a custom YOLO11 model. By fine-tuning a YOLO11 model, you can create a custom version of the model that meets your specific project requirements better. For example, retailers can use a custom model to accurately segment a customer's physical features to recommend clothes that fit properly. The code snippet below shows how to load and train a YOLO11 model for instance segmentation. You can start from a YAML configuration or a pre-trained model, transfer weights, and train on a dataset like COCO to achieve effective segmentation. 


from ultralytics import YOLO

# Load a model
model = YOLO("yolo11n-seg.yaml")  # build a new model from YAML
model = YOLO("yolo11n-seg.pt")  # load a pretrained model (recommended for training)
model = YOLO("yolo11n-seg.yaml").load("yolo11n.pt")  # build from YAML and transfer weights

# Train the model
results = model.train(data="coco8-seg.yaml", epochs=100, imgsz=640)

Once completed, you can perform inferences using the custom model for your specific applications. Using the export option, you can also export your custom model to a different format.

YOLO11 Instance Segmentation on Ultralytics HUB

Now that we’ve explored running inferences and custom training a YOLO11 instance segmentation model through code, let’s look at a no-code alternative: Ultralytics HUB. Ultralytics HUB is an intuitive Vision AI platform that simplifies the process of training and deploying YOLO models, including the YOLO11 instance segmentation models. 

To run inference on images, all you have to do is; create an account, go to the ‘Models’ section, and select the YOLO11 instance segmentation model variant of your choice. You can upload an image and view the prediction results in the preview section, as shown below.

Fig 7. Running inferences on Ultralytics HUB.

الماخذ الرئيسية

YOLO11 offers reliable instance segmentation capabilities that open up a world of possibilities across various industries. From enhancing safety in autonomous vehicles and monitoring gas flaring in the oil and gas sector to automating waste sorting in recycling facilities, YOLO11’s pixel-level precision makes it ideal for complex segmentation tasks. 

With options for custom training through the Ultralytics Python package and a no-code setup via Ultralytics HUB, users can seamlessly integrate YOLO11 into their workflows. Whether for industrial applications, healthcare, retail, or environmental monitoring, YOLO11 brings flexibility and accuracy to meet diverse segmentation needs.

To explore more, visit our GitHub repository, and engage with our community. Explore AI applications in self-driving cars and agriculture on our solutions pages. 🚀

شعار الفيسبوكشعار تويترشعار لينكد إنرمز نسخ الرابط

اقرأ المزيد في هذه الفئة

دعونا نبني المستقبل
من الذكاء الاصطناعي معا!

ابدأ رحلتك مع مستقبل التعلم الآلي