Skip to content

Commit 198fb2e

Browse files
authored
add notebook for efficient-sam (#1557)
* add notebook for efficient-sam * text descriptions and readme * Apply suggestions from code review * reduce pt usage * add quantization * apply review comments
1 parent 767d66b commit 198fb2e

File tree

4 files changed

+1845
-1
lines changed

4 files changed

+1845
-1
lines changed

.ci/spellcheck/.pyspelling.wordlist.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ dropdown
172172
ECCV
173173
editability
174174
EfficientNet
175+
EfficientSAM
176+
EfficientSAMs
175177
embeddings
176178
EnCodec
177179
encodec
@@ -554,6 +556,8 @@ sagittal
554556
SALICON
555557
Saliency
556558
saliency
559+
SAMI
560+
sam
557561
SavedModel
558562
scalability
559563
Scalable
@@ -699,6 +703,7 @@ ViT
699703
vit
700704
vits
701705
VITS
706+
vitt
702707
VM
703708
Vladlen
704709
VOC

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ Check out the latest notebooks that show how to optimize and deploy popular mode
4747
| [Audio LDM 2](notebooks/270-sound-generation-audioldm2/)<br> | Sound Generation with AudioLDM2 and OpenVINO™ | <img src="https://github.com/openvinotoolkit/openvino_notebooks/assets/76463150/c93a0f86-d9cf-4bd1-93b9-e27532170d75" width=300> |
4848
| [SDXL-Turbo](notebooks/271-sdxl-turbo/)<br> | Single-step image generation using SDXL-turbo and OpenVINO | <img src="https://github.com/openvinotoolkit/openvino_notebooks/assets/29454499/79b625c7-0f0a-4f19-8e38-e6f896f75c3e" width=300> |
4949
| [Segmind-VegaRT](notebooks/248-stable-diffusion-xl/248-segmind-vegart.ipynb)<br> | High-resolution image generation with Segmind-VegaRT and OpenVINO | <img src="https://github.com/openvinotoolkit/openvino_notebooks/assets/29454499/66bfe823-01c8-4749-a8aa-419a1d78a070" width=300> |
50-
| [Stable-Zephyr chatbot](notebooks/273-stable-zephyr-3b-chatbot/)<br> | Use Stable-Zephyr as chatbot assistant with OpenVINO | <img src=https://github.com/openvinotoolkit/openvino_notebooks/assets/29454499/cfac6ddb-6f22-4343-855c-e513269cf2bf width=300> |
50+
| [Stable-Zephyr chatbot](notebooks/273-stable-zephyr-3b-chatbot/)<br> | Use Stable-Zephyr as chatbot assistant with OpenVINO | <img src=https://github.com/openvinotoolkit/openvino_notebooks/assets/29454499/cfac6ddb-6f22-4343-855c-e513269cf2bf width=300> |
51+
| [Efficient-SAM](notebooks/274-efficient-sam)<br> | Object segmentation with EfficientSAM and OpenVINO | <img src=https://github.com/openvinotoolkit/openvino_notebooks/assets/29454499/15d0a23a-0550-43c6-9ca9-f689e772a79a width=300> |
5152

5253
## Table of Contents
5354

@@ -220,6 +221,8 @@ Demos that demonstrate inference on a particular model.
220221
| [270-sound-generation-audioldm2](notebooks/270-sound-generation-audioldm2/)<br> | Sound Generation with AudioLDM2 and OpenVINO™ | <img src="https://github.com/openvinotoolkit/openvino_notebooks/assets/76463150/c93a0f86-d9cf-4bd1-93b9-e27532170d75" width=225> |
221222
| [271-sdxl-turbo](notebooks/271-sdxl-turbo/)<br> | Single-step image generation using SDXL-turbo and OpenVINO | <img src="https://github.com/openvinotoolkit/openvino_notebooks/assets/29454499/79b625c7-0f0a-4f19-8e38-e6f896f75c3e" width=225> |
222223
| [272-paint-by-example](notebooks/272-paint-by-example/)<br>| Exemplar based image editing using diffusion models, [Paint-by-Example](https://github.com/Fantasy-Studio/Paint-by-Example), and OpenVINO™ | <img width="225" alt="ui_example" src="https://user-images.githubusercontent.com/103226580/236958011-0550ba7b-19b3-4dc6-8b50-eaedb84c1681.png"> |
224+
| [274-efficient-sam](notebooks/274-efficient-sam/)<br>| Object segmentation with EfficientSAM and OpenVINO™ | <img width="225" src="https://github.com/openvinotoolkit/openvino_notebooks/assets/29454499/15d0a23a-0550-43c6-9ca9-f689e772a79a"> |
225+
223226
<div id='-model-training'></div>
224227

225228
### 🏃 Model Training

notebooks/274-efficient-sam/274-efficient-sam.ipynb

Lines changed: 1804 additions & 0 deletions
Large diffs are not rendered by default.

notebooks/274-efficient-sam/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Object segmentations with EfficientSAM and OpenVINO
2+
3+
Segment Anything Model (SAM) has emerged as a powerful tool for numerous vision applications. A key component that drives the impressive performance for zero-shot transfer and high versatility is a super large Transformer model trained on the extensive high-quality SA-1B dataset. While beneficial, the huge computation cost of SAM model has limited its applications to wider real-world applications. To address this limitation, EfficientSAMs, light-weight SAM models that exhibit decent performance with largely reduced complexity, were proposed. The idea behind EfficientSAM is based on leveraging masked image pretraining, SAMI, which learns to reconstruct features from SAM image encoder for effective visual representation learning.
4+
5+
![overview.png](https://yformer.github.io/efficient-sam/EfficientSAM_files/overview.png)
6+
7+
More details about model can be found in [paper](https://arxiv.org/pdf/2312.00863.pdf), [model web page](https://yformer.github.io/efficient-sam/) and [original repository](https://github.com/yformer/EfficientSAM)
8+
9+
In this tutorial, we consider how to convert and run EfficientSAM using OpenVINO. We also demonstrate how to quantize model using [NNCF](https://github.com/openvinotoolkit/nncf)
10+
11+
The image below illustrates the result of the segmented area of the image by provided points
12+
13+
![example.png](https://github.com/openvinotoolkit/openvino_notebooks/assets/29454499/15d0a23a-0550-43c6-9ca9-f689e772a79a)
14+
15+
16+
### Notebook Contents
17+
18+
The tutorial consists of the following steps:
19+
20+
- Install prerequisites
21+
- Load PyTorch model
22+
- Run PyTorch model inference
23+
- Convert PyTorch model to OpenVINO Intermediate Representation
24+
- Run OpenVINO model inference
25+
- Optimize OpenVINO model using [NNCF](https://github.com/openvinotoolkit/nncf)
26+
- Launch interactive segmentation demo
27+
28+
## Installation Instructions
29+
30+
This is a self-contained example that relies solely on its own code.</br>
31+
We recommend running the notebook in a virtual environment. You only need a Jupyter server to start.
32+
For details, please refer to [Installation Guide](../../README.md).

0 commit comments

Comments
 (0)