jennyxue commited on
Commit
492b0ce
·
verified ·
1 Parent(s): 53a8cb3

Model card and the original license

Browse files
Files changed (2) hide show
  1. LICENSE +201 -0
  2. README.md +260 -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,260 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ pipeline_tag: mask-generation
4
+ library_name: tensorrt
5
+ tags:
6
+ - tensorrt
7
+ - moonbox
8
+ - efficientvit
9
+ - efficientvit-sam
10
+ - segment-anything
11
+ - image-segmentation
12
+ ---
13
+
14
+ # EfficientViT-SAM TensorRT
15
+
16
+ TensorRT engines of [EfficientViT-SAM](https://github.com/mit-han-lab/efficientvit), made by Moonbox for NVIDIA RTX GPUs. Each precision is one folder holding the
17
+ engine, `trt_runner.py` (a small numpy runner: TensorRT plus Polygraphy, no PyTorch) and a script that does the rest
18
+ of the pipeline. What the engine takes and returns is under *How to run*.
19
+
20
+ **Compatibility.** The engines are built *hardware compatible* (Ampere and newer: RTX 30, 40 and 50 series) and
21
+ *version compatible* (any TensorRT 10.x from 10.13 on, through its lean runtime). That costs a little speed against an
22
+ engine built for one GPU, but no rebuild is needed. Install the runtime with
23
+ `pip install "tensorrt-cu12>=10.13,<11" "tensorrt-lean-cu12>=10.13,<11" polygraphy numpy`.
24
+
25
+ ## Files
26
+
27
+ The last column is the benchmark (details under *How to run*).
28
+
29
+ | Precision | File | Size | sha256 | Benchmark |
30
+ |---|---|---|---|---|
31
+ | fp32 | [`fp32/decoder.engine`](https://huggingface.co/moonbox-dev/efficientvit-TensorRT/blob/main/fp32/decoder.engine) | 75.1 MB | `a2e0a324e55b` | no TF32: mask IoU vs the ONNX fp32 build (CPU) 0.9999 mean / 0.9977 worst (32 masks); encoder 19.3 ms vs 43.6 ms |
32
+ | fp32 | [`fp32/encoder.engine`](https://huggingface.co/moonbox-dev/efficientvit-TensorRT/blob/main/fp32/encoder.engine) | 293.6 MB | `75711f129358` | no TF32: mask IoU vs the ONNX fp32 build (CPU) 0.9999 mean / 0.9977 worst (32 masks); encoder 19.3 ms vs 43.6 ms |
33
+ | fp32 | [`fp32/pipeline.py`](https://huggingface.co/moonbox-dev/efficientvit-TensorRT/blob/main/fp32/pipeline.py) | 4.2 kB | `3cee6dcd2a80` | no TF32: mask IoU vs the ONNX fp32 build (CPU) 0.9999 mean / 0.9977 worst (32 masks); encoder 19.3 ms vs 43.6 ms |
34
+ | fp32 | [`fp32/pipeline_trt.py`](https://huggingface.co/moonbox-dev/efficientvit-TensorRT/blob/main/fp32/pipeline_trt.py) | 3.9 kB | `fb1791cf9e66` | no TF32: mask IoU vs the ONNX fp32 build (CPU) 0.9999 mean / 0.9977 worst (32 masks); encoder 19.3 ms vs 43.6 ms |
35
+ | fp32 | [`fp32/trt_runner.py`](https://huggingface.co/moonbox-dev/efficientvit-TensorRT/blob/main/fp32/trt_runner.py) | 3.3 kB | `0da2222f799a` | no TF32: mask IoU vs the ONNX fp32 build (CPU) 0.9999 mean / 0.9977 worst (32 masks); encoder 19.3 ms vs 43.6 ms |
36
+
37
+ ## How to run
38
+
39
+ EfficientViT-SAM (L0: an EfficientViT image encoder with SAM's mask decoder) as TensorRT engines plus
40
+ `pipeline_trt.py`. It follows the repository's EfficientViTSamPredictor like this model's ONNX `pipeline.py`:
41
+ - **Picture:** the longest side resized to 512, SAM's pixel mean / std, padded to 512 x 512.
42
+ - **Prompts:** given in the 1024 frame; point prompts give three masks, box prompts one.
43
+
44
+ ```python
45
+ import sys
46
+ import numpy as np
47
+ from PIL import Image
48
+ sys.path.insert(0, "fp32")
49
+ from pipeline_trt import EfficientViTSAMTrt
50
+ p = EfficientViTSAMTrt("fp32")
51
+ rgb = np.asarray(Image.open("photo.jpg").convert("RGB"))
52
+ emb, size = p.embed(rgb) # the image embedding, once per picture
53
+ masks, scores = p.point(emb, size, [[410, 300]]) # 3 masks [3, H, W] (bool) for a foreground point
54
+ mask, score = p.box(emb, size, [100, 80, 620, 540]) # 1 mask for a box
55
+ ```
56
+
57
+ Or `python fp32/pipeline_trt.py photo.jpg masks.npz --point 410 300 --box 100 80 620 540`. It needs numpy, Pillow,
58
+ TensorRT and Polygraphy; opencv-python makes the final mask resize fast.
59
+
60
+ **The engines.**
61
+ - `encoder.engine`: `image` [1, 3, 512, 512] -> `image_embeddings` [1, 256, 64, 64].
62
+ - `decoder.engine`: SAM's ONNX decoder wrapper up to its low-resolution masks.
63
+ - Inputs: `image_embeddings`, `point_coords` [1, N, 2] with N from 1 to 10, `point_labels`, `mask_input`,
64
+ `has_mask_input`.
65
+ - Outputs: `iou_predictions` and `low_res_masks` [1, 4, 256, 256].
66
+ - **Resizing to the picture:** `pipeline_trt.py` does it with the same bilinear arithmetic, because TensorRT can't
67
+ take the picture size as a float shape input.
68
+
69
+ **Precisions.** `fp32/` only, as this model's ONNX build: its BatchNorm scales reach 602, and an fp16 build loses
70
+ masks (worst IoU 0.12). The engines are built without TF32, full fp32 math. That matters: ONNX Runtime's CUDA
71
+ provider uses TF32 by default, and with it this model's worst mask in the benchmark drops to IoU 0.16 against an
72
+ exact fp32 run. If you run the ONNX build on CUDA, set `use_tf32` to 0.
73
+
74
+ **Benchmark.**
75
+ - **Data:** the first 8 photos of DIS5K-250, with a point prompt (3 masks) and the box prompt (1 mask) per photo, both
76
+ from the ground truth: 32 masks.
77
+ - **Run:** the engines through `pipeline_trt.py`, on an RTX 3080 Laptop GPU.
78
+ - **Reference:** the ONNX `fp32/` build through its `pipeline.py` on ONNX Runtime's CPU provider (exact fp32). That
79
+ build is within IoU 0.999 of the original (EfficientViTSamPredictor, fp32) on every mask.
80
+ - **Pass mark:** IoU >= 0.99 against the reference on every mask.
81
+
82
+ | | mask IoU vs the ONNX build (CPU): mean / worst | encoder alone |
83
+ |---|---|---|
84
+ | ONNX `fp32/`, CUDA with TF32 off | - | 43.6 ms |
85
+ | TensorRT `fp32/` | 0.9999 / 0.9977 | 19.3 ms |
86
+
87
+ ## How these were made
88
+
89
+ From [EfficientViT-SAM](https://github.com/mit-han-lab/efficientvit) at revision `de7d7733cc`: each engine was built with TensorRT's builder from Moonbox's published
90
+ ONNX graph of the same model and precision. The network is *strongly typed*: every tensor keeps the precision the
91
+ ONNX graph gives it, so an fp16 engine computes what the fp16 ONNX build computes. Built on an RTX 3080 Laptop GPU,
92
+ it was benchmarked against the original before upload, and the `sha256` column above is what the files must hash to.
93
+
94
+ ## License
95
+
96
+ apache-2.0. These files are a derivative of the original model and carry its license: it is copied in this
97
+ repository, and it governs your use of these files. The original model card follows unchanged.
98
+
99
+ ---
100
+
101
+ # Original model card
102
+
103
+ # Efficient Vision Foundation Models for High-Resolution Generation and Perception
104
+
105
+ [![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)
106
+
107
+ ## News
108
+ - (🔥 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).
109
+ - (🔥 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).
110
+ - (🔥 New) [2025/01/23] DC-AE and SANA are accepted by ICLR 2025.
111
+ - (🔥 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).
112
+
113
+ ______________________________________________________________________
114
+
115
+ - (🔥 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).
116
+ - [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.
117
+ - [2024/10/15] We released **Deep Compression Autoencoder (DC-AE)**: [link](#deep-compression-autoencoder-for-efficient-high-resolution-diffusion-models-paper-readme)!
118
+ - [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.
119
+ - [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/).
120
+ - [2024/04/06] EfficientViT-SAM is accepted by [eLVM@CVPR'24](https://sites.google.com/view/elvm/home?authuser=0).
121
+ - [2024/03/19] Online demo of EfficientViT-SAM is available: [https://evitsam.hanlab.ai/](https://evitsam.hanlab.ai/).
122
+ - [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.
123
+ - [2023/11/20] EfficientViT is available in the [NVIDIA Jetson Generative AI Lab](https://www.jetson-ai-lab.com/tutorial_efficientvit.html).
124
+ - [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).
125
+ - [2023/07/18] EfficientViT is accepted by ICCV 2023.
126
+
127
+ ## Content
128
+
129
+ ### [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)]
130
+
131
+ **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.**
132
+
133
+ #### Demo
134
+
135
+ ![demo](https://huggingface.co/mit-han-lab/dc-ae-f64c128-in-1.0/resolve/main/assets/dc_ae_demo.gif)
136
+ <p align="center">
137
+ <b> Figure 1: We address the reconstruction accuracy drop of high spatial-compression autoencoders.
138
+ </p>
139
+
140
+ ![demo](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/assets/dc_ae_diffusion_demo.gif)
141
+ <p align="center">
142
+ <b> Figure 2: DC-AE speeds up latent diffusion models.
143
+ </p>
144
+
145
+ <p align="center">
146
+ <img src="https://huggingface.co/mit-han-lab/dc-ae-f64c128-in-1.0/resolve/main/assets/dc_ae_sana.jpg" width="1200">
147
+ </p>
148
+
149
+ <p align="center">
150
+ <b> Figure 3: DC-AE enables efficient text-to-image generation on the laptop: <a href="https://nvlabs.github.io/Sana/">SANA</a>.
151
+ </p>
152
+
153
+ - [Usage of Deep Compression Autoencoder](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/dc_ae/README.md#deep-compression-autoencoder)
154
+ - [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)
155
+ - [Evaluate Deep Compression Autoencoder](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/dc_ae/README.md#evaluate-deep-compression-autoencoder)
156
+ - [Demo DC-AE-Diffusion Models](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/dc_ae/README.md#demo-dc-ae-diffusion-models)
157
+ - [Evaluate DC-AE-Diffusion Models](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/dc_ae/README.md#evaluate-dc-ae-diffusion-models)
158
+ - [Train DC-AE-Diffusion Models](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/dc_ae/README.md#train-dc-ae-diffusion-models)
159
+ - [Reference](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/dc_ae/README.md#reference)
160
+
161
+ ### [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)]
162
+
163
+ **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.**
164
+
165
+ <p align="left">
166
+ <img src="https://huggingface.co/mit-han-lab/efficientvit-sam/resolve/main/sam_zero_shot_coco_mAP.png" width="500">
167
+ </p>
168
+
169
+ - [Pretrained EfficientViT-SAM Models](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_sam/README.md#pretrained-efficientvit-sam-models)
170
+ - [Usage of EfficientViT-SAM](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_sam/README.md#usage)
171
+ - [Evaluate EfficientViT-SAM](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_sam/README.md#evaluation)
172
+ - [Visualize EfficientViT-SAM](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_sam/README.md#visualization)
173
+ - [Deploy EfficientViT-SAM](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_sam/README.md#deployment)
174
+ - [Train EfficientViT-SAM](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_sam/README.md#training)
175
+ - [Reference](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_sam/README.md#reference)
176
+
177
+ ### [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)]
178
+
179
+ **Efficient image classification models with EfficientViT backbones.**
180
+
181
+ <p align="left">
182
+ <img src="https://huggingface.co/han-cai/efficientvit-cls/resolve/main/efficientvit_cls_results.png" width="600">
183
+ </p>
184
+
185
+ - [Pretrained EfficientViT Classification Models](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_cls/README.md#pretrained-efficientvit-classification-models)
186
+ - [Usage of EfficientViT Classification Models](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_cls/README.md#usage)
187
+ - [Evaluate EfficientViT Classification Models](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_cls/README.md#evaluation)
188
+ - [Export EfficientViT Classification Models](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_cls/README.md#export)
189
+ - [Train EfficientViT Classification Models](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_cls/README.md#training)
190
+ - [Reference](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_cls/README.md#reference)
191
+
192
+ ### [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)]
193
+
194
+ **Efficient semantic segmantation models with EfficientViT backbones.**
195
+
196
+ ![demo](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/assets/cityscapes_l1.gif)
197
+
198
+ - [Pretrained EfficientViT Segmentation Models](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_seg/README.md#pretrained-efficientvit-segmentation-models)
199
+ - [Usage of EfficientViT Segmentation Models](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_seg/README.md#usage)
200
+ - [Evaluate EfficientViT Segmentation Models](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_seg/README.md#evaluation)
201
+ - [Visualize EfficientViT Segmentation Models](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_seg/README.md#visualization)
202
+ - [Export EfficientViT Segmentation Models](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_seg/README.md#export)
203
+ - [Reference](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_seg/README.md#reference)
204
+
205
+ ### EfficientViT-GazeSAM [[readme](https://raw.githubusercontent.com/mit-han-lab/efficientvit/de7d7733cc0329f391b33f1f459271562ec27bd5/applications/efficientvit_gazesam/README.md)]
206
+
207
+ **Gaze-prompted image segmentation models capable of running in real time with TensorRT on an NVIDIA RTX 4070.**
208
+
209
+ ![GazeSAM demo](https://huggingface.co/mit-han-lab/efficientvit-sam/resolve/main/gazesam/efficientvit_gazesam_demo.gif)
210
+
211
+ ## Getting Started
212
+
213
+ ```bash
214
+ conda create -n efficientvit python=3.10
215
+ conda activate efficientvit
216
+ pip install -U -r requirements.txt
217
+ ```
218
+
219
+ ## Third-Party Implementation/Integration
220
+
221
+ - [NVIDIA Jetson Generative AI Lab](https://www.jetson-ai-lab.com/tutorial_efficientvit.html)
222
+ - [timm](https://github.com/huggingface/pytorch-image-models): [link](https://github.com/huggingface/pytorch-image-models/blob/main/timm/models/efficientvit_mit.py)
223
+ - [X-AnyLabeling](https://github.com/CVHub520/X-AnyLabeling): [link](https://github.com/CVHub520/X-AnyLabeling/blob/main/anylabeling/services/auto_labeling/efficientvit_sam.py)
224
+ - [Grounding DINO 1.5 Edge](https://github.com/IDEA-Research/Grounding-DINO-1.5-API): [link](https://arxiv.org/pdf/2405.10300)
225
+
226
+ ## Contact
227
+
228
+ [Han Cai](http://hancai.ai/)
229
+
230
+ ## Reference
231
+
232
+ If EfficientViT or EfficientViT-SAM or DC-AE is useful or relevant to your research, please kindly recognize our contributions by citing our paper:
233
+
234
+ ```bibtex
235
+ @inproceedings{cai2023efficientvit,
236
+ title={Efficientvit: Lightweight multi-scale attention for high-resolution dense prediction},
237
+ author={Cai, Han and Li, Junyan and Hu, Muyan and Gan, Chuang and Han, Song},
238
+ booktitle={Proceedings of the IEEE/CVF International Conference on Computer Vision},
239
+ pages={17302--17313},
240
+ year={2023}
241
+ }
242
+ ```
243
+
244
+ ```bibtex
245
+ @article{zhang2024efficientvit,
246
+ title={EfficientViT-SAM: Accelerated Segment Anything Model Without Performance Loss},
247
+ author={Zhang, Zhuoyang and Cai, Han and Han, Song},
248
+ journal={arXiv preprint arXiv:2402.05008},
249
+ year={2024}
250
+ }
251
+ ```
252
+
253
+ ```bibtex
254
+ @article{chen2024deep,
255
+ title={Deep Compression Autoencoder for Efficient High-Resolution Diffusion Models},
256
+ 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},
257
+ journal={arXiv preprint arXiv:2410.10733},
258
+ year={2024}
259
+ }
260
+ ```