Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
renzhc
diffusers_dcu
Commits
fd0f4695
Unverified
Commit
fd0f4695
authored
Feb 26, 2024
by
jiqing-feng
Committed by
GitHub
Feb 26, 2024
Browse files
Resize image before crop (#7095)
resize first Co-authored-by:
Sayak Paul
<
spsayakpaul@gmail.com
>
parent
ae84e405
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
examples/textual_inversion/textual_inversion_sdxl.py
examples/textual_inversion/textual_inversion_sdxl.py
+2
-1
No files found.
examples/textual_inversion/textual_inversion_sdxl.py
View file @
fd0f4695
...
...
@@ -546,6 +546,8 @@ class TextualInversionDataset(Dataset):
example
[
"original_size"
]
=
(
image
.
height
,
image
.
width
)
image
=
image
.
resize
((
self
.
size
,
self
.
size
),
resample
=
self
.
interpolation
)
if
self
.
center_crop
:
y1
=
max
(
0
,
int
(
round
((
image
.
height
-
self
.
size
)
/
2.0
)))
x1
=
max
(
0
,
int
(
round
((
image
.
width
-
self
.
size
)
/
2.0
)))
...
...
@@ -576,7 +578,6 @@ class TextualInversionDataset(Dataset):
img
=
np
.
array
(
image
).
astype
(
np
.
uint8
)
image
=
Image
.
fromarray
(
img
)
image
=
image
.
resize
((
self
.
size
,
self
.
size
),
resample
=
self
.
interpolation
)
image
=
self
.
flip_transform
(
image
)
image
=
np
.
array
(
image
).
astype
(
np
.
uint8
)
...
...
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