123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- #!/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")
-
-
- 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.txt'
- logFileName = os.path.join(resultPath, 'log.txt')
- 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'
- # resultPath = './result/integration'
- #
- # logFileName = f'{resultPath}/log.txt'
- # log.setup_logger(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.json"
- # print(f" configPath: {configPath},\n resultPath: {resultPath}")
- # t1 = time.time()
- # parsebag(dataPath, resultPath)
- # single_case_eval(configPath, resultPath, 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)
|