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
098d2fda
Commit
098d2fda
authored
May 11, 2023
by
Aarni Koskela
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reindent autocrop with 4 spaces
parent
48354525
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
102 additions
and
100 deletions
+102
-100
modules/textual_inversion/autocrop.py
modules/textual_inversion/autocrop.py
+102
-100
No files found.
modules/textual_inversion/autocrop.py
View file @
098d2fda
...
@@ -25,6 +25,7 @@ def crop_image(im, settings):
...
@@ -25,6 +25,7 @@ def crop_image(im, settings):
elif
is_portrait
(
settings
.
crop_width
,
settings
.
crop_height
):
elif
is_portrait
(
settings
.
crop_width
,
settings
.
crop_height
):
scale_by
=
settings
.
crop_height
/
im
.
height
scale_by
=
settings
.
crop_height
/
im
.
height
im
=
im
.
resize
((
int
(
im
.
width
*
scale_by
),
int
(
im
.
height
*
scale_by
)))
im
=
im
.
resize
((
int
(
im
.
width
*
scale_by
),
int
(
im
.
height
*
scale_by
)))
im_debug
=
im
.
copy
()
im_debug
=
im
.
copy
()
...
@@ -260,10 +261,11 @@ def image_entropy(im):
...
@@ -260,10 +261,11 @@ def image_entropy(im):
hist
=
hist
[
hist
>
0
]
hist
=
hist
[
hist
>
0
]
return
-
np
.
log2
(
hist
/
hist
.
sum
())
.
sum
()
return
-
np
.
log2
(
hist
/
hist
.
sum
())
.
sum
()
def
centroid
(
pois
):
def
centroid
(
pois
):
x
=
[
poi
.
x
for
poi
in
pois
]
x
=
[
poi
.
x
for
poi
in
pois
]
y
=
[
poi
.
y
for
poi
in
pois
]
y
=
[
poi
.
y
for
poi
in
pois
]
return
PointOfInterest
(
sum
(
x
)
/
len
(
pois
),
sum
(
y
)
/
len
(
pois
))
return
PointOfInterest
(
sum
(
x
)
/
len
(
pois
),
sum
(
y
)
/
len
(
pois
))
def
poi_average
(
pois
,
settings
):
def
poi_average
(
pois
,
settings
):
...
@@ -320,10 +322,10 @@ class PointOfInterest:
...
@@ -320,10 +322,10 @@ class PointOfInterest:
def
bounding
(
self
,
size
):
def
bounding
(
self
,
size
):
return
[
return
[
self
.
x
-
size
//
2
,
self
.
x
-
size
//
2
,
self
.
y
-
size
//
2
,
self
.
y
-
size
//
2
,
self
.
x
+
size
//
2
,
self
.
x
+
size
//
2
,
self
.
y
+
size
//
2
self
.
y
+
size
//
2
]
]
...
...
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