We use essential cookies to make our site work. With your consent, we may also use non-essential cookies to improve user experience and analyze website traffic. By clicking “Accept,” you agree to our website's cookie use as described in our Cookie Policy. You can change your cookie settings at any time by clicking “Preferences.” 
Accept
[ ![](../images/000.png) ](https://learnopencv.com)
  * [Getting Started](https://learnopencv.com/category/install/)
    * [Subscribe](https://learnopencv.com/)
    * [Installation](https://learnopencv.com/category/install/)
    * [Getting Started with OpenCV](https://learnopencv.com/getting-started-with-opencv/)
    * [PyTorch](https://learnopencv.com/getting-started-with-pytorch/)
    * [Tensorflow & Keras](https://learnopencv.com/getting-started-with-tensorflow-keras/)
  * [Free Courses](https://opencv.org/university/free-courses/?utm_source=lopcv&utm_medium=menu&utm_campaign=fcpage)
    * [VLM Bootcamp](https://opencv.org/university/vision-language-model-bootcamp/?utm_source=lopcv&utm_medium=menu&utm_campaign=vlm)
    * [PyTorch Bootcamp](https://opencv.org/university/free-pytorch-course/?utm_source=lopcv&utm_medium=menu&utm_campaign=ptbc)
    * [TensorFlow Keras Course](https://opencv.org/university/free-tensorflow-keras-course/?utm_source=lopcv&utm_medium=menu&utm_campaign=tbc)
    * [OpenCV Course](https://opencv.org/university/free-opencv-course/?utm_source=lopcv&utm_medium=menu&utm_campaign=obc)
    * [Python for Beginners](https://opencv.org/university/python-for-beginners/?utm_source=lopcv&utm_medium=menu&utm_campaign=pbc)
  * [AI Consulting](https://bigvision.ai/expert-ai-solution-builders/#talk?utm_source=locv&utm_medium=menu)
  * [About](https://learnopencv.com/about/)


  * [Getting Started](https://learnopencv.com/category/install/)
    * [Subscribe](https://learnopencv.com/)
    * [Installation](https://learnopencv.com/category/install/)
    * [Getting Started with OpenCV](https://learnopencv.com/getting-started-with-opencv/)
    * [PyTorch](https://learnopencv.com/getting-started-with-pytorch/)
    * [Tensorflow & Keras](https://learnopencv.com/getting-started-with-tensorflow-keras/)
  * [Free Courses](https://opencv.org/university/free-courses/?utm_source=lopcv&utm_medium=menu&utm_campaign=fcpage)
    * [VLM Bootcamp](https://opencv.org/university/vision-language-model-bootcamp/?utm_source=lopcv&utm_medium=menu&utm_campaign=vlm)
    * [PyTorch Bootcamp](https://opencv.org/university/free-pytorch-course/?utm_source=lopcv&utm_medium=menu&utm_campaign=ptbc)
    * [TensorFlow Keras Course](https://opencv.org/university/free-tensorflow-keras-course/?utm_source=lopcv&utm_medium=menu&utm_campaign=tbc)
    * [OpenCV Course](https://opencv.org/university/free-opencv-course/?utm_source=lopcv&utm_medium=menu&utm_campaign=obc)
    * [Python for Beginners](https://opencv.org/university/python-for-beginners/?utm_source=lopcv&utm_medium=menu&utm_campaign=pbc)
  * [AI Consulting](https://bigvision.ai/expert-ai-solution-builders/#talk?utm_source=locv&utm_medium=menu)
  * [About](https://learnopencv.com/about/)


Search ...
Results
See all results
  * [Home](https://learnopencv.com "Home")
  * >
  * [Computer Vision](https://learnopencv.com/category/computer-vision/ "Computer Vision")
  * >
  * Segment Anything – A Foundation Model for Image Segmentation


[Sovit Rath](https://learnopencv.com/author/sovit/)
  * on  May 2, 2023


# Segment Anything – A Foundation Model for Image Segmentation
This article explores the Segment Anything mode, a foundation model for image segmentation trained on 1.1 billion masks.
  * [Computer Vision](https://learnopencv.com/category/computer-vision/), [Deep Learning](https://learnopencv.com/category/deep-learning/), [Image Segmentation](https://learnopencv.com/category/image-segmentation/)


![Segment Anything – A Foundation Model for Image Segmentation](../images/006.gif)
0%
  *   *   * [ ](https://bigvision.ai/expert-ai-solution-builders?utm_source=lopcv&utm_medium=post-icon)


Foundation models in Artificial Intelligence are becoming increasingly important. The term started picking up pace in the field of NLP and now, with the Segment Anything Model, they are slowly getting into the world of computer vision as well. **Segment Anything** is a project by Meta to build a starting point for foundation models for image segmentation. In this article, we will understand the most essential components of the Segment Anything project, including the dataset and the model.
In addition to the Segment Anything Model and Dataset, we will also use the official pretrained weights to make inferences.
  * [What is the Segment Anything Project?](https://learnopencv.com/segment-anything/#What-is-the-Segment-Anything-Project? "What is the Segment Anything Project?")
  * [The Segment Anything Model (SAM)](https://learnopencv.com/segment-anything/#The-Segment-Anything-Model-\(SAM\) "The Segment Anything Model \(SAM\)")
  * [The Segment Anything Dataset](https://learnopencv.com/segment-anything/#The-Segment-Anything-Dataset "The Segment Anything Dataset")
  * [What Can SAM Do?](https://learnopencv.com/segment-anything/#What-Can-SAM-Do? "What Can SAM Do?")
  * [Models Available Under the Open Source Project](https://learnopencv.com/segment-anything/#Models-Available-Under-the-Open-Source-Project "Models Available Under the Open Source Project")
  * [Inference using SAM](https://learnopencv.com/segment-anything/#Inference-using-SAM "Inference using SAM")
  * [Conclusion](https://learnopencv.com/segment-anything/#Conclusion "Conclusion")
  * [References](https://learnopencv.com/segment-anything/#References "References")


## What is the Segment Anything Project?
Segment Anything is a new project by Meta to build two important components:
  * A large dataset for image segmentation
  * The Segment Anything Model (SAM) as a promptable foundation model for image segmentation


It was introduced in the **Segment Anything paper** by Alexander Kirillov et al.
This takes inspiration from the field of NLP where foundation models and large datasets (worth billions of tokens) have become commonplace.
The project leads to the creation of a large dataset, a segmentation model, and a data engine all in loop. 
As [image segmentation](https://learnopencv.com/image-segmentation-tensorflow-hub/) is one of the core computer vision tasks, the authors chose it as a starting point for such huge models and datasets. In both, science, and artificial intelligence, image segmentation has a number of potential uses. These include analyzing biomedical images, editing photos, and autonomous driving, among others.
To solve any of these problems, you must train specialized models that can do only one task. This requires extensive domain knowledge, and time needed for specific data collection, not to mention the hours of training that are necessary for deep learning models.
However, the Segment Anything project aims to democratize the world of image segmentation. By open sourcing both- the dataset and the model (SAM for short), opens up a huge array of possibilities.
[![The Segment Anything Model can run in real-time in browser.](../images/007.gif)](https://cdn.learnopencv.com/wp-content/uploads/2023/04/04090623/segment-anything-pipeline.gif)Figure 1. The Segment Anything Model can run in real-time in browser.
Further in the article, we will explore how all of the components are connected with each other.
## The Segment Anything Model (SAM)
The Segment Anything Model is an approach to building a fully automatic promptable image segmentation model with minimal human intervention.
The earlier deep learning approaches required specialized training data collection, manual annotation, and hours of training. Such approaches work well but also require substantial amounts of re-training the model when changing the dataset.
With SAM, we now have a generalizable and promptable image segmentation model that can cut out almost anything from an image.
[![Cutting out an image using the Segment Anything Model.](../images/008.gif)](https://cdn.learnopencv.com/wp-content/uploads/2023/04/04090622/segment-anything-cut-out.gif)Figure 2. Cutting out an image using the Segment Anything Model.
The above example gives an idea of how versatile SAM is for segmenting objects in images irrespective of their classes.
_So, how does SAM do it?_
SAM is a deep learning model (transformer based). And as with any deep learning, it has been trained on a huge number of images and masks – more than **1 billion masks** in **11 million images,** to be precise. That’s a considerable number. The dataset is called the Segment Anything dataset, which we will delve into later in this article
Even so, how does SAM know what objects to segment out in an image? The fact is, it does not always know. That’s where the promptable design of SAM comes in.
### SAM as a Promptable Image Segmentation Model
SAM can take prompts from users about which area to segment out precisely. As of the current release, we can provide three different prompts to SAM:
  * By clicking on a point
  * By drawing a bounding box
  * By drawing a rough mask on an object

[![Segment Anything as a promptable image segmentation model.](../images/009.png)](https://cdn.learnopencv.com/wp-content/uploads/2023/04/04090622/segment-anything-promptable-segmentation.png)Figure 3. Segment Anything as a promptable image segmentation model.
The authors are also working on a version of SAM that takes text inputs as prompts, just as in the case of language models.
Because SAM has been trained on 1 billion masks and allows users to provide prompts, it can **always output a valid mask.** What exactly does this mean?
In the case of a click as a prompt, sometimes users may click on a person. If, for some reason, SAM does not feel confident about outputting the mask of the person, it will try to mask the dress. In a manner similar to that, it tries to segment other “parts of an object” whenever a prompt is provided to SAM.
[![Multi-mask segmentation using the Segment Anything model.](../images/015.gif)](https://cdn.learnopencv.com/wp-content/uploads/2023/04/04090621/segment-antyhing-multi-mask.gif)Figure 4. Multi-mask segmentation using the Segment Anything model.
Such a methodology allows SAM to output multiple valid masks when the object is ambiguous. 
### How Does the Segment Anything Model Work?
The creators of the Segment Anything Model take inspiration from chat-based **Large Language Models** where prompting is an integral part of the pipeline.
In SAM, too, there are three important components of the mode:
  * An image encoder.
  * A prompt encoder.
  * A mask decoder.

[![The model architecture of Segment Anything when giving it an image as input.](../images/016.png)](https://cdn.learnopencv.com/wp-content/uploads/2023/04/04090621/segment-anything-model.png)Figure 5. The model architecture of Segment Anything when giving it an image as input.
When we give an image as input to the Segment Anything Model, it first passes through an image encoder and produces a one-time embedding for the entire image. 
There is also a prompt encoder for **points** , **boxes** , or **text as prompts**. For points, the x & y coordinates, along with the foreground and background information, become input to the encoder. For boxes, the bounding box coordinates become the input to the encoder, and as for the text (not released at the time of writing this), the tokens become the input.
In case we provide a mask as input, it directly goes through a downsampling stage. The downsampling happens using 2D convolutional layers. Then the model concatenates it with the image embedding to get the final vector. 
Any vector that the model gets from the prompt vector + image embedding passes through a lightweight decoder that creates the final segmentation mask. 
We get possible valid masks along with a confidence score as the output.
#### SAM Image Encoder
The image encoder is one of the most powerful and essential components of SAM. It is built upon a **MAE pre-trained[Vision Transformer](https://learnopencv.com/the-future-of-image-recognition-is-here-pytorch-vision-transformer/)** model. But to keep the performance real-time in browsers, trade-offs have been made. 
#### Prompt Encoder
For the prompt encoder, points, boxes, and text act as sparse inputs, and masks act as dense inputs. The creators of SAM represent points and bounding boxes using positional encodings and sum it with learned embeddings. For text prompts, SAM uses the text encoder from CLIP. For masks as prompts, after downsampling happens through convolutional layers, the embedding is summed element-wise with the input image embedding.
## The Segment Anything Dataset
The foundation of any groundbreaking deep learning model is the dataset it’s trained on. And it’s no different for the Segmentation Anything Model as well. 
The Segment Anything Dataset contains more than 11 million images and 1.1 billion masks. The final dataset is called **SA-1B dataset**.
Such a dataset is surely needed to train a model of Segment Anything capability. But we also know that such datasets do not exist, and manually annotating so many images is impossible.
**_So, how was the dataset curated?_**
In short, SAM helped in annotating the dataset. The data annotators used SAM to annotate images interactively, and the newly annotated data was then used to train SAM. This process was repeated, which gave rise to SAM’s in-loop data engine.
This data engine + training the SAM on the dataset has three stages:
  * Assisted-Manual Stage
  * Semi-Automatic Stage
  * Fully Automatic Stage


In the first stage, the annotators used a pretrained SAM model to interactively segment objects in images in the browser. The image embeddings were precomputed to make the annotation process seamless and real-time. After the first stage, the dataset consisted of **4.3 million masks** from **120k images**. The Segment Anything Model was retrained on this dataset.
In the second semi-automatic stage, the prominent objects were already segmented using SAM. The annotators additionally annotated less prominent objects which were unannotated. This stage resulted in an **additional 5.9M masks** in **180k images** on which SAM was retrained.
In the final ‘fully automatic stage’, the annotation was entirely done by SAM, By this stage, it had already been trained on more than 10M masks which made it possible. **Automatic mask generation was applied on 11M images resulting in 1.1B masks**.
“The final version of the Segment Anything Dataset makes it the largest publicly available image segmentation dataset. **Compared to OpenImages V5** , there are **6x more images** and **400x more masks** in the dataset.
## What Can SAM Do?
The possibilities while using SAM are endless. With its zero-shot generalization capability, SAM can segment objects in images without additional training.
The following are some of the major contributions that SAM can possibly make.
### Augmented Reality
Identifying everyday objects is one of the biggest achievements of SAM. Coupled with AR and AR glasses, it can help users with reminders and instructions.
[![Segment Anything model used in Augmented Reality.](../images/022.gif)](https://cdn.learnopencv.com/wp-content/uploads/2023/04/04090619/segment-anything-ar.gif)
Not only that, in AR/VR users can segment and lift objects in the virtual world just by the user’s gaze. 
### Bio-Medical Image Segmentation
Medical image segmentation and cell microscopy are some of the hardest to tackle. But SAM can assist in the segmentation of cell-microscopy images out of the box without any retraining.
[![Cell microscopy image segmentation using the Segment Anything model.](../images/023.gif)](https://cdn.learnopencv.com/wp-content/uploads/2023/04/04090619/segment-anything-cell-microscopy.gif)
### Integration with Diffusion Models
We can also integrate SAM with diffusion based image generation models. This will automate a lot of things, especially creating masks while inpainting. 
### Generating Semantic Segmentation Datasets
Because SAM can segment out objects so well, we can use it to generate masks for thousands of objects which can be used as ground truth. This will be most helpful when we want to segment objects belonging to a single class.
## Models Available Under the Open Source Project
The SAM pretrained weights are available under [segment-anything](https://github.com/facebookresearch/segment-anything) open source project.
As of now, there are model weights available for three different scales of Vision Transformer models.
  * ViT-B SAM
  * ViT-L SAM
  * ViT-H SAM


The project also has a pip installable command. You can install segment-anything using the following command.
`pip install git+https://github.com/facebookresearch/segment-anything.git`
In the next section, we will use the official SAM weights and model to run inference on a few images. This will help us capture the exact capabilities of SAM.
Before that, you will need to download the models. You can find all the official model weights in the [official repository](https://github.com/facebookresearch/segment-anything#model-checkpoints).
Or you can use the command line if you are using Linux environment.
`wget https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth `
We will use the SAM-ViT-H (Huge) model for inference.
## Inference using SAM
Here, we will follow the code for running inference using a Python script. All the code goes into the `segment.py` script.
**Download Code** To easily follow along this tutorial, please download code by clicking on the button below. It's FREE!
[Download Code](javascript:void\(0\))
Let’s start with the import statements and define the argument parser.  
|  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15  |  `import` `cv2` `import` `matplotlib.pyplot as plt` `import` `numpy as np` `import` `os` `import` `argparse` `from` `segment_anything ``import` `SamAutomaticMaskGenerator, sam_model_registry` `parser ``=` `argparse.ArgumentParser()` `parser.add_argument(` `'--input'``,` `default``=``'input/image_4.jpg'` `)` `args ``=` `parser.parse_args()`  |  
| --- | --- |  
From the `segment_anything` library, we are importing the `SamAutomaticMaskGenerator` and `sam_model_registry`.
The former will be used to initialize the mask generation module and the latter to initialize the model.
Next, we have the `show_anns` function which extracts the mask annotations from the model output and plots them.  
|  1 2 3 4 5 6 7 8 9 10 11 12 13 14  |  `def` `show_anns(anns):` `if` `len``(anns) ``=``=` `0``:` `return` `sorted_anns ``=` `sorted``(anns, key``=``(``lambda` `x: x[``'area'``]), reverse``=``True``)` `ax ``=` `plt.gca()` `ax.set_autoscale_on(``False``)` `for` `ann ``in` `sorted_anns:` `m ``=` `ann[``'segmentation'``]` `img ``=` `np.ones((m.shape[``0``], m.shape[``1``], ``3``))` `color_mask ``=` `np.random.random((``1``, ``3``)).tolist()[``0``]` `for` `i ``in` `range``(``3``):` `img[:,:,i] ``=` `color_mask[i]` `np.dstack((img, m``*``0.35``))` `ax.imshow(np.dstack((img, m``*``0.35``)))`  |  
| --- | --- |  
Finally, we can initialize the model and run inference on the image provided through the argument parser.  
|  1 2 3 4 5 6 7 8 9 10 11 12 13 14  |  `sam = sam_model_registry["vit_h"](checkpoint="sam_vit_h_4b8939.pth")` `sam.cuda()` `mask_generator = SamAutomaticMaskGenerator(sam)` `image_path = args.input` `image_name = image_path.split(os.path.sep)[-1]` `image = cv2.imread(image_path)` `image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)` `masks = mask_generator.generate(image)` `plt.figure(figsize=(12, 9))` `plt.imshow(image)` `show_anns(masks)` `plt.axis('off')` `plt.savefig(os.path.join('outputs', image_name), bbox_inches='tight')`  |  
| --- | --- |  
While initializing the model, we provide the model key to the registry. This is `vit_h` in this case. Then the checkpoint argument accepts the model weight path that we downloaded earlier.
The rest of the code reads the image, preprocesses it, forward passes it through the model, and saves the output to disk.
Let’s execute the script using one image and visualize the output. 
`python segment.py --input input/image_1.jpg`
It will take some time for the model to run inference. After that, you can find the results in the output directory.
Here is the result.
[![Image segmentation output from the Segment Anything model.](../images/024.jpg)](https://cdn.learnopencv.com/wp-content/uploads/2023/04/04090618/image_1.jpg)Figure 6. Image segmentation output from the Segment Anything model.
It is truly remarkable how SAM is able to segment almost all the perceivable objects in the image. Starting from horses and shoes to the caps of persons, it has segmented almost everything. The Segment Anything Model is really living up to its name.
Here are a few other results.
[![Segmenting persons using the Segment Anything model.](../images/030.jpg)](https://cdn.learnopencv.com/wp-content/uploads/2023/04/04090617/image_2.jpg)Figure 7. Segmenting persons using the Segment Anything model.
In this case, the model is making a mistake while segmenting the background.
[![Using SAM to segment dense traffic scene.](../images/036.jpg)](https://cdn.learnopencv.com/wp-content/uploads/2023/04/04090616/image_3.jpg)Figure 8. Using SAM to segment dense traffic scenes.
In this traffic scene, SAM is able to segment the individual cars, the tires, and even the roofs of the horses.
Now, let’s take a look at one final image, which contains microscopic blood cell elements.
[![Using SAM to segment blood cells in cell micorscopy images.](../images/body-7a138e975d178608911c.jpg)](https://cdn.learnopencv.com/wp-content/uploads/2023/04/04090616/image_4.jpg)Figure 9. Using SAM to segment blood cells in cell microscopy images.
We can see that SAM is able to segment almost every cell in the image.
## Conclusion
In this article, we discussed the Segment Anything Project and Model by Meta. Such a powerful foundation model for image segmentation opens up a world of possibilities. The possibilities to create automated annotation tools and [instance segmentation](https://learnopencv.com/yolov5-instance-segmentation/) tools using SAM are staggering. Not only that, we can even fine-tune SAM on more specific downstream segmentation tasks. This methodology is bound to result in a very robust image segmentation model. With SAM as a strong foundation, the future of image segmentation is brighter than ever before.
Are you thinking about building something interesting using SAM? Let us know in the comment section. We will love to see a demo of your project.
## Related Posts on Image Segmentation
  * [Document Segmentation Using Deep Learning in PyTorch](https://learnopencv.com/deep-learning-based-document-segmentation-using-semantic-segmentation-deeplabv3-on-custom-dataset/)
  * [Mask RCNN Pytorch – Instance Segmentation](https://learnopencv.com/mask-r-cnn-instance-segmentation-with-pytorch/)[](https://learnopencv.com/author/vaibhav/)


### From idea to working model to real-time deployment
Big Vision takes computer vision projects through the full journey, not just the easy parts.
![Satya Mallick](../images/body-fe65e1f717d94c873fd9.jpg)
**Satya Mallick** Founder - Big Vision & LearnOpenCV
[ Talk to our Team ](https://bigvision.ai/expert-ai-solution-builders/)
## References
  * [Segment Anything](https://segment-anything.com/)
  * [Segment Anything GitHub](https://github.com/facebookresearch/segment-anything)


Was This Article Helpful?
Post Views: 146
## Subscribe & Download Code
If you liked this article and would like to download code (C++ and Python) and example images used in this post, please [click here](javascript:void\(0\)). In our newsletter, we share Computer Vision and AI tutorials and examples written in C++/Python, and Computer Vision and Machine Learning algorithms and news.  
  

[ Download Example Code](javascript:void\(0\))
  
  

[PrevPreviousObject Detection Made Easy with TensorFlow Hub: Step-by-Step Tutorial](https://learnopencv.com/object-detection-tensorflow-hub/)
[NextMeet YOLO-NAS: New YOLO Object Detection Model Beats YOLOv6 & YOLOv8Next](https://learnopencv.com/yolo-nas/)
###  [ Train RF-DETR for Instance Segmentation with GPT-6 Astra ](https://learnopencv.com/astra-rf-detr-microduck-segmentation/)
Before a flight, I left Astra a short prompt and a signed-in Roboflow account. It
###  [ How 10x AI Engineers Train Models for Production: Lessons from PINTO’s Face Alignment Project ](https://learnopencv.com/how-10x-ai-engineers-train-models-for-production/)
Learn a production model training playbook from PINTO’s face alignment project: reframe the task, engineer
###  [ VGGT vs. VGGT-Ω (VGGT-Omega): A Complete Guide to Feed-Forward 3D Reconstruction ](https://learnopencv.com/vggt-vs-vggt-%cf%89-vggt-omega-a-complete-guide-to-feed-forward-3d-reconstruction/)
How VGGT and VGGT-Ω work, what changed, and real benchmark numbers, speed, GPU memory, depth,
![Satya Mallick](../images/body-fe65e1f717d94c873fd9.jpg)
#### Satya Mallick, Ph.D.
Founder - Big Vision & LearnOpenCV
#####  Are you struggling with your Computer Vision Product Development?
Helping startups and enterprises build and deploy scalable solutions that work in the real world.
[ Schedule a Call ](https://bigvision.ai/expert-ai-solution-builders?utm_source=lopcv&utm_medium=post)
####  Table of Contents
  1. [What is the Segment Anything Project?](https://learnopencv.com/segment-anything/#What-is-the-Segment-Anything-Project?)
  2. [The Segment Anything Model (SAM)](https://learnopencv.com/segment-anything/#The-Segment-Anything-Model-\(SAM\))
  3. [The Segment Anything Dataset](https://learnopencv.com/segment-anything/#The-Segment-Anything-Dataset)
  4. [What Can SAM Do?](https://learnopencv.com/segment-anything/#What-Can-SAM-Do?)
  5. [Models Available Under the Open Source Project](https://learnopencv.com/segment-anything/#Models-Available-Under-the-Open-Source-Project)
  6. [Inference using SAM](https://learnopencv.com/segment-anything/#Inference-using-SAM)
  7. [Conclusion](https://learnopencv.com/segment-anything/#Conclusion)
  8. [Related Posts on Image Segmentation](https://learnopencv.com/segment-anything/#elementor-toc__heading-anchor-7)
  9. [References](https://learnopencv.com/segment-anything/#References)


Was This Article Helpful?
  * [image segmentation](https://learnopencv.com/tag/image-segmentation/), [Image Segmentation Foundation Model](https://learnopencv.com/tag/image-segmentation-foundation-model/), [Segment Anything](https://learnopencv.com/tag/segment-anything/), [Segment Anything Dataset](https://learnopencv.com/tag/segment-anything-dataset/), [Segment Anything Meta](https://learnopencv.com/tag/segment-anything-meta/), [Segment Anything Model](https://learnopencv.com/tag/segment-anything-model/), [Segment Anything Model Demo](https://learnopencv.com/tag/segment-anything-model-demo/)


## Read Next
[ ![Decoding Virat Kohli’s Flick Shot: AI-Based 3D Motion Reconstruction](../images/body-f3950ee9e907f51f83d3.png) ](https://learnopencv.com/decoding-virat-kohlis-flick-shot-ai-based-3d-motion-reconstruction/)
[3D Computer Vision](https://learnopencv.com/category/3d-computer-vision/)[3D Reconstruction](https://learnopencv.com/category/3d-computer-vision/3d-reconstruction/)[Segmentation](https://learnopencv.com/category/segmentation/)[SpatialAI-Depth](https://learnopencv.com/category/3d-computer-vision/spatialai-depth/)[Video Analysis](https://learnopencv.com/category/video-analysis/)
[Adnan Shaikh](https://learnopencv.com/author/adnan/) July 18, 2026 
##  [ Decoding Virat Kohli’s Flick Shot: AI-Based 3D Motion Reconstruction ](https://learnopencv.com/decoding-virat-kohlis-flick-shot-ai-based-3d-motion-reconstruction/)
Reconstruct the 3D swing plane of Virat Kohli's flick shot from a single 2D video with off-the-shelf vision models. No…
[ ![How to Run Object Detection with OpenCV 5](../images/body-6f304990249f37d13c7f.jpg) ](https://learnopencv.com/how-to-run-object-detection-with-opencv-5/)
[Object Detection](https://learnopencv.com/category/object-detection/)[OpenCV 5](https://learnopencv.com/category/opencv/opencv-5/)[OpenCV DNN](https://learnopencv.com/category/opencv-dnn/)[YOLO](https://learnopencv.com/category/yolo/)
[Sudip Chakrabarty](https://learnopencv.com/author/sudip/) July 9, 2026 
##  [ How to Run Object Detection with OpenCV 5 ](https://learnopencv.com/how-to-run-object-detection-with-opencv-5/)
Learn about the new OpenCV 5 and how to use its DNN engine to run object detection models on the…
[ ![How to Fine-Tune YOLO26 for Safety Gear and Sign Language Detection](../images/body-6b014d4d46a21419f999.jpg) ](https://learnopencv.com/how-to-fine-tune-yolo26-for-safety-gear-and-sign-language-detection/)
[Computer Vision](https://learnopencv.com/category/computer-vision/)[Object Detection](https://learnopencv.com/category/object-detection/)[YOLO](https://learnopencv.com/category/yolo/)
[Sudip Chakrabarty](https://learnopencv.com/author/sudip/) June 18, 2026 
##  [ How to Fine-Tune YOLO26 for Safety Gear and Sign Language Detection ](https://learnopencv.com/how-to-fine-tune-yolo26-for-safety-gear-and-sign-language-detection/)
Learn how to fine-tune YOLO26 on your own data. We build a construction PPE safety detector and a sign-language reader…
##  Subscribe to our Newsletter
Subscribe to our email newsletter to get the latest posts delivered right to your email.
Name 
Email 
Send
![](../images/body-2dd5ce664c5fca7d56f8.png)
Empowering innovation through education, LearnOpenCV provides in-depth tutorials, code, and guides in AI, Computer Vision, and Deep Learning. Led by Dr. Satya Mallick, we're dedicated to nurturing a community keen on technology breakthroughs.
[ Read More ](https://learnopencv.com/about/)
Categories
  * [Deep Learning](https://learnopencv.com/category/deep-learning/)
  * [Object Detection](https://learnopencv.com/category/object-detection/)
  * [Image Classification](https://learnopencv.com/category/image-classification)
  * [YOLO](https://learnopencv.com/category/yolo/)
  * [Image Processing](https://learnopencv.com/category/image-processing/)
  * [Image Segmentation](https://learnopencv.com/category/image-segmentation/)


  * [Deep Learning](https://learnopencv.com/category/deep-learning/)
  * [Object Detection](https://learnopencv.com/category/object-detection/)
  * [Image Classification](https://learnopencv.com/category/image-classification)
  * [YOLO](https://learnopencv.com/category/yolo/)
  * [Image Processing](https://learnopencv.com/category/image-processing/)
  * [Image Segmentation](https://learnopencv.com/category/image-segmentation/)


Getting Started
  * [Installation](https://learnopencv.com/category/install/)
  * [PyTorch](https://learnopencv.com/learn-pytorch/)
  * [Getting Started with OpenCV](https://learnopencv.com/getting-started-with-opencv/)
  * [Keras & Tensorflow](https://learnopencv.com/learn-keras-and-tensorflow/)


  * [Installation](https://learnopencv.com/category/install/)
  * [PyTorch](https://learnopencv.com/learn-pytorch/)
  * [Getting Started with OpenCV](https://learnopencv.com/getting-started-with-opencv/)
  * [Keras & Tensorflow](https://learnopencv.com/learn-keras-and-tensorflow/)


Big Vision
  * [AI Consulting](https://bigvision.ai/expert-ai-solution-builders/#talk?utm_source=locv&utm_medium=footer)
  * [Case Studies](https://bigvision.ai/case-studies/?utm_source=locv&utm_medium=footer)
  * [Get in Touch](https://bigvision.ai/contact-us/?utm_source=locv&utm_medium=footer)


  * [AI Consulting](https://bigvision.ai/expert-ai-solution-builders/#talk?utm_source=locv&utm_medium=footer)
  * [Case Studies](https://bigvision.ai/case-studies/?utm_source=locv&utm_medium=footer)
  * [Get in Touch](https://bigvision.ai/contact-us/?utm_source=locv&utm_medium=footer)


Copyright © 2026 – BIG VISION LLC [Privacy Policy](https://learnopencv.com/privacy-policy/) [Terms and Conditions](https://learnopencv.com/terms-and-conditions/)
  * [ ](https://bit.ly/Facebook_LearnOpenCV)
  * [ ](https://www.instagram.com/learnopencv/)
  * [ ](https://www.linkedin.com/in/satyamallick/)
  * [ ](https://x.com/LearnOpenCV)
  * [ ](https://www.youtube.com/c/LearnOpenCV?utm_source=lopcv&utm_medium=footer&utm_campaign=yt)


[ ![](../images/body-ab5d272e3cb213d5eb46.png) Click here to download the source code to this post ](javascript:void\(0\))
