jennyxue commited on
Commit
baea333
·
verified ·
1 Parent(s): 7c308c6

Model card and the original license

Browse files
Files changed (2) hide show
  1. LICENSE +201 -0
  2. README.md +253 -0
LICENSE ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [2023] [Han Cai]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
README.md ADDED
@@ -0,0 +1,253 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ pipeline_tag: mask-generation
4
+ library_name: onnx
5
+ tags:
6
+ - onnx
7
+ - moonbox
8
+ - onnxruntime
9
+ - efficientvit
10
+ - efficientvit-sam
11
+ - segment-anything
12
+ - image-segmentation
13
+ ---
14
+
15
+ # EfficientViT-SAM ONNX
16
+
17
+ ONNX builds of [EfficientViT-SAM](https://github.com/mit-han-lab/efficientvit), made by Moonbox for on-device use with ONNX Runtime (CPU, CUDA, DirectML). Each
18
+ precision is one folder holding the graphs and a small Python `pipeline.py` that does the rest (image preprocessing,
19
+ prompt coordinates, mask upsampling); what the graphs take and return is under *How to run*.
20
+
21
+ ## Files
22
+
23
+ The last column is the benchmark against the original PyTorch model (details under *How to run*): IoU of every
24
+ predicted mask with the original's on the same pictures and prompts.
25
+
26
+ | Precision | File | Size | sha256 | Benchmark |
27
+ |---|---|---|---|---|
28
+ | fp32 | [`fp32/decoder.onnx`](https://huggingface.co/moonbox-dev/efficientvit-ONNX/blob/main/fp32/decoder.onnx) | 0.3 MB | `72ff3fdc36d9` | mask IoU 0.9999 mean / 0.9991 worst |
29
+ | fp32 | [`fp32/decoder.onnx.data`](https://huggingface.co/moonbox-dev/efficientvit-ONNX/blob/main/fp32/decoder.onnx.data) | 16.2 MB | `df2017f2c3fc` | mask IoU 0.9999 mean / 0.9991 worst |
30
+ | fp32 | [`fp32/encoder.onnx`](https://huggingface.co/moonbox-dev/efficientvit-ONNX/blob/main/fp32/encoder.onnx) | 0.4 MB | `35d5b72c6f74` | mask IoU 0.9999 mean / 0.9991 worst |
31
+ | fp32 | [`fp32/encoder.onnx.data`](https://huggingface.co/moonbox-dev/efficientvit-ONNX/blob/main/fp32/encoder.onnx.data) | 229.0 MB | `f5552293e854` | mask IoU 0.9999 mean / 0.9991 worst |
32
+ | fp32 | [`fp32/pipeline.py`](https://huggingface.co/moonbox-dev/efficientvit-ONNX/blob/main/fp32/pipeline.py) | 4.2 kB | `3cee6dcd2a80` | mask IoU 0.9999 mean / 0.9991 worst |
33
+
34
+ ## How to run
35
+
36
+ EfficientViT-SAM L2 (MIT Han Lab: SAM's prompt encoder and mask decoder on an EfficientViT-L2 image encoder at 512 px,
37
+ 61 M parameters) as two ONNX graphs plus `pipeline.py`, a numpy runtime that reproduces the repository's
38
+ `EfficientViTSamPredictor` around them.
39
+
40
+ - `encoder.onnx`: EfficientViT-L2 + the SAM neck: `image` [1, 3, 512, 512] (normalised, padded) ->
41
+ `image_embeddings` [1, 256, 64, 64]. Run it once per image.
42
+ - `decoder.onnx`: SAM's ONNX decoder wrapper (`SamOnnxModel`, all 4 masks; prompts and masks in the 1024 frame):
43
+ `image_embeddings`, `point_coords` [1, N, 2] and `point_labels` [1, N] (1 / 0 points, 2 / 3 box corners, -1
44
+ padding), `mask_input` [1, 1, 256, 256], `has_mask_input` [1], `orig_im_size` [2] -> `masks` [1, 4, H, W] (logits
45
+ at the image size), `iou_predictions` [1, 4], `low_res_masks` [1, 4, 256, 256].
46
+
47
+ `pipeline.py` resizes the longest side to 512 (Pillow bilinear, as the repository's SamResize), applies SAM's pixel
48
+ mean / std and pads bottom-right to 512 x 512. It scales the prompt coordinates to the 1024 frame, and returns masks 1-3
49
+ for multimask point prompts and mask 0 for a box. It needs numpy, onnxruntime (or onnxruntime-gpu) and Pillow:
50
+
51
+ ```python
52
+ import sys, numpy as np
53
+ from PIL import Image
54
+ sys.path.insert(0, "fp32")
55
+ import pipeline
56
+ sam = pipeline.EfficientViTSAM("fp32", "cuda")
57
+ emb, size = sam.embed(np.array(Image.open("photo.jpg").convert("RGB")))
58
+ masks, scores = sam.point(emb, size, [[410, 300]]) # 3 masks [3, H, W] (bool)
59
+ box_mask, score = sam.box(emb, size, [120, 80, 700, 560])
60
+ ```
61
+
62
+ **Precisions.** Only `fp32/`: the model doesn't survive 16 bits. 30 conv + BatchNorm pairs (every MBConv point conv of
63
+ stages 3-4, eight in the neck, the stem) have BatchNorm scales above 20, up to 602 (running variance 5.5e-7). Their
64
+ outputs are differences of terms about 1000x larger than the result. Measured here: fp16 (decoder fp32) worst mask IoU
65
+ 0.12 (mean 0.89); weight-only int8 mean 0.33. Neither is published.
66
+
67
+ **Benchmark.** Eight photos (the first eight of the lab's DIS5K-250 set). Each gets a positive point (the ground-truth
68
+ foreground pixel nearest its centroid; 3 masks) and the ground truth's bounding box (1 mask), so 32 masks per build.
69
+ The original is the repository's EfficientViTSamPredictor in float32. The build gets the image it preprocesses and the
70
+ same prompt coordinates (the conversion measured alone). Pass: IoU with the original's mask at least 0.95 on every mask.
71
+
72
+ | | worst mask IoU | mean mask IoU |
73
+ |---|---|---|
74
+ | `fp32/` | 0.9991 | 0.9999 |
75
+
76
+ Graphs checked against the original modules (largest absolute difference, float32): encoder 7.0e-5 of 0.58, decoder
77
+ 2.3e-5 of 14.8 (masks).
78
+
79
+ ## How these were made
80
+
81
+ From [EfficientViT-SAM](https://github.com/mit-han-lab/efficientvit) at revision `de7d7733cc`. The graphs were exported from the original PyTorch modules with
82
+ torch.onnx (opset 17 / 18) and checked against them. Weight-only quantization: int8 is a per-output-channel int8
83
+ weight behind DequantizeLinear, int4 is ONNX Runtime's MatMulNBits (block 32). Each card above says which precision
84
+ every graph uses. Every precision was benchmarked against the original before upload (pass: IoU at least 0.95 on every
85
+ mask, otherwise marked below threshold), and the `sha256` column above is what the files must hash to.
86
+
87
+ ## License
88
+
89
+ apache-2.0. These files are a derivative of the original model and carry its license: it is copied in this
90
+ repository, and it governs your use of these files. The original model card follows unchanged.
91
+
92
+ ---
93
+
94
+ # Original model card
95
+
96
+ # Efficient Vision Foundation Models for High-Resolution Generation and Perception
97
+
98
+ [![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/deep-compression-autoencoder-for-efficient/image-generation-on-imagenet-512x512)](https://paperswithcode.com/sota/image-generation-on-imagenet-512x512?p=deep-compression-autoencoder-for-efficient)
99
+
100
+ ## News
101
+ - (🔥 New) [2025/09/05] We will no longer maintain this codebase. All future updates and announcements will be made on [DC-Gen](https://github.com/dc-ai-projects/DC-Gen).
102
+ - (🔥 New) [2025/01/24] We released DC-AE-SANA-1.1: [doc](https://github.com/mit-han-lab/efficientvit/blob/master/assets/docs/dc_ae_sana_1.1.md).
103
+ - (🔥 New) [2025/01/23] DC-AE and SANA are accepted by ICLR 2025.
104
+ - (🔥 New) [2025/01/14] We released **DC-AE+USiT models**: [model](https://huggingface.co/collections/mit-han-lab/dc-ae-diffusion-670dbb8d6b6914cf24c1a49d), [training](https://github.com/mit-han-lab/efficientvit/blob/master/applications/dc_ae/README.md#dc-ae--usit). Using the default training settings and sampling strategy, DC-AE+USiT-2B achieves 1.72 FID on ImageNet 512x512, surpassing the SOTA diffusion model EDM2-XXL and SOTA auto-regressive image generative models (MAGVIT-v2 and MAR-L).
105
+
106
+ ______________________________________________________________________
107
+
108
+ - (🔥 New) [2024/12/24] **diffusers** supports DC-AE models. All [DC-AE models in diffusers safetensors](https://huggingface.co/collections/mit-han-lab/dc-ae-670085b9400ad7197bb1009b) are released. [Usage](https://github.com/mit-han-lab/efficientvit/tree/master/applications/dc_ae#deep-compression-autoencoder-diffusers).
109
+ - [2024/10/21] DC-AE and EfficientViT block are used in our latest text-to-image diffusion model SANA! Check the [project page](https://nvlabs.github.io/Sana/) for more details.
110
+ - [2024/10/15] We released **Deep Compression Autoencoder (DC-AE)**: [link](#deep-compression-autoencoder-for-efficient-high-resolution-diffusion-models-paper-readme)!
111
+ - [2024/07/10] EfficientViT is used as the backbone in [Grounding DINO 1.5 Edge](https://arxiv.org/pdf/2405.10300) for efficient open-set object detection.
112
+ - [2024/07/10] EfficientViT-SAM is used in [MedficientSAM](https://github.com/hieplpvip/medficientsam), the 1st place model in [CVPR 2024 Segment Anything In Medical Images On Laptop Challenge](https://www.codabench.org/competitions/1847/).
113
+ - [2024/04/06] EfficientViT-SAM is accepted by [eLVM@CVPR'24](https://sites.google.com/view/elvm/home?authuser=0).
114
+ - [2024/03/19] Online demo of EfficientViT-SAM is available: [https://evitsam.hanlab.ai/](https://evitsam.hanlab.ai/).
115
+ - [2024/02/07] We released [EfficientViT-SAM](https://arxiv.org/abs/2402.05008), the first accelerated SAM model that matches/outperforms SAM-ViT-H's zero-shot performance, delivering the SOTA performance-efficiency trade-off.
116
+ - [2023/11/20] EfficientViT is available in the [NVIDIA Jetson Generative AI Lab](https://www.jetson-ai-lab.com/tutorial_efficientvit.html).
117
+ - [2023/09/12] EfficientViT is highlighted by [MIT home page](https://www.mit.edu/archive/spotlight/efficient-computer-vision/) and [MIT News](https://news.mit.edu/2023/ai-model-high-resolution-computer-vision-0912).
118
+ - [2023/07/18] EfficientViT is accepted by ICCV 2023.
119
+
120
+ ## Content
121
+
122
+ ### [ICLR 2025] Deep Compression Autoencoder for Efficient High-Resolution Diffusion Models [[paper](https://arxiv.org/abs/2410.10733)] [[readme](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/dc_ae/README.md)] [[poster](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/assets/dc_ae_poster.pdf)]
123
+
124
+ **Deep Compression Autoencoder (DC-AE) is a new family of high-spatial compression autoencoders with a spatial compression ratio of up to 128 while maintaining reconstruction quality. It accelerates all latent diffusion models regardless of the diffusion model architecture.**
125
+
126
+ #### Demo
127
+
128
+ ![demo](https://huggingface.co/mit-han-lab/dc-ae-f64c128-in-1.0/resolve/main/assets/dc_ae_demo.gif)
129
+ <p align="center">
130
+ <b> Figure 1: We address the reconstruction accuracy drop of high spatial-compression autoencoders.
131
+ </p>
132
+
133
+ ![demo](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/assets/dc_ae_diffusion_demo.gif)
134
+ <p align="center">
135
+ <b> Figure 2: DC-AE speeds up latent diffusion models.
136
+ </p>
137
+
138
+ <p align="center">
139
+ <img src="https://huggingface.co/mit-han-lab/dc-ae-f64c128-in-1.0/resolve/main/assets/dc_ae_sana.jpg" width="1200">
140
+ </p>
141
+
142
+ <p align="center">
143
+ <b> Figure 3: DC-AE enables efficient text-to-image generation on the laptop: <a href="https://nvlabs.github.io/Sana/">SANA</a>.
144
+ </p>
145
+
146
+ - [Usage of Deep Compression Autoencoder](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/dc_ae/README.md#deep-compression-autoencoder)
147
+ - [Usage of DC-AE-Diffusion](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/dc_ae/README.md#efficient-diffusion-models-with-dc-ae)
148
+ - [Evaluate Deep Compression Autoencoder](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/dc_ae/README.md#evaluate-deep-compression-autoencoder)
149
+ - [Demo DC-AE-Diffusion Models](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/dc_ae/README.md#demo-dc-ae-diffusion-models)
150
+ - [Evaluate DC-AE-Diffusion Models](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/dc_ae/README.md#evaluate-dc-ae-diffusion-models)
151
+ - [Train DC-AE-Diffusion Models](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/dc_ae/README.md#train-dc-ae-diffusion-models)
152
+ - [Reference](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/dc_ae/README.md#reference)
153
+
154
+ ### [CVPR 2024 eLVM Workshop] EfficientViT-SAM: Accelerated Segment Anything Model Without Accuracy Loss [[paper](https://arxiv.org/abs/2402.05008)] [[online demo](https://evitsam.hanlab.ai/)] [[readme](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_sam/README.md)]
155
+
156
+ **EfficientViT-SAM is a new family of accelerated segment anything models by replacing SAM's heavy image encoder with EfficientViT. It delivers a 48.9x measured TensorRT speedup on A100 GPU over SAM-ViT-H without sacrificing accuracy.**
157
+
158
+ <p align="left">
159
+ <img src="https://huggingface.co/mit-han-lab/efficientvit-sam/resolve/main/sam_zero_shot_coco_mAP.png" width="500">
160
+ </p>
161
+
162
+ - [Pretrained EfficientViT-SAM Models](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_sam/README.md#pretrained-efficientvit-sam-models)
163
+ - [Usage of EfficientViT-SAM](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_sam/README.md#usage)
164
+ - [Evaluate EfficientViT-SAM](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_sam/README.md#evaluation)
165
+ - [Visualize EfficientViT-SAM](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_sam/README.md#visualization)
166
+ - [Deploy EfficientViT-SAM](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_sam/README.md#deployment)
167
+ - [Train EfficientViT-SAM](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_sam/README.md#training)
168
+ - [Reference](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_sam/README.md#reference)
169
+
170
+ ### [ICCV 2023] EfficientViT-Classification [[paper](https://arxiv.org/abs/2205.14756)] [[readme](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_cls/README.md)]
171
+
172
+ **Efficient image classification models with EfficientViT backbones.**
173
+
174
+ <p align="left">
175
+ <img src="https://huggingface.co/han-cai/efficientvit-cls/resolve/main/efficientvit_cls_results.png" width="600">
176
+ </p>
177
+
178
+ - [Pretrained EfficientViT Classification Models](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_cls/README.md#pretrained-efficientvit-classification-models)
179
+ - [Usage of EfficientViT Classification Models](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_cls/README.md#usage)
180
+ - [Evaluate EfficientViT Classification Models](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_cls/README.md#evaluation)
181
+ - [Export EfficientViT Classification Models](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_cls/README.md#export)
182
+ - [Train EfficientViT Classification Models](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_cls/README.md#training)
183
+ - [Reference](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_cls/README.md#reference)
184
+
185
+ ### [ICCV 2023] EfficientViT-Segmentation [[paper](https://arxiv.org/abs/2205.14756)] [[readme](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_seg/README.md)]
186
+
187
+ **Efficient semantic segmantation models with EfficientViT backbones.**
188
+
189
+ ![demo](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/assets/cityscapes_l1.gif)
190
+
191
+ - [Pretrained EfficientViT Segmentation Models](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_seg/README.md#pretrained-efficientvit-segmentation-models)
192
+ - [Usage of EfficientViT Segmentation Models](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_seg/README.md#usage)
193
+ - [Evaluate EfficientViT Segmentation Models](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_seg/README.md#evaluation)
194
+ - [Visualize EfficientViT Segmentation Models](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_seg/README.md#visualization)
195
+ - [Export EfficientViT Segmentation Models](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_seg/README.md#export)
196
+ - [Reference](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_seg/README.md#reference)
197
+
198
+ ### EfficientViT-GazeSAM [[readme](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_gazesam/README.md)]
199
+
200
+ **Gaze-prompted image segmentation models capable of running in real time with TensorRT on an NVIDIA RTX 4070.**
201
+
202
+ ![GazeSAM demo](https://huggingface.co/mit-han-lab/efficientvit-sam/resolve/main/gazesam/efficientvit_gazesam_demo.gif)
203
+
204
+ ## Getting Started
205
+
206
+ ```bash
207
+ conda create -n efficientvit python=3.10
208
+ conda activate efficientvit
209
+ pip install -U -r requirements.txt
210
+ ```
211
+
212
+ ## Third-Party Implementation/Integration
213
+
214
+ - [NVIDIA Jetson Generative AI Lab](https://www.jetson-ai-lab.com/tutorial_efficientvit.html)
215
+ - [timm](https://github.com/huggingface/pytorch-image-models): [link](https://github.com/huggingface/pytorch-image-models/blob/main/timm/models/efficientvit_mit.py)
216
+ - [X-AnyLabeling](https://github.com/CVHub520/X-AnyLabeling): [link](https://github.com/CVHub520/X-AnyLabeling/blob/main/anylabeling/services/auto_labeling/efficientvit_sam.py)
217
+ - [Grounding DINO 1.5 Edge](https://github.com/IDEA-Research/Grounding-DINO-1.5-API): [link](https://arxiv.org/pdf/2405.10300)
218
+
219
+ ## Contact
220
+
221
+ [Han Cai](http://hancai.ai/)
222
+
223
+ ## Reference
224
+
225
+ If EfficientViT or EfficientViT-SAM or DC-AE is useful or relevant to your research, please kindly recognize our contributions by citing our paper:
226
+
227
+ ```bibtex
228
+ @inproceedings{cai2023efficientvit,
229
+ title={Efficientvit: Lightweight multi-scale attention for high-resolution dense prediction},
230
+ author={Cai, Han and Li, Junyan and Hu, Muyan and Gan, Chuang and Han, Song},
231
+ booktitle={Proceedings of the IEEE/CVF International Conference on Computer Vision},
232
+ pages={17302--17313},
233
+ year={2023}
234
+ }
235
+ ```
236
+
237
+ ```bibtex
238
+ @article{zhang2024efficientvit,
239
+ title={EfficientViT-SAM: Accelerated Segment Anything Model Without Performance Loss},
240
+ author={Zhang, Zhuoyang and Cai, Han and Han, Song},
241
+ journal={arXiv preprint arXiv:2402.05008},
242
+ year={2024}
243
+ }
244
+ ```
245
+
246
+ ```bibtex
247
+ @article{chen2024deep,
248
+ title={Deep Compression Autoencoder for Efficient High-Resolution Diffusion Models},
249
+ author={Chen, Junyu and Cai, Han and Chen, Junsong and Xie, Enze and Yang, Shang and Tang, Haotian and Li, Muyang and Lu, Yao and Han, Song},
250
+ journal={arXiv preprint arXiv:2410.10733},
251
+ year={2024}
252
+ }
253
+ ```