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
CenterFace_pytorch
Commits
cc1bb604
Commit
cc1bb604
authored
Nov 30, 2023
by
chenych
Browse files
Modify img_path and model_path in test_wider_face.py
parent
35e22e0a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
src/test_wider_face.py
src/test_wider_face.py
+11
-4
No files found.
src/test_wider_face.py
View file @
cc1bb604
...
@@ -4,6 +4,7 @@ import cv2
...
@@ -4,6 +4,7 @@ import cv2
path
=
os
.
path
.
dirname
(
__file__
)
path
=
os
.
path
.
dirname
(
__file__
)
CENTERNET_PATH
=
os
.
path
.
join
(
path
,
'../src/lib'
)
CENTERNET_PATH
=
os
.
path
.
join
(
path
,
'../src/lib'
)
sys
.
path
.
insert
(
0
,
CENTERNET_PATH
)
sys
.
path
.
insert
(
0
,
CENTERNET_PATH
)
from
opts_pose
import
opts
from
opts_pose
import
opts
...
@@ -12,14 +13,14 @@ from detectors.detector_factory import detector_factory
...
@@ -12,14 +13,14 @@ from detectors.detector_factory import detector_factory
import
scipy.io
as
sio
import
scipy.io
as
sio
def
test_img
(
model_path
,
debug
,
threshold
=
0.4
):
def
test_img
(
model_path
,
img_path
,
debug
,
threshold
=
0.4
):
TASK
=
'multi_pose'
TASK
=
'multi_pose'
input_h
,
intput_w
=
800
,
800
input_h
,
intput_w
=
800
,
800
opt
=
opts
().
init
(
'--task {} --load_model {} --debug {} --input_h {} --input_w {}'
.
format
(
opt
=
opts
().
init
(
'--task {} --load_model {} --debug {} --input_h {} --input_w {}'
.
format
(
TASK
,
model_path
,
debug
,
intput_w
,
input_h
).
split
(
' '
))
TASK
,
model_path
,
debug
,
intput_w
,
input_h
).
split
(
' '
))
detector
=
detector_factory
[
opt
.
task
](
opt
)
detector
=
detector_factory
[
opt
.
task
](
opt
)
img_path
=
'../test_img/000388.jpg'
ori_img
=
cv2
.
imread
(
img_path
,
-
1
)
ori_img
=
cv2
.
imread
(
img_path
,
-
1
)
res
=
detector
.
run
(
ori_img
)[
'results'
]
res
=
detector
.
run
(
ori_img
)[
'results'
]
draw_img
=
ori_img
.
copy
()
draw_img
=
ori_img
.
copy
()
...
@@ -112,9 +113,15 @@ if __name__ == '__main__':
...
@@ -112,9 +113,15 @@ if __name__ == '__main__':
debug = -1 # return the result image with draw
debug = -1 # return the result image with draw
'''
'''
debug
=
0
debug
=
0
model_path
=
'../models/model_best.pth'
# or your model path
curr_path
=
os
.
getcwd
()
model_path
=
os
.
path
.
join
(
curr_path
,
'models/model_best.pth'
)
# or your model path
img_path
=
os
.
path
.
join
(
curr_path
,
"test_img/000388.jpg"
)
# or your img path
if
'src'
in
curr_path
:
model_path
=
os
.
path
.
join
(
curr_path
,
'../models/model_best.pth'
)
# or your model path
img_path
=
os
.
path
.
join
(
curr_path
,
"../test_img/000388.jpg"
)
# or your img path
# 单图测试
# 单图测试
test_img
(
model_path
,
debug
)
test_img
(
model_path
,
img_path
,
debug
)
# 视频测试
# 视频测试
# test_vedio(model_path, debug)
# test_vedio(model_path, debug)
# WIDER_val 数据集测试
# WIDER_val 数据集测试
...
...
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