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
df0c5ea2
Commit
df0c5ea2
authored
Oct 25, 2022
by
captin411
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update default weights
parent
54f0c148
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
modules/textual_inversion/autocrop.py
modules/textual_inversion/autocrop.py
+8
-8
modules/ui.py
modules/ui.py
+1
-1
No files found.
modules/textual_inversion/autocrop.py
View file @
df0c5ea2
...
...
@@ -71,9 +71,9 @@ def crop_image(im, settings):
return
results
def
focal_point
(
im
,
settings
):
corner_points
=
image_corner_points
(
im
,
settings
)
entropy_points
=
image_entropy_points
(
im
,
settings
)
face_points
=
image_face_points
(
im
,
settings
)
corner_points
=
image_corner_points
(
im
,
settings
)
if
settings
.
corner_points_weight
>
0
else
[]
entropy_points
=
image_entropy_points
(
im
,
settings
)
if
settings
.
entropy_points_weight
>
0
else
[]
face_points
=
image_face_points
(
im
,
settings
)
if
settings
.
face_points_weight
>
0
else
[]
pois
=
[]
...
...
@@ -144,7 +144,7 @@ def image_face_points(im, settings):
settings
.
dnn_model_path
,
""
,
(
im
.
width
,
im
.
height
),
0.
8
,
# score threshold
0.
9
,
# score threshold
0.3
,
# nms threshold
5000
# keep top k before nms
)
...
...
@@ -159,7 +159,7 @@ def image_face_points(im, settings):
results
.
append
(
PointOfInterest
(
int
(
x
+
(
w
*
0.5
)),
# face focus left/right is center
int
(
y
+
(
h
*
0
)),
# face focus up/down is close to the top of the head
int
(
y
+
(
h
*
0
.33
)),
# face focus up/down is close to the top of the head
size
=
w
,
weight
=
1
/
len
(
faces
[
1
])
)
...
...
@@ -207,7 +207,7 @@ def image_corner_points(im, settings):
np_im
,
maxCorners
=
100
,
qualityLevel
=
0.04
,
minDistance
=
min
(
grayscale
.
width
,
grayscale
.
height
)
*
0.0
3
,
minDistance
=
min
(
grayscale
.
width
,
grayscale
.
height
)
*
0.0
6
,
useHarrisDetector
=
False
,
)
...
...
@@ -256,8 +256,8 @@ def image_entropy_points(im, settings):
def
image_entropy
(
im
):
# greyscale image entropy
band
=
np
.
asarray
(
im
.
convert
(
"L"
))
#
band = np.asarray(im.convert("1"), dtype=np.uint8)
#
band = np.asarray(im.convert("L"))
band
=
np
.
asarray
(
im
.
convert
(
"1"
),
dtype
=
np
.
uint8
)
hist
,
_
=
np
.
histogram
(
band
,
bins
=
range
(
0
,
256
))
hist
=
hist
[
hist
>
0
]
return
-
np
.
log2
(
hist
/
hist
.
sum
())
.
sum
()
...
...
modules/ui.py
View file @
df0c5ea2
...
...
@@ -1270,7 +1270,7 @@ def create_ui(wrap_gradio_gpu_call):
with
gr
.
Row
(
visible
=
False
)
as
process_focal_crop_row
:
process_focal_crop_face_weight
=
gr
.
Slider
(
label
=
'Focal point face weight'
,
value
=
0.9
,
minimum
=
0.0
,
maximum
=
1.0
,
step
=
0.05
)
process_focal_crop_entropy_weight
=
gr
.
Slider
(
label
=
'Focal point entropy weight'
,
value
=
0.
3
,
minimum
=
0.0
,
maximum
=
1.0
,
step
=
0.05
)
process_focal_crop_entropy_weight
=
gr
.
Slider
(
label
=
'Focal point entropy weight'
,
value
=
0.
15
,
minimum
=
0.0
,
maximum
=
1.0
,
step
=
0.05
)
process_focal_crop_edges_weight
=
gr
.
Slider
(
label
=
'Focal point edges weight'
,
value
=
0.5
,
minimum
=
0.0
,
maximum
=
1.0
,
step
=
0.05
)
process_focal_crop_debug
=
gr
.
Checkbox
(
label
=
'Create debug image'
)
...
...
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