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
ModelZoo
DiffBIR_pytorch
Commits
56987fa1
"vscode:/vscode.git/clone" did not exist on "5fa8050d80db763d72ea0ba3a2c68d418bd8821b"
Commit
56987fa1
authored
Sep 16, 2023
by
Masahide Okada
Browse files
fixed output path structure
parent
2ec23e4b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
inference_face.py
inference_face.py
+8
-6
No files found.
inference_face.py
View file @
56987fa1
...
@@ -167,10 +167,12 @@ def main() -> None:
...
@@ -167,10 +167,12 @@ def main() -> None:
face_helper
.
get_face_landmarks_5
(
only_center_face
=
args
.
only_center_face
,
resize
=
640
,
eye_dist_threshold
=
5
)
face_helper
.
get_face_landmarks_5
(
only_center_face
=
args
.
only_center_face
,
resize
=
640
,
eye_dist_threshold
=
5
)
face_helper
.
align_warp_face
()
face_helper
.
align_warp_face
()
cropped_face_dir
=
os
.
path
.
join
(
args
.
output
,
'cropped_faces'
)
parent_dir
,
img_basename
,
_
=
get_file_name_parts
(
file_path
)
restored_face_dir
=
os
.
path
.
join
(
args
.
output
,
'restored_faces'
)
rel_parent_dir
=
os
.
path
.
relpath
(
parent_dir
,
args
.
input
)
restored_img_dir
=
os
.
path
.
join
(
args
.
output
,
'restored_imgs'
)
output_parent_dir
=
os
.
path
.
join
(
args
.
output
,
rel_parent_dir
)
_
,
img_basename
,
_
=
get_file_name_parts
(
file_path
)
cropped_face_dir
=
os
.
path
.
join
(
output_parent_dir
,
'cropped_faces'
)
restored_face_dir
=
os
.
path
.
join
(
output_parent_dir
,
'restored_faces'
)
restored_img_dir
=
os
.
path
.
join
(
output_parent_dir
,
'restored_imgs'
)
if
not
args
.
has_aligned
:
if
not
args
.
has_aligned
:
os
.
makedirs
(
cropped_face_dir
,
exist_ok
=
True
)
os
.
makedirs
(
cropped_face_dir
,
exist_ok
=
True
)
os
.
makedirs
(
restored_img_dir
,
exist_ok
=
True
)
os
.
makedirs
(
restored_img_dir
,
exist_ok
=
True
)
...
@@ -252,7 +254,7 @@ def main() -> None:
...
@@ -252,7 +254,7 @@ def main() -> None:
restored_img
=
restored_img
[:
lq_resized
.
height
,
:
lq_resized
.
width
,
:]
restored_img
=
restored_img
[:
lq_resized
.
height
,
:
lq_resized
.
width
,
:]
# save restored image
# save restored image
Image
.
fromarray
(
restored_img
).
resize
(
lq
.
size
,
Image
.
LANCZOS
).
convert
(
"RGB"
).
save
(
restored_img_path
)
Image
.
fromarray
(
restored_img
).
resize
(
lq
.
size
,
Image
.
LANCZOS
).
convert
(
"RGB"
).
save
(
restored_img_path
)
print
(
f
"Face image
{
basename
}
saved to
{
args
.
output
}
"
)
print
(
f
"Face image
{
basename
}
saved to
{
output
_parent_dir
}
"
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
...
...
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