Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
Stable Diffusion Webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
novelai-storage
Stable Diffusion Webui
Commits
2985b317
Commit
2985b317
authored
Jan 19, 2023
by
dan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix of fix
parent
18a09c7e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
modules/textual_inversion/preprocess.py
modules/textual_inversion/preprocess.py
+2
-2
No files found.
modules/textual_inversion/preprocess.py
View file @
2985b317
...
...
@@ -124,12 +124,12 @@ def center_crop(image: Image, w: int, h: int):
def
multicrop_pic
(
image
:
Image
,
mindim
,
maxdim
,
minarea
,
maxarea
,
objective
,
threshold
):
iw
,
ih
=
image
.
size
err
=
lambda
w
,
h
:
1
-
(
lambda
x
:
x
if
x
<
1
else
1
/
x
)(
iw
/
ih
/
(
w
/
h
))
w
,
h
=
max
(((
w
,
h
)
for
w
in
range
(
mindim
,
maxdim
+
1
,
64
)
for
h
in
range
(
mindim
,
maxdim
+
1
,
64
)
wh
=
max
(((
w
,
h
)
for
w
in
range
(
mindim
,
maxdim
+
1
,
64
)
for
h
in
range
(
mindim
,
maxdim
+
1
,
64
)
if
minarea
<=
w
*
h
<=
maxarea
and
err
(
w
,
h
)
<=
threshold
),
key
=
lambda
wh
:
(
wh
[
0
]
*
wh
[
1
],
-
err
(
*
wh
))[::
1
if
objective
==
'Maximize area'
else
-
1
],
default
=
None
)
return
center_crop
(
image
,
w
,
h
)
return
wh
and
center_crop
(
image
,
*
w
h
)
def
preprocess_work
(
process_src
,
process_dst
,
process_width
,
process_height
,
preprocess_txt_action
,
process_flip
,
process_split
,
process_caption
,
process_caption_deepbooru
=
False
,
split_threshold
=
0.5
,
overlap_ratio
=
0.2
,
process_focal_crop
=
False
,
process_focal_crop_face_weight
=
0.9
,
process_focal_crop_entropy_weight
=
0.3
,
process_focal_crop_edges_weight
=
0.5
,
process_focal_crop_debug
=
False
,
process_multicrop
=
None
,
process_multicrop_mindim
=
None
,
process_multicrop_maxdim
=
None
,
process_multicrop_minarea
=
None
,
process_multicrop_maxarea
=
None
,
process_multicrop_objective
=
None
,
process_multicrop_threshold
=
None
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment