Fetch the repository succeeded.
import os
import shutil
from pyicdartools import TL_iou, rrc_evaluation_funcs
def compute_hmean(submit_file_path):
print('EAST <==> Evaluation <==> Compute Hmean <==> Begin')
basename = os.path.basename(submit_file_path)
assert basename == 'submit.zip', 'There is no submit.zip'
dirname = os.path.dirname(submit_file_path)
gt_file_path = os.path.join(dirname, 'gt.zip')
assert os.path.isfile(gt_file_path), 'There is no gt.zip'
log_file_path = os.path.join(dirname, 'log_epoch_hmean.txt')
if not os.path.isfile(log_file_path):
os.mknod(log_file_path)
result_dir_path = os.path.join(dirname, 'result')
try:
shutil.rmtree(result_dir_path)
except:
pass
os.mkdir(result_dir_path)
resDict = rrc_evaluation_funcs.main_evaluation({'g': gt_file_path,'s': submit_file_path,'o':result_dir_path},TL_iou.default_evaluation_params, TL_iou.validate_data, TL_iou.evaluate_method)
print(resDict)
recall = resDict['method']['recall']
precision = resDict['method']['precision']
hmean = resDict['method']['hmean']
print('EAST <==> Evaluation <==> Precision:{:.2f} Recall:{:.2f} Hmean{:.2f} <==> Done'.format(precision, recall, hmean))
with open(log_file_path, 'a') as f:
f.write('EAST <==> Evaluation <==> Precision:{:.2f} Recall:{:.2f} Hmean{:.2f} <==> Done\n'.format(precision, recall, hmean))
return hmean
if __name__ == '__main__':
submit_file_path = '/home/djsong/update/result/submit.zip'
hmean = compute_hmean(submit_file_path)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。