本文整理匯總了Python中model.utils.config.get_output_dir方法的典型用法代碼示例。如果您正苦於以下問題:Python config.get_output_dir方法的具體用法?Python config.get_output_dir怎麽用?Python config.get_output_dir使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類model.utils.config
的用法示例。
在下文中一共展示了config.get_output_dir方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_net
# 需要導入模塊: from model.utils import config [as 別名]
# 或者: from model.utils.config import get_output_dir [as 別名]
def test_net(net, imdb, device,thresh=0.5, visualize=False,output_path=None):
"""
Testing the SSH network on a dataset
:param net: The trained network
:param imdb: The test imdb
:param thresh: Detections with a probability less than this threshold are ignored
:param visualize: Whether to visualize the detections
:param output_path: Output directory
"""
print('Evaluating on {}'.format(imdb.name))
output_dir = get_output_dir(imdb_name=imdb.name, net_name="SSH pytorch", output_dir=output_path)
timers = {'detect': Timer(), 'misc': Timer()}
dets = [[[] for _ in range(len(imdb))] for _ in range(imdb.num_classes)]
pyramid = True if len(cfg.TEST.SCALES) > 1 else False
for i in range(len(imdb)):
im_path = imdb.image_path_at(i)
dets[1][i], detect_time = detect(net, im_path, device, thresh, visualize=visualize,
timers=timers, pyramid=pyramid,visualization_folder=arg.visualize_folder)
print('\r{:d}/{:d} detect-time: {:.3f}s, misc-time:{:.3f}s'
.format(i + 1, len(imdb), timers['detect'].average_time,
timers['misc'].average_time), end='')
print('\n', end='')
# Evaluate the detections
print('Evaluating detections')
imdb.evaluate_detections(all_boxes=dets, output_dir=output_dir, method_name="SSH pytorch")
print('All Done!')