Label Data with Segment Anything Model (SAM) in Roboflow

Roboflow · Beginner ·👁️ Computer Vision ·3y ago

Key Takeaways

The video demonstrates how to use the Segment Anything Model (SAM) in Roboflow for zero-shot segmentation labeling, leveraging the Smart Polygon feature for efficient object segmentation and annotation. It showcases the model's capabilities in converting bounding boxes into polygons and handling occluded objects, with a focus on increasing labeling productivity and accuracy.

Full Transcript

few days ago we released a video about segment anything modeled by meta Ai and in that video I mentioned that our engineering team was working on the integration of Sam into roboflow annotation tool and today we can take a look at the results of their hard work I selected three different data sets from roboflow universe and we will pick few images from each of them and re-annotate them using some so without further Ado let's dive in and let me show you how fast you can annotate complicated objects with smart polygon in roboflow editor okay so let's start with one of my favorite data sets in roboflow universe and this is the concrete cracks data set I actually used it in one of my previous demo videos at our channel before so before I started recording I created empty project in my workspace and right now I'm just copying images from this already annotated project into mine and hopefully I will be able to recreate those annotations but much faster let's keep the whole copying process as it is not the main topic of this video and jump straight into the editor pick smart polygon tool and hover it over the crack and after split of a second I see the preview of my polygon I just click and I get the first version of it we can see that it only got highlighted partially but while I'm still in editing mode I can just pick one more point this time in the part of the crack that was not highlighted originally and now our annotation is complete we have the full crack mask we can just hit enter it will convert our mask into polygon hit enter once again to confirm that we want to use crack class and we are done it was pretty fast so let's annotate one more we just hover over the crack wait until the editor will show us the preview of The Mask if it's acceptable we click and then hit enter to confirm hit enter once again to confirm that we want to use crack class and that's it now in this image there are actually two cracks the other one is very thin so I try to annotate it hovered over the crack but didn't get any preview that would be acceptable so we need to skip that and annotate it manually so stuff like that can happen especially in case of long thin objects unfortunately not every mask can be obtained with some let's take a look at next image here the case is much simpler got the mask right away so we just click enter enter next image same drill we just hover over the crack click when it's acceptable then enter enter to confirm and that's it I guess you can see that at this point the process is getting quite repetitive so we will jump into next example but like we saw even in case of hard to detect objects Sam is doing absolutely fine and in most cases our work is done in just few seconds next up we have blueberries so this is data set that already exists in roboflow Universe however originally it was annotated using bounding boxes and because there is a lot of objects on every image I thought it's a very good example that we can use so once again we have empty blueberries project in my workspace and I'm just selecting few images copying them into my project and we will use Sam to convert those bounding boxes into segmentations it's actually pretty easy I can just click with right button of my mouse on the bounding box and select convert box into smart polygon and that's it this obviously increase our labeling productivity tremendously and notice how bounding boxes around the objects are not necessarily super tight and some can still figure out which part of the bounding box contain the object that we want to annotate and which part of the bounding box is basically a background that needs to be removed and at the same time even when one object is occluded by another like in this case the blueberry is occluded by the leaf it can still figure out how to properly annotate that which is you yeah super awesome okay so let's speed up the recording a little bit as you can see it's pretty repetitive process so I'm just using the same functionality over and over again but here here is quite an interesting example so you can see that within the same bounding box we had a blueberry annotation but there was also a leaf and interestingly enough the leaf was in the foreground so some thought that in this particular case we are most interested in the leaf not the blueberry because it's kind of blurred and in a background so I could just remove a prediction provided by some and use the manual tool to hover over the blueberry and select this mask instead so because it's not fully automated process you can still fix your mistakes along the way okay so I think that I will spare you looking at me converting those bounding boxes into segmentations and and we will take a look at the final result so here it is the initial image annotated with bounding boxes for object detection on the left side and the same image but annotated with polygons on the right side the quality of the masks is really good but what blows my mind the most that whole process where I converted the bounding boxes into polygons fix few things along the way and even added some annotations for some blueberries that were not annotated before took me four minutes to do I'm pretty confident that with the traditional approach where I'm just drawing the polygons in the editor that would take me easily 30-40 minutes and I'm not even sure if I would be able to deliver the same quality of the annotations in case of both demos that we already saw there is one common factor and that is the quality of the images in both cases we used higher resolution images with easily recognizable objects even if one object occluded another it was quite easy to figure out where is The Edge between them so now let's take a look at a bit harder use case and try to segment blood cells on microscope images similarly as before I copied few images from public data set into my private one and now we will convert those bounding boxes into segmentations let's start with the huge white cell in the middle that was most likely the easiest of them all similarly like in the case of blueberries we just hit the right button and use the convert bounding box to Smart polygon functionality and now you can do exactly the same for other blood cells we can see that even though that the overall resolution of the image is much lower and the quality of damage is also worst it is doing quite well for most of the blood cells from time to time we we need to pick the manual tool to create new annotation because not every blood cell is annotated but the process is very similar to the one that we already covered when we annotated cracks so we just hover confirm the polygon confirm the class and we are good to go the next few cells are interesting because they are close to each other and they also heavily overlap each other but we see that we had no problem with the first one we got a bit weird polygon for the second one and the third one was also generated quite well so now we need to zoom in to fix our polygon we just click on the anchors that we want to delete and drag the and cores that we want to move and after just few adjustments the mask is ready let's speed up the video a bit and take a look how efficiently we can convert the bounding boxes into the masks but also how easy it is to add annotations for objects that were not originally annotated like previously in some cases we need to do some adjustments either by manually annotating or just editing the polygon provided by Sam but after just few seconds we are done so there you have it segment anything model supporting polygon annotation in roboflow editor I highly encourage you to use it and let us know in the comment how it did on your data set remember that it works best on high resolution images but you can certainly give it a try even on those small ones best case scenario you are doing your annotations almost automatically and you just supervise the processed worst case scenarios you still need to do some manual adjustments either way you save a lot of time so if you are doing segmentation annotation in roboflow editor and you are not using some you are certainly missing out okay that's all from me today I hope my tips were useful in the meantime let I can subscribe and stay tuned for more computer vision content coming to this channel soon my name is Peter and I see you next time bye

Original Description

We are excited to release support for zero-shot segmentation labeling in Roboflow Annotate using Meta AI’s Segment Anything Model (SAM). Using the Smart Polygon feature, you’re accessing a cloud-hosted Segment Anything model enabling you to apply polygon annotations faster, easier, and more accurately than ever before, right inside the Roboflow UI. No setup. No servers. No integrations. Create annotations with one click. Chapters: 00:00 - Introduction 00:35 - Concrete Cracks Annotation with Smart Polygon 03:06 - Converting Bounding Box Blueberry Object Detection Dataset into Polygons 06:43 - Annotating Low-Resolution Blood Cells Images with Smart Polygon 08:47 - Conclusion Resources: 🌏 Roboflow: https://roboflow.com 🌌 Roboflow Universe: https://universe.roboflow.com 📚 Launch: Label Data with Segment Anything in Roboflow blog: https://blog.roboflow.com/label-data-segment-anything-model-sam 🔥 Automated Data Labeling with SAM: https://youtu.be/oEQYStnF2l8 On July 29th, 2024, Meta AI released Segment Anything 2 (SAM 2), a new image and video segmentation foundation model. According to Meta, SAM 2 is 6x more accurate than the original SAM model at image segmentation tasks. Learn more: https://blog.roboflow.com/what-is-segment-anything-2/ Don't forget to like, comment, and subscribe for more content on AI, computer vision, and the latest breakthroughs in technology! 🚀 #MetaAI #SegmentAnythingModel #SAM #ImageSegmentation #ComputerVision
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Roboflow · Roboflow · 0 of 60

← Previous Next →
1 YOLOv3 PyTorch Notebook Tutorial
YOLOv3 PyTorch Notebook Tutorial
Roboflow
2 How to Train YOLOv4 on a Custom Dataset (PyTorch)
How to Train YOLOv4 on a Custom Dataset (PyTorch)
Roboflow
3 How to Train YOLOv5 on a Custom Dataset
How to Train YOLOv5 on a Custom Dataset
Roboflow
4 How to Use the Roboflow Dataset Health Check
How to Use the Roboflow Dataset Health Check
Roboflow
5 What is Mean Average Precision (mAP)?
What is Mean Average Precision (mAP)?
Roboflow
6 How to Use the Roboflow Model Library
How to Use the Roboflow Model Library
Roboflow
7 How to Train EfficientDet in TensorFlow 2 Object Detection
How to Train EfficientDet in TensorFlow 2 Object Detection
Roboflow
8 How to Train YOLO v4 Tiny (Darknet) on a Custom Dataset
How to Train YOLO v4 Tiny (Darknet) on a Custom Dataset
Roboflow
9 Ask the Roboflow Team Anything - Episode 1
Ask the Roboflow Team Anything - Episode 1
Roboflow
10 Exploring The COCO Dataset
Exploring The COCO Dataset
Roboflow
11 Community Spotlight: Improving Uno with Computer Vision
Community Spotlight: Improving Uno with Computer Vision
Roboflow
12 Mosaic Data Augmentation - Deep Dive
Mosaic Data Augmentation - Deep Dive
Roboflow
13 Hands on with the OAK-1
Hands on with the OAK-1
Roboflow
14 Glenn Jocher: What is New in YOLO v5?
Glenn Jocher: What is New in YOLO v5?
Roboflow
15 How to Use Amazon Rekognition Custom Labels and Roboflow to Build an Object Detection Model
How to Use Amazon Rekognition Custom Labels and Roboflow to Build an Object Detection Model
Roboflow
16 An Interview with Brandon Gilles, Luxonis Founder and OAK Chief Architect
An Interview with Brandon Gilles, Luxonis Founder and OAK Chief Architect
Roboflow
17 How to Train a Custom Mobile Object Detection Model (with YOLOv4 Tiny and TensorFlow Lite)
How to Train a Custom Mobile Object Detection Model (with YOLOv4 Tiny and TensorFlow Lite)
Roboflow
18 Tackling the Small Object Problem in Object Detection
Tackling the Small Object Problem in Object Detection
Roboflow
19 Fast.ai v2 Released - What's New?
Fast.ai v2 Released - What's New?
Roboflow
20 Teaser: Roboflow Train (1-Click Computer Vision AutoML)
Teaser: Roboflow Train (1-Click Computer Vision AutoML)
Roboflow
21 How to Train a Custom Resnet34 Image Classification Model
How to Train a Custom Resnet34 Image Classification Model
Roboflow
22 How to Label Images for Object Detection with CVAT
How to Label Images for Object Detection with CVAT
Roboflow
23 Deploy YOLOv5 to Jetson Xavier NX at 30 FPS
Deploy YOLOv5 to Jetson Xavier NX at 30 FPS
Roboflow
24 Elisha Odemakinde Hosts Roboflow ML Engineer, Jacob Solawetz
Elisha Odemakinde Hosts Roboflow ML Engineer, Jacob Solawetz
Roboflow
25 Getting Started with VoTT - Computer Vision Annotation
Getting Started with VoTT - Computer Vision Annotation
Roboflow
26 How to Manage Classes in Object Detection (Rename, Combine, Balance)
How to Manage Classes in Object Detection (Rename, Combine, Balance)
Roboflow
27 How to Train YOLOv4 on a Custom Dataset in Darknet
How to Train YOLOv4 on a Custom Dataset in Darknet
Roboflow
28 Is Grayscale a Preprocessing or Augmentation Step in Computer Vision?
Is Grayscale a Preprocessing or Augmentation Step in Computer Vision?
Roboflow
29 Getting Started with Image Data Augmentation
Getting Started with Image Data Augmentation
Roboflow
30 Glenn Jocher: Image Augmentation in YOLO v5 and Beyond
Glenn Jocher: Image Augmentation in YOLO v5 and Beyond
Roboflow
31 GA Hosts Roboflow - Healthcare and AI
GA Hosts Roboflow - Healthcare and AI
Roboflow
32 How do self driving cars know when to stop?
How do self driving cars know when to stop?
Roboflow
33 What is PASCAL VOC XML?
What is PASCAL VOC XML?
Roboflow
34 AutoML Showdown: Google vs Amazon vs Microsoft
AutoML Showdown: Google vs Amazon vs Microsoft
Roboflow
35 How is computer vision changing manufacturing?
How is computer vision changing manufacturing?
Roboflow
36 The Alphabet in American Sign Language
The Alphabet in American Sign Language
Roboflow
37 Luxonis OAK-D: Computer Vision on Device
Luxonis OAK-D: Computer Vision on Device
Roboflow
38 How to Train a Custom Faster R-CNN Model with Facebook AI's Detectron2 | Use Your Own Dataset
How to Train a Custom Faster R-CNN Model with Facebook AI's Detectron2 | Use Your Own Dataset
Roboflow
39 TensorFlow vs PyTorch: Fireside
TensorFlow vs PyTorch: Fireside
Roboflow
40 Occlusion Techniques in Computer Vision
Occlusion Techniques in Computer Vision
Roboflow
41 A Customizable Web Application for Your Computer Vision Model
A Customizable Web Application for Your Computer Vision Model
Roboflow
42 Model Tradeoffs and the Future of Computer Vision
Model Tradeoffs and the Future of Computer Vision
Roboflow
43 Designing an Augmented Reality Board Game App
Designing an Augmented Reality Board Game App
Roboflow
44 YOLOv4 - Advanced Tactics
YOLOv4 - Advanced Tactics
Roboflow
45 How to Use CreateML and Build a Computer Vision iPhone App | AR Object Detection
How to Use CreateML and Build a Computer Vision iPhone App | AR Object Detection
Roboflow
46 Fireside Chat: Computer Vision in Agriculture
Fireside Chat: Computer Vision in Agriculture
Roboflow
47 Scaled-YOLOv4 Tops EfficientDet: Research Rundown
Scaled-YOLOv4 Tops EfficientDet: Research Rundown
Roboflow
48 What is Image Preprocessing?
What is Image Preprocessing?
Roboflow
49 Building a Community of Creators with BlkArthouse and Von Deon
Building a Community of Creators with BlkArthouse and Von Deon
Roboflow
50 How to Train Scaled-YOLOv4 to Detect Custom Objects
How to Train Scaled-YOLOv4 to Detect Custom Objects
Roboflow
51 Intro to Computer Vision: Fireside
Intro to Computer Vision: Fireside
Roboflow
52 The Best Way to Annotate Images for Object Detection
The Best Way to Annotate Images for Object Detection
Roboflow
53 The Computer Vision Process: Fireside
The Computer Vision Process: Fireside
Roboflow
54 How to Annotate Images with Your Team Using Roboflow
How to Annotate Images with Your Team Using Roboflow
Roboflow
55 Introducing the Roboflow Object Count Histogram
Introducing the Roboflow Object Count Histogram
Roboflow
56 How Fast is the M1 at Machine Learning? Benchmarking Apple's M1 and Intel's Chips
How Fast is the M1 at Machine Learning? Benchmarking Apple's M1 and Intel's Chips
Roboflow
57 CLIP: OpenAI's amazing new zero-shot image classifier
CLIP: OpenAI's amazing new zero-shot image classifier
Roboflow
58 How I hacked my Nest camera to run custom models
How I hacked my Nest camera to run custom models
Roboflow
59 Getting Started with the Roboflow Inference API
Getting Started with the Roboflow Inference API
Roboflow
60 Transfer Learning in Computer Vision | What, How, Why
Transfer Learning in Computer Vision | What, How, Why
Roboflow

This video teaches how to use the Segment Anything Model (SAM) in Roboflow for efficient object segmentation and annotation, with a focus on increasing labeling productivity and accuracy. By leveraging the Smart Polygon feature, users can convert bounding boxes into polygons and handle occluded objects with high accuracy. The video provides a step-by-step guide on how to use SAM in Roboflow, making it a valuable resource for computer vision practitioners.

Key Takeaways
  1. Pick the smart polygon tool and hover it over the object
  2. Click to create a polygon and adjust points as needed
  3. Hit enter to convert mask into polygon and confirm class
  4. Convert bounding boxes into polygons
  5. Use manual tool to create new annotations
  6. Edit polygons provided by SAM
  7. Add annotations for objects not originally annotated
💡 The Segment Anything Model (SAM) can significantly increase labeling productivity and accuracy in computer vision tasks, especially when used in conjunction with the Smart Polygon feature in Roboflow.

Related Reads

Chapters (5)

Introduction
0:35 Concrete Cracks Annotation with Smart Polygon
3:06 Converting Bounding Box Blueberry Object Detection Dataset into Polygons
6:43 Annotating Low-Resolution Blood Cells Images with Smart Polygon
8:47 Conclusion
Up next
9-Phase Computer Vision Roadmap 2026 | AI & Deep Learning | #shorts
SCALER
Watch →