#!/usr/bin/env python # -*- coding: utf-8 -*- ################################################################## # # Copyright (c) 2023 CICV, Inc. All Rights Reserved # ################################################################## """ @Authors: yangzihao(yangzihao@china-icv.cn) @Data: 2024/04/21 @Last Modified: 2024/04/21 @Summary: Evaluation entrance """ import os import sys import time from single_case_eval import single_case_eval from common import get_subfolders_name # from pjirebot_evaluate_csv import parsebag import log if __name__ == "__main__": from warnings import simplefilter # simplefilter(action="ignore", category=FutureWarning) simplefilter(action="ignore") # input_dict = { # "data_path": dataPath, # "resultPath": resultPath, # "trackPath": trackPath # } # if len(sys.argv) >= 3: # dataPath = sys.argv[1] # resultPath = sys.argv[2] # trackPath = sys.argv[3] # if len(sys.argv) > 4: # case_name = sys.argv[4] # else: # case_name = dataPath.split('/')[-1] # .split('.')[0] # # # logFileName = f'{resultPath}/log.log' # logFileName = os.path.join(resultPath, 'log.log') # log.setup_logger(logFileName) # logger = log.get_logger() # # if not os.path.exists(dataPath): # print('Invalid dataPath!') # logger.error(f"[case:{case_name}] SINGLE_CASE_EVAL: Invalid dataPath!") # sys.exit(-1) # else: # try: # logger.info(f"[case:{case_name}] SINGLE_CASE_EVAL: Start evaluating:") # print("SINGLE_CASE_EVAL程序开始运行:") # configPath = r"./config.json" # print( # f" configPath: {configPath},\n dataPath: {dataPath},\n resultPath: {resultPath},\n trackPath: {trackPath}") # t1 = time.time() # parsebag(dataPath, resultPath) # EgoState_pji.csv存放resultPath下 # single_case_eval(configPath, resultPath, resultPath, trackPath, case_name) # t2 = time.time() # print(f"程序结束,执行时间:{int(t2 - t1)} s") # logger.info(f"[case:{case_name}] SINGLE_CASE_EVAL: End.") # sys.exit(0) # except Exception as e: # print("异常,退出...") # print(repr(e)) # sys.exit(-1) # else: # print('No enough arguments!') # sys.exit(-1) # dataPath = './bag/2024-04-22-08-48-30_obstacledetection_30.bag' # dataPath = './task/case0613' # dataPath = './task/case0730' # dataPath = './task/test_0807-1' # dataPath = './task/test_0807-2' # dataPath = './task/test_0807-3' dataPath = './task/test_0807-4' # resultPath = './result/integration' resultPath = dataPath trackPath = f'{dataPath}/trajectory.png' logFileName = f'{resultPath}/log.log' log.setup_logger(logFileName) # 初始化或配置一个日志记录器,以便将日志信息输出到指定的文件(logFileName) logger = log.get_logger() case_name = dataPath.split('/')[-1].split('.')[0] # case_name = os.path.basename(os.path.dirname(dataPath)) if not os.path.exists(dataPath): print('Invalid dataPath!') logger.error(f"[case:{case_name}] SINGLE_CASE_EVAL: Invalid dataPath!") sys.exit(-1) else: try: logger.info(f"[case:{case_name}] SINGLE_CASE_EVAL: Start evaluating:") print("SINGLE_CASE_EVAL程序开始运行:") # configPath = r"./config_comfort.json" # configPath = r"./config_safe.json" # configPath = r"./config_accurate.json" configPath = r"./config.json" print(f" configPath: {configPath},\n resultPath: {resultPath}") t1 = time.time() # parsebag(dataPath, resultPath) single_case_eval(configPath, resultPath, resultPath, trackPath, case_name) t2 = time.time() print(f"程序结束,执行时间:{int(t2 - t1)} s") logger.info(f"[case:{case_name}] SINGLE_CASE_EVAL: End.") sys.exit(0) except Exception as e: print("异常,退出...") print(repr(e)) sys.exit(-1)