Commit cc1bb604 authored by chenych's avatar chenych
Browse files

Modify img_path and model_path in test_wider_face.py

parent 35e22e0a
...@@ -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 数据集测试
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment