dikdimon commited on
Commit
c10aebf
·
verified ·
1 Parent(s): f2f3b8d

Upload 3-bmab using SD-Hub

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. 3-bmab/.gitignore +2 -0
  2. 3-bmab/LICENSE.txt +663 -0
  3. 3-bmab/README.md +214 -0
  4. 3-bmab/ReleaseNote.md +143 -0
  5. 3-bmab/docs/en/bmab.md +319 -0
  6. 3-bmab/docs/en/manual.md +58 -0
  7. 3-bmab/docs/en/postprocess.md +66 -0
  8. 3-bmab/docs/en/preprocess.md +425 -0
  9. 3-bmab/docs/kr/api.md +234 -0
  10. 3-bmab/docs/kr/bmab.md +319 -0
  11. 3-bmab/docs/kr/manual.md +65 -0
  12. 3-bmab/docs/kr/postprocess.md +66 -0
  13. 3-bmab/docs/kr/preprocess.md +425 -0
  14. 3-bmab/docs/masking.md +31 -0
  15. 3-bmab/filter/Put filter file here.txt +0 -0
  16. 3-bmab/filter/basic.py +34 -0
  17. 3-bmab/filter/vintage.py +46 -0
  18. 3-bmab/install.py +42 -0
  19. 3-bmab/models/Put model file here.txt +0 -0
  20. 3-bmab/requirements.txt +9 -0
  21. 3-bmab/resources/preset/3girls.json +46 -0
  22. 3-bmab/resources/preset/Put config file here.txt +0 -0
  23. 3-bmab/resources/preset/example.json +25 -0
  24. 3-bmab/resources/preset/example2.json +27 -0
  25. 3-bmab/resources/preset/hand.json +18 -0
  26. 3-bmab/resources/preset/hand2.json +20 -0
  27. 3-bmab/scripts/__pycache__/sd_webui_bmab.cpython-310.pyc +0 -0
  28. 3-bmab/scripts/sd_webui_bmab.py +1 -0
  29. 3-bmab/sd_bmab/__init__.py +0 -0
  30. 3-bmab/sd_bmab/__pycache__/__init__.cpython-310.pyc +0 -0
  31. 3-bmab/sd_bmab/__pycache__/bmab.cpython-310.pyc +0 -0
  32. 3-bmab/sd_bmab/__pycache__/compat.cpython-310.pyc +0 -0
  33. 3-bmab/sd_bmab/__pycache__/constants.cpython-310.pyc +0 -0
  34. 3-bmab/sd_bmab/__pycache__/controlnet.cpython-310.pyc +0 -0
  35. 3-bmab/sd_bmab/__pycache__/parameters.cpython-310.pyc +0 -0
  36. 3-bmab/sd_bmab/__pycache__/ui.cpython-310.pyc +0 -0
  37. 3-bmab/sd_bmab/base/__init__.py +7 -0
  38. 3-bmab/sd_bmab/base/__pycache__/__init__.cpython-310.pyc +0 -0
  39. 3-bmab/sd_bmab/base/__pycache__/cache.cpython-310.pyc +0 -0
  40. 3-bmab/sd_bmab/base/__pycache__/common.cpython-310.pyc +0 -0
  41. 3-bmab/sd_bmab/base/__pycache__/context.cpython-310.pyc +0 -0
  42. 3-bmab/sd_bmab/base/__pycache__/detectorbase.cpython-310.pyc +0 -0
  43. 3-bmab/sd_bmab/base/__pycache__/filter.cpython-310.pyc +0 -0
  44. 3-bmab/sd_bmab/base/__pycache__/maskbase.cpython-310.pyc +0 -0
  45. 3-bmab/sd_bmab/base/__pycache__/process.cpython-310.pyc +0 -0
  46. 3-bmab/sd_bmab/base/__pycache__/processorbase.cpython-310.pyc +0 -0
  47. 3-bmab/sd_bmab/base/cache.py +40 -0
  48. 3-bmab/sd_bmab/base/common.py +47 -0
  49. 3-bmab/sd_bmab/base/context.py +114 -0
  50. 3-bmab/sd_bmab/base/detectorbase.py +16 -0
3-bmab/.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ **/__pycache__/
2
+ cache/
3-bmab/LICENSE.txt ADDED
@@ -0,0 +1,663 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU AFFERO GENERAL PUBLIC LICENSE
2
+ Version 3, 19 November 2007
3
+
4
+ Copyright (c) 2023 AUTOMATIC1111
5
+
6
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
7
+ Everyone is permitted to copy and distribute verbatim copies
8
+ of this license document, but changing it is not allowed.
9
+
10
+ Preamble
11
+
12
+ The GNU Affero General Public License is a free, copyleft license for
13
+ software and other kinds of works, specifically designed to ensure
14
+ cooperation with the community in the case of network server software.
15
+
16
+ The licenses for most software and other practical works are designed
17
+ to take away your freedom to share and change the works. By contrast,
18
+ our General Public Licenses are intended to guarantee your freedom to
19
+ share and change all versions of a program--to make sure it remains free
20
+ software for all its users.
21
+
22
+ When we speak of free software, we are referring to freedom, not
23
+ price. Our General Public Licenses are designed to make sure that you
24
+ have the freedom to distribute copies of free software (and charge for
25
+ them if you wish), that you receive source code or can get it if you
26
+ want it, that you can change the software or use pieces of it in new
27
+ free programs, and that you know you can do these things.
28
+
29
+ Developers that use our General Public Licenses protect your rights
30
+ with two steps: (1) assert copyright on the software, and (2) offer
31
+ you this License which gives you legal permission to copy, distribute
32
+ and/or modify the software.
33
+
34
+ A secondary benefit of defending all users' freedom is that
35
+ improvements made in alternate versions of the program, if they
36
+ receive widespread use, become available for other developers to
37
+ incorporate. Many developers of free software are heartened and
38
+ encouraged by the resulting cooperation. However, in the case of
39
+ software used on network servers, this result may fail to come about.
40
+ The GNU General Public License permits making a modified version and
41
+ letting the public access it on a server without ever releasing its
42
+ source code to the public.
43
+
44
+ The GNU Affero General Public License is designed specifically to
45
+ ensure that, in such cases, the modified source code becomes available
46
+ to the community. It requires the operator of a network server to
47
+ provide the source code of the modified version running there to the
48
+ users of that server. Therefore, public use of a modified version, on
49
+ a publicly accessible server, gives the public access to the source
50
+ code of the modified version.
51
+
52
+ An older license, called the Affero General Public License and
53
+ published by Affero, was designed to accomplish similar goals. This is
54
+ a different license, not a version of the Affero GPL, but Affero has
55
+ released a new version of the Affero GPL which permits relicensing under
56
+ this license.
57
+
58
+ The precise terms and conditions for copying, distribution and
59
+ modification follow.
60
+
61
+ TERMS AND CONDITIONS
62
+
63
+ 0. Definitions.
64
+
65
+ "This License" refers to version 3 of the GNU Affero General Public License.
66
+
67
+ "Copyright" also means copyright-like laws that apply to other kinds of
68
+ works, such as semiconductor masks.
69
+
70
+ "The Program" refers to any copyrightable work licensed under this
71
+ License. Each licensee is addressed as "you". "Licensees" and
72
+ "recipients" may be individuals or organizations.
73
+
74
+ To "modify" a work means to copy from or adapt all or part of the work
75
+ in a fashion requiring copyright permission, other than the making of an
76
+ exact copy. The resulting work is called a "modified version" of the
77
+ earlier work or a work "based on" the earlier work.
78
+
79
+ A "covered work" means either the unmodified Program or a work based
80
+ on the Program.
81
+
82
+ To "propagate" a work means to do anything with it that, without
83
+ permission, would make you directly or secondarily liable for
84
+ infringement under applicable copyright law, except executing it on a
85
+ computer or modifying a private copy. Propagation includes copying,
86
+ distribution (with or without modification), making available to the
87
+ public, and in some countries other activities as well.
88
+
89
+ To "convey" a work means any kind of propagation that enables other
90
+ parties to make or receive copies. Mere interaction with a user through
91
+ a computer network, with no transfer of a copy, is not conveying.
92
+
93
+ An interactive user interface displays "Appropriate Legal Notices"
94
+ to the extent that it includes a convenient and prominently visible
95
+ feature that (1) displays an appropriate copyright notice, and (2)
96
+ tells the user that there is no warranty for the work (except to the
97
+ extent that warranties are provided), that licensees may convey the
98
+ work under this License, and how to view a copy of this License. If
99
+ the interface presents a list of user commands or options, such as a
100
+ menu, a prominent item in the list meets this criterion.
101
+
102
+ 1. Source Code.
103
+
104
+ The "source code" for a work means the preferred form of the work
105
+ for making modifications to it. "Object code" means any non-source
106
+ form of a work.
107
+
108
+ A "Standard Interface" means an interface that either is an official
109
+ standard defined by a recognized standards body, or, in the case of
110
+ interfaces specified for a particular programming language, one that
111
+ is widely used among developers working in that language.
112
+
113
+ The "System Libraries" of an executable work include anything, other
114
+ than the work as a whole, that (a) is included in the normal form of
115
+ packaging a Major Component, but which is not part of that Major
116
+ Component, and (b) serves only to enable use of the work with that
117
+ Major Component, or to implement a Standard Interface for which an
118
+ implementation is available to the public in source code form. A
119
+ "Major Component", in this context, means a major essential component
120
+ (kernel, window system, and so on) of the specific operating system
121
+ (if any) on which the executable work runs, or a compiler used to
122
+ produce the work, or an object code interpreter used to run it.
123
+
124
+ The "Corresponding Source" for a work in object code form means all
125
+ the source code needed to generate, install, and (for an executable
126
+ work) run the object code and to modify the work, including scripts to
127
+ control those activities. However, it does not include the work's
128
+ System Libraries, or general-purpose tools or generally available free
129
+ programs which are used unmodified in performing those activities but
130
+ which are not part of the work. For example, Corresponding Source
131
+ includes interface definition files associated with source files for
132
+ the work, and the source code for shared libraries and dynamically
133
+ linked subprograms that the work is specifically designed to require,
134
+ such as by intimate data communication or control flow between those
135
+ subprograms and other parts of the work.
136
+
137
+ The Corresponding Source need not include anything that users
138
+ can regenerate automatically from other parts of the Corresponding
139
+ Source.
140
+
141
+ The Corresponding Source for a work in source code form is that
142
+ same work.
143
+
144
+ 2. Basic Permissions.
145
+
146
+ All rights granted under this License are granted for the term of
147
+ copyright on the Program, and are irrevocable provided the stated
148
+ conditions are met. This License explicitly affirms your unlimited
149
+ permission to run the unmodified Program. The output from running a
150
+ covered work is covered by this License only if the output, given its
151
+ content, constitutes a covered work. This License acknowledges your
152
+ rights of fair use or other equivalent, as provided by copyright law.
153
+
154
+ You may make, run and propagate covered works that you do not
155
+ convey, without conditions so long as your license otherwise remains
156
+ in force. You may convey covered works to others for the sole purpose
157
+ of having them make modifications exclusively for you, or provide you
158
+ with facilities for running those works, provided that you comply with
159
+ the terms of this License in conveying all material for which you do
160
+ not control copyright. Those thus making or running the covered works
161
+ for you must do so exclusively on your behalf, under your direction
162
+ and control, on terms that prohibit them from making any copies of
163
+ your copyrighted material outside their relationship with you.
164
+
165
+ Conveying under any other circumstances is permitted solely under
166
+ the conditions stated below. Sublicensing is not allowed; section 10
167
+ makes it unnecessary.
168
+
169
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
170
+
171
+ No covered work shall be deemed part of an effective technological
172
+ measure under any applicable law fulfilling obligations under article
173
+ 11 of the WIPO copyright treaty adopted on 20 December 1996, or
174
+ similar laws prohibiting or restricting circumvention of such
175
+ measures.
176
+
177
+ When you convey a covered work, you waive any legal power to forbid
178
+ circumvention of technological measures to the extent such circumvention
179
+ is effected by exercising rights under this License with respect to
180
+ the covered work, and you disclaim any intention to limit operation or
181
+ modification of the work as a means of enforcing, against the work's
182
+ users, your or third parties' legal rights to forbid circumvention of
183
+ technological measures.
184
+
185
+ 4. Conveying Verbatim Copies.
186
+
187
+ You may convey verbatim copies of the Program's source code as you
188
+ receive it, in any medium, provided that you conspicuously and
189
+ appropriately publish on each copy an appropriate copyright notice;
190
+ keep intact all notices stating that this License and any
191
+ non-permissive terms added in accord with section 7 apply to the code;
192
+ keep intact all notices of the absence of any warranty; and give all
193
+ recipients a copy of this License along with the Program.
194
+
195
+ You may charge any price or no price for each copy that you convey,
196
+ and you may offer support or warranty protection for a fee.
197
+
198
+ 5. Conveying Modified Source Versions.
199
+
200
+ You may convey a work based on the Program, or the modifications to
201
+ produce it from the Program, in the form of source code under the
202
+ terms of section 4, provided that you also meet all of these conditions:
203
+
204
+ a) The work must carry prominent notices stating that you modified
205
+ it, and giving a relevant date.
206
+
207
+ b) The work must carry prominent notices stating that it is
208
+ released under this License and any conditions added under section
209
+ 7. This requirement modifies the requirement in section 4 to
210
+ "keep intact all notices".
211
+
212
+ c) You must license the entire work, as a whole, under this
213
+ License to anyone who comes into possession of a copy. This
214
+ License will therefore apply, along with any applicable section 7
215
+ additional terms, to the whole of the work, and all its parts,
216
+ regardless of how they are packaged. This License gives no
217
+ permission to license the work in any other way, but it does not
218
+ invalidate such permission if you have separately received it.
219
+
220
+ d) If the work has interactive user interfaces, each must display
221
+ Appropriate Legal Notices; however, if the Program has interactive
222
+ interfaces that do not display Appropriate Legal Notices, your
223
+ work need not make them do so.
224
+
225
+ A compilation of a covered work with other separate and independent
226
+ works, which are not by their nature extensions of the covered work,
227
+ and which are not combined with it such as to form a larger program,
228
+ in or on a volume of a storage or distribution medium, is called an
229
+ "aggregate" if the compilation and its resulting copyright are not
230
+ used to limit the access or legal rights of the compilation's users
231
+ beyond what the individual works permit. Inclusion of a covered work
232
+ in an aggregate does not cause this License to apply to the other
233
+ parts of the aggregate.
234
+
235
+ 6. Conveying Non-Source Forms.
236
+
237
+ You may convey a covered work in object code form under the terms
238
+ of sections 4 and 5, provided that you also convey the
239
+ machine-readable Corresponding Source under the terms of this License,
240
+ in one of these ways:
241
+
242
+ a) Convey the object code in, or embodied in, a physical product
243
+ (including a physical distribution medium), accompanied by the
244
+ Corresponding Source fixed on a durable physical medium
245
+ customarily used for software interchange.
246
+
247
+ b) Convey the object code in, or embodied in, a physical product
248
+ (including a physical distribution medium), accompanied by a
249
+ written offer, valid for at least three years and valid for as
250
+ long as you offer spare parts or customer support for that product
251
+ model, to give anyone who possesses the object code either (1) a
252
+ copy of the Corresponding Source for all the software in the
253
+ product that is covered by this License, on a durable physical
254
+ medium customarily used for software interchange, for a price no
255
+ more than your reasonable cost of physically performing this
256
+ conveying of source, or (2) access to copy the
257
+ Corresponding Source from a network server at no charge.
258
+
259
+ c) Convey individual copies of the object code with a copy of the
260
+ written offer to provide the Corresponding Source. This
261
+ alternative is allowed only occasionally and noncommercially, and
262
+ only if you received the object code with such an offer, in accord
263
+ with subsection 6b.
264
+
265
+ d) Convey the object code by offering access from a designated
266
+ place (gratis or for a charge), and offer equivalent access to the
267
+ Corresponding Source in the same way through the same place at no
268
+ further charge. You need not require recipients to copy the
269
+ Corresponding Source along with the object code. If the place to
270
+ copy the object code is a network server, the Corresponding Source
271
+ may be on a different server (operated by you or a third party)
272
+ that supports equivalent copying facilities, provided you maintain
273
+ clear directions next to the object code saying where to find the
274
+ Corresponding Source. Regardless of what server hosts the
275
+ Corresponding Source, you remain obligated to ensure that it is
276
+ available for as long as needed to satisfy these requirements.
277
+
278
+ e) Convey the object code using peer-to-peer transmission, provided
279
+ you inform other peers where the object code and Corresponding
280
+ Source of the work are being offered to the general public at no
281
+ charge under subsection 6d.
282
+
283
+ A separable portion of the object code, whose source code is excluded
284
+ from the Corresponding Source as a System Library, need not be
285
+ included in conveying the object code work.
286
+
287
+ A "User Product" is either (1) a "consumer product", which means any
288
+ tangible personal property which is normally used for personal, family,
289
+ or household purposes, or (2) anything designed or sold for incorporation
290
+ into a dwelling. In determining whether a product is a consumer product,
291
+ doubtful cases shall be resolved in favor of coverage. For a particular
292
+ product received by a particular user, "normally used" refers to a
293
+ typical or common use of that class of product, regardless of the status
294
+ of the particular user or of the way in which the particular user
295
+ actually uses, or expects or is expected to use, the product. A product
296
+ is a consumer product regardless of whether the product has substantial
297
+ commercial, industrial or non-consumer uses, unless such uses represent
298
+ the only significant mode of use of the product.
299
+
300
+ "Installation Information" for a User Product means any methods,
301
+ procedures, authorization keys, or other information required to install
302
+ and execute modified versions of a covered work in that User Product from
303
+ a modified version of its Corresponding Source. The information must
304
+ suffice to ensure that the continued functioning of the modified object
305
+ code is in no case prevented or interfered with solely because
306
+ modification has been made.
307
+
308
+ If you convey an object code work under this section in, or with, or
309
+ specifically for use in, a User Product, and the conveying occurs as
310
+ part of a transaction in which the right of possession and use of the
311
+ User Product is transferred to the recipient in perpetuity or for a
312
+ fixed term (regardless of how the transaction is characterized), the
313
+ Corresponding Source conveyed under this section must be accompanied
314
+ by the Installation Information. But this requirement does not apply
315
+ if neither you nor any third party retains the ability to install
316
+ modified object code on the User Product (for example, the work has
317
+ been installed in ROM).
318
+
319
+ The requirement to provide Installation Information does not include a
320
+ requirement to continue to provide support service, warranty, or updates
321
+ for a work that has been modified or installed by the recipient, or for
322
+ the User Product in which it has been modified or installed. Access to a
323
+ network may be denied when the modification itself materially and
324
+ adversely affects the operation of the network or violates the rules and
325
+ protocols for communication across the network.
326
+
327
+ Corresponding Source conveyed, and Installation Information provided,
328
+ in accord with this section must be in a format that is publicly
329
+ documented (and with an implementation available to the public in
330
+ source code form), and must require no special password or key for
331
+ unpacking, reading or copying.
332
+
333
+ 7. Additional Terms.
334
+
335
+ "Additional permissions" are terms that supplement the terms of this
336
+ License by making exceptions from one or more of its conditions.
337
+ Additional permissions that are applicable to the entire Program shall
338
+ be treated as though they were included in this License, to the extent
339
+ that they are valid under applicable law. If additional permissions
340
+ apply only to part of the Program, that part may be used separately
341
+ under those permissions, but the entire Program remains governed by
342
+ this License without regard to the additional permissions.
343
+
344
+ When you convey a copy of a covered work, you may at your option
345
+ remove any additional permissions from that copy, or from any part of
346
+ it. (Additional permissions may be written to require their own
347
+ removal in certain cases when you modify the work.) You may place
348
+ additional permissions on material, added by you to a covered work,
349
+ for which you have or can give appropriate copyright permission.
350
+
351
+ Notwithstanding any other provision of this License, for material you
352
+ add to a covered work, you may (if authorized by the copyright holders of
353
+ that material) supplement the terms of this License with terms:
354
+
355
+ a) Disclaiming warranty or limiting liability differently from the
356
+ terms of sections 15 and 16 of this License; or
357
+
358
+ b) Requiring preservation of specified reasonable legal notices or
359
+ author attributions in that material or in the Appropriate Legal
360
+ Notices displayed by works containing it; or
361
+
362
+ c) Prohibiting misrepresentation of the origin of that material, or
363
+ requiring that modified versions of such material be marked in
364
+ reasonable ways as different from the original version; or
365
+
366
+ d) Limiting the use for publicity purposes of names of licensors or
367
+ authors of the material; or
368
+
369
+ e) Declining to grant rights under trademark law for use of some
370
+ trade names, trademarks, or service marks; or
371
+
372
+ f) Requiring indemnification of licensors and authors of that
373
+ material by anyone who conveys the material (or modified versions of
374
+ it) with contractual assumptions of liability to the recipient, for
375
+ any liability that these contractual assumptions directly impose on
376
+ those licensors and authors.
377
+
378
+ All other non-permissive additional terms are considered "further
379
+ restrictions" within the meaning of section 10. If the Program as you
380
+ received it, or any part of it, contains a notice stating that it is
381
+ governed by this License along with a term that is a further
382
+ restriction, you may remove that term. If a license document contains
383
+ a further restriction but permits relicensing or conveying under this
384
+ License, you may add to a covered work material governed by the terms
385
+ of that license document, provided that the further restriction does
386
+ not survive such relicensing or conveying.
387
+
388
+ If you add terms to a covered work in accord with this section, you
389
+ must place, in the relevant source files, a statement of the
390
+ additional terms that apply to those files, or a notice indicating
391
+ where to find the applicable terms.
392
+
393
+ Additional terms, permissive or non-permissive, may be stated in the
394
+ form of a separately written license, or stated as exceptions;
395
+ the above requirements apply either way.
396
+
397
+ 8. Termination.
398
+
399
+ You may not propagate or modify a covered work except as expressly
400
+ provided under this License. Any attempt otherwise to propagate or
401
+ modify it is void, and will automatically terminate your rights under
402
+ this License (including any patent licenses granted under the third
403
+ paragraph of section 11).
404
+
405
+ However, if you cease all violation of this License, then your
406
+ license from a particular copyright holder is reinstated (a)
407
+ provisionally, unless and until the copyright holder explicitly and
408
+ finally terminates your license, and (b) permanently, if the copyright
409
+ holder fails to notify you of the violation by some reasonable means
410
+ prior to 60 days after the cessation.
411
+
412
+ Moreover, your license from a particular copyright holder is
413
+ reinstated permanently if the copyright holder notifies you of the
414
+ violation by some reasonable means, this is the first time you have
415
+ received notice of violation of this License (for any work) from that
416
+ copyright holder, and you cure the violation prior to 30 days after
417
+ your receipt of the notice.
418
+
419
+ Termination of your rights under this section does not terminate the
420
+ licenses of parties who have received copies or rights from you under
421
+ this License. If your rights have been terminated and not permanently
422
+ reinstated, you do not qualify to receive new licenses for the same
423
+ material under section 10.
424
+
425
+ 9. Acceptance Not Required for Having Copies.
426
+
427
+ You are not required to accept this License in order to receive or
428
+ run a copy of the Program. Ancillary propagation of a covered work
429
+ occurring solely as a consequence of using peer-to-peer transmission
430
+ to receive a copy likewise does not require acceptance. However,
431
+ nothing other than this License grants you permission to propagate or
432
+ modify any covered work. These actions infringe copyright if you do
433
+ not accept this License. Therefore, by modifying or propagating a
434
+ covered work, you indicate your acceptance of this License to do so.
435
+
436
+ 10. Automatic Licensing of Downstream Recipients.
437
+
438
+ Each time you convey a covered work, the recipient automatically
439
+ receives a license from the original licensors, to run, modify and
440
+ propagate that work, subject to this License. You are not responsible
441
+ for enforcing compliance by third parties with this License.
442
+
443
+ An "entity transaction" is a transaction transferring control of an
444
+ organization, or substantially all assets of one, or subdividing an
445
+ organization, or merging organizations. If propagation of a covered
446
+ work results from an entity transaction, each party to that
447
+ transaction who receives a copy of the work also receives whatever
448
+ licenses to the work the party's predecessor in interest had or could
449
+ give under the previous paragraph, plus a right to possession of the
450
+ Corresponding Source of the work from the predecessor in interest, if
451
+ the predecessor has it or can get it with reasonable efforts.
452
+
453
+ You may not impose any further restrictions on the exercise of the
454
+ rights granted or affirmed under this License. For example, you may
455
+ not impose a license fee, royalty, or other charge for exercise of
456
+ rights granted under this License, and you may not initiate litigation
457
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
458
+ any patent claim is infringed by making, using, selling, offering for
459
+ sale, or importing the Program or any portion of it.
460
+
461
+ 11. Patents.
462
+
463
+ A "contributor" is a copyright holder who authorizes use under this
464
+ License of the Program or a work on which the Program is based. The
465
+ work thus licensed is called the contributor's "contributor version".
466
+
467
+ A contributor's "essential patent claims" are all patent claims
468
+ owned or controlled by the contributor, whether already acquired or
469
+ hereafter acquired, that would be infringed by some manner, permitted
470
+ by this License, of making, using, or selling its contributor version,
471
+ but do not include claims that would be infringed only as a
472
+ consequence of further modification of the contributor version. For
473
+ purposes of this definition, "control" includes the right to grant
474
+ patent sublicenses in a manner consistent with the requirements of
475
+ this License.
476
+
477
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
478
+ patent license under the contributor's essential patent claims, to
479
+ make, use, sell, offer for sale, import and otherwise run, modify and
480
+ propagate the contents of its contributor version.
481
+
482
+ In the following three paragraphs, a "patent license" is any express
483
+ agreement or commitment, however denominated, not to enforce a patent
484
+ (such as an express permission to practice a patent or covenant not to
485
+ sue for patent infringement). To "grant" such a patent license to a
486
+ party means to make such an agreement or commitment not to enforce a
487
+ patent against the party.
488
+
489
+ If you convey a covered work, knowingly relying on a patent license,
490
+ and the Corresponding Source of the work is not available for anyone
491
+ to copy, free of charge and under the terms of this License, through a
492
+ publicly available network server or other readily accessible means,
493
+ then you must either (1) cause the Corresponding Source to be so
494
+ available, or (2) arrange to deprive yourself of the benefit of the
495
+ patent license for this particular work, or (3) arrange, in a manner
496
+ consistent with the requirements of this License, to extend the patent
497
+ license to downstream recipients. "Knowingly relying" means you have
498
+ actual knowledge that, but for the patent license, your conveying the
499
+ covered work in a country, or your recipient's use of the covered work
500
+ in a country, would infringe one or more identifiable patents in that
501
+ country that you have reason to believe are valid.
502
+
503
+ If, pursuant to or in connection with a single transaction or
504
+ arrangement, you convey, or propagate by procuring conveyance of, a
505
+ covered work, and grant a patent license to some of the parties
506
+ receiving the covered work authorizing them to use, propagate, modify
507
+ or convey a specific copy of the covered work, then the patent license
508
+ you grant is automatically extended to all recipients of the covered
509
+ work and works based on it.
510
+
511
+ A patent license is "discriminatory" if it does not include within
512
+ the scope of its coverage, prohibits the exercise of, or is
513
+ conditioned on the non-exercise of one or more of the rights that are
514
+ specifically granted under this License. You may not convey a covered
515
+ work if you are a party to an arrangement with a third party that is
516
+ in the business of distributing software, under which you make payment
517
+ to the third party based on the extent of your activity of conveying
518
+ the work, and under which the third party grants, to any of the
519
+ parties who would receive the covered work from you, a discriminatory
520
+ patent license (a) in connection with copies of the covered work
521
+ conveyed by you (or copies made from those copies), or (b) primarily
522
+ for and in connection with specific products or compilations that
523
+ contain the covered work, unless you entered into that arrangement,
524
+ or that patent license was granted, prior to 28 March 2007.
525
+
526
+ Nothing in this License shall be construed as excluding or limiting
527
+ any implied license or other defenses to infringement that may
528
+ otherwise be available to you under applicable patent law.
529
+
530
+ 12. No Surrender of Others' Freedom.
531
+
532
+ If conditions are imposed on you (whether by court order, agreement or
533
+ otherwise) that contradict the conditions of this License, they do not
534
+ excuse you from the conditions of this License. If you cannot convey a
535
+ covered work so as to satisfy simultaneously your obligations under this
536
+ License and any other pertinent obligations, then as a consequence you may
537
+ not convey it at all. For example, if you agree to terms that obligate you
538
+ to collect a royalty for further conveying from those to whom you convey
539
+ the Program, the only way you could satisfy both those terms and this
540
+ License would be to refrain entirely from conveying the Program.
541
+
542
+ 13. Remote Network Interaction; Use with the GNU General Public License.
543
+
544
+ Notwithstanding any other provision of this License, if you modify the
545
+ Program, your modified version must prominently offer all users
546
+ interacting with it remotely through a computer network (if your version
547
+ supports such interaction) an opportunity to receive the Corresponding
548
+ Source of your version by providing access to the Corresponding Source
549
+ from a network server at no charge, through some standard or customary
550
+ means of facilitating copying of software. This Corresponding Source
551
+ shall include the Corresponding Source for any work covered by version 3
552
+ of the GNU General Public License that is incorporated pursuant to the
553
+ following paragraph.
554
+
555
+ Notwithstanding any other provision of this License, you have
556
+ permission to link or combine any covered work with a work licensed
557
+ under version 3 of the GNU General Public License into a single
558
+ combined work, and to convey the resulting work. The terms of this
559
+ License will continue to apply to the part which is the covered work,
560
+ but the work with which it is combined will remain governed by version
561
+ 3 of the GNU General Public License.
562
+
563
+ 14. Revised Versions of this License.
564
+
565
+ The Free Software Foundation may publish revised and/or new versions of
566
+ the GNU Affero General Public License from time to time. Such new versions
567
+ will be similar in spirit to the present version, but may differ in detail to
568
+ address new problems or concerns.
569
+
570
+ Each version is given a distinguishing version number. If the
571
+ Program specifies that a certain numbered version of the GNU Affero General
572
+ Public License "or any later version" applies to it, you have the
573
+ option of following the terms and conditions either of that numbered
574
+ version or of any later version published by the Free Software
575
+ Foundation. If the Program does not specify a version number of the
576
+ GNU Affero General Public License, you may choose any version ever published
577
+ by the Free Software Foundation.
578
+
579
+ If the Program specifies that a proxy can decide which future
580
+ versions of the GNU Affero General Public License can be used, that proxy's
581
+ public statement of acceptance of a version permanently authorizes you
582
+ to choose that version for the Program.
583
+
584
+ Later license versions may give you additional or different
585
+ permissions. However, no additional obligations are imposed on any
586
+ author or copyright holder as a result of your choosing to follow a
587
+ later version.
588
+
589
+ 15. Disclaimer of Warranty.
590
+
591
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
+ APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
+ HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
+ OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
+ IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
+ ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
+
600
+ 16. Limitation of Liability.
601
+
602
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
+ THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
+ GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
+ USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
+ DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
+ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
+ EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
+ SUCH DAMAGES.
611
+
612
+ 17. Interpretation of Sections 15 and 16.
613
+
614
+ If the disclaimer of warranty and limitation of liability provided
615
+ above cannot be given local legal effect according to their terms,
616
+ reviewing courts shall apply local law that most closely approximates
617
+ an absolute waiver of all civil liability in connection with the
618
+ Program, unless a warranty or assumption of liability accompanies a
619
+ copy of the Program in return for a fee.
620
+
621
+ END OF TERMS AND CONDITIONS
622
+
623
+ How to Apply These Terms to Your New Programs
624
+
625
+ If you develop a new program, and you want it to be of the greatest
626
+ possible use to the public, the best way to achieve this is to make it
627
+ free software which everyone can redistribute and change under these terms.
628
+
629
+ To do so, attach the following notices to the program. It is safest
630
+ to attach them to the start of each source file to most effectively
631
+ state the exclusion of warranty; and each file should have at least
632
+ the "copyright" line and a pointer to where the full notice is found.
633
+
634
+ <one line to give the program's name and a brief idea of what it does.>
635
+ Copyright (C) <year> <name of author>
636
+
637
+ This program is free software: you can redistribute it and/or modify
638
+ it under the terms of the GNU Affero General Public License as published by
639
+ the Free Software Foundation, either version 3 of the License, or
640
+ (at your option) any later version.
641
+
642
+ This program is distributed in the hope that it will be useful,
643
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
644
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
+ GNU Affero General Public License for more details.
646
+
647
+ You should have received a copy of the GNU Affero General Public License
648
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
649
+
650
+ Also add information on how to contact you by electronic and paper mail.
651
+
652
+ If your software can interact with users remotely through a computer
653
+ network, you should also make sure that it provides a way for users to
654
+ get its source. For example, if your program is a web application, its
655
+ interface could display a "Source" link that leads users to an archive
656
+ of the code. There are many ways you could offer source, and different
657
+ solutions will be better for different programs; see section 13 for the
658
+ specific requirements.
659
+
660
+ You should also get your employer (if you work as a programmer) or school,
661
+ if any, to sign a "copyright disclaimer" for the program, if necessary.
662
+ For more information on this, and how to apply and follow the GNU AGPL, see
663
+ <https://www.gnu.org/licenses/>.
3-bmab/README.md ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # BMAB
3
+
4
+ BMAB는 Stable Diffusion WebUI의 확장 기능으로, 생성된 이미지를 설정에 따라 후처리하는 기능을 가지고 있습니다.
5
+ 필요에 따라 인물, 얼굴, 손을 찾아 다시 그리거나, Resize, Resample, 노이즈 추가 등의 기능을 수행할 수 있으며,
6
+ 두 장의 이미지를 합성하거나, Upscale의 기능을 수행 할 수 있습니다.
7
+
8
+ BMAB is an extension of Stable Diffusion WebUI and has the function of post-processing the generated image according to settings.
9
+ If necessary, you can find and redraw people, faces, and hands, or perform functions such as resize, resample, and add noise.
10
+ You can composite two images or perform the Upscale function.
11
+
12
+ <a href="./docs/kr/manual.md">Manual (KR)</a>
13
+
14
+ You can see more image. https://www.facebook.com/profile.php?id=61553793992101
15
+
16
+ ## Example
17
+
18
+ <table>
19
+ <tr>
20
+ <td colspan="2">
21
+ <img src="https://i.ibb.co/rH9Wxj3/00065-3744566961.jpg">
22
+ </td>
23
+ </tr>
24
+ <tr>
25
+ <td colspan="2">
26
+ Person, Face Detailing, cnNoise(0.4, 0, 0.4), cnPose(1, 0, 1), cnIpAdapter(0.6, 0, 0.3), Custom Filter,
27
+ </td>
28
+ </tr>
29
+ <tr>
30
+ <td colspan="2">
31
+ <img src="https://i.ibb.co/LNfGT3X/00129-1720370296.jpg">
32
+ </td>
33
+ </tr>
34
+ <tr>
35
+ <td colspan="2">
36
+ IC-Light(Left), Face Detailing, Resample, cnNoise(0.4, 0, 0.4), cnPose(1, 0, 1), cnIpAdapter(0.6, 0, 0.3)
37
+ </td>
38
+ </tr>
39
+ <tr>
40
+ <td colspan="2">
41
+ <img src="https://i.ibb.co/4jmHsYj/00111-1987036481.jpg">
42
+ </td>
43
+ </tr>
44
+ <tr>
45
+ <td colspan="2">
46
+ IC-Light(Left), Face Detailing, Resample, cnNoise(0.4, 0, 0.4), cnPose(1, 0, 1), cnIpAdapter(0.6, 0, 0.3)
47
+ </td>
48
+ </tr>
49
+ <tr>
50
+ <td>
51
+ <img src="https://i.ibb.co/jVPtgnM/00074-4133194501.jpg">
52
+ </td>
53
+ <td>
54
+ <img src="https://i.ibb.co/wL1Xm2P/00079-1737359342.jpg">
55
+ </td>
56
+ </tr>
57
+ <tr>
58
+ <td>
59
+ IC-Light(Left), Face Detailing,
60
+ </td>
61
+ <td>
62
+ IC-Light(Left), Face Detailing,
63
+ </td>
64
+ </tr>
65
+ <tr>
66
+ <td colspan="2">
67
+ <img src="https://i.ibb.co/B2QJ0Tz/00126-1953699647.jpg">
68
+ </td>
69
+ </tr>
70
+ <tr>
71
+ <td colspan="2">
72
+ Face Detailing, Resample, cnNoise(0.4, 0, 0.4), cnPose(1, 0, 1), cnIpAdapter(0.6, 0, 0.3)
73
+ </td>
74
+ </tr>
75
+ <tr>
76
+ <td>
77
+ <img src="https://i.ibb.co/xD1fxg1/00755-233390832.jpg">
78
+ </td>
79
+ <td>
80
+ <img src="https://i.ibb.co/TTm7CdN/00774-2729955256.jpg">
81
+ </td>
82
+ </tr>
83
+ <tr>
84
+ <td>
85
+ Face Detailing, cnNoise(0.4, 0, 0.4), cnPose(1, 0, 1), cnIpAdapter(0.6, 0, 0.3)
86
+ </td>
87
+ <td>
88
+ Face Detailing, cnNoise(0.4, 0, 0.4), cnPose(1, 0, 1), cnIpAdapter(0.6, 0, 0.3)
89
+ </td>
90
+ </tr>
91
+ <tr>
92
+ <td>
93
+ <img src="https://i.ibb.co/yBT2YX5/00548-4054764802.jpg">
94
+ </td>
95
+ <td>
96
+ <img src="https://i.ibb.co/RQtVS2g/00581-3667453446.jpg">
97
+ </td>
98
+ </tr>
99
+ <tr>
100
+ <td>
101
+ Face Detailing, cnNoise(0.4, 0, 0.4), cnPose(1, 0, 1), cnIpAdapter(0.6, 0, 0.3)
102
+ </td>
103
+ <td>
104
+ Face Detailing, cnNoise(0.4, 0, 0.4), cnPose(1, 0, 1), cnIpAdapter(0.6, 0, 0.3)
105
+ </td>
106
+ </tr>
107
+ <tr>
108
+ <td>
109
+ <img src="https://i.ibb.co/hM8pvV2/00612-2685660966.jpg">
110
+ </td>
111
+ <td>
112
+ <img src="https://i.ibb.co/H2CD8kX/00672-3470647356.jpg">
113
+ </td>
114
+ </tr>
115
+ <tr>
116
+ <td>
117
+ Face Detailing, cnNoise(0.4, 0, 0.4), cnPose(1, 0, 1), cnIpAdapter(0.6, 0, 0.3)
118
+ </td>
119
+ <td>
120
+ Face Detailing, cnNoise(0.4, 0, 0.4), cnPose(1, 0, 1), cnIpAdapter(0.6, 0, 0.3)
121
+ </td>
122
+ </tr>
123
+ <tr>
124
+ <td>
125
+ <img src="https://i.ibb.co/WvHHKc7/00111-2484939723.jpg">
126
+ </td>
127
+ <td>
128
+ <img src="https://i.ibb.co/px4YXDM/00199-2019853980.jpg">
129
+ </td>
130
+ </tr>
131
+ <tr>
132
+ <td>
133
+ Face Detailing, cnNoise(0.4, 0, 0.4), cnPose(1, 0, 1)
134
+ </td>
135
+ <td>
136
+ Face Detailing, cnNoise(0.4, 0, 0.4), cnPose(1, 0, 1)
137
+ </td>
138
+ </tr>
139
+ <tr>
140
+ <td colspan="2">
141
+ <img src="https://i.ibb.co/ns1Kn04/00460-759278328.jpg">
142
+ </td>
143
+ </tr>
144
+ <tr>
145
+ <td colspan="2">
146
+ Face Detailing, ControlNet Noise (0.4, 0, 0.4),
147
+ </td>
148
+ </tr>
149
+ <tr>
150
+ <td>
151
+ <img src="https://i.ibb.co/zsDs4bq/00450-3195179381.jpg">
152
+ </td>
153
+ <td>
154
+ <img src="https://i.ibb.co/D9tz1NY/00180-3383798469.png">
155
+ </td>
156
+ </tr>
157
+ <tr>
158
+ <td>
159
+ Resize intermediate (inpaint+lama, Bottom, 0.75, 0.6),<br>
160
+ Face Detailing, ControlNet Noise (0.7, 0, 0.6),<br>
161
+ Noise Alpha (0.1)
162
+ </td>
163
+ <td>
164
+ Resize intermediate (Center, 0.5, 0.6),<br>
165
+ Face Detailing, ControlNet Noise (0.4, 0, 0.4)<br>
166
+ </td>
167
+ </tr>
168
+ <tr>
169
+ <td colspan="2">
170
+ <img src="https://i.ibb.co/P6477Vg/resize-00101-2353183853.png">
171
+ </td>
172
+ </tr>
173
+ <tr>
174
+ <td colspan="2">
175
+ <img src="https://i.ibb.co/3vsBTFZ/resize-00183-1413773744.png">
176
+ </td>
177
+ </tr>
178
+ <tr>
179
+ <td colspan="2">
180
+ <img src="https://i.ibb.co/tcYzHP1/resize-00226-4176028607.png">
181
+ </td>
182
+ </tr>
183
+ <tr>
184
+ <td colspan="2">
185
+ <img src="https://i.ibb.co/r6G1cwy/resize-00340-4033828371.png">
186
+ </td>
187
+ </tr>
188
+ <tr>
189
+ <td>
190
+ <img src="https://i.ibb.co/PmPJtVb/resize-00718-3635306692.png">
191
+ </td>
192
+ <td>
193
+ <img src="https://i.ibb.co/Bq2PFxc/resize-00793-3980284595.png">
194
+ </td>
195
+ </tr>
196
+ <tr>
197
+ <td>
198
+ <img src="https://i.ibb.co/ZMNC1Cm/00518-1067577565.jpg">
199
+ </td>
200
+ <td>
201
+ <img src="https://i.ibb.co/JtjGrMX/00126-496754363.jpg">
202
+ </td>
203
+ </tr>
204
+ <tr>
205
+ <td colspan="2">
206
+ <img src="https://i.ibb.co/Lnh4Kpm/resize-00824-738395988.png">
207
+ </td>
208
+ </tr>
209
+ <tr>
210
+ <td colspan="2">
211
+ Resize intermediate (Bottom, 0.5, 0.6), Face Detailing, ControlNet Noise (0.4, 0, 0.4)
212
+ </td>
213
+ </tr>
214
+ </table>
3-bmab/ReleaseNote.md ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### v24.05.12
2
+
3
+ * New Feature
4
+ * ICLight
5
+ * Style 추가했습니다.
6
+ * intensive : IC-Light original process
7
+ * less intensive : 과도한 적용을 줄임
8
+ * normal : 배경을 최대한 살리면서 lighting 적용
9
+ * soft : 배경을 최대한 살림
10
+ * Face : 얼굴 부분을 강조하도록 검출해서 조명으로 강조
11
+ * Person : 사람을 찾아 조명으로 강조
12
+ * Cache
13
+ * 디렉토리가 존재하지 않으면 생성
14
+ * Pretraining
15
+ * 입력된 폭, 높이가 아니라 실제 이미지의 크기를 사용하도록 수정
16
+
17
+ ### v24.05.12
18
+
19
+ * New Feature
20
+ * ICLight : https://github.com/lllyasviel/IC-Light
21
+ * ICLight 기능을 제어할 수 있도록 통합했습니다.
22
+ * 메모리 사용량이 많습니다.
23
+ * Enable ICLight before upscale 끄면 1200*1800을 4090으로도 어렵습니다.
24
+ * Process 작업전 수행되는 preprocess filter가 추가되었습니다.
25
+ * Code Fix
26
+ * Pose Default 값을 변경했습니다.
27
+ * cache를 통합 제어하도록 변경했습니다.
28
+
29
+ ### v24.05.07
30
+
31
+ * New Feature
32
+ * Installer : groudingdino for CUDA support.
33
+ * Resample : fix FakeControlNet
34
+ * Refactoring : multiple controlnet support
35
+
36
+
37
+ ### v24.05.01
38
+
39
+ * New Feature
40
+ * ControlNet IpAdapter에서 하위 디렉토리를 만들면 하위 디렉토리 안에서 이미지를 적용할 수 있도록 개선했습니다.
41
+ * Random으로 지정하면 전체 이미지에서 선택합니다.
42
+ * 저장된 정보를 불러왔을때 Pose, IpAdapter 이미지가 표시됩니다.
43
+
44
+ * ### v24.05.01
45
+
46
+ * New Feature
47
+ * ControlNet IpAdapter 기능을 제공합니다.
48
+ * sd-webui-controlnet을 이용하여 제공하며, 랜덤하게 이미지를 적용할 수 있도록 개선했습니다.
49
+ * Setting > BMAB에 현재 ControlNet IpAdapter의 model을 적어주셔야 합니다.
50
+ * 기본적으로 모델은 default로 적용해두었습니다.
51
+
52
+ * Code Fix
53
+ * Setting에 Additional Checkpoint Path이 sd-webui 1.8에서 동작하지 않아, 이런 경우 빈칸으로 두면 오류가 발생하지 않도록 수정했습니다.
54
+ * Person, Face 의 prompt가 hires.fix가 켜져있다면 hires.fix 것을 사용함.
55
+
56
+ ### v24.04.30
57
+
58
+ * New Feature
59
+ * Person Detailer에 checkpoint, vae, sampler, scheduler 및 steps 추가
60
+ * Setting에 Additional Checkpoint Path 디렉토리를 입력하면 두 디렉토리 내용을 병합하여 전체적 적용됨.
61
+
62
+ * Code Fix
63
+ * Person, Face 의 prompt가 hires.fix가 켜져있다면 hires.fix 것을 사용함.
64
+
65
+ ### v24.04.26
66
+
67
+ * Code Fix
68
+ * Pretraining 에 checkpoint, vae 선택 추가
69
+ * checkpoint, vae, filter, pose 등에 대한 fresh 버튼을 삭제하고 하나로 통합
70
+ * vintage filter 추가
71
+
72
+
73
+ ### v24.04.20
74
+
75
+ * New Features
76
+ * Pose
77
+ * Face only 옵션 추가
78
+ * Pose를 선택할 수 있도록 추가
79
+
80
+ ### v24.04.17
81
+
82
+ * New Features
83
+ * Pose
84
+ * sd-webui-bmab/pose 디렉토리에 있는 이미지를 이용하여 openpose를 동작한다.
85
+ * seed에 맞춰서 임의이 순서로 동작한다.
86
+ * Face
87
+ * CheckPoint를 선택할 수 있도록 추가
88
+ * Pretraining
89
+ * Filter를 선택할 수 있도록 추가
90
+ * Refiner
91
+ * VAE를 선택할 수 있도록 추가
92
+ * Noise
93
+ * Both, Low res fix, High res fix 추가.
94
+
95
+ ### v24.04.16
96
+
97
+ * Code Fix
98
+ * 1.9.0 지원
99
+ * 1.8.0 하위 호환
100
+ * CheckPoint 관련 전반 수정
101
+ * basicsr 설치 오류 수정
102
+
103
+ ### v24.04.05
104
+
105
+ * Code Fix
106
+ * 1.8.0 설치시에 동작하지 않는 버그를 수정했습니다.
107
+ * preprocess filter 분리
108
+ * hires.fix - upscale 시에 필터가 정확하게 적용되지 않는 버그 수정
109
+ * ControlNet Noise 사용시에 그레이 이미지를 사용하도록 수정
110
+ * 그 외 몇가지 코드 리펙토링
111
+
112
+ ### v23.11.30.0
113
+
114
+ * Code Fix
115
+ * Support BMAB DR
116
+ * Img2img rollback
117
+
118
+
119
+ ### v23.11.28.0
120
+
121
+ * New Feature
122
+ * Kohya Hires.fix
123
+ * Preprocess에서 Kohya Hires.fix기능을 추가하였습니다.
124
+ * 이 기능을 사용할때 sd 1.5 기준 1024x1025, 1536x1536, 1024x1536, 1536x1024일 경우가 가장 잘나옵니다.
125
+ * 이 기능은 원작자가 SDXL을 위해서 만든 기능입니다. 굳이 sd 1.5에서 사용할 필요는 없습니다.
126
+
127
+
128
+ ### v23.11.27.0
129
+
130
+ * New Feature
131
+ * Stop generating gracefully
132
+ * BMAB 프로세스가 완료되면 batch가 남아있더라도 종료하는 기능.
133
+ * 이미지 생성 중간에 Interrupt 를 눌러서 종료가 아니라, 이미지 생성이 완료되면 종료된다.
134
+ * 'Enable BMAB' 오른쪽에 작게 Stop이 있다.
135
+ * FinalFilter
136
+ * 최종 이미지에 수정을 가할 수 있도록 필터를 적용할 수 있도록 하는 기능.
137
+ * 필터는 구현해서 filter에 넣으면 확인할 수 있다.
138
+ * BugFix
139
+ * Img2Img와 openpose 사용시에 inpaint area 적용되지 않는 문제 수정.
140
+ * 약간의 코드 리펙토링
141
+
142
+
143
+
3-bmab/docs/en/bmab.md ADDED
@@ -0,0 +1,319 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # BMAB
3
+
4
+ ## 기본 기능
5
+
6
+ * Contrast : 대비값 조절 (1이면 변경 없음)
7
+ * Brightness : 밝기값 조절 (1이면 변경 없음)
8
+ * Sharpeness : 날카롭게 처리하는 값 조절 (1이면 변경 없음)
9
+ * Color Temperature : 색온도 조절, 6500K이 0 (0이면 변경 없음)
10
+ * Noise alpha : 프로세스 전에 노이즈를 추가하여 디테일을 올릴 수 있습니다. (권장값:0.1)
11
+ * Noise alpha at final stage : 최종 단계에서 노이즈를 추가하여 분위기를 다르게 전달할 수 있습니다.
12
+
13
+
14
+ ## Imaging
15
+
16
+ ### Blend Image in Img2Img
17
+
18
+ 이미지 업로드 상자에 입력한 이미지와 Img2Img에 입력된 이미지를 Blending합니다.
19
+ Blend Alpha 값으로 두 개의 이미지를 합성합니다.
20
+ "Process before Img2Img" 옵션이 적용됩니다.
21
+
22
+ ### Dino detect
23
+
24
+ Img2Img Inpainting 하는 경우에 마스크를 입력하지 않아도 Dino detect prompt에 있는 내용을 이용하여 자동으로 마스크를 생성합니다.
25
+ 이미지를 업로드 하게되면 업로드된 이미지를 배경으로 하여 prompt로 입력된 부분을 업로드 이미지에 합성합니다.
26
+
27
+ #### Img2Img 에서 사용하는 경우
28
+
29
+ <p>
30
+ <img src="https://i.ibb.co/W5xs487/00027-3690585574.png" width="40%">
31
+ <img src="https://i.ibb.co/rk7xDSR/00467-2764185410.png" width="40%">
32
+ </p>
33
+ <p>
34
+ <img src="https://i.ibb.co/Byw3rY6/tmp3478vdur.png" width="40%">
35
+ <img src="https://i.ibb.co/7W6QhTG/00024-155186649.png" width="40%">
36
+ </p>
37
+
38
+
39
+
40
+ 첫번째 image는 Img2Img 이미지로 지정
41
+ 두번째 image는 BMAB의 Imaging에 Image 입력창에 지정
42
+
43
+ 프로세스 과정에서 세번째 image를 합성하고 프롬프트에 따라서 결과가 얻어진다.
44
+
45
+ Enabled : CHECK!!
46
+
47
+ Contrast : 1.2
48
+ Brightness : 0.9
49
+ Sharpeness : 1.5
50
+
51
+ Enable dino detect : CHECK!!
52
+ DINO detect Prompt : 1girl
53
+
54
+
55
+ #### Img2Img Inpaint 에서 사용하는 경우
56
+
57
+ DINO detect Prompt에 있는 내용대로 자동으로 마스크를 만들어준다.
58
+
59
+ <p>
60
+ <img src="https://i.ibb.co/W5xs487/00027-3690585574.png" width="30%">
61
+ <img src="https://i.ibb.co/80qQvDv/tmpnm78iuqo.png" width="30%">
62
+ <img src="https://i.ibb.co/mRT77BM/00028-2672855487.png" width="30%">
63
+ </p>
64
+
65
+
66
+ 이번 예제에서는 배경을 변경했으니, inpaint 설정에서 "Inpaint Not Masked"를 선택해야 한다.
67
+ 반대로 "Inpaint Masked"를 하면 인물이 변경된다.
68
+
69
+
70
+ ## Person
71
+
72
+ 이 기능을 사용하게 되면 프로세스가 완료된 이후에, 인물을 감지하여 다시 그립니다.
73
+ 아래의 경우에 사용하면 효과적입니다.
74
+
75
+ * 인물이 배경에 비해 매우 작은 경우, 의복, 얼굴 등 인물 전체의 디테일이 올라갑니다.
76
+ * 4K와 같이 큰 이미지를 출력하는 경우, 업 스케일 이후에 인물이 작은 경우 이 기능을 사용하면 인물이 뚜렷해 집니다.
77
+ * Face Detailing과 같이 사용하면 좋은 효과를 볼 수 있습니다.
78
+
79
+
80
+ <img src="https://i.ibb.co/RSrvqM1/person.png">
81
+
82
+
83
+ #### Enable person detailing for landscape (EXPERIMENTAL)
84
+
85
+ 풍경에서 인물을 자세하게 다시 그리는 기능을 활성화 합니다.
86
+
87
+ #### Block over-scaled image
88
+
89
+ 이 기능이 켜지게 되면 인물을 찾아내서 크게 키워서 다시 그리는데 이때 확대된 이미지의 면적이 본래 이미지를 초과하게 되면 프로세스를 멈춥니다.
90
+ sd-webui가 멈추거나 GPU를 보호하기 위한 목적입니다.
91
+
92
+ #### Auto scale if "Block over-scaled image" enabled
93
+
94
+ 이 기능을 설정하면 위에서 언급한 "Block over-scaled image"로 차단될 경우 본래 이미지의 면적에 맞춰서 스케일을 조정하여 작업합니다.
95
+
96
+ #### Upscale Ratio
97
+
98
+ 인물이 발견되면 주어진 비율로 키워서 자세하게 그립니다.
99
+
100
+ #### Denoising Strength
101
+
102
+ 인물의 크기가 클 경우 0.4로 부족할 수 있습니다. 이런 경우 수치를 올려주세요.
103
+
104
+ #### Dilation mask
105
+
106
+ 찾아낸 인물의 마스크를 확장합니다.
107
+
108
+ #### CFG Scale
109
+
110
+ 인물을 다시 그릴때 사용하는 CFG scale 값입니다.
111
+
112
+ #### Large person area limit
113
+
114
+ 인물이 이미지 속에서 차지하는 면적이 이 값을 초과하면 작업하지 않습니다.
115
+ 인물이 충분히 큰 경우 다시 그릴 필요가 없기 때문입니다.
116
+
117
+ #### Limit
118
+
119
+ 이미지 속에 인물이 너무 많은 경우 면적단위로 큰 것부터 카운트하여 설정값을 초과하여 다시 그리지 않습니다.
120
+
121
+
122
+ <img src="https://i.ibb.co/n8PmL3P/00057-2574875327.jpg">
123
+ <img src="https://i.ibb.co/r2fdSmJ/00399-1097195856.png">
124
+
125
+
126
+ ## Face
127
+
128
+ ### Face Detailing
129
+
130
+ 이 기능을 사용하게 되면 프로세스가 완료된 이후 After Detailer(AD)나 Detection Detailer(DD)와 같이
131
+ 얼굴을 보정합니다.
132
+ 이 기능을 동작시킨 후에 AD, DD가 동작하도록 설정한다면, 결과가 좋지 않을 수 있습니다.
133
+
134
+ <img src="https://i.ibb.co/frx85BR/face.png">
135
+
136
+ 최대 5개의 캐릭터에 대해 prompt를 별도로 지정할 수 있습니다.
137
+
138
+ #### Enable face detailing
139
+
140
+ face detailing 기능을 켜고 끌 수 있습니다.
141
+
142
+ #### Enable face detailing before hires.fix (EXPERIMENTAL)
143
+
144
+ face detailing 기능을 txt2img 과정의 hires.fix 직전에 한 번 더 수행합니다.
145
+ 얼굴을 보정한 이후에 upscale을 하기 때문에 더 좋은 품질의 이미지를 얻을 수 있습니다.
146
+ 하지만 부하가 더 들어가고, 이미지 변화가 심합니다.
147
+
148
+ #### Face detailing sort by
149
+
150
+ 이미지 안에 여러 인물이 있는 경우 어떤 순서로 Detailing 할 것인지 결정합니다.
151
+
152
+ <img src="https://i.ibb.co/DR8g34t/00037-3214376443.png">
153
+ <img src="https://i.ibb.co/4JXdkpT/00036-3214376443.png">
154
+
155
+ 왼쪽, 오른쪽 혹은 크기로 가능하며 없다면 기본적으로 Score 값이 높은 순서로 합니다.
156
+
157
+ #### Limit
158
+
159
+ 이미지 않에 여러 인물이 있는 경우 위에서 정한 순서로 얼마나 수행할지 결정합니다.
160
+ Limit이 1이라면 최대 1개만 수행한다는 뜻입니다.
161
+
162
+ #### Override Parameters
163
+
164
+ * Denoising Strength
165
+ * CFG Scale
166
+ * Width
167
+ * Height
168
+ * Steps
169
+ * Mask Blur
170
+
171
+ 위 값에 대해 기본값이 아닌 UI에서 지정한 값을 사용합니다.
172
+
173
+ #### Inpaint Area
174
+
175
+ 전체를 다시 그릴지 얼굴만 다시 그릴지를 결정합니다. 전체를 다시 그리는 것은 별로 추천하지 않습니다.
176
+
177
+ #### Only masked padding, pixels
178
+
179
+ 기본값을 사용해 주세요.
180
+
181
+ #### Dilation
182
+
183
+ 검출된 얼굴의 마스크 크기를 키웁니다.
184
+
185
+ #### Box threshold
186
+
187
+ Detector의 검출 값을 결정합니다. 기본값 0.35보다 작으면 face가 아닐 것으로 제외합니다.
188
+ YOLO를 사용하는 경우 confidence를 대체합니다.
189
+
190
+ **좋은 결과를 얻기 위한 조언**
191
+
192
+ * Prompt에 얼굴 관련된 lora, textual inversion등 관련 내용을 뺍니다. sunglass 등은 무관합니다.
193
+ * 설정 파일에 얼굴마다 서로 다른 lora, textual inversion 등을 넣습니다.
194
+ * prompt에 lora, TI가 많을 경우 그림 생성 자유도가 떨어지는 것 같습니다.
195
+ * 그림속 모든 캐릭터가 공유되는 lora는 넣어주셔도 무방합니다.
196
+
197
+
198
+
199
+ ## Hand
200
+
201
+ ### Hand Detailing (EXPERIMENTAL)
202
+
203
+ 손 표현이 잘못된 부분을 수정하는 기능입니다.
204
+ 만들어진 그림에서 손 부분을 자동으로 찾아내어 해당 부분을 다시 그리는 기능입니다.
205
+ 다만 손의 경우 다시 그려도 잘 그려질지 확실하지 않으며, 손을 자세하게 그리는 정도입니다.
206
+
207
+ <img src="https://i.ibb.co/fxQh9ZN/hand.png">
208
+
209
+ #### Enable hand detailing
210
+
211
+ 손 보정 기능을 사용하도록 활성화 합니다.
212
+
213
+ #### Block over-scaled image
214
+
215
+ 이 기능은 손을 찾아내어 확대해서 다시그리는 방법을 사용합니다.
216
+ 다시 그려야 하는 부분의 면적이 원래이미지를 초과하게 되면 작업을 수행하지 않습니다.
217
+ 이런 경우에는 Upscale Ratio를 줄이거나, 이 기능을 꺼야하는데, 이 기능을 끄면 매우 큰 그림을 다시 그릴 수도 있어서 GPU에 부하가 걸릴 수 있습니다..
218
+
219
+ #### Method
220
+ * subframe : 손을 포함하여 얼굴/머리 부분까지 찾아내어 상반신을 다시 그린다.
221
+ * each hand : 손을 찾아내여 3배 크기의 주변부 까지 다시 그려 손만 적용한다.
222
+ * each hand inpaint : 손을 찾아내어 3재 크기의 주변부를 기반으로 손만 다시 그린다.
223
+ 매우 극단적으로 변형될 수 있어서 잘 그려지기 어렵다 모양이 갖춰진다면, subframe으로 다시 그리는 것을 추천한다.
224
+ * at once : 찾아낸 손을 모두 한번에 다시 그린다.
225
+
226
+
227
+ #### Prompt
228
+
229
+ Subframe에서는 입력하지 않을 것을 권장합니다.
230
+ each hand, each hand inpaint시에 손 관련 프롬프트를 입력합니다.
231
+
232
+ #### Negative Prompt
233
+
234
+ Subframe에서는 입력하지 않을 것을 권장합니다.
235
+ each hand, each hand inpaint시에 손 관련 네거티브 프롬프트를 입력합니다.
236
+
237
+ #### Denoising Strength
238
+
239
+ 다시 그리는 경우 Denoising Strength 값 입니다.
240
+ * subframe : 0.4 권장
241
+ * 기타 0.55 이상 권장
242
+
243
+ #### CFG Scale
244
+
245
+ 다시 그리는 경우 CFG Scale 값 입니다.
246
+
247
+ #### Upscale Ratio
248
+ 상반신 / 손 주변을 찾아내어 얼마나 크게 확대하여 다시 그릴 것인지 지정한다.
249
+ 무조건 크게 그린다고 성공확률이 올라가는 것은 아니다.
250
+ * subframe : 2.0
251
+ * 기타 : 2.0~4.0
252
+
253
+ #### Box Threshold
254
+
255
+ 손을 찾아내지 못하는 경우 이 값을 낮추면, 찾아낼 수 있는 확률이 올라갑니다.
256
+ 하지만 잘 못 찾아낼 가능성도 올라갑니다.
257
+
258
+ #### Box Dilation
259
+
260
+ 찾아낸 박스(손을 포함하여)의 외곽 부분을 얼마나 크게 할 것이 결정합니다. (only for subframe)
261
+
262
+ #### Inpaint Area
263
+
264
+ 찾아낸 박스 전체를 다시 그릴 것인지, 손만 다시 그릴 것인지를 결정한다.
265
+ 손만 다시그리는 경우 손 모양이 원하지 않게 바뀔 수 있으나 크게 변경된다.
266
+
267
+ #### Only masked padding
268
+
269
+ 찾아낸 손의 내부 공간을 얼마 정도로 채울지를 결정합니다. 딱히 변경할 일 없습니다.
270
+
271
+ #### Additional Parameter
272
+
273
+ 현재는 제공하지 않지만 향후 고급 사용자를 위한 옵션을 제공할 예정입니다.
274
+
275
+
276
+
277
+ ## ControlNet
278
+
279
+ ControlNet을 이용하여 이미지에 노이즈를 추가하는 방법으로 디테일을 올리는 기능입니다.
280
+ ControlNet의 Lineart 모델에 가우시안 노이즈 이미지를 입력으로 사용하여,
281
+ 결과물에 다양하고 복잡한 디테일을 추가합니다.
282
+
283
+ #### Noise Strength
284
+
285
+ 노이즈 강도를 지정합니다. (0.4 권장)
286
+
287
+ #### Begin
288
+
289
+ Sampling 단계 시작점
290
+
291
+ #### End
292
+
293
+ Sampling 단계 끝점
294
+
295
+ 보통의 경우 0.4, 0, 0.4를 권장합니다. 혹은 이미지가 과도하게 그려질 경우 0.2, 0, 0.4 정도로 추천합니다.
296
+ 과도하게 이미지가 그려진 경우 refiner를 사용하면 이미지를 어느 정도 안정시킬 수 있습니다.
297
+
298
+ 아래는 모두 같은 seed입니다.
299
+ <table>
300
+ <tr>
301
+ <td>기본이미지</td>
302
+ <td>0.4</td>
303
+ <td>0.7</td>
304
+ </tr>
305
+ <tr>
306
+ <td><img src="https://i.ibb.co/ypRrwmN/00007-51151519.jpg"></td>
307
+ <td><img src="https://i.ibb.co/j54HfHF/00009-51151519.jpg"></td>
308
+ <td><img src="https://i.ibb.co/MsgCZS3/00008-51151519.jpg"></td>
309
+ </tr>
310
+ </table>
311
+
312
+
313
+
314
+
315
+
316
+
317
+ <br>
318
+ <br>
319
+ <br>
3-bmab/docs/en/manual.md ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ## Quick Test
3
+
4
+ Enable을 체크하고 Config Tab에서 Preset "example"을 선택합니다.
5
+
6
+ contrast: 1.2
7
+ brightness: 0.9
8
+ sharpeness: 1.5
9
+
10
+ Edge enhancement 적용
11
+ Face Detailing 적용
12
+ Resize by person 적용
13
+
14
+
15
+
16
+ ## 기본 옵션
17
+
18
+ Enabled (VERSION): 기능을 켜고 끌 수 있습니다.
19
+
20
+ ### Resize and fill override
21
+
22
+ Img2Img를 수행하는 경우 "Resize and fill" 을 선택하게 되면
23
+ 통상 좌우, 상하로 늘어나거나 비율이 같다면 그대로 크기만 변경됩니다.
24
+
25
+ Enabled 된 상태에서는 항상 이미지가 아래에 위치하고,
26
+ 왼쪽, 오른쪽, 윗쪽으로 비율에 맞게 늘어납니다.
27
+
28
+ 인물의 윗쪽으로 여백이 없는 경우에 적용하면 효과적입니다.
29
+ 너무 크게 늘리게 되면 좋은 결과를 얻기 힘듭니다.
30
+ 대략 1.1, 1.2 정도 스케일에서 사용하시길 권장합니다.
31
+
32
+ <p>
33
+ <img src="https://i.ibb.co/j3WzZrc/00408-3188840002.png" width="40%">
34
+ <img src="https://i.ibb.co/ZWMWVFB/00409-3188840002.png" width="40%">
35
+ </p>
36
+
37
+ <br>
38
+ <br>
39
+ <br>
40
+
41
+ # Preprocess
42
+
43
+ 본 이미지 변경을 하기 전에 사전 처리 과정을 수행합니다.
44
+ 조건에 따라 hires.fix 과정에 개입할 수도 있습니다.
45
+
46
+ <a href="https://github.com/portu-sim/sd-webui-bmab/docs/en/preprocess.md">Preprocess</a>
47
+
48
+ # BMAB
49
+
50
+ Person, Hand, Face detailer를 수행하거나, 이미지 합성 혹은 노이즈 추가등의 기능을 수행합니다.
51
+
52
+ <a href="https://github.com/portu-sim/sd-webui-bmab/docs/en/bmab.md">bmab</a>
53
+
54
+ # Postprocess
55
+
56
+ 이미지 처리가 완료된 이후, 인물의 크기에 따라 배경을 확장하거나 upscale을 할 수 있습니다.
57
+
58
+ <a href="https://github.com/portu-sim/sd-webui-bmab/docs/en/preprocess.md">Postprocess</a>
3-bmab/docs/en/postprocess.md ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ # PostProcessing
4
+
5
+ ## Resize
6
+
7
+ ### Resize by person
8
+
9
+ 그림 속 인물중 가장 신장이 큰 사람의 길이와 그림 높이의 비율이 설정값을 넘어가면 비율을 설정값로 맞추는 기능입니다.
10
+ 설정값이 0.90이고 인물의 전체 길이: 그림 높이의 비율이 0.95라고 한다면
11
+ 배경을 늘려서 인물의 비율이 0.90이 되도록 합니다.
12
+ 배경은 왼쪽, 오른쪽, 위쪽으로 늘어납니다.
13
+
14
+
15
+ 이 기능은 2가지 방법을 제공하는데 다음과 같습니다.
16
+
17
+ #### Inpaint
18
+
19
+ Face Detailing과 같은 방법으로 이미지가 완전히 생성되고 난 후에 주변부를 확장합니다.
20
+ 이때 이미 생성된 이미지를 훼손하지 않고 주변부만 확장하기 때문에 직관적으로 확인이 가능합니다.
21
+ 가장 빠르고 효과적으로 추천합니다.
22
+
23
+ #### Inpaint + lama
24
+
25
+ Inpaint와 같은 방법인데 BMAB에서 ControlNet을 불러서 Inpaint+lama를 이용해서 동작합니다.
26
+ 이미지가 생성되고나서 디테일링 시작하기 전에 img2img를 이용하여 배경을 확장하여 전체적으로 인물을 작게 만드는 효과가 있습니다.
27
+
28
+ <table>
29
+ <tr>
30
+ <td><img src="https://i.ibb.co/X7P8kmH/00012-2131442442.jpg"></td>
31
+ <td><img src="https://i.ibb.co/Zc1nTz7/00022-2131442442.jpg"></td>
32
+ </tr>
33
+ <tr>
34
+ <td><img src="https://i.ibb.co/d0rSW0q/00013-2131442443.jpg"></td>
35
+ <td><img src="https://i.ibb.co/vHh2940/00023-2131442443.jpg"></td>
36
+ </tr>
37
+ <tr>
38
+ <td><img src="https://i.ibb.co/4jNJQ3b/00016-2131442446.jpg"></td>
39
+ <td><img src="https://i.ibb.co/HdcMpTH/00026-2131442446.jpg"></td>
40
+ </tr>
41
+ </table>
42
+
43
+ 이 두가지 방법은 생성된 이미지를 축소하기만 할뿐 훼손하지 않습니다.
44
+ 이것이 Resize intermediate와 다른점입니다.
45
+
46
+
47
+ ## Upscaler
48
+
49
+ 최종적으로 이미지가 완성되고 난 이후에 이미지를 upscaler를 이용하여 크게 만듭니다.
50
+
51
+
52
+ #### Enable upscale at final stage
53
+
54
+ 이미지 생성이 완료되고 난 이후에 Upscale을 수행합니다.
55
+ 960x540으로 생성하고 hires.fix를 x2로 하면 1920x1080 이미지가 나오는데
56
+ 여기서 Upscale을 x2를 하면 4K 이미지가 나오게 됩니다.
57
+
58
+ #### Detailing after upscale
59
+
60
+ 이 옵션을 설정하면 위에서 언급한 Person, Face, Hand 에 대한 detailing을 upscale 이후에 수행합니다.
61
+
62
+ #### Upscale Ratio
63
+
64
+ 이미지를 얼마나 upscale할지 결정합니다.
65
+
66
+
3-bmab/docs/en/preprocess.md ADDED
@@ -0,0 +1,425 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Preprocess
3
+
4
+ ## Context
5
+
6
+ BMAB에서 사용할 Checkpoint와 VAE를 지정합니다.
7
+ 특정 기능들은 자체 Checkpoint와 VAE를 설정할 수 있습니다.
8
+ 한 번 변경된 Checkpoint는 그 이후 프로세스들이 계속 사용합니다.
9
+
10
+ <img src="https://i.ibb.co/VTP5ddx/2023-11-12-3-48-54.png">
11
+
12
+ #### txt2img noise multiplier for hires.fix
13
+
14
+ hires.fix 단계에서 noise를 추가 할 수 있다.
15
+
16
+ #### txt2img extra noise multiplier for hires.fix (EXPERIMENTAL)
17
+
18
+ hires.fix 단계에서 추가적인 noise를 더 할 수 있다.
19
+
20
+ #### Hires.fix filter before upscaler
21
+
22
+ Hires.fix 단계 중 upscaler 전에 filter를 적용할 수 있다.
23
+
24
+ #### Hires.fix filter after upscaler
25
+
26
+ Hires.fix 단계 중 upscaler 후에 filter를 적용할 수 있다.
27
+
28
+
29
+ ## Resample (EXPERIMENTAL)
30
+
31
+ Self resampling 기능입니다. txt2img -> hres.fix를 통해 생성된 이미지를 다시 txt2img -> hires.fix 과정을 수행하면서
32
+ ControlNet Tile Resample을 수행합니다. 아래와 같은 경우 사용할 수 있습니다.
33
+
34
+ * 두 모델간에 결과물 차이가 큰 경우
35
+ * 두 모델간에 인물 비율이 차이나는 경우
36
+ * 두 모델간 버전이 다른 경우 (SDXL, SD15)
37
+
38
+ <table>
39
+ <tr>
40
+ <td>txt2img->hires.fix</td>
41
+ <td>Resample + BMAB Basic</td>
42
+ </tr>
43
+ <tr>
44
+ <td><img src="https://i.ibb.co/VxPfgN0/00153-3939130001-before-resample.png"></td>
45
+ <td><img src="https://i.ibb.co/XZ9gHHN/00154-3939130001.png"></td>
46
+ </tr>
47
+ </table>
48
+
49
+ <img src="https://i.ibb.co/5hWtbmZ/e822842f656d73757ee65713317f7ba9d947472d3fe94fc3ceffc72aee31064d.jpg">
50
+ BMAB resample image by [padapari](https://www.instagram.com/_padapari_/)
51
+
52
+ <br>
53
+ <br>
54
+ <br>
55
+ <br>
56
+
57
+
58
+ <img src="https://i.ibb.co/9hD81hd/resample.png">
59
+
60
+ #### Enable self resample (EXPERIMENTAL)
61
+
62
+ 이 기능을 켜고 끌 수 있습니다.
63
+
64
+ #### Save image before processing
65
+
66
+ 최초 txt2img -> hires.fix를 통해 생성된 이미지가 후 처리를 위해 BMAB로 입력되면,
67
+ 해당 이미지를 프로세싱하기 전에 저장합니다. 이미지 postfix로 "-before-resample"이 붙습니다.
68
+
69
+ #### Checkpoint
70
+
71
+ SD Checkpoint를 지정할 수 있습니다. 지정하지 않는다면 앞에서 설정된 Checkpoint를 사용합니다.
72
+ 프로세스가 완료되어도 원래 것으로 돌려놓지 않습니다.
73
+
74
+ #### SD VAE
75
+
76
+ SD VAE를 지정할 수 있습니다. 지정하지 않는다면 앞에서 설정된 VAE를 사용합니다.
77
+ 프로세스가 완료되어도 원래 것으로 돌려놓지 않습니다.
78
+
79
+ #### Resample method
80
+
81
+ Resample 방법을 선택할 수 있습니다.
82
+
83
+ txt2img-1pass : txt2img을 hires.fix 없이 동작시킨다.
84
+ txt2img-2pass : txt2img를 hires.fix로 동작시킨다. 기본적으로 이미지를 출력할 때 hires.fix가 동작해야하만 한다.
85
+ img2img-1pass : img2img로 동작시킨다.
86
+
87
+ #### Resample filter
88
+
89
+ Resample이 완료되고 난 이후에 외부 filter 코드를 호출하여 이미지 변환을 추가적으로 수행할 수 있다.
90
+
91
+
92
+ #### Resample prompt
93
+
94
+ resampling 과정에서 사용할 prompt입니다. 비어있는 경우 main prompt와 동일하며,
95
+ "#!org!#" 를 입력하면 main prompt를 대체합니다. "#!org!#" 이후에 추가로 prompt를 적을 수 있습니다.
96
+ ex) #!org!#, soft light, some more keyword
97
+
98
+ #### Resample negative prompt
99
+
100
+ resampling 과정에서 사용할 prompt입니다. 비어있는 경우 main negative prompt와 동일합니다.
101
+
102
+ #### Sampling method
103
+
104
+ 프로세스에 사용할 sampling method를 지정합니다. 지정하지 않는다면 이전 프로세스와 같은 sampler를 지정합니다.
105
+
106
+ #### Upsacler
107
+
108
+ hires.fix를 사용하는 경우에 지정하는 upscaler입니다.
109
+
110
+ #### Resample sampling steps
111
+
112
+ resample process 사용할 samping steps를 지정합니다.
113
+ (권장 20)
114
+
115
+ #### Resample CFG scale
116
+
117
+ resample process 사용할 CFG scale 값을 지정합니다.
118
+ dynamic threshold는 지원하지 않습니다.
119
+
120
+ #### Resample denoising strength
121
+
122
+ resample process가 사용할 denoising strength를 지정합니다.
123
+ (권장 0.4)
124
+
125
+ #### Resample strength
126
+
127
+ 0에 가까운 값은 입력 이미지와 멀어지고, 1에 가까울 수록 원본 이미지와 유사합니다.
128
+
129
+ #### Resample begin
130
+
131
+ sampling 단계에 적용 시작점.
132
+
133
+ #### Resample end
134
+
135
+ sampling 단계 적용 종료 시점.
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+ ## Pretraining (EXPERIMENTAL)
145
+
146
+ Pretraining detailer입니다. ultralytics로 pretraining 모델을 적용하여 detection을 수행하고
147
+ 이를 기반으로 prompt, negative prompt를 적용하여 부분적으로 이미지를 더 자세하게 그릴 수 있습니다.
148
+
149
+ <img src="https://i.ibb.co/Qkx6rQK/pretraining.png"/>
150
+
151
+ #### Enable pretraining detailer (EXPERIMENTAL)
152
+
153
+ 이 기능을 켜고 끌 수 있습니다.
154
+
155
+ #### Enable pretraining before hires.fix
156
+
157
+ pretraining detailer를 hires.fix 전에 수행하도록 한다.
158
+
159
+ #### Pretraining model
160
+
161
+ ultralytics 로 학습된 detection model (*.pt)를 지정할 수 있습니다.
162
+ stable-diffusion-webui/models/BMAB��� 해당 파일이 있어야 목록에 나타납니다.
163
+
164
+
165
+ #### Pretraining prompt
166
+
167
+ pretraining detailer process 과정에서 사용할 prompt입니다. 비어있는 경우 main prompt와 동일하며,
168
+ "#!org!#" 를 입력하면 main prompt를 대체합니다. "#!org!#" 이후에 추가로 prompt를 적을 수 있습니다.
169
+ ex) #!org!#, soft light, some more keyword
170
+
171
+ #### Pretraining negative prompt
172
+
173
+ pretraining detailer process 과정에서 사용할 prompt입니다. 비어있는 경우 main negative prompt와 동일합니다.
174
+
175
+ #### Sampling method
176
+
177
+ 프로세스에 사용할 sampling method를 지정합니다. 지정하지 않는다면 이전 프로세스와 같은 sampler를 지정합니다.
178
+
179
+
180
+ #### Pretraining sampling steps
181
+
182
+ resample process 사용할 samping steps를 지정합니다.
183
+ (권장 20)
184
+
185
+ #### Pretraining CFG scale
186
+
187
+ resample process 사용할 CFG scale 값을 지정합니다.
188
+ dynamic threshold는 지원하지 않습니다.
189
+
190
+ #### Pretraining denoising strength
191
+
192
+ resample process가 사용할 denoising strength를 지정합니다.
193
+ (권장 0.4)
194
+
195
+ #### Pretraining dilation
196
+
197
+ detection 된 사각형의 범위를 주어진 값 만큼 크기를 크게 합니다.
198
+
199
+ #### Pretraining box threshold
200
+
201
+ Detector의 검출 값을 결정합니다. 기본값 0.35보다 작으면 face가 아닐 것으로 제외합니다.
202
+ ultralytics predict의 confidence 값입니다.
203
+
204
+
205
+
206
+ ## Edge enhancemant
207
+
208
+ 이미지 경계를 강화해 선명도를 증가시키거나 디테일을 증가시키는 기능입니다.
209
+
210
+ **<span style="color: red">Upscaler가 Latent 계열인 경우 동작하지 않습니다. (R-ESRGAN, 4x-UltraSharp 추천)</span>**
211
+
212
+ <img src="https://i.ibb.co/4sjB1Lr/edge.png">
213
+
214
+ 권장설정
215
+
216
+ * Edge low threshold : 50
217
+ * Edge high threshold : 200
218
+ * Edge strength : 0.5
219
+
220
+ <p>
221
+ <img src="https://i.ibb.co/Wsw2Wrh/00598-1745587019.png" width="40%">
222
+ <img src="https://i.ibb.co/z4nCW9Z/00600-1745587019.png" width="40%">
223
+ </p>
224
+
225
+ Enabled : CHECK!!
226
+
227
+ Contrast : 1.2
228
+ Brightness : 0.9
229
+ Sharpeness : 1.5
230
+
231
+ Enable edge enhancement : CHECK!!
232
+ Edge low threshold : 50
233
+ Edge high threshold : 200
234
+ Edge strength : 0.5
235
+
236
+
237
+
238
+
239
+ ## Resize
240
+
241
+ txt2img -> hires.fix 의 중간 과정에서 동작합니다..
242
+ 만약 img2img에서 사용한다면, 프로세스 시작 전에 동작합니다.
243
+
244
+ 그림 속 인물중 가장 신장이 큰 사람의 길이와 그림 높이의 비율이 설정값을 넘어가면 비율을 설정값로 맞추는 기능입니다.
245
+ 설정값이 0.90이고 인물의 전체 길이: 그림 높이의 비율이 0.95라고 한다면
246
+ 배경을 늘려서 인물의 비율이 0.90이 되도록 합니다.
247
+ 배경은 Alignment에서 지정한 방식에 따라 늘어납니다.
248
+
249
+ txt2img 수행하는 단계에서 hires.fix 하기 직전에 이미지를 변경합니다.
250
+ 이 과정은 변경된 이미지가 hires.fix 과정에서 매끄럽게 변하게 하기 위한 것입니다.
251
+ **<span style="color: red">denoising strength는 0.6~0.7 정도를 사용하셔야 주변부 이미지 왜곡이 발생하지 않습니다.</span>**
252
+ **<span style="color: red">Upscaler가 Latent 계열인 경우 동작하지 않습니다. (R-ESRGAN, 4x-UltraSharp 추천)</span>**
253
+
254
+ #### Method
255
+
256
+ Resize 하는 방식을 지정할 수 있습니다.
257
+
258
+ * Stretching : 단순히 이미지를 외곽부분을 늘려서 배경을 확장합니다.
259
+ * inpaint : Stretching된 이미지를 mask를 사용하여 늘린 부분만 img2img inpainting을 수행합니다.
260
+ * inpaint+lama : Controlnet의 inpaint+lama 모델을 사용하여 확장된 영역을 다시 그립니다.
261
+ * inpaint_only : Controlnet의 inpaint_only를 사용하여 확장된 영역을 다시 그립니다.
262
+
263
+
264
+ #### Alignment
265
+
266
+ 이미지를 확장하고 원래 이미지를 어느 방향으로 정렬할 것인지를 결정합니다.
267
+
268
+ <img src="https://i.ibb.co/g62KhZQ/align.png">
269
+
270
+ #### Resize filter
271
+
272
+ Resize가 완료되고 난 이후에 외부 filter 코드를 호출하여 이미지 변환을 추가적으로 수행할 수 있다.
273
+
274
+
275
+ #### Resize by person intermediate
276
+
277
+ 인물의 크기 비율을 나타냅니다. 이 값을 초과하면 이 크기가 되도록 배경을 확장시킵니다.
278
+
279
+
280
+
281
+ <table>
282
+ <tr>
283
+ <td>Original</td>
284
+ <td>Resize 0.7</td>
285
+ <td>Resize 0.5</td>
286
+ </tr>
287
+ <tr>
288
+ <td><img src="https://i.ibb.co/XttbBz0/00133-3615254454.png"></td>
289
+ <td><img src="https://i.ibb.co/RS4tbZs/00135-3615254454.png"></td>
290
+ <td><img src="https://i.ibb.co/mHHqBKk/00134-3615254454.png"></td>
291
+ </tr>
292
+ </table>
293
+
294
+ <table>
295
+ <tr>
296
+ <td>Original</td>
297
+ <td>Alignment center</td>
298
+ </tr>
299
+ <tr>
300
+ <td><img src="https://i.ibb.co/hmSG5SK/00074-2037889107.png"></td>
301
+ <td><img src="https://i.ibb.co/7kPycZ5/00075-2037889107.png"></td>
302
+ </tr>
303
+ <tr>
304
+ <td>Alignment bottom</td>
305
+ <td>Alignment bottom-left</td>
306
+ </tr>
307
+ <tr>
308
+ <td><img src="https://i.ibb.co/2gPCbr4/00076-2037889107.png"></td>
309
+ <td><img src="https://i.ibb.co/x7T91QH/00080-2037889107.png"></td>
310
+ </tr>
311
+ </table>
312
+
313
+
314
+ Resize sample
315
+
316
+ <img src="https://i.ibb.co/G07KG6M/resize-00008-4017585008.png">
317
+
318
+
319
+
320
+
321
+
322
+
323
+
324
+
325
+
326
+
327
+
328
+
329
+ ## Refiner
330
+
331
+ txt2img에서 만들어진 이미지를 한번 더 그리는 과정을 수행한다.
332
+ txt2img + hires.fix 가 된 상황에서도 유효하다.
333
+
334
+ refiner는 이미지가 생성되고 detailing 하기전에 동작하며,
335
+ sd-webui의 hires.fix + refiner를 합친 동작과 비슷하다.
336
+
337
+
338
+
339
+ <table>
340
+ <tr>
341
+ <td>txt2img(512x768)</td>
342
+ <td>txt2img + hires.fix(800x1200)</td>
343
+ <td>txt2img + hires.fix + refiner(1200x1800)</td>
344
+ </tr>
345
+ <tr>
346
+ <td><img src="https://i.ibb.co/JCxXc9D/resize-00268-767037284.png"></td>
347
+ <td><img src="https://i.ibb.co/zR3nWKt/resize-00269-767037284.png"></td>
348
+ <td><img src="https://i.ibb.co/R21B0fr/resize-00270-767037284.png"></td>
349
+ </tr>
350
+ </table>
351
+
352
+
353
+ (위 예제는 결과를 모두 resize하여 동일한 크기이다.)
354
+
355
+ 위 예제와 같이 3단계로 처리할 수도 있으나,
356
+ hires.fix 단계 없이 refiner로 resize하여 처리할 수도 있다.
357
+
358
+
359
+
360
+ <p>
361
+ <img src="https://i.ibb.co/GFjgJ5B/refiner.png">
362
+ </p>
363
+
364
+ #### Enable refiner
365
+
366
+ refiner 사용 여부를 체크합니다.
367
+
368
+ #### CheckPoint
369
+
370
+ refiner를 이용하여 다시 그릴때 사용할 checkpoint를 지정합니다.
371
+
372
+ #### Use this checkpoint for detailing
373
+
374
+ 위에서 지정한 checkpoint를 이용하여 detailing에 적용합니다.
375
+
376
+ #### Prompt
377
+
378
+ refiner가 이미지를 다시 그릴때 사용하는 prompt를 지정합니다.
379
+ 비어있다면 main prompt와 동일하고,채워져 있다면 main prompt를 무시합니다.
380
+ 만약 #!org!# 문자열이 있다면 main prompt를 대체합니다.
381
+
382
+ #### Negative prompt
383
+
384
+ refiner가 이미지를 다시 그릴때 사용하는 negative prompt를 지정합니다.
385
+
386
+ #### Sampling method
387
+
388
+ refiner가 사용할 sampler를 지정할 수 있습니다.
389
+ (Euler A 권장)
390
+
391
+ #### Upscaler
392
+
393
+ refiner가 이미지를 resize하는 경우 사용할 upscaler를 지정합니다.
394
+
395
+ #### Refiner sampling steps
396
+
397
+ refiner가 사용할 samping steps를 지정합니다.
398
+ (권장 20)
399
+
400
+ #### Refiner CFG scale
401
+
402
+ refiner가 사용할 CFG scale 값을 지정합니다.
403
+ dynamic threshold는 지원하지 않습니다.
404
+
405
+ #### Refiner denoising strength
406
+
407
+ refiner가 사용할 denoising strength를 지정합니다.
408
+ (권장 0.4)
409
+
410
+ #### Refiner scale
411
+
412
+ refiner가 주어진 이미지를 scale 값으로 resize합니다.
413
+ 만약 refiner width, refiner height가 설정되어있다면 무시됩니다.
414
+
415
+ #### Refiner width
416
+
417
+ 이미지 폭을 해당 값으로 강제로 설정합니다.
418
+
419
+ #### Refiner height
420
+
421
+ 이미지 높이를 해당 값으로 강제로 설정합니다.
422
+
423
+ <br>
424
+ <br>
425
+ <br>
3-bmab/docs/kr/api.md ADDED
@@ -0,0 +1,234 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+
4
+ # API
5
+
6
+ Stable diffusion webui의 API를 이용하여 이미지를 생성하는 경우 아래와 같이 BMAB를 사용하여 API Call을 할 수 있습니다.
7
+
8
+
9
+ ```python
10
+ import requests
11
+ import json
12
+ import base64
13
+
14
+
15
+ prompt = '''
16
+ 1girl
17
+ '''
18
+ negative_prompt = '(worst quality, low quality:1.4),'
19
+
20
+ txt2img = {
21
+ 'prompt': prompt,
22
+ 'negative_prompt': negative_prompt,
23
+ 'steps': 20,
24
+ 'width': 512,
25
+ 'height': 768,
26
+ 'cfg_scale': 7,
27
+ 'seed': -1,
28
+ 'sampler_index': 'DPM++ SDE Karras',
29
+ 'script_name': None,
30
+ 'alwayson_scripts': {
31
+ 'BMAB': {
32
+ 'args': [
33
+ {
34
+ 'enabled': True,
35
+ 'face_detailing_enabled': True,
36
+ }
37
+ ]
38
+ }
39
+ }
40
+ }
41
+
42
+ response = requests.post('http://localhost:7860/sdapi/v1/txt2img', data=json.dumps(txt2img))
43
+ print(response)
44
+ j = response.json()
45
+ b64_image = j['images'][0]
46
+
47
+
48
+ with open('test.png', 'wb') as image_file:
49
+ image_file.write(base64.b64decode(b64_image))
50
+
51
+ ```
52
+
53
+ BAMB의 Argument는 저장된 설정 파일과 동일하며,
54
+ 이것을 기반으로 모든 설정을 사용할 수 있습니다. 설정에 없는 경우 기본값을 사용합니다.
55
+
56
+ 아래는 json 형태의 기본 설정 값입니다.
57
+
58
+ ```json
59
+ {
60
+ "enabled": false,
61
+ "preprocess_checkpoint": "Use same checkpoint",
62
+ "preprocess_vae": "Use same vae",
63
+ "txt2img_noise_multiplier": 1,
64
+ "txt2img_extra_noise_multiplier": 0,
65
+ "txt2img_filter_hresfix_before_upscale": "None",
66
+ "txt2img_filter_hresfix_after_upscale": "None",
67
+ "resample_enabled": false,
68
+ "module_config": {
69
+ "resample_opt": {
70
+ "save_image": false,
71
+ "hiresfix_enabled": false,
72
+ "checkpoint": "Use same checkpoint",
73
+ "vae": "Use same vae",
74
+ "method": "txt2img-1pass",
75
+ "filter": "None",
76
+ "prompt": "",
77
+ "negative_prompt": "",
78
+ "sampler": "Use same sampler",
79
+ "upscaler": "BMAB fast",
80
+ "steps": 20,
81
+ "cfg_scale": 7,
82
+ "denoising_strength": 0.75,
83
+ "strength": 0.5,
84
+ "begin": 0.1,
85
+ "end": 0.9
86
+ },
87
+ "pretraining_opt": {
88
+ "hiresfix_enabled": false,
89
+ "pretraining_model": "Select Model",
90
+ "prompt": "",
91
+ "negative_prompt": "",
92
+ "sampler": "Use same sampler",
93
+ "steps": 20,
94
+ "cfg_scale": 7,
95
+ "denoising_strength": 0.75,
96
+ "dilation": 4,
97
+ "box_threshold": 0.35
98
+ },
99
+ "resize_intermediate_opt": {
100
+ "resize_by_person": true,
101
+ "method": "stretching",
102
+ "alignment": "bottom",
103
+ "filter": "None",
104
+ "scale": 0.85,
105
+ "denoising_strength": 0.75
106
+ },
107
+ "refiner_opt": {
108
+ "checkpoint": "Use same checkpoint",
109
+ "keep_checkpoint": true,
110
+ "prompt": "",
111
+ "negative_prompt": "",
112
+ "sampler": "Use same sampler",
113
+ "upscaler": "BMAB fast",
114
+ "steps": 20,
115
+ "cfg_scale": 7,
116
+ "denoising_strength": 0.75,
117
+ "scale": 1,
118
+ "width": 0,
119
+ "height": 0
120
+ },
121
+ "person_detailing_opt": {
122
+ "best_quality": false,
123
+ "force_1:1": false,
124
+ "block_overscaled_image": true,
125
+ "auto_upscale": true,
126
+ "scale": 4,
127
+ "dilation": 3,
128
+ "area_ratio": 0.1,
129
+ "limit": 1,
130
+ "background_color": 1,
131
+ "background_blur": 0
132
+ },
133
+ "person_detailing": {
134
+ "denoising_strength": 0.4,
135
+ "cfg_scale": 7
136
+ },
137
+ "face_detailing_opt": {
138
+ "best_quality": false,
139
+ "sort_by": "Score",
140
+ "limit": 1,
141
+ "prompt0": "",
142
+ "negative_prompt0": "",
143
+ "prompt1": "",
144
+ "negative_prompt1": "",
145
+ "prompt2": "",
146
+ "negative_prompt2": "",
147
+ "prompt3": "",
148
+ "negative_prompt3": "",
149
+ "prompt4": "",
150
+ "negative_prompt4": "",
151
+ "override_parameter": false,
152
+ "sampler": "Use same sampler",
153
+ "detection_model": "BMAB Face(Normal)",
154
+ "dilation": 4,
155
+ "box_threshold": 0.35,
156
+ "skip_large_face": false,
157
+ "large_face_pixels": 0.26
158
+ },
159
+ "face_detailing": {
160
+ "width": 512,
161
+ "height": 512,
162
+ "cfg_scale": 7,
163
+ "steps": 20,
164
+ "mask_blur": 4,
165
+ "inpaint_full_res": "Only masked",
166
+ "inpaint_full_res_padding": 32,
167
+ "denoising_strength": 0.4
168
+ },
169
+ "hand_detailing_opt": {
170
+ "block_overscaled_image": true,
171
+ "best_quality": false,
172
+ "detailing_method": "subframe",
173
+ "auto_upscale": true,
174
+ "scale": 4,
175
+ "box_threshold": 0.3,
176
+ "dilation": 0.1,
177
+ "additional_parameter": ""
178
+ },
179
+ "hand_detailing": {
180
+ "prompt": "",
181
+ "negative_prompt": "",
182
+ "denoising_strength": 0.4,
183
+ "cfg_scale": 7,
184
+ "inpaint_full_res": "Only masked",
185
+ "inpaint_full_res_padding": 32
186
+ },
187
+ "controlnet": {
188
+ "enabled": false,
189
+ "with_refiner": false,
190
+ "noise": false,
191
+ "noise_strength": 0.4,
192
+ "noise_begin": 0.1,
193
+ "noise_end": 0.9
194
+ },
195
+ "resize_by_person_opt": {
196
+ "mode": "Inpaint",
197
+ "scale": 0.85,
198
+ "denoising_strength": 0.6,
199
+ "dilation": 30
200
+ }
201
+ },
202
+ "pretraining_enabled": false,
203
+ "edge_flavor_enabled": false,
204
+ "edge_low_threadhold": 50,
205
+ "edge_high_threadhold": 200,
206
+ "edge_strength": 0.5,
207
+ "resize_intermediate_enabled": false,
208
+ "refiner_enabled": false,
209
+ "contrast": 1,
210
+ "brightness": 1,
211
+ "sharpeness": 1,
212
+ "color_saturation": 1,
213
+ "color_temperature": 0,
214
+ "noise_alpha": 0,
215
+ "noise_alpha_final": 0,
216
+ "input_image": null,
217
+ "blend_enabled": false,
218
+ "blend_alpha": 1,
219
+ "detect_enabled": false,
220
+ "masking_prompt": "",
221
+ "person_detailing_enabled": false,
222
+ "face_detailing_enabled": false,
223
+ "face_detailing_before_hiresfix_enabled": false,
224
+ "hand_detailing_enabled": false,
225
+ "resize_by_person_enabled": false,
226
+ "upscale_enabled": false,
227
+ "detailing_after_upscale": true,
228
+ "upscaler_name": "None",
229
+ "upscale_ratio": 1.5,
230
+ "config_file": "test",
231
+ "preset": "None"
232
+ }
233
+ ```
234
+
3-bmab/docs/kr/bmab.md ADDED
@@ -0,0 +1,319 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # BMAB
3
+
4
+ ## 기본 기능
5
+
6
+ * Contrast : 대비값 조절 (1이면 변경 없음)
7
+ * Brightness : 밝기값 조절 (1이면 변경 없음)
8
+ * Sharpeness : 날카롭게 처리하는 값 조절 (1이면 변경 없음)
9
+ * Color Temperature : 색온도 조절, 6500K이 0 (0이면 변경 없음)
10
+ * Noise alpha : 프로세스 전에 노이즈를 추가하여 디테일을 올릴 수 있습니다. (권장값:0.1)
11
+ * Noise alpha at final stage : 최종 단계에서 노이즈를 추가하여 분위기를 다르게 전달할 수 있습니다.
12
+
13
+
14
+ ## Imaging
15
+
16
+ ### Blend Image in Img2Img
17
+
18
+ 이미지 업로드 상자에 입력한 이미지와 Img2Img에 입력된 이미지를 Blending합니다.
19
+ Blend Alpha 값으로 두 개의 이미지를 합성합니다.
20
+ "Process before Img2Img" 옵션이 적용됩니다.
21
+
22
+ ### Dino detect
23
+
24
+ Img2Img Inpainting 하는 경우에 마스크를 입력하지 않아도 Dino detect prompt에 있는 내용을 이용하여 자동으로 마스크를 생성합니다.
25
+ 이미지를 업로드 하게되면 업로드된 이미지를 배경으로 하여 prompt로 입력된 부분을 업로드 이미지에 합성합니다.
26
+
27
+ #### Img2Img 에서 사용하는 경우
28
+
29
+ <p>
30
+ <img src="https://i.ibb.co/W5xs487/00027-3690585574.png" width="40%">
31
+ <img src="https://i.ibb.co/rk7xDSR/00467-2764185410.png" width="40%">
32
+ </p>
33
+ <p>
34
+ <img src="https://i.ibb.co/Byw3rY6/tmp3478vdur.png" width="40%">
35
+ <img src="https://i.ibb.co/7W6QhTG/00024-155186649.png" width="40%">
36
+ </p>
37
+
38
+
39
+
40
+ 첫번째 image는 Img2Img 이미지로 지정
41
+ 두번째 image는 BMAB의 Imaging에 Image 입력창에 지정
42
+
43
+ 프로세스 과정에서 세번째 image를 합성하고 프롬프트에 따라서 결과가 얻어진다.
44
+
45
+ Enabled : CHECK!!
46
+
47
+ Contrast : 1.2
48
+ Brightness : 0.9
49
+ Sharpeness : 1.5
50
+
51
+ Enable dino detect : CHECK!!
52
+ DINO detect Prompt : 1girl
53
+
54
+
55
+ #### Img2Img Inpaint 에서 사용하는 경우
56
+
57
+ DINO detect Prompt에 있는 내용대로 자동으로 마스크를 만들어준다.
58
+
59
+ <p>
60
+ <img src="https://i.ibb.co/W5xs487/00027-3690585574.png" width="30%">
61
+ <img src="https://i.ibb.co/80qQvDv/tmpnm78iuqo.png" width="30%">
62
+ <img src="https://i.ibb.co/mRT77BM/00028-2672855487.png" width="30%">
63
+ </p>
64
+
65
+
66
+ 이번 예제에서는 배경을 변경했으니, inpaint 설정에서 "Inpaint Not Masked"를 선택해야 한다.
67
+ 반대로 "Inpaint Masked"를 하면 인물이 변경된다.
68
+
69
+
70
+ ## Person
71
+
72
+ 이 기능을 사용하게 되면 프로세스가 완료된 이후에, 인물을 감지하여 다시 그립니다.
73
+ 아래의 경우에 사용하면 효과적입니다.
74
+
75
+ * 인물이 배경에 비해 매우 작은 경우, 의복, 얼굴 등 인물 전체의 디테일이 올라갑니다.
76
+ * 4K와 같이 큰 이미지를 출력하는 경우, 업 스케일 이후에 인물이 작은 경우 이 기능을 사용하면 인물이 뚜렷해 집니다.
77
+ * Face Detailing과 같이 사용하면 좋은 효과를 볼 수 있습니다.
78
+
79
+
80
+ <img src="https://i.ibb.co/RSrvqM1/person.png">
81
+
82
+
83
+ #### Enable person detailing for landscape (EXPERIMENTAL)
84
+
85
+ 풍경에서 인물을 자세하게 다시 그리는 기능을 활성화 합니다.
86
+
87
+ #### Block over-scaled image
88
+
89
+ 이 기능이 켜지게 되면 인물을 찾아내서 크게 키워서 다시 그리는데 이때 확대된 이미지의 면적이 본래 이미지를 초과하게 되면 프로세스를 멈춥니다.
90
+ sd-webui가 멈추거나 GPU를 보호하기 위한 목적입니다.
91
+
92
+ #### Auto scale if "Block over-scaled image" enabled
93
+
94
+ 이 기능을 설정하면 위에서 언급한 "Block over-scaled image"로 차단될 경우 본래 이미지의 면적에 맞춰서 스케일을 조정하여 작업합니다.
95
+
96
+ #### Upscale Ratio
97
+
98
+ 인물이 발견되면 주어진 비율로 키워서 자세하게 그립니다.
99
+
100
+ #### Denoising Strength
101
+
102
+ 인물의 크기가 클 경우 0.4로 부족할 수 있습니다. 이런 경우 수치를 올려주세요.
103
+
104
+ #### Dilation mask
105
+
106
+ 찾아낸 인물의 마스크를 확장합니다.
107
+
108
+ #### CFG Scale
109
+
110
+ 인물을 다시 그릴때 사용하는 CFG scale 값입니다.
111
+
112
+ #### Large person area limit
113
+
114
+ 인물이 이미지 속에서 차지하는 면적이 이 값을 초과하면 작업하지 않습니다.
115
+ 인물이 충분히 큰 경우 다시 그릴 필요가 없기 때문입니다.
116
+
117
+ #### Limit
118
+
119
+ 이미지 속에 인물이 너무 많은 경우 면적단위로 큰 것부터 카운트하여 설정값을 초과하여 다시 그리지 않습니다.
120
+
121
+
122
+ <img src="https://i.ibb.co/n8PmL3P/00057-2574875327.jpg">
123
+ <img src="https://i.ibb.co/r2fdSmJ/00399-1097195856.png">
124
+
125
+
126
+ ## Face
127
+
128
+ ### Face Detailing
129
+
130
+ 이 기능을 사용하게 되면 프로세스가 완료된 이후 After Detailer(AD)나 Detection Detailer(DD)와 같이
131
+ 얼굴을 보정합니다.
132
+ 이 기능을 동작시킨 후에 AD, DD가 동작하도록 설정한다면, 결과가 좋지 않을 수 있습니다.
133
+
134
+ <img src="https://i.ibb.co/frx85BR/face.png">
135
+
136
+ 최대 5개의 캐릭터에 대해 prompt를 별도로 지정할 수 있습니다.
137
+
138
+ #### Enable face detailing
139
+
140
+ face detailing 기능을 켜고 끌 수 있습니다.
141
+
142
+ #### Enable face detailing before hires.fix (EXPERIMENTAL)
143
+
144
+ face detailing 기능을 txt2img 과정의 hires.fix 직전에 한 번 더 수행합니다.
145
+ 얼굴을 보정한 이후에 upscale을 하기 때문에 더 좋은 품질의 이미지를 얻을 수 있습니다.
146
+ 하지만 부하가 더 들어가고, 이미지 변화가 심합니다.
147
+
148
+ #### Face detailing sort by
149
+
150
+ 이미지 안에 여러 인물이 있는 경우 어떤 순서로 Detailing 할 것인지 결정합니다.
151
+
152
+ <img src="https://i.ibb.co/DR8g34t/00037-3214376443.png">
153
+ <img src="https://i.ibb.co/4JXdkpT/00036-3214376443.png">
154
+
155
+ 왼쪽, 오른쪽 혹은 크기로 가능하며 없다면 기본적으로 Score 값이 높은 순서로 합니다.
156
+
157
+ #### Limit
158
+
159
+ 이미지 않에 여러 인물이 있는 경우 위에서 정한 순서로 얼마나 수행할지 결정합니다.
160
+ Limit이 1이라면 최대 1개만 수행한다는 뜻입니다.
161
+
162
+ #### Override Parameters
163
+
164
+ * Denoising Strength
165
+ * CFG Scale
166
+ * Width
167
+ * Height
168
+ * Steps
169
+ * Mask Blur
170
+
171
+ 위 값에 대해 기본값이 아닌 UI에서 지정한 값을 사용합니다.
172
+
173
+ #### Inpaint Area
174
+
175
+ 전체를 다시 그릴지 얼굴만 다시 그릴지를 결정합니다. 전체를 다시 그리는 것은 별로 추천하지 않습니다.
176
+
177
+ #### Only masked padding, pixels
178
+
179
+ 기본값을 사용해 주세요.
180
+
181
+ #### Dilation
182
+
183
+ 검출된 얼굴의 마스크 크기를 키웁니다.
184
+
185
+ #### Box threshold
186
+
187
+ Detector의 검출 값을 결정합니다. 기본값 0.35보다 작으면 face가 아닐 것으로 제외합니다.
188
+ YOLO를 사용하는 경우 confidence를 대체합니다.
189
+
190
+ **좋은 결과를 얻기 위한 조언**
191
+
192
+ * Prompt에 얼굴 관련된 lora, textual inversion등 관련 내용을 뺍니다. sunglass 등은 무관합니다.
193
+ * 설정 파일에 얼굴마다 서로 다른 lora, textual inversion 등을 넣습니다.
194
+ * prompt에 lora, TI가 많을 경우 그림 생성 자유도가 떨어지는 것 같습니다.
195
+ * 그림속 모든 캐릭터가 공유되는 lora는 넣어주셔도 무방합니다.
196
+
197
+
198
+
199
+ ## Hand
200
+
201
+ ### Hand Detailing (EXPERIMENTAL)
202
+
203
+ 손 표현이 잘못된 부분을 수정하는 기능입니다.
204
+ 만들어진 그림에서 손 부분을 자동으로 찾아내어 해당 부분을 다시 그리는 기능입니다.
205
+ 다만 손의 경우 다시 그려도 잘 그려질지 확실하지 않으며, 손을 자세하게 그리는 정도입니다.
206
+
207
+ <img src="https://i.ibb.co/fxQh9ZN/hand.png">
208
+
209
+ #### Enable hand detailing
210
+
211
+ 손 보정 기능을 사용하도록 활성화 합니다.
212
+
213
+ #### Block over-scaled image
214
+
215
+ 이 기능은 손을 찾아내어 확대해서 다시그리는 방법을 사용합니다.
216
+ 다시 그려야 하는 부분의 면적이 원래이미지를 초과하게 되면 작업을 수행하지 않습니다.
217
+ 이런 경우에는 Upscale Ratio를 줄이거나, 이 기능을 꺼야하는데, 이 기능을 끄면 매우 큰 그림을 다시 그릴 수도 있어서 GPU에 부하가 걸릴 수 있습니다..
218
+
219
+ #### Method
220
+ * subframe : 손을 포함하여 얼굴/머리 부분까지 찾아내어 상반신을 다시 그린다.
221
+ * each hand : 손을 찾아내여 3배 크기의 주변부 까지 다시 그려 손만 적용한다.
222
+ * each hand inpaint : 손을 찾아내어 3재 크기의 주변부를 기반으로 손만 다시 그린다.
223
+ 매우 극단적으로 변형될 수 있어서 잘 그려지기 어렵다 모양이 갖춰진다면, subframe으로 다시 그리는 것을 추천한다.
224
+ * at once : 찾아낸 손을 모두 한번에 다시 그린다.
225
+
226
+
227
+ #### Prompt
228
+
229
+ Subframe에서는 입력하지 않을 것을 권장합니다.
230
+ each hand, each hand inpaint시에 손 관련 프롬프트를 입력합니다.
231
+
232
+ #### Negative Prompt
233
+
234
+ Subframe에서는 입력하지 않을 것을 권장합니다.
235
+ each hand, each hand inpaint시에 손 관련 네거티브 프롬프트를 입력합니다.
236
+
237
+ #### Denoising Strength
238
+
239
+ 다시 그리는 경우 Denoising Strength 값 입니다.
240
+ * subframe : 0.4 권장
241
+ * 기타 0.55 이상 권장
242
+
243
+ #### CFG Scale
244
+
245
+ 다시 그리는 경우 CFG Scale 값 입니다.
246
+
247
+ #### Upscale Ratio
248
+ 상반신 / 손 주변을 찾아내어 얼마나 크게 확대하여 다시 그릴 것인지 지정한다.
249
+ 무조건 크게 그린다고 성공확률이 올라가는 것은 아니다.
250
+ * subframe : 2.0
251
+ * 기타 : 2.0~4.0
252
+
253
+ #### Box Threshold
254
+
255
+ 손을 찾아내지 못하는 경우 이 값을 낮추면, 찾아낼 수 있는 확률이 올라갑니다.
256
+ 하지만 잘 못 찾아낼 가능성도 올라갑니다.
257
+
258
+ #### Box Dilation
259
+
260
+ 찾아낸 박스(손을 포함하여)의 외곽 부분을 얼마나 크게 할 것이 결정합니다. (only for subframe)
261
+
262
+ #### Inpaint Area
263
+
264
+ 찾아낸 박스 전체를 다시 그릴 것인지, 손만 다시 그릴 것인지를 결정한다.
265
+ 손만 다시그리는 경우 손 모양이 원하지 않게 바뀔 수 있으나 크게 변경된다.
266
+
267
+ #### Only masked padding
268
+
269
+ 찾아낸 손의 내부 공간을 얼마 정도로 채울지를 결정합니다. 딱히 변경할 일 없습니다.
270
+
271
+ #### Additional Parameter
272
+
273
+ 현재는 제공하지 않지만 향후 고급 사용자를 위한 옵션을 제공할 예정입니다.
274
+
275
+
276
+
277
+ ## ControlNet
278
+
279
+ ControlNet을 이용하여 이미지에 노이즈를 추가하는 방법으로 디테일을 올리는 기능입니다.
280
+ ControlNet의 Lineart 모델에 가우시안 노이즈 이미지를 입력으로 사용하여,
281
+ 결과물에 다양하고 복잡한 디테일을 추가합니다.
282
+
283
+ #### Noise Strength
284
+
285
+ 노이즈 강도를 지정합니다. (0.4 권장)
286
+
287
+ #### Begin
288
+
289
+ Sampling 단계 시작점
290
+
291
+ #### End
292
+
293
+ Sampling 단계 끝점
294
+
295
+ 보통의 경우 0.4, 0, 0.4를 권장합니다. 혹은 이미지가 과도하게 그려질 경우 0.2, 0, 0.4 정도로 추천합니다.
296
+ 과도하게 이미지가 그려진 경우 refiner를 사용하면 이미지를 어느 정도 안정시킬 수 있습니다.
297
+
298
+ 아래는 모두 같은 seed입니다.
299
+ <table>
300
+ <tr>
301
+ <td>기본이미지</td>
302
+ <td>0.4</td>
303
+ <td>0.7</td>
304
+ </tr>
305
+ <tr>
306
+ <td><img src="https://i.ibb.co/ypRrwmN/00007-51151519.jpg"></td>
307
+ <td><img src="https://i.ibb.co/j54HfHF/00009-51151519.jpg"></td>
308
+ <td><img src="https://i.ibb.co/MsgCZS3/00008-51151519.jpg"></td>
309
+ </tr>
310
+ </table>
311
+
312
+
313
+
314
+
315
+
316
+
317
+ <br>
318
+ <br>
319
+ <br>
3-bmab/docs/kr/manual.md ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ## Quick Test
3
+
4
+ Enable을 체크하고 Config Tab에서 Preset "example"을 선택합니다.
5
+
6
+ contrast: 1.2
7
+ brightness: 0.9
8
+ sharpeness: 1.5
9
+
10
+ Edge enhancement 적용
11
+ Face Detailing 적용
12
+ Resize by person 적용
13
+
14
+
15
+
16
+ ## 기본 옵션
17
+
18
+ Enabled (VERSION): 기능을 켜고 끌 수 있습니다.
19
+
20
+ ### Resize and fill override
21
+
22
+ Img2Img를 수행하는 경우 "Resize and fill" 을 선택하게 되면
23
+ 통상 좌우, 상하로 늘어나거나 비율이 같다면 그대로 크기만 변경됩니다.
24
+
25
+ Enabled 된 상태에서는 항상 이미지가 아래에 위치하고,
26
+ 왼쪽, 오른쪽, 윗쪽으로 비율에 맞게 늘어납니다.
27
+
28
+ 인물의 윗쪽으로 여백이 없는 경우에 적용하면 효과적입니다.
29
+ 너무 크게 늘리게 되면 좋은 결과를 얻기 힘듭니다.
30
+ 대략 1.1, 1.2 정도 스케일에서 사용하시길 권장합니다.
31
+
32
+ <p>
33
+ <img src="https://i.ibb.co/j3WzZrc/00408-3188840002.png" width="40%">
34
+ <img src="https://i.ibb.co/ZWMWVFB/00409-3188840002.png" width="40%">
35
+ </p>
36
+
37
+ <br>
38
+ <br>
39
+ <br>
40
+
41
+ # Preprocess
42
+
43
+ 본 이미지 변경을 하기 전에 사전 처리 과정을 수행합니다.
44
+ 조건에 따라 hires.fix 과정에 개입할 수도 있습니다.
45
+
46
+ <a href="./preprocess.md">Preprocess</a>
47
+
48
+ # BMAB
49
+
50
+ Person, Hand, Face detailer를 수행하거나, 이미지 합성 혹은 노이즈 추가등의 기능을 수행합니다.
51
+
52
+ <a href="./bmab.md">bmab</a>
53
+
54
+ # Postprocess
55
+
56
+ 이미지 처리가 완료된 이후, 인물의 크기에 따라 배경을 확장하거나 upscale을 할 수 있습니다.
57
+
58
+ <a href="./postprocess.md">Postprocess</a>
59
+
60
+
61
+ # API
62
+
63
+ stable diffusion webui의 API 기능을 호출할때 BMAB extension을 사용할 수 있습니다.
64
+
65
+ <a href="./api.md">API Guide</a>
3-bmab/docs/kr/postprocess.md ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ # PostProcessing
4
+
5
+ ## Resize
6
+
7
+ ### Resize by person
8
+
9
+ 그림 속 인물중 가장 신장이 큰 사람의 길이와 그림 높이의 비율이 설정값을 넘어가면 비율을 설정값로 맞추는 기능입니다.
10
+ 설정값이 0.90이고 인물의 전체 길이: 그림 높이의 비율이 0.95라고 한다면
11
+ 배경을 늘려서 인물의 비율이 0.90이 되도록 합니다.
12
+ 배경은 왼쪽, 오른쪽, 위쪽으로 늘어납니다.
13
+
14
+
15
+ 이 기능은 2가지 방법을 제공하는데 다음과 같습니다.
16
+
17
+ #### Inpaint
18
+
19
+ Face Detailing과 같은 방법으로 이미지가 완전히 생성되고 난 후에 주변부를 확장합니다.
20
+ 이때 이미 생성된 이미지를 훼손하지 않고 주변부만 확장하기 때문에 직관적으로 확인이 가능합니다.
21
+ 가장 빠르고 효과적으로 추천합니다.
22
+
23
+ #### Inpaint + lama
24
+
25
+ Inpaint와 같은 방법인데 BMAB에서 ControlNet을 불러서 Inpaint+lama를 이용해서 동작합니다.
26
+ 이미지가 생성되고나서 디테일링 시작하기 전에 img2img를 이용하여 배경을 확장하여 전체적으로 인물을 작게 만드는 효과가 있습니다.
27
+
28
+ <table>
29
+ <tr>
30
+ <td><img src="https://i.ibb.co/X7P8kmH/00012-2131442442.jpg"></td>
31
+ <td><img src="https://i.ibb.co/Zc1nTz7/00022-2131442442.jpg"></td>
32
+ </tr>
33
+ <tr>
34
+ <td><img src="https://i.ibb.co/d0rSW0q/00013-2131442443.jpg"></td>
35
+ <td><img src="https://i.ibb.co/vHh2940/00023-2131442443.jpg"></td>
36
+ </tr>
37
+ <tr>
38
+ <td><img src="https://i.ibb.co/4jNJQ3b/00016-2131442446.jpg"></td>
39
+ <td><img src="https://i.ibb.co/HdcMpTH/00026-2131442446.jpg"></td>
40
+ </tr>
41
+ </table>
42
+
43
+ 이 두가지 방법은 생성된 이미지를 축소하기만 할뿐 훼손하지 않습니다.
44
+ 이것이 Resize intermediate와 다른점입니다.
45
+
46
+
47
+ ## Upscaler
48
+
49
+ 최종적으로 이미지가 완성되고 난 이후에 이미지를 upscaler를 이용하여 크게 만듭니다.
50
+
51
+
52
+ #### Enable upscale at final stage
53
+
54
+ 이미지 생성이 완료되고 난 이후에 Upscale을 수행합니다.
55
+ 960x540으로 생성하고 hires.fix를 x2로 하면 1920x1080 이미지가 나오는데
56
+ 여기서 Upscale을 x2를 하면 4K 이미지가 나오게 됩니다.
57
+
58
+ #### Detailing after upscale
59
+
60
+ 이 옵션을 설정하면 위에서 언급한 Person, Face, Hand 에 대한 detailing을 upscale 이후에 수행합니다.
61
+
62
+ #### Upscale Ratio
63
+
64
+ 이미지를 얼마나 upscale할지 결정합니다.
65
+
66
+
3-bmab/docs/kr/preprocess.md ADDED
@@ -0,0 +1,425 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Preprocess
3
+
4
+ ## Context
5
+
6
+ BMAB에서 사용할 Checkpoint와 VAE를 지정합니다.
7
+ 특정 기능들은 자체 Checkpoint와 VAE를 설정할 수 있습니다.
8
+ 한 번 변경된 Checkpoint는 그 이후 프로세스들이 계속 사용합니다.
9
+
10
+ <img src="https://i.ibb.co/VTP5ddx/2023-11-12-3-48-54.png">
11
+
12
+ #### txt2img noise multiplier for hires.fix
13
+
14
+ hires.fix 단계에서 noise를 추가 할 수 있다.
15
+
16
+ #### txt2img extra noise multiplier for hires.fix (EXPERIMENTAL)
17
+
18
+ hires.fix 단계에서 추가적인 noise를 더 할 수 있다.
19
+
20
+ #### Hires.fix filter before upscaler
21
+
22
+ Hires.fix 단계 중 upscaler 전에 filter를 적용할 수 있다.
23
+
24
+ #### Hires.fix filter after upscaler
25
+
26
+ Hires.fix 단계 중 upscaler 후에 filter를 적용할 수 있다.
27
+
28
+
29
+ ## Resample (EXPERIMENTAL)
30
+
31
+ Self resampling 기능입니다. txt2img -> hres.fix를 통해 생성된 이미지를 다시 txt2img -> hires.fix 과정을 수행하면서
32
+ ControlNet Tile Resample을 수행합니다. 아래와 같은 경우 사용할 수 있습니다.
33
+
34
+ * 두 모델간에 결과물 차이가 큰 경우
35
+ * 두 모델간에 인물 비율이 차이나는 경우
36
+ * 두 모델간 버전이 다른 경우 (SDXL, SD15)
37
+
38
+ <table>
39
+ <tr>
40
+ <td>txt2img->hires.fix</td>
41
+ <td>Resample + BMAB Basic</td>
42
+ </tr>
43
+ <tr>
44
+ <td><img src="https://i.ibb.co/VxPfgN0/00153-3939130001-before-resample.png"></td>
45
+ <td><img src="https://i.ibb.co/XZ9gHHN/00154-3939130001.png"></td>
46
+ </tr>
47
+ </table>
48
+
49
+ <img src="https://i.ibb.co/5hWtbmZ/e822842f656d73757ee65713317f7ba9d947472d3fe94fc3ceffc72aee31064d.jpg">
50
+ BMAB resample image by [padapari](https://www.instagram.com/_padapari_/)
51
+
52
+ <br>
53
+ <br>
54
+ <br>
55
+ <br>
56
+
57
+
58
+ <img src="https://i.ibb.co/9hD81hd/resample.png">
59
+
60
+ #### Enable self resample (EXPERIMENTAL)
61
+
62
+ 이 기능을 켜고 끌 수 있습니다.
63
+
64
+ #### Save image before processing
65
+
66
+ 최초 txt2img -> hires.fix를 통해 생성된 이미지가 후 처리를 위해 BMAB로 입력되면,
67
+ 해당 이미지를 프로세싱하기 전에 저장합니다. 이미지 postfix로 "-before-resample"이 붙습니다.
68
+
69
+ #### Checkpoint
70
+
71
+ SD Checkpoint를 지정할 수 있습니다. 지정하지 않는다면 앞에서 설정된 Checkpoint를 사용합니다.
72
+ 프로세스가 완료되어도 원래 것으로 돌려놓지 않습니다.
73
+
74
+ #### SD VAE
75
+
76
+ SD VAE를 지정할 수 있습니다. 지정하지 않는다면 앞에서 설정된 VAE를 사용합니다.
77
+ 프로세스가 완료되어도 원래 것으로 돌려놓지 않습니다.
78
+
79
+ #### Resample method
80
+
81
+ Resample 방법을 선택할 수 있습니다.
82
+
83
+ txt2img-1pass : txt2img을 hires.fix 없이 동작시킨다.
84
+ txt2img-2pass : txt2img를 hires.fix로 동작시킨다. 기본적으로 이미지를 출력할 때 hires.fix가 동작해야하만 한다.
85
+ img2img-1pass : img2img로 동작시킨다.
86
+
87
+ #### Resample filter
88
+
89
+ Resample이 완료되고 난 이후에 외부 filter 코드를 호출하여 이미지 변환을 추가적으로 수행할 수 있다.
90
+
91
+
92
+ #### Resample prompt
93
+
94
+ resampling 과정에서 사용할 prompt입니다. 비어있는 경우 main prompt와 동일하며,
95
+ "#!org!#" 를 입력하면 main prompt를 대체합니다. "#!org!#" 이후에 추가로 prompt를 적을 수 있습니다.
96
+ ex) #!org!#, soft light, some more keyword
97
+
98
+ #### Resample negative prompt
99
+
100
+ resampling 과정에서 사용할 prompt입니다. 비어있는 경우 main negative prompt와 동일합니다.
101
+
102
+ #### Sampling method
103
+
104
+ 프로세스에 사용할 sampling method를 지정합니다. 지정하지 않는다면 이전 프로세스와 같은 sampler를 지정합니다.
105
+
106
+ #### Upsacler
107
+
108
+ hires.fix를 사용하는 경우에 지정하는 upscaler입니다.
109
+
110
+ #### Resample sampling steps
111
+
112
+ resample process 사용할 samping steps를 지정합니다.
113
+ (권장 20)
114
+
115
+ #### Resample CFG scale
116
+
117
+ resample process 사용할 CFG scale 값을 지정합니다.
118
+ dynamic threshold는 지원하지 않습니다.
119
+
120
+ #### Resample denoising strength
121
+
122
+ resample process가 사용할 denoising strength를 지정합니다.
123
+ (권장 0.4)
124
+
125
+ #### Resample strength
126
+
127
+ 0에 가까운 값은 입력 이미지와 멀어지고, 1에 가까울 수록 원본 이미지와 유사합니다.
128
+
129
+ #### Resample begin
130
+
131
+ sampling 단계에 적용 시작점.
132
+
133
+ #### Resample end
134
+
135
+ sampling 단계 적용 종료 시점.
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+ ## Pretraining (EXPERIMENTAL)
145
+
146
+ Pretraining detailer입니다. ultralytics로 pretraining 모델을 적용하여 detection을 수행하고
147
+ 이를 기반으로 prompt, negative prompt를 적용하여 부분적으로 이미지를 더 자세하게 그릴 수 있습니다.
148
+
149
+ <img src="https://i.ibb.co/Qkx6rQK/pretraining.png"/>
150
+
151
+ #### Enable pretraining detailer (EXPERIMENTAL)
152
+
153
+ 이 기능을 켜고 끌 수 있습니다.
154
+
155
+ #### Enable pretraining before hires.fix
156
+
157
+ pretraining detailer를 hires.fix 전에 수행하도록 한다.
158
+
159
+ #### Pretraining model
160
+
161
+ ultralytics 로 학습된 detection model (*.pt)를 지정할 수 있습니다.
162
+ stable-diffusion-webui/models/BMAB��� 해당 파일이 있어야 목록에 나타납니다.
163
+
164
+
165
+ #### Pretraining prompt
166
+
167
+ pretraining detailer process 과정에서 사용할 prompt입니다. 비어있는 경우 main prompt와 동일하며,
168
+ "#!org!#" 를 입력하면 main prompt를 대체합니다. "#!org!#" 이후에 추가로 prompt를 적을 수 있습니다.
169
+ ex) #!org!#, soft light, some more keyword
170
+
171
+ #### Pretraining negative prompt
172
+
173
+ pretraining detailer process 과정에서 사용할 prompt입니다. 비어있는 경우 main negative prompt와 동일합니다.
174
+
175
+ #### Sampling method
176
+
177
+ 프로세스에 사용할 sampling method를 지정합니다. 지정하지 않는다면 이전 프로세스와 같은 sampler를 지정합니다.
178
+
179
+
180
+ #### Pretraining sampling steps
181
+
182
+ resample process 사용할 samping steps를 지정합니다.
183
+ (권장 20)
184
+
185
+ #### Pretraining CFG scale
186
+
187
+ resample process 사용할 CFG scale 값을 지정합니다.
188
+ dynamic threshold는 지원하지 않습니다.
189
+
190
+ #### Pretraining denoising strength
191
+
192
+ resample process가 사용할 denoising strength를 지정합니다.
193
+ (권장 0.4)
194
+
195
+ #### Pretraining dilation
196
+
197
+ detection 된 사각형의 범위를 주어진 값 만큼 크기를 크게 합니다.
198
+
199
+ #### Pretraining box threshold
200
+
201
+ Detector의 검출 값을 결정합니다. 기본값 0.35보다 작으면 face가 아닐 것으로 제외합니다.
202
+ ultralytics predict의 confidence 값입니다.
203
+
204
+
205
+
206
+ ## Edge enhancemant
207
+
208
+ 이미지 경계를 강화해 선명도를 증가시키거나 디테일을 증가시키는 기능입니다.
209
+
210
+ **<span style="color: red">Upscaler가 Latent 계열인 경우 동작하지 않습니다. (R-ESRGAN, 4x-UltraSharp 추천)</span>**
211
+
212
+ <img src="https://i.ibb.co/4sjB1Lr/edge.png">
213
+
214
+ 권장설정
215
+
216
+ * Edge low threshold : 50
217
+ * Edge high threshold : 200
218
+ * Edge strength : 0.5
219
+
220
+ <p>
221
+ <img src="https://i.ibb.co/Wsw2Wrh/00598-1745587019.png" width="40%">
222
+ <img src="https://i.ibb.co/z4nCW9Z/00600-1745587019.png" width="40%">
223
+ </p>
224
+
225
+ Enabled : CHECK!!
226
+
227
+ Contrast : 1.2
228
+ Brightness : 0.9
229
+ Sharpeness : 1.5
230
+
231
+ Enable edge enhancement : CHECK!!
232
+ Edge low threshold : 50
233
+ Edge high threshold : 200
234
+ Edge strength : 0.5
235
+
236
+
237
+
238
+
239
+ ## Resize
240
+
241
+ txt2img -> hires.fix 의 중간 과정에서 동작합니다..
242
+ 만약 img2img에서 사용한다면, 프로세스 시작 전에 동작합니다.
243
+
244
+ 그림 속 인물중 가장 신장이 큰 사람의 길이와 그림 높이의 비율이 설정값을 넘어가면 비율을 설정값로 맞추는 기능입니다.
245
+ 설정값이 0.90이고 인물의 전체 길이: 그림 높이의 비율이 0.95라고 한다면
246
+ 배경을 늘려서 인물의 비율이 0.90이 되도록 합니다.
247
+ 배경은 Alignment에서 지정한 방식에 따라 늘어납니다.
248
+
249
+ txt2img 수행하는 단계에서 hires.fix 하기 직전에 이미지를 변경합니다.
250
+ 이 과정은 변경된 이미지가 hires.fix 과정에서 매끄럽게 변하게 하기 위한 것입니다.
251
+ **<span style="color: red">denoising strength는 0.6~0.7 정도를 사용하셔야 주변부 이미지 왜곡이 발생하지 않습니다.</span>**
252
+ **<span style="color: red">Upscaler가 Latent 계열인 경우 동작하지 않습니다. (R-ESRGAN, 4x-UltraSharp 추천)</span>**
253
+
254
+ #### Method
255
+
256
+ Resize 하는 방식을 지정할 수 있습니다.
257
+
258
+ * Stretching : 단순히 이미지를 외곽부분을 늘려서 배경을 확장합니다.
259
+ * inpaint : Stretching된 이미지를 mask를 사용하여 늘린 부분만 img2img inpainting을 수행합니다.
260
+ * inpaint+lama : Controlnet의 inpaint+lama 모델을 사용하여 확장된 영역을 다시 그립니다.
261
+ * inpaint_only : Controlnet의 inpaint_only를 사용하여 확장된 영역을 다시 그립니다.
262
+
263
+
264
+ #### Alignment
265
+
266
+ 이미지를 확장하고 원래 이미지를 어느 방향으로 정렬할 것인지를 결정합니다.
267
+
268
+ <img src="https://i.ibb.co/g62KhZQ/align.png">
269
+
270
+ #### Resize filter
271
+
272
+ Resize가 완료되고 난 이후에 외부 filter 코드를 호출하여 이미지 변환을 추가적으로 수행할 수 있다.
273
+
274
+
275
+ #### Resize by person intermediate
276
+
277
+ 인물의 크기 비율을 나타냅니다. 이 값을 초과하면 이 크기가 되도록 배경을 확장시킵니다.
278
+
279
+
280
+
281
+ <table>
282
+ <tr>
283
+ <td>Original</td>
284
+ <td>Resize 0.7</td>
285
+ <td>Resize 0.5</td>
286
+ </tr>
287
+ <tr>
288
+ <td><img src="https://i.ibb.co/XttbBz0/00133-3615254454.png"></td>
289
+ <td><img src="https://i.ibb.co/RS4tbZs/00135-3615254454.png"></td>
290
+ <td><img src="https://i.ibb.co/mHHqBKk/00134-3615254454.png"></td>
291
+ </tr>
292
+ </table>
293
+
294
+ <table>
295
+ <tr>
296
+ <td>Original</td>
297
+ <td>Alignment center</td>
298
+ </tr>
299
+ <tr>
300
+ <td><img src="https://i.ibb.co/hmSG5SK/00074-2037889107.png"></td>
301
+ <td><img src="https://i.ibb.co/7kPycZ5/00075-2037889107.png"></td>
302
+ </tr>
303
+ <tr>
304
+ <td>Alignment bottom</td>
305
+ <td>Alignment bottom-left</td>
306
+ </tr>
307
+ <tr>
308
+ <td><img src="https://i.ibb.co/2gPCbr4/00076-2037889107.png"></td>
309
+ <td><img src="https://i.ibb.co/x7T91QH/00080-2037889107.png"></td>
310
+ </tr>
311
+ </table>
312
+
313
+
314
+ Resize sample
315
+
316
+ <img src="https://i.ibb.co/G07KG6M/resize-00008-4017585008.png">
317
+
318
+
319
+
320
+
321
+
322
+
323
+
324
+
325
+
326
+
327
+
328
+
329
+ ## Refiner
330
+
331
+ txt2img에서 만들어진 이미지를 한번 더 그리는 과정을 수행한다.
332
+ txt2img + hires.fix 가 된 상황에서도 유효하다.
333
+
334
+ refiner는 이미지가 생성되고 detailing 하기전에 동작하며,
335
+ sd-webui의 hires.fix + refiner를 합친 동작과 비슷하다.
336
+
337
+
338
+
339
+ <table>
340
+ <tr>
341
+ <td>txt2img(512x768)</td>
342
+ <td>txt2img + hires.fix(800x1200)</td>
343
+ <td>txt2img + hires.fix + refiner(1200x1800)</td>
344
+ </tr>
345
+ <tr>
346
+ <td><img src="https://i.ibb.co/JCxXc9D/resize-00268-767037284.png"></td>
347
+ <td><img src="https://i.ibb.co/zR3nWKt/resize-00269-767037284.png"></td>
348
+ <td><img src="https://i.ibb.co/R21B0fr/resize-00270-767037284.png"></td>
349
+ </tr>
350
+ </table>
351
+
352
+
353
+ (위 예제는 결과를 모두 resize하여 동일한 크기이다.)
354
+
355
+ 위 예제와 같이 3단계로 처리할 수도 있으나,
356
+ hires.fix 단계 없이 refiner로 resize하여 처리할 수도 있다.
357
+
358
+
359
+
360
+ <p>
361
+ <img src="https://i.ibb.co/GFjgJ5B/refiner.png">
362
+ </p>
363
+
364
+ #### Enable refiner
365
+
366
+ refiner 사용 여부를 체크합니다.
367
+
368
+ #### CheckPoint
369
+
370
+ refiner를 이용하여 다시 그릴때 사용할 checkpoint를 지정합니다.
371
+
372
+ #### Use this checkpoint for detailing
373
+
374
+ 위에서 지정한 checkpoint를 이용하여 detailing에 적용합니다.
375
+
376
+ #### Prompt
377
+
378
+ refiner가 이미지를 다시 그릴때 사용하는 prompt를 지정합니다.
379
+ 비어있다면 main prompt와 동일하고,채워져 있다면 main prompt를 무시합니다.
380
+ 만약 #!org!# 문자열이 있다면 main prompt를 대체합니다.
381
+
382
+ #### Negative prompt
383
+
384
+ refiner가 이미지를 다시 그릴때 사용하는 negative prompt를 지정합니다.
385
+
386
+ #### Sampling method
387
+
388
+ refiner가 사용할 sampler를 지정할 수 있습니다.
389
+ (Euler A 권장)
390
+
391
+ #### Upscaler
392
+
393
+ refiner가 이미지를 resize하는 경우 사용할 upscaler를 지정합니다.
394
+
395
+ #### Refiner sampling steps
396
+
397
+ refiner가 사용할 samping steps를 지정합니다.
398
+ (권장 20)
399
+
400
+ #### Refiner CFG scale
401
+
402
+ refiner가 사용할 CFG scale 값을 지정합니다.
403
+ dynamic threshold는 지원하지 않습니다.
404
+
405
+ #### Refiner denoising strength
406
+
407
+ refiner가 사용할 denoising strength를 지정합니다.
408
+ (권장 0.4)
409
+
410
+ #### Refiner scale
411
+
412
+ refiner가 주어진 이미지를 scale 값으로 resize합니다.
413
+ 만약 refiner width, refiner height가 설정되어있다면 무시됩니다.
414
+
415
+ #### Refiner width
416
+
417
+ 이미지 폭을 해당 값으로 강제로 설정합니다.
418
+
419
+ #### Refiner height
420
+
421
+ 이미지 높이를 해당 값으로 강제로 설정합니다.
422
+
423
+ <br>
424
+ <br>
425
+ <br>
3-bmab/docs/masking.md ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Auto Masking
3
+
4
+ ## Detect
5
+
6
+ * Img2Img 인물 사진을 추가한다.
7
+ * Just resize 선택
8
+ * Resize를 하면서 크기를 키워야 좋은 결과를 얻을 수 있다.
9
+ 예제의 경우는 512x768 --> 800x1200 으로 resize한 것이다.
10
+ * Denoising Strength는 0.4~0.6 정도를 설정한다.
11
+ 모델별로 다르지만, 배경까지 심하게 바뀌는 경우 숫자를 줄인다.
12
+
13
+ <p>
14
+ <img src="https://i.ibb.co/VpRpN5m/2023-08-16-1-47-31.png">
15
+ </p>
16
+
17
+ * BMAB를 Enable 한다.
18
+ * 반드시 Process before img2img를 체크한다.
19
+ * Detect enabled 체크하고 prompt에 person, 1girl, human...뭐든..
20
+
21
+ <p>
22
+ <img src="https://i.ibb.co/k525fb6/2023-08-16-1-47-45.png">
23
+ </p>
24
+
25
+ * 최종적으로 좋은 결과를 내기 위해서 합쳐진 이미지를 프롬프트로 잘 표현해야 한다.
26
+ * 프롬프트가 없거나 적당히 적으면 원하는 이미지에서 멀어지기 때문에 프롬프트가 매우 중요하다.
27
+
28
+ <p>
29
+ <img src="https://i.ibb.co/V0yKJdS/00015-188939271.png">
30
+ </p>
31
+
3-bmab/filter/Put filter file here.txt ADDED
File without changes
3-bmab/filter/basic.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from PIL import Image
3
+ from PIL import ImageEnhance
4
+
5
+ import sd_bmab
6
+ from sd_bmab import util
7
+ from sd_bmab.base import filter
8
+ from sd_bmab.base import cache
9
+
10
+
11
+ class Filter(filter.BaseFilter):
12
+
13
+ def preprocess(self, context, image, *args, **kwargs):
14
+ pass
15
+
16
+ def basic_process(self, image: Image):
17
+ enhancer = ImageEnhance.Brightness(image)
18
+ image = enhancer.enhance(0.8)
19
+ enhancer = ImageEnhance.Contrast(image)
20
+ image = enhancer.enhance(1.2)
21
+ return image
22
+
23
+ def basic_process_with_noise(self, processed: Image):
24
+ noise = cache.get_noise_from_cache(0, processed.width, processed.height).convert('LA')
25
+ noise = noise.convert('RGBA')
26
+ blended = Image.blend(processed.convert('RGBA'), noise, alpha=0.1)
27
+ return self.basic_process(blended.convert('RGB'))
28
+
29
+ def process(self, context, image: Image, processed: Image, *args, **kwargs):
30
+ print('-----FILTER BASIC-----')
31
+ return self.basic_process(processed)
32
+
33
+ def postprocess(self, context, *args, **kwargs):
34
+ pass
3-bmab/filter/vintage.py ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from PIL import Image
2
+ from PIL import ImageEnhance
3
+
4
+ from sd_bmab.base import filter
5
+ from sd_bmab.base import cache
6
+ from sd_bmab.processors.basic import final
7
+
8
+
9
+ CONTRAST = 0.8
10
+ BRIGHTNESS = 0.9
11
+ SHARPNESS = 0.5
12
+ COLOR = 0.85
13
+ COLOR_TEMPERATURE = 5240
14
+ NOISE = 0.05
15
+
16
+
17
+ class Filter(filter.BaseFilter):
18
+
19
+ def preprocess(self, context, image, *args, **kwargs):
20
+ pass
21
+
22
+ def basic_process(self, image: Image):
23
+ enhancer = ImageEnhance.Contrast(image)
24
+ image = enhancer.enhance(CONTRAST)
25
+ enhancer = ImageEnhance.Brightness(image)
26
+ image = enhancer.enhance(BRIGHTNESS)
27
+ enhancer = ImageEnhance.Sharpness(image)
28
+ image = enhancer.enhance(SHARPNESS)
29
+ enhancer = ImageEnhance.Color(image)
30
+ image = enhancer.enhance(COLOR)
31
+ temp = final.calc_color_temperature(COLOR_TEMPERATURE)
32
+ az = []
33
+ for d in image.getdata():
34
+ az.append((int(d[0] * temp[0]), int(d[1] * temp[1]), int(d[2] * temp[2])))
35
+ image = Image.new('RGB', image.size)
36
+ image.putdata(az)
37
+ noise = cache.get_noise_from_cache(0, image.size[0], image.size[1])
38
+ image = Image.blend(image, noise, alpha=NOISE)
39
+ return image
40
+
41
+ def process(self, context, image: Image, processed: Image, *args, **kwargs):
42
+ print('-----FILTER VINTAGE-----')
43
+ return self.basic_process(processed)
44
+
45
+ def postprocess(self, context, *args, **kwargs):
46
+ pass
3-bmab/install.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+
3
+ import launch
4
+
5
+
6
+ def install_segmentanything():
7
+ launch.run_pip('install segment_anything')
8
+
9
+
10
+ def install_segmentanything_hq():
11
+ launch.run_pip('install segment_anything_hq')
12
+
13
+
14
+ def install_ultralytics():
15
+ launch.run_pip('install ultralytics')
16
+
17
+
18
+ def install_diffusers():
19
+ launch.run_pip('install diffusers==0.27.2')
20
+
21
+
22
+ try:
23
+ from basicsr.utils.download_util import load_file_from_url
24
+ except:
25
+ launch.run_pip('install basicsr==1.4.2')
26
+
27
+ required = {
28
+ ('segment_anything', install_segmentanything),
29
+ ('segment_anything_hq', install_segmentanything_hq),
30
+ ('ultralytics', install_ultralytics),
31
+ ('diffusers', install_diffusers)
32
+ }
33
+
34
+ for pack_name, func in required:
35
+ if not launch.is_installed(pack_name):
36
+ func()
37
+
38
+ '''
39
+ with open('ui-config.json', 'rt', encoding='UTF8') as f:
40
+ j = json.load(f)
41
+ print(json.dumps(j, indent=2))
42
+ '''
3-bmab/models/Put model file here.txt ADDED
File without changes
3-bmab/requirements.txt ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ segment_anything
2
+ segment_anything_hq
3
+ ultralytics
4
+ pillow
5
+
6
+ basicsr==1.4.2
7
+ kornia
8
+ omegaconf
9
+ numpy
3-bmab/resources/preset/3girls.json ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "enabled": true,
3
+ "contrast": 1.2,
4
+ "brightness": 0.9,
5
+ "sharpeness": 1.5,
6
+ "execute_before_img2img": true,
7
+ "edge_flavor_enabled": true,
8
+ "edge_low_threadhold": 50,
9
+ "edge_high_threadhold": 200,
10
+ "edge_strength": 0.5,
11
+ "resize_by_person_enabled": true,
12
+ "resize_by_person": 0.85,
13
+ "face_detailing_enabled": true,
14
+ "module_config": {
15
+ "multiple_face": [
16
+ {
17
+ "denoising_strength": 0.40,
18
+ "prompt": "smile, #!org!#",
19
+ "inpaint_full_res": true,
20
+ "inpaint_full_res_padding": 32,
21
+ "cfg_scale": 7
22
+ },
23
+ {
24
+ "denoising_strength": 0.40,
25
+ "prompt": "sad, #!org!#",
26
+ "inpaint_full_res": true,
27
+ "inpaint_full_res_padding": 32,
28
+ "cfg_scale": 7
29
+ },
30
+ {
31
+ "denoising_strength": 0.40,
32
+ "prompt": "sad, #!org!#",
33
+ "width": 512,
34
+ "height": 512,
35
+ "inpaint_full_res": true,
36
+ "inpaint_full_res_padding": 32,
37
+ "cfg_scale": 7
38
+ }
39
+ ],
40
+ "multiple_face_opt": {
41
+ "mask dilation": 4,
42
+ "limit": -1,
43
+ "order": "left"
44
+ }
45
+ }
46
+ }
3-bmab/resources/preset/Put config file here.txt ADDED
File without changes
3-bmab/resources/preset/example.json ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "enabled": true,
3
+ "contrast": 1.2,
4
+ "brightness": 0.9,
5
+ "sharpeness": 1.5,
6
+ "edge_flavor_enabled": true,
7
+ "edge_low_threadhold": 50,
8
+ "edge_high_threadhold": 200,
9
+ "edge_strength": 0.5,
10
+ "resize_by_person_enabled": true,
11
+ "resize_by_person": 0.85,
12
+ "face_detailing_enabled": true,
13
+ "module_config": {
14
+ "face_detailing": {
15
+ "denoising_strength": 0.40,
16
+ "prompt": "smile, #!org!#",
17
+ "inpaint_full_res": true,
18
+ "inpaint_full_res_padding": 32,
19
+ "cfg_scale": 7
20
+ },
21
+ "face_detailing_opt": {
22
+ "mask dilation": 4
23
+ }
24
+ }
25
+ }
3-bmab/resources/preset/example2.json ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "enabled": true,
3
+ "contrast": 1.2,
4
+ "brightness": 0.9,
5
+ "sharpeness": 1.5,
6
+ "edge_flavor_enabled": true,
7
+ "edge_low_threadhold": 50,
8
+ "edge_high_threadhold": 200,
9
+ "edge_strength": 0.5,
10
+ "resize_by_person_enabled": true,
11
+ "resize_by_person": 0.85,
12
+ "face_detailing_enabled": true,
13
+ "module_config": {
14
+ "face_detailing": {
15
+ "denoising_strength": 0.40,
16
+ "prompt": "<lora:koreanDollLikeness_v15:0.3>, (ulzzang-6500:0.4), #!org!#",
17
+ "width": 512,
18
+ "height": 512,
19
+ "inpaint_full_res": true,
20
+ "inpaint_full_res_padding": 32,
21
+ "cfg_scale": 7
22
+ },
23
+ "face_detailing_opt": {
24
+ "mask dilation": 4
25
+ }
26
+ }
27
+ }
3-bmab/resources/preset/hand.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "enabled": true,
3
+ "hand_detailing_enabled": true,
4
+ "module_config": {
5
+ "hand_detailing": {
6
+ "denoising_strength": 0.4,
7
+ "steps": 20,
8
+ "cfg_scale": 7,
9
+ "inpaint_full_res": 0,
10
+ "inpaint_full_res_padding": 32
11
+ },
12
+ "hand_detailing_opt": {
13
+ "scale": 2,
14
+ "mode": "inpaint",
15
+ "detailing method": "subframe"
16
+ }
17
+ }
18
+ }
3-bmab/resources/preset/hand2.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "enabled": true,
3
+ "hand_detailing_enabled": true,
4
+ "module_config": {
5
+ "hand_detailing": {
6
+ "denoising_strength": 0.5,
7
+ "prompt": "(good anatomy:1.2), (five fingers:1.3), pretty hands, detail hands, detail fingers, detail nails",
8
+ "negative_prompt": "(bad anatomy:1.2), (wrong anatomy:1.2), mutation, amputation, extra fingers, missing fingers, disconnected fingers",
9
+ "steps": 20,
10
+ "cfg_scale": 7,
11
+ "inpaint_full_res": 0,
12
+ "inpaint_full_res_padding": 32
13
+ },
14
+ "hand_detailing_opt": {
15
+ "scale": 4,
16
+ "mode": "inpaint",
17
+ "detailing method": "each hand"
18
+ }
19
+ }
20
+ }
3-bmab/scripts/__pycache__/sd_webui_bmab.cpython-310.pyc ADDED
Binary file (213 Bytes). View file
 
3-bmab/scripts/sd_webui_bmab.py ADDED
@@ -0,0 +1 @@
 
 
1
+ from sd_bmab.bmab import BmabExtScript
3-bmab/sd_bmab/__init__.py ADDED
File without changes
3-bmab/sd_bmab/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (158 Bytes). View file
 
3-bmab/sd_bmab/__pycache__/bmab.cpython-310.pyc ADDED
Binary file (4.19 kB). View file
 
3-bmab/sd_bmab/__pycache__/compat.cpython-310.pyc ADDED
Binary file (612 Bytes). View file
 
3-bmab/sd_bmab/__pycache__/constants.cpython-310.pyc ADDED
Binary file (1.69 kB). View file
 
3-bmab/sd_bmab/__pycache__/controlnet.cpython-310.pyc ADDED
Binary file (4.91 kB). View file
 
3-bmab/sd_bmab/__pycache__/parameters.cpython-310.pyc ADDED
Binary file (18 kB). View file
 
3-bmab/sd_bmab/__pycache__/ui.cpython-310.pyc ADDED
Binary file (39.7 kB). View file
 
3-bmab/sd_bmab/base/__init__.py ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ from sd_bmab.base.common import VAEMethodOverride
2
+ from sd_bmab.base.context import Context
3
+ from sd_bmab.base.detectorbase import DetectorBase
4
+ from sd_bmab.base.processorbase import ProcessorBase
5
+ from sd_bmab.base.process import process_img2img, process_txt2img, build_img2img, apply_extensions, process_img2img_with_controlnet
6
+ from sd_bmab.base.maskbase import MaskBase
7
+
3-bmab/sd_bmab/base/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (635 Bytes). View file
 
3-bmab/sd_bmab/base/__pycache__/cache.cpython-310.pyc ADDED
Binary file (1.38 kB). View file
 
3-bmab/sd_bmab/base/__pycache__/common.cpython-310.pyc ADDED
Binary file (1.97 kB). View file
 
3-bmab/sd_bmab/base/__pycache__/context.cpython-310.pyc ADDED
Binary file (5.17 kB). View file
 
3-bmab/sd_bmab/base/__pycache__/detectorbase.cpython-310.pyc ADDED
Binary file (1.03 kB). View file
 
3-bmab/sd_bmab/base/__pycache__/filter.cpython-310.pyc ADDED
Binary file (3.58 kB). View file
 
3-bmab/sd_bmab/base/__pycache__/maskbase.cpython-310.pyc ADDED
Binary file (1.19 kB). View file
 
3-bmab/sd_bmab/base/__pycache__/process.cpython-310.pyc ADDED
Binary file (5.62 kB). View file
 
3-bmab/sd_bmab/base/__pycache__/processorbase.cpython-310.pyc ADDED
Binary file (1.33 kB). View file
 
3-bmab/sd_bmab/base/cache.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from PIL import Image
3
+
4
+ import sd_bmab
5
+ from sd_bmab import util
6
+
7
+
8
+ def check_cache_dir(path):
9
+ if not os.path.exists(path):
10
+ os.mkdir(path)
11
+
12
+
13
+ def get_noise_from_cache(seed, width, height):
14
+ path = os.path.dirname(sd_bmab.__file__)
15
+ path = os.path.normpath(os.path.join(path, '../resources/cache'))
16
+ check_cache_dir(path)
17
+ cache_file = f'{path}/noise_{width}_{height}.png'
18
+ if os.path.isfile(cache_file):
19
+ return Image.open(cache_file)
20
+ img = util.generate_noise(seed, width, height)
21
+ img.save(cache_file)
22
+ return img
23
+
24
+
25
+ def get_image_from_cache(filename):
26
+ path = os.path.dirname(sd_bmab.__file__)
27
+ path = os.path.normpath(os.path.join(path, '../resources/cache'))
28
+ check_cache_dir(path)
29
+ full_path = os.path.join(path, filename)
30
+ if os.path.exists(full_path):
31
+ return Image.open(full_path)
32
+ return None
33
+
34
+
35
+ def put_image_to_cache(filename, image):
36
+ path = os.path.dirname(sd_bmab.__file__)
37
+ path = os.path.normpath(os.path.join(path, '../resources/cache'))
38
+ check_cache_dir(path)
39
+ full_path = os.path.join(path, filename)
40
+ image.save(full_path)
3-bmab/sd_bmab/base/common.py ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from modules import shared
2
+
3
+
4
+ class VAEMethodOverride:
5
+
6
+ def __init__(self, hiresfix=False) -> None:
7
+ super().__init__()
8
+ self.org_encode_method = None
9
+ self.org_decode_method = None
10
+ self.img2img_fix_steps = None
11
+ self.hiresfix = hiresfix
12
+
13
+ def __enter__(self):
14
+ if ('sd_vae_encode_method' in shared.opts.data) and shared.opts.bmab_detail_full:
15
+ self.encode_method = shared.opts.sd_vae_encode_method
16
+ self.decode_method = shared.opts.sd_vae_decode_method
17
+ shared.opts.sd_vae_encode_method = 'Full'
18
+ shared.opts.sd_vae_decode_method = 'Full'
19
+ if self.hiresfix and not shared.opts.img2img_fix_steps:
20
+ self.img2img_fix_steps = shared.opts.img2img_fix_steps
21
+ shared.opts.img2img_fix_steps = True
22
+
23
+ def __exit__(self, *args, **kwargs):
24
+ if ('sd_vae_encode_method' in shared.opts.data) and shared.opts.bmab_detail_full:
25
+ shared.opts.sd_vae_encode_method = self.encode_method
26
+ shared.opts.sd_vae_decode_method = self.decode_method
27
+ if self.img2img_fix_steps is not None:
28
+ shared.opts.img2img_fix_steps = self.img2img_fix_steps
29
+
30
+
31
+ class StopGeneration:
32
+
33
+ def __init__(self) -> None:
34
+ super().__init__()
35
+ if not hasattr(shared.state, 'stopping_generation'):
36
+ return
37
+ self.stopping_generation = shared.state.stopping_generation
38
+
39
+ def __enter__(self):
40
+ if not hasattr(shared.state, 'stopping_generation'):
41
+ return
42
+ shared.state.stopping_generation = False
43
+
44
+ def __exit__(self, *args, **kwargs):
45
+ if not hasattr(shared.state, 'stopping_generation'):
46
+ return
47
+ shared.state.stopping_generation = self.stopping_generation
3-bmab/sd_bmab/base/context.py ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from modules import shared
2
+ from modules.processing import StableDiffusionProcessingImg2Img
3
+
4
+ from sd_bmab.sd_override import StableDiffusionProcessingTxt2ImgOv, StableDiffusionProcessingImg2ImgOv
5
+ from sd_bmab import constants
6
+
7
+
8
+ class Context(object):
9
+ def __init__(self, s, p, a, idx, **kwargs) -> None:
10
+ super().__init__()
11
+
12
+ self.script = s
13
+ self.sdprocessing = p
14
+ self.args = a
15
+ self.index = idx
16
+ self.refiner = None
17
+ self.sd_model_name = None
18
+ self.sd_vae_name = None
19
+ self.container = {}
20
+
21
+ @staticmethod
22
+ def newContext(s, p, a, idx, **kwargs):
23
+ return Context(s, p, a, idx, **kwargs)
24
+
25
+ def get_current_prompt(self):
26
+ return self.sdprocessing.prompt
27
+
28
+ def get_prompt_by_index(self):
29
+ if self.sdprocessing.all_prompts is None or len(self.sdprocessing.all_prompts) <= self.index:
30
+ return self.sdprocessing.prompt
31
+ return self.sdprocessing.all_prompts[self.index]
32
+
33
+ def get_negative_prompt_by_index(self):
34
+ if self.sdprocessing.all_negative_prompts is None or len(self.sdprocessing.all_negative_prompts) <= self.index:
35
+ return self.sdprocessing.negative_prompt
36
+ return self.sdprocessing.all_negative_prompts[self.index]
37
+
38
+ def get_hires_prompt_by_index(self):
39
+ if self.sdprocessing.all_hr_prompts is None or len(self.sdprocessing.all_hr_prompts) <= self.index:
40
+ return self.sdprocessing.hr_prompt
41
+ return self.sdprocessing.all_hr_prompts[self.index]
42
+
43
+ def get_hires_negative_prompt_by_index(self):
44
+ if self.sdprocessing.all_hr_negative_prompts is None or len(self.sdprocessing.all_hr_negative_prompts) <= self.index:
45
+ return self.sdprocessing.hr_negative_prompt
46
+ return self.sdprocessing.all_hr_negative_prompts[self.index]
47
+
48
+ def get_seeds(self):
49
+ if self.sdprocessing.all_seeds is None or self.sdprocessing.all_subseeds is None:
50
+ return self.sdprocessing.seed, self.sdprocessing.subseed
51
+ if len(self.sdprocessing.all_seeds) <= self.index or len(self.sdprocessing.all_subseeds) <= self.index:
52
+ return self.sdprocessing.seed, self.sdprocessing.subseed
53
+ return self.sdprocessing.all_seeds[self.index], self.sdprocessing.all_subseeds[self.index]
54
+
55
+ def get_max_area(self):
56
+ if shared.opts.bmab_optimize_vram == 'low vram':
57
+ return 512 * 768
58
+ elif shared.opts.bmab_optimize_vram == 'med vram':
59
+ return self.sdprocessing.width * self.sdprocessing.height
60
+ if isinstance(self.sdprocessing, StableDiffusionProcessingTxt2ImgOv) and self.sdprocessing.enable_hr:
61
+ return self.sdprocessing.hr_upscale_to_x * self.sdprocessing.hr_upscale_to_y
62
+ return self.sdprocessing.width * self.sdprocessing.height
63
+
64
+ def add_generation_param(self, key: object, value: object) -> object:
65
+ self.sdprocessing.extra_generation_params[key] = value
66
+
67
+ def add_extra_image(self, image):
68
+ self.script.extra_image.append(image)
69
+
70
+ def with_refiner(self):
71
+ return self.args.get('refiner_enabled', False)
72
+
73
+ def is_refiner_context(self):
74
+ return self.refiner is not None
75
+
76
+ def is_hires_fix(self):
77
+ if isinstance(self.sdprocessing, StableDiffusionProcessingTxt2ImgOv) and self.sdprocessing.enable_hr:
78
+ return True
79
+ return False
80
+
81
+ def add_job(self, count=1):
82
+ shared.state.job_count += count
83
+ shared.state.sampling_step = 0
84
+ shared.state.current_image_sampling_step = 0
85
+
86
+ def is_img2img(self):
87
+ return isinstance(self.sdprocessing, StableDiffusionProcessingImg2ImgOv) or isinstance(self.sdprocessing, StableDiffusionProcessingImg2Img)
88
+
89
+ def is_txtimg(self):
90
+ return isinstance(self.sdprocessing, StableDiffusionProcessingTxt2ImgOv)
91
+
92
+ def save_and_apply_checkpoint(self, checkpoint, vae):
93
+ self.sd_model_name = checkpoint
94
+ self.sd_vae_name = vae
95
+
96
+ def restore_checkpoint(self):
97
+ self.sd_model_name = None
98
+ self.sd_vae_name = None
99
+
100
+ def apply_checkpoint(self, options):
101
+ if self.sd_model_name is not None and self.sd_model_name != constants.checkpoint_default:
102
+ override_settings = options.get('override_settings', {})
103
+ override_settings['sd_model_checkpoint'] = self.sd_model_name
104
+ options['override_settings'] = override_settings
105
+ if self.sd_vae_name is not None and self.sd_vae_name != constants.vae_default:
106
+ override_settings = options.get('override_settings', {})
107
+ override_settings['sd_vae'] = self.sd_vae_name
108
+ options['override_settings'] = override_settings
109
+
110
+ def save(self, key, value):
111
+ self.container[key] = value
112
+
113
+ def load(self, key):
114
+ return self.container.get(key)
3-bmab/sd_bmab/base/detectorbase.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from PIL import Image
2
+ from sd_bmab.base.context import Context
3
+
4
+
5
+ class DetectorBase(object):
6
+ def __init__(self, **kwargs) -> None:
7
+ super().__init__()
8
+
9
+ def target(self):
10
+ pass
11
+
12
+ def description(self):
13
+ pass
14
+
15
+ def predict(self, context: Context, image: Image):
16
+ pass