eliphatfs commited on
Commit
798f776
1 Parent(s): 39a769a
.gitignore ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ output.png
2
+ output-rembg.png
3
+ __pycache__
4
+ tmp
Dockerfile ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM nvidia/cuda:12.1.1-cudnn8-devel-ubuntu22.04
2
+
3
+ ARG DEBIAN_FRONTEND=noninteractive
4
+
5
+ ENV PYTHONUNBUFFERED=1
6
+
7
+ RUN apt-get update && apt-get install --no-install-recommends -y \
8
+ build-essential \
9
+ python3.9 \
10
+ python3-pip \
11
+ git \
12
+ ffmpeg \
13
+ && apt-get clean && rm -rf /var/lib/apt/lists/*
14
+
15
+ WORKDIR /code
16
+
17
+ COPY ./requirements.txt /code/requirements.txt
18
+
19
+ # Set up a new user named "user" with user ID 1000
20
+ RUN useradd -m -u 1000 user
21
+ # Switch to the "user" user
22
+ USER user
23
+ # Set home to the user's home directory
24
+ ENV HOME=/home/user \
25
+ PATH=/home/user/.local/bin:$PATH \
26
+ PYTHONPATH=$HOME/app \
27
+ PYTHONUNBUFFERED=1 \
28
+ SYSTEM=spaces
29
+
30
+ RUN pip3 install --no-cache-dir --upgrade -r /code/requirements.txt
31
+
32
+ # Set the working directory to the user's home directory
33
+ WORKDIR $HOME/app
34
+
35
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
36
+ COPY --chown=user . $HOME/app
37
+
38
+ CMD ["streamlit", "run", "app.py"]
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 eliphat
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.
app.py ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import sys
3
+ import numpy
4
+ import torch
5
+ import rembg
6
+ import urllib.request
7
+ from PIL import Image
8
+ import streamlit as st
9
+
10
+
11
+ img_example_counter = 0
12
+ iret_base = 'resources/examples'
13
+ iret = [
14
+ dict(rimageinput=os.path.join(iret_base, x), dispi=os.path.join(iret_base, x))
15
+ for x in sorted(os.listdir(iret_base))
16
+ ]
17
+
18
+
19
+ class SAMAPI:
20
+ predictor = None
21
+
22
+ @staticmethod
23
+ @st.cache_resource
24
+ def get_instance(sam_checkpoint=None):
25
+ if SAMAPI.predictor is None:
26
+ if sam_checkpoint is None:
27
+ sam_checkpoint = "tmp/sam_vit_h_4b8939.pth"
28
+ if not os.path.exists(sam_checkpoint):
29
+ urllib.request.urlretrieve(
30
+ "https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth",
31
+ sam_checkpoint
32
+ )
33
+ device = "cuda:0" if torch.cuda.is_available() else "cpu"
34
+ model_type = "default"
35
+
36
+ from segment_anything import sam_model_registry, SamPredictor
37
+
38
+ sam = sam_model_registry[model_type](checkpoint=sam_checkpoint)
39
+ sam.to(device=device)
40
+
41
+ predictor = SamPredictor(sam)
42
+ SAMAPI.predictor = predictor
43
+ return SAMAPI.predictor
44
+
45
+ @staticmethod
46
+ def segment_api(rgb, mask=None, bbox=None, sam_checkpoint=None):
47
+ """
48
+
49
+ Parameters
50
+ ----------
51
+ rgb : np.ndarray h,w,3 uint8
52
+ mask: np.ndarray h,w bool
53
+
54
+ Returns
55
+ -------
56
+
57
+ """
58
+ np = numpy
59
+ predictor = SAMAPI.get_instance(sam_checkpoint)
60
+ predictor.set_image(rgb)
61
+ if mask is None and bbox is None:
62
+ box_input = None
63
+ else:
64
+ # mask to bbox
65
+ if bbox is None:
66
+ y1, y2, x1, x2 = np.nonzero(mask)[0].min(), np.nonzero(mask)[0].max(), np.nonzero(mask)[1].min(), \
67
+ np.nonzero(mask)[1].max()
68
+ else:
69
+ x1, y1, x2, y2 = bbox
70
+ box_input = np.array([[x1, y1, x2, y2]])
71
+ masks, scores, logits = predictor.predict(
72
+ box=box_input,
73
+ multimask_output=True,
74
+ return_logits=False,
75
+ )
76
+ mask = masks[-1]
77
+ return mask
78
+
79
+
80
+ def image_examples(samples, ncols, return_key=None, example_text="Examples"):
81
+ global img_example_counter
82
+ trigger = False
83
+ with st.expander(example_text, True):
84
+ for i in range(len(samples) // ncols):
85
+ cols = st.columns(ncols)
86
+ for j in range(ncols):
87
+ idx = i * ncols + j
88
+ if idx >= len(samples):
89
+ continue
90
+ entry = samples[idx]
91
+ with cols[j]:
92
+ st.image(entry['dispi'])
93
+ img_example_counter += 1
94
+ with st.columns(5)[2]:
95
+ this_trigger = st.button('\+', key='imgexuse%d' % img_example_counter)
96
+ trigger = trigger or this_trigger
97
+ if this_trigger:
98
+ trigger = entry[return_key]
99
+ return trigger
100
+
101
+
102
+ def segment_img(img: Image):
103
+ output = rembg.remove(img)
104
+ mask = numpy.array(output)[:, :, 3] > 0
105
+ sam_mask = SAMAPI.segment_api(numpy.array(img)[:, :, :3], mask)
106
+ segmented_img = Image.new("RGBA", img.size, (0, 0, 0, 0))
107
+ segmented_img.paste(img, mask=Image.fromarray(sam_mask))
108
+ return segmented_img
109
+
110
+
111
+ def segment_6imgs(zero123pp_imgs):
112
+ imgs = [zero123pp_imgs.crop([0, 0, 320, 320]),
113
+ zero123pp_imgs.crop([320, 0, 640, 320]),
114
+ zero123pp_imgs.crop([0, 320, 320, 640]),
115
+ zero123pp_imgs.crop([320, 320, 640, 640]),
116
+ zero123pp_imgs.crop([0, 640, 320, 960]),
117
+ zero123pp_imgs.crop([320, 640, 640, 960])]
118
+ segmented_imgs = []
119
+ for i, img in enumerate(imgs):
120
+ output = rembg.remove(img)
121
+ mask = numpy.array(output)[:, :, 3]
122
+ mask = SAMAPI.segment_api(numpy.array(img)[:, :, :3], mask)
123
+ data = numpy.array(img)[:,:,:3]
124
+ data[mask == 0] = [255, 255, 255]
125
+ segmented_imgs.append(data)
126
+ result = numpy.concatenate([
127
+ numpy.concatenate([segmented_imgs[0], segmented_imgs[1]], axis=1),
128
+ numpy.concatenate([segmented_imgs[2], segmented_imgs[3]], axis=1),
129
+ numpy.concatenate([segmented_imgs[4], segmented_imgs[5]], axis=1)
130
+ ])
131
+ return Image.fromarray(result)
132
+
133
+
134
+ def expand2square(pil_img, background_color):
135
+ width, height = pil_img.size
136
+ if width == height:
137
+ return pil_img
138
+ elif width > height:
139
+ result = Image.new(pil_img.mode, (width, width), background_color)
140
+ result.paste(pil_img, (0, (width - height) // 2))
141
+ return result
142
+ else:
143
+ result = Image.new(pil_img.mode, (height, height), background_color)
144
+ result.paste(pil_img, ((height - width) // 2, 0))
145
+ return result
146
+
147
+
148
+ @st.cache_data
149
+ def check_dependencies():
150
+ reqs = []
151
+ try:
152
+ import diffusers
153
+ except ImportError:
154
+ import traceback
155
+ traceback.print_exc()
156
+ print("Error: `diffusers` not found.", file=sys.stderr)
157
+ reqs.append("diffusers==0.20.2")
158
+ else:
159
+ if not diffusers.__version__.startswith("0.20"):
160
+ print(
161
+ f"Warning: You are using an unsupported version of diffusers ({diffusers.__version__}), which may lead to performance issues.",
162
+ file=sys.stderr
163
+ )
164
+ print("Recommended version is `diffusers==0.20.2`.", file=sys.stderr)
165
+ try:
166
+ import transformers
167
+ except ImportError:
168
+ import traceback
169
+ traceback.print_exc()
170
+ print("Error: `transformers` not found.", file=sys.stderr)
171
+ reqs.append("transformers==4.29.2")
172
+ if torch.__version__ < '2.0':
173
+ try:
174
+ import xformers
175
+ except ImportError:
176
+ print("Warning: You are using PyTorch 1.x without a working `xformers` installation.", file=sys.stderr)
177
+ print("You may see a significant memory overhead when running the model.", file=sys.stderr)
178
+ if len(reqs):
179
+ print(f"Info: Fix all dependency errors with `pip install {' '.join(reqs)}`.")
180
+
181
+
182
+ @st.cache_resource
183
+ def load_zero123plus_pipeline():
184
+ from diffusers import DiffusionPipeline, EulerAncestralDiscreteScheduler
185
+ pipeline = DiffusionPipeline.from_pretrained(
186
+ "sudo-ai/zero123plus-v1.1", custom_pipeline="sudo-ai/zero123plus-pipeline",
187
+ torch_dtype=torch.float16
188
+ )
189
+ # Feel free to tune the scheduler
190
+ pipeline.scheduler = EulerAncestralDiscreteScheduler.from_config(
191
+ pipeline.scheduler.config, timestep_spacing='trailing'
192
+ )
193
+ if torch.cuda.is_available():
194
+ pipeline.to('cuda:0')
195
+ return pipeline
196
+
197
+
198
+ check_dependencies()
199
+ pipeline = load_zero123plus_pipeline()
200
+ SAMAPI.get_instance()
201
+ torch.set_grad_enabled(False)
202
+
203
+ st.title("Zero123++ Demo")
204
+ # st.caption("For faster inference without waiting in queue, you may clone the space and run it yourself.")
205
+ prog = st.progress(0.0, "Idle")
206
+ with st.form("imgform"):
207
+ pic = st.file_uploader("Upload an Image", key='imageinput', type=['png', 'jpg', 'webp'])
208
+ left, right = st.columns(2)
209
+ with left:
210
+ rem_input_bg = st.checkbox("Remove Input Background")
211
+ with right:
212
+ rem_output_bg = st.checkbox("Remove Output Background")
213
+ num_inference_steps = st.slider("Number of Inference Steps", 15, 100, 75)
214
+ st.caption("Diffusion Steps. For general real or synthetic objects, around 28 is enough. For objects with delicate details such as faces (either realistic or illustration), you may need 75 or more steps.")
215
+ cfg_scale = st.slider("Classifier Free Guidance Scale", 1.0, 10.0, 4.0)
216
+ seed = st.text_input("Seed", "42")
217
+ submit = False
218
+ if st.form_submit_button("Submit"):
219
+ submit = True
220
+ results_container = st.container()
221
+ sample_got = image_examples(iret, 4, 'rimageinput')
222
+ if sample_got:
223
+ pic = sample_got
224
+ with results_container:
225
+ if sample_got or submit:
226
+ seed = int(seed)
227
+ torch.manual_seed(seed)
228
+ img = Image.open(pic)
229
+ left, right = st.columns(2)
230
+ with left:
231
+ st.image(img)
232
+ st.caption("Input Image")
233
+ prog.progress(0.1, "Preparing Inputs")
234
+ if rem_input_bg:
235
+ with right:
236
+ img = segment_img(img)
237
+ st.image(img)
238
+ st.caption("Input (Background Removed)")
239
+ img = expand2square(img, (127, 127, 127, 0))
240
+ pipeline.set_progress_bar_config(disable=True)
241
+ result = pipeline(
242
+ img,
243
+ num_inference_steps=num_inference_steps,
244
+ guidance_scale=cfg_scale,
245
+ generator=torch.Generator(pipeline.device).manual_seed(seed),
246
+ callback=lambda i, t, latents: prog.progress(0.1 + 0.8 * i / num_inference_steps, "Diffusion Step %d" % i)
247
+ ).images[0]
248
+ prog.progress(0.9, "Post Processing")
249
+ left, right = st.columns(2)
250
+ with left:
251
+ st.image(result)
252
+ st.caption("Result")
253
+ if rem_output_bg:
254
+ result = segment_6imgs(result)
255
+ with right:
256
+ st.image(result)
257
+ st.caption("Result (Background Removed)")
258
+ prog.progress(1.0, "Idle")
diffusers-support/pipeline.py ADDED
@@ -0,0 +1,398 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Any, Dict, Optional
2
+ from diffusers.models import AutoencoderKL, UNet2DConditionModel
3
+ from diffusers.schedulers import KarrasDiffusionSchedulers
4
+
5
+ import numpy
6
+ import torch
7
+ import torch.nn as nn
8
+ import torch.utils.checkpoint
9
+ import torch.distributed
10
+ import transformers
11
+ from collections import OrderedDict
12
+ from PIL import Image
13
+ from torchvision import transforms
14
+ from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer
15
+
16
+ import diffusers
17
+ from diffusers import (
18
+ AutoencoderKL,
19
+ DDPMScheduler,
20
+ DiffusionPipeline,
21
+ EulerAncestralDiscreteScheduler,
22
+ UNet2DConditionModel,
23
+ ImagePipelineOutput
24
+ )
25
+ from diffusers.image_processor import VaeImageProcessor
26
+ from diffusers.models.attention_processor import Attention, AttnProcessor, XFormersAttnProcessor, AttnProcessor2_0
27
+ from diffusers.utils.import_utils import is_xformers_available
28
+
29
+
30
+ def to_rgb_image(maybe_rgba: Image.Image):
31
+ if maybe_rgba.mode == 'RGB':
32
+ return maybe_rgba
33
+ elif maybe_rgba.mode == 'RGBA':
34
+ rgba = maybe_rgba
35
+ img = numpy.random.randint(127, 128, size=[rgba.size[1], rgba.size[0], 3], dtype=numpy.uint8)
36
+ img = Image.fromarray(img, 'RGB')
37
+ img.paste(rgba, mask=rgba.getchannel('A'))
38
+ return img
39
+ else:
40
+ raise ValueError("Unsupported image type.", maybe_rgba.mode)
41
+
42
+
43
+ class ReferenceOnlyAttnProc(torch.nn.Module):
44
+ def __init__(
45
+ self,
46
+ chained_proc,
47
+ enabled=False,
48
+ name=None
49
+ ) -> None:
50
+ super().__init__()
51
+ self.enabled = enabled
52
+ self.chained_proc = chained_proc
53
+ self.name = name
54
+
55
+ def __call__(
56
+ self, attn: Attention, hidden_states, encoder_hidden_states=None, attention_mask=None,
57
+ mode="w", ref_dict: dict = None, is_cfg_guidance = False
58
+ ) -> Any:
59
+ if encoder_hidden_states is None:
60
+ encoder_hidden_states = hidden_states
61
+ if self.enabled and is_cfg_guidance:
62
+ res0 = self.chained_proc(attn, hidden_states[:1], encoder_hidden_states[:1], attention_mask)
63
+ hidden_states = hidden_states[1:]
64
+ encoder_hidden_states = encoder_hidden_states[1:]
65
+ if self.enabled:
66
+ if mode == 'w':
67
+ ref_dict[self.name] = encoder_hidden_states
68
+ elif mode == 'r':
69
+ encoder_hidden_states = torch.cat([encoder_hidden_states, ref_dict.pop(self.name)], dim=1)
70
+ elif mode == 'm':
71
+ encoder_hidden_states = torch.cat([encoder_hidden_states, ref_dict[self.name]], dim=1)
72
+ else:
73
+ assert False, mode
74
+ res = self.chained_proc(attn, hidden_states, encoder_hidden_states, attention_mask)
75
+ if self.enabled and is_cfg_guidance:
76
+ res = torch.cat([res0, res])
77
+ return res
78
+
79
+
80
+ class RefOnlyNoisedUNet(torch.nn.Module):
81
+ def __init__(self, unet: UNet2DConditionModel, train_sched: DDPMScheduler, val_sched: EulerAncestralDiscreteScheduler) -> None:
82
+ super().__init__()
83
+ self.unet = unet
84
+ self.train_sched = train_sched
85
+ self.val_sched = val_sched
86
+
87
+ unet_lora_attn_procs = dict()
88
+ for name, _ in unet.attn_processors.items():
89
+ if torch.__version__ >= '2.0':
90
+ default_attn_proc = AttnProcessor2_0()
91
+ elif is_xformers_available():
92
+ default_attn_proc = XFormersAttnProcessor()
93
+ else:
94
+ default_attn_proc = AttnProcessor()
95
+ unet_lora_attn_procs[name] = ReferenceOnlyAttnProc(
96
+ default_attn_proc, enabled=name.endswith("attn1.processor"), name=name
97
+ )
98
+ unet.set_attn_processor(unet_lora_attn_procs)
99
+
100
+ def __getattr__(self, name: str):
101
+ try:
102
+ return super().__getattr__(name)
103
+ except AttributeError:
104
+ return getattr(self.unet, name)
105
+
106
+ def forward_cond(self, noisy_cond_lat, timestep, encoder_hidden_states, class_labels, ref_dict, is_cfg_guidance, **kwargs):
107
+ if is_cfg_guidance:
108
+ encoder_hidden_states = encoder_hidden_states[1:]
109
+ class_labels = class_labels[1:]
110
+ self.unet(
111
+ noisy_cond_lat, timestep,
112
+ encoder_hidden_states=encoder_hidden_states,
113
+ class_labels=class_labels,
114
+ cross_attention_kwargs=dict(mode="w", ref_dict=ref_dict),
115
+ **kwargs
116
+ )
117
+
118
+ def forward(
119
+ self, sample, timestep, encoder_hidden_states, class_labels=None,
120
+ *args, cross_attention_kwargs,
121
+ down_block_res_samples=None, mid_block_res_sample=None,
122
+ **kwargs
123
+ ):
124
+ cond_lat = cross_attention_kwargs['cond_lat']
125
+ is_cfg_guidance = cross_attention_kwargs.get('is_cfg_guidance', False)
126
+ noise = torch.randn_like(cond_lat)
127
+ if self.training:
128
+ noisy_cond_lat = self.train_sched.add_noise(cond_lat, noise, timestep)
129
+ noisy_cond_lat = self.train_sched.scale_model_input(noisy_cond_lat, timestep)
130
+ else:
131
+ noisy_cond_lat = self.val_sched.add_noise(cond_lat, noise, timestep.reshape(-1))
132
+ noisy_cond_lat = self.val_sched.scale_model_input(noisy_cond_lat, timestep.reshape(-1))
133
+ ref_dict = {}
134
+ self.forward_cond(
135
+ noisy_cond_lat, timestep,
136
+ encoder_hidden_states, class_labels,
137
+ ref_dict, is_cfg_guidance, **kwargs
138
+ )
139
+ weight_dtype = self.unet.dtype
140
+ return self.unet(
141
+ sample, timestep,
142
+ encoder_hidden_states, *args,
143
+ class_labels=class_labels,
144
+ cross_attention_kwargs=dict(mode="r", ref_dict=ref_dict, is_cfg_guidance=is_cfg_guidance),
145
+ down_block_additional_residuals=[
146
+ sample.to(dtype=weight_dtype) for sample in down_block_res_samples
147
+ ] if down_block_res_samples is not None else None,
148
+ mid_block_additional_residual=(
149
+ mid_block_res_sample.to(dtype=weight_dtype)
150
+ if mid_block_res_sample is not None else None
151
+ ),
152
+ **kwargs
153
+ )
154
+
155
+
156
+ def scale_latents(latents):
157
+ latents = (latents - 0.22) * 0.75
158
+ return latents
159
+
160
+
161
+ def unscale_latents(latents):
162
+ latents = latents / 0.75 + 0.22
163
+ return latents
164
+
165
+
166
+ def scale_image(image):
167
+ image = image * 0.5 / 0.8
168
+ return image
169
+
170
+
171
+ def unscale_image(image):
172
+ image = image / 0.5 * 0.8
173
+ return image
174
+
175
+
176
+ class DepthControlUNet(torch.nn.Module):
177
+ def __init__(self, unet: RefOnlyNoisedUNet, controlnet: Optional[diffusers.ControlNetModel] = None, conditioning_scale=1.0) -> None:
178
+ super().__init__()
179
+ self.unet = unet
180
+ if controlnet is None:
181
+ self.controlnet = diffusers.ControlNetModel.from_unet(unet.unet)
182
+ else:
183
+ self.controlnet = controlnet
184
+ DefaultAttnProc = AttnProcessor2_0
185
+ if is_xformers_available():
186
+ DefaultAttnProc = XFormersAttnProcessor
187
+ self.controlnet.set_attn_processor(DefaultAttnProc())
188
+ self.conditioning_scale = conditioning_scale
189
+
190
+ def __getattr__(self, name: str):
191
+ try:
192
+ return super().__getattr__(name)
193
+ except AttributeError:
194
+ return getattr(self.unet, name)
195
+
196
+ def forward(self, sample, timestep, encoder_hidden_states, class_labels=None, *args, cross_attention_kwargs: dict, **kwargs):
197
+ cross_attention_kwargs = dict(cross_attention_kwargs)
198
+ control_depth = cross_attention_kwargs.pop('control_depth')
199
+ down_block_res_samples, mid_block_res_sample = self.controlnet(
200
+ sample,
201
+ timestep,
202
+ encoder_hidden_states=encoder_hidden_states,
203
+ controlnet_cond=control_depth,
204
+ conditioning_scale=self.conditioning_scale,
205
+ return_dict=False,
206
+ )
207
+ return self.unet(
208
+ sample,
209
+ timestep,
210
+ encoder_hidden_states=encoder_hidden_states,
211
+ down_block_res_samples=down_block_res_samples,
212
+ mid_block_res_sample=mid_block_res_sample,
213
+ cross_attention_kwargs=cross_attention_kwargs
214
+ )
215
+
216
+
217
+ class ModuleListDict(torch.nn.Module):
218
+ def __init__(self, procs: dict) -> None:
219
+ super().__init__()
220
+ self.keys = sorted(procs.keys())
221
+ self.values = torch.nn.ModuleList(procs[k] for k in self.keys)
222
+
223
+ def __getitem__(self, key):
224
+ return self.values[self.keys.index(key)]
225
+
226
+
227
+ class SuperNet(torch.nn.Module):
228
+ def __init__(self, state_dict: Dict[str, torch.Tensor]):
229
+ super().__init__()
230
+ state_dict = OrderedDict((k, state_dict[k]) for k in sorted(state_dict.keys()))
231
+ self.layers = torch.nn.ModuleList(state_dict.values())
232
+ self.mapping = dict(enumerate(state_dict.keys()))
233
+ self.rev_mapping = {v: k for k, v in enumerate(state_dict.keys())}
234
+
235
+ # .processor for unet, .self_attn for text encoder
236
+ self.split_keys = [".processor", ".self_attn"]
237
+
238
+ # we add a hook to state_dict() and load_state_dict() so that the
239
+ # naming fits with `unet.attn_processors`
240
+ def map_to(module, state_dict, *args, **kwargs):
241
+ new_state_dict = {}
242
+ for key, value in state_dict.items():
243
+ num = int(key.split(".")[1]) # 0 is always "layers"
244
+ new_key = key.replace(f"layers.{num}", module.mapping[num])
245
+ new_state_dict[new_key] = value
246
+
247
+ return new_state_dict
248
+
249
+ def remap_key(key, state_dict):
250
+ for k in self.split_keys:
251
+ if k in key:
252
+ return key.split(k)[0] + k
253
+ return key.split('.')[0]
254
+
255
+ def map_from(module, state_dict, *args, **kwargs):
256
+ all_keys = list(state_dict.keys())
257
+ for key in all_keys:
258
+ replace_key = remap_key(key, state_dict)
259
+ new_key = key.replace(replace_key, f"layers.{module.rev_mapping[replace_key]}")
260
+ state_dict[new_key] = state_dict[key]
261
+ del state_dict[key]
262
+
263
+ self._register_state_dict_hook(map_to)
264
+ self._register_load_state_dict_pre_hook(map_from, with_module=True)
265
+
266
+
267
+ class Zero123PlusPipeline(diffusers.StableDiffusionPipeline):
268
+ tokenizer: transformers.CLIPTokenizer
269
+ text_encoder: transformers.CLIPTextModel
270
+ vision_encoder: transformers.CLIPVisionModelWithProjection
271
+
272
+ feature_extractor_clip: transformers.CLIPImageProcessor
273
+ unet: UNet2DConditionModel
274
+ scheduler: diffusers.schedulers.KarrasDiffusionSchedulers
275
+
276
+ vae: AutoencoderKL
277
+ ramping: nn.Linear
278
+
279
+ feature_extractor_vae: transformers.CLIPImageProcessor
280
+
281
+ depth_transforms_multi = transforms.Compose([
282
+ transforms.ToTensor(),
283
+ transforms.Normalize([0.5], [0.5])
284
+ ])
285
+
286
+ def __init__(
287
+ self,
288
+ vae: AutoencoderKL,
289
+ text_encoder: CLIPTextModel,
290
+ tokenizer: CLIPTokenizer,
291
+ unet: UNet2DConditionModel,
292
+ scheduler: KarrasDiffusionSchedulers,
293
+ vision_encoder: transformers.CLIPVisionModelWithProjection,
294
+ feature_extractor_clip: CLIPImageProcessor,
295
+ feature_extractor_vae: CLIPImageProcessor,
296
+ ramping_coefficients: Optional[list] = None,
297
+ safety_checker=None,
298
+ ):
299
+ DiffusionPipeline.__init__(self)
300
+
301
+ self.register_modules(
302
+ vae=vae, text_encoder=text_encoder, tokenizer=tokenizer,
303
+ unet=unet, scheduler=scheduler, safety_checker=None,
304
+ vision_encoder=vision_encoder,
305
+ feature_extractor_clip=feature_extractor_clip,
306
+ feature_extractor_vae=feature_extractor_vae
307
+ )
308
+ self.register_to_config(ramping_coefficients=ramping_coefficients)
309
+ self.vae_scale_factor = 2 ** (len(self.vae.config.block_out_channels) - 1)
310
+ self.image_processor = VaeImageProcessor(vae_scale_factor=self.vae_scale_factor)
311
+
312
+ def prepare(self):
313
+ train_sched = DDPMScheduler.from_config(self.scheduler.config)
314
+ if isinstance(self.unet, UNet2DConditionModel):
315
+ self.unet = RefOnlyNoisedUNet(self.unet, train_sched, self.scheduler).eval()
316
+
317
+ def add_controlnet(self, controlnet: Optional[diffusers.ControlNetModel] = None, conditioning_scale=1.0):
318
+ self.prepare()
319
+ self.unet = DepthControlUNet(self.unet, controlnet, conditioning_scale)
320
+ return SuperNet(OrderedDict([('controlnet', self.unet.controlnet)]))
321
+
322
+ def encode_condition_image(self, image: torch.Tensor):
323
+ image = self.vae.encode(image).latent_dist.sample()
324
+ return image
325
+
326
+ @torch.no_grad()
327
+ def __call__(
328
+ self,
329
+ image: Image.Image = None,
330
+ prompt = "",
331
+ *args,
332
+ num_images_per_prompt: Optional[int] = 1,
333
+ guidance_scale=4.0,
334
+ depth_image: Image.Image = None,
335
+ output_type: Optional[str] = "pil",
336
+ width=640,
337
+ height=960,
338
+ num_inference_steps=28,
339
+ return_dict=True,
340
+ **kwargs
341
+ ):
342
+ self.prepare()
343
+ if image is None:
344
+ raise ValueError("Inputting embeddings not supported for this pipeline. Please pass an image.")
345
+ assert not isinstance(image, torch.Tensor)
346
+ image = to_rgb_image(image)
347
+ image_1 = self.feature_extractor_vae(images=image, return_tensors="pt").pixel_values
348
+ image_2 = self.feature_extractor_clip(images=image, return_tensors="pt").pixel_values
349
+ if depth_image is not None and hasattr(self.unet, "controlnet"):
350
+ depth_image = to_rgb_image(depth_image)
351
+ depth_image = self.depth_transforms_multi(depth_image).to(
352
+ device=self.unet.controlnet.device, dtype=self.unet.controlnet.dtype
353
+ )
354
+ image = image_1.to(device=self.vae.device, dtype=self.vae.dtype)
355
+ image_2 = image_2.to(device=self.vae.device, dtype=self.vae.dtype)
356
+ cond_lat = self.encode_condition_image(image)
357
+ if guidance_scale > 1:
358
+ negative_lat = self.encode_condition_image(torch.zeros_like(image))
359
+ cond_lat = torch.cat([negative_lat, cond_lat])
360
+ encoded = self.vision_encoder(image_2, output_hidden_states=False)
361
+ global_embeds = encoded.image_embeds
362
+ global_embeds = global_embeds.unsqueeze(-2)
363
+
364
+ encoder_hidden_states = self._encode_prompt(
365
+ prompt,
366
+ self.device,
367
+ num_images_per_prompt,
368
+ False
369
+ )
370
+ ramp = global_embeds.new_tensor(self.config.ramping_coefficients).unsqueeze(-1)
371
+ encoder_hidden_states = encoder_hidden_states + global_embeds * ramp
372
+ cak = dict(cond_lat=cond_lat)
373
+ if hasattr(self.unet, "controlnet"):
374
+ cak['control_depth'] = depth_image
375
+ latents: torch.Tensor = super().__call__(
376
+ None,
377
+ *args,
378
+ cross_attention_kwargs=cak,
379
+ guidance_scale=guidance_scale,
380
+ num_images_per_prompt=num_images_per_prompt,
381
+ prompt_embeds=encoder_hidden_states,
382
+ num_inference_steps=num_inference_steps,
383
+ output_type='latent',
384
+ width=width,
385
+ height=height,
386
+ **kwargs
387
+ ).images
388
+ latents = unscale_latents(latents)
389
+ if not output_type == "latent":
390
+ image = unscale_image(self.vae.decode(latents / self.vae.config.scaling_factor, return_dict=False)[0])
391
+ else:
392
+ image = latents
393
+
394
+ image = self.image_processor.postprocess(image, output_type=output_type)
395
+ if not return_dict:
396
+ return (image,)
397
+
398
+ return ImagePipelineOutput(images=image)
examples/depth_controlnet.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import requests
3
+ from PIL import Image
4
+ from diffusers import DiffusionPipeline, EulerAncestralDiscreteScheduler, ControlNetModel
5
+
6
+ # Load the pipeline
7
+ pipeline = DiffusionPipeline.from_pretrained(
8
+ "sudo-ai/zero123plus-v1.1", custom_pipeline="sudo-ai/zero123plus-pipeline",
9
+ torch_dtype=torch.float16
10
+ )
11
+ pipeline.add_controlnet(ControlNetModel.from_pretrained(
12
+ "sudo-ai/controlnet-zp11-depth-v1", torch_dtype=torch.float16
13
+ ), conditioning_scale=0.75)
14
+ # Feel free to tune the scheduler
15
+ pipeline.scheduler = EulerAncestralDiscreteScheduler.from_config(
16
+ pipeline.scheduler.config, timestep_spacing='trailing'
17
+ )
18
+ pipeline.to('cuda:0')
19
+ # Run the pipeline
20
+ cond = Image.open(requests.get("https://d.skis.ltd/nrp/sample-data/0_cond.png", stream=True).raw)
21
+ depth = Image.open(requests.get("https://d.skis.ltd/nrp/sample-data/0_depth.png", stream=True).raw)
22
+ result = pipeline(cond, depth_image=depth, num_inference_steps=36).images[0]
23
+ result.show()
24
+ result.save("output.png")
examples/img_to_mv.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import requests
3
+ from PIL import Image
4
+ from diffusers import DiffusionPipeline, EulerAncestralDiscreteScheduler
5
+
6
+ # Load the pipeline
7
+ pipeline = DiffusionPipeline.from_pretrained(
8
+ "sudo-ai/zero123plus-v1.1", custom_pipeline="sudo-ai/zero123plus-pipeline",
9
+ torch_dtype=torch.float16
10
+ )
11
+ # Feel free to tune the scheduler
12
+ pipeline.scheduler = EulerAncestralDiscreteScheduler.from_config(
13
+ pipeline.scheduler.config, timestep_spacing='trailing'
14
+ )
15
+ pipeline.to('cuda:0')
16
+ # Run the pipeline
17
+ cond = Image.open(requests.get("https://d.skis.ltd/nrp/sample-data/lysol.png", stream=True).raw)
18
+ result = pipeline(cond, num_inference_steps=75).images[0]
19
+ result.show()
20
+ result.save("output.png")
examples/text_to_img.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from diffusers import StableDiffusionXLPipeline
2
+ import torch
3
+ import rembg
4
+
5
+ # text-to-image with SDXL for text-to-image-to-3d
6
+ pipeline = StableDiffusionXLPipeline.from_single_file(
7
+ "https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/blob/main/sd_xl_base_1.0.safetensors",
8
+ torch_dtype=torch.float16,
9
+ variant="fp16",
10
+ use_safetensors=True
11
+ ).to("cuda")
12
+ pipeline.enable_model_cpu_offload()
13
+
14
+ num_images_per_prompt = 1
15
+ res = 1024
16
+ text = input("Prompt > ")
17
+ bkgd_color = "white"
18
+ prompt = f"a ((full-body:2)) shot of a ((single:2)) {text}, isolated on {bkgd_color} background, 4k, highly detailed"
19
+ images = pipeline(prompt=prompt, num_images_per_prompt=num_images_per_prompt, height=res, width=res).images
20
+ image = images[0]
21
+ image.show()
22
+ image.save("output.png")
23
+ image = rembg.remove(image)
24
+ image.save("output-rembg.png")
requirements.txt ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ torch
2
+ torchvision
3
+ numpy
4
+ rembg
5
+ opencv-contrib-python
6
+ diffusers==0.20.2
7
+ transformers==4.29.2
8
+ streamlit==1.22.0
9
+ altair<5
10
+ git+https://github.com/facebookresearch/segment-anything.git
resources/examples/extinguisher.png ADDED
resources/examples/ghost-eating-burger.png ADDED
resources/examples/mushroom.png ADDED
resources/examples/tianw2.png ADDED
resources/teaser-low.jpg ADDED