Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
S
stable-diffusion-webui
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
stable-diffusion-webui
Commits
df0c5ea2
Commit
df0c5ea2
authored
Oct 26, 2022
by
captin411
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update default weights
parent
54f0c148
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
autocrop.py
modules/textual_inversion/autocrop.py
+8
-8
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):
...
@@ -71,9 +71,9 @@ def crop_image(im, settings):
return
results
return
results
def
focal_point
(
im
,
settings
):
def
focal_point
(
im
,
settings
):
corner_points
=
image_corner_points
(
im
,
settings
)
corner_points
=
image_corner_points
(
im
,
settings
)
if
settings
.
corner_points_weight
>
0
else
[]
entropy_points
=
image_entropy_points
(
im
,
settings
)
entropy_points
=
image_entropy_points
(
im
,
settings
)
if
settings
.
entropy_points_weight
>
0
else
[]
face_points
=
image_face_points
(
im
,
settings
)
face_points
=
image_face_points
(
im
,
settings
)
if
settings
.
face_points_weight
>
0
else
[]
pois
=
[]
pois
=
[]
...
@@ -144,7 +144,7 @@ def image_face_points(im, settings):
...
@@ -144,7 +144,7 @@ def image_face_points(im, settings):
settings
.
dnn_model_path
,
settings
.
dnn_model_path
,
""
,
""
,
(
im
.
width
,
im
.
height
),
(
im
.
width
,
im
.
height
),
0.
8
,
# score threshold
0.
9
,
# score threshold
0.3
,
# nms threshold
0.3
,
# nms threshold
5000
# keep top k before nms
5000
# keep top k before nms
)
)
...
@@ -159,7 +159,7 @@ def image_face_points(im, settings):
...
@@ -159,7 +159,7 @@ def image_face_points(im, settings):
results
.
append
(
results
.
append
(
PointOfInterest
(
PointOfInterest
(
int
(
x
+
(
w
*
0.5
)),
# face focus left/right is center
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
,
size
=
w
,
weight
=
1
/
len
(
faces
[
1
])
weight
=
1
/
len
(
faces
[
1
])
)
)
...
@@ -207,7 +207,7 @@ def image_corner_points(im, settings):
...
@@ -207,7 +207,7 @@ def image_corner_points(im, settings):
np_im
,
np_im
,
maxCorners
=
100
,
maxCorners
=
100
,
qualityLevel
=
0.04
,
qualityLevel
=
0.04
,
minDistance
=
min
(
grayscale
.
width
,
grayscale
.
height
)
*
0.0
3
,
minDistance
=
min
(
grayscale
.
width
,
grayscale
.
height
)
*
0.0
6
,
useHarrisDetector
=
False
,
useHarrisDetector
=
False
,
)
)
...
@@ -256,8 +256,8 @@ def image_entropy_points(im, settings):
...
@@ -256,8 +256,8 @@ def image_entropy_points(im, settings):
def
image_entropy
(
im
):
def
image_entropy
(
im
):
# greyscale image entropy
# greyscale image entropy
band
=
np
.
asarray
(
im
.
convert
(
"L"
))
#
band = np.asarray(im.convert("L"))
#
band = np.asarray(im.convert("1"), dtype=np.uint8)
band
=
np
.
asarray
(
im
.
convert
(
"1"
),
dtype
=
np
.
uint8
)
hist
,
_
=
np
.
histogram
(
band
,
bins
=
range
(
0
,
256
))
hist
,
_
=
np
.
histogram
(
band
,
bins
=
range
(
0
,
256
))
hist
=
hist
[
hist
>
0
]
hist
=
hist
[
hist
>
0
]
return
-
np
.
log2
(
hist
/
hist
.
sum
())
.
sum
()
return
-
np
.
log2
(
hist
/
hist
.
sum
())
.
sum
()
...
...
modules/ui.py
View file @
df0c5ea2
...
@@ -1270,7 +1270,7 @@ def create_ui(wrap_gradio_gpu_call):
...
@@ -1270,7 +1270,7 @@ def create_ui(wrap_gradio_gpu_call):
with
gr
.
Row
(
visible
=
False
)
as
process_focal_crop_row
:
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_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_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'
)
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