14:32
Traceback (most recent call last):
File "log_analysis.py", line 145, in
segmentations = select_top(segmentations)
File "log_analysis.py", line 136, in select_top
tmp = {'label':classes[lab], 'score':nms_in[i][2], 'segment': nms_in[i][0:2]}
KeyError: 4
usage: get_detection_performance.py [-h] [--subset SUBSET]
[--tiou_thresholds TIOU_THRESHOLDS]
[--verbose VERBOSE]
[--check_status CHECK_STATUS]
ground_truth_filename prediction_filename
get_detection_performance.py: error: unrecognized arguments: Detection/R-C3D/experiments/OMRON/test/Evaluation/data/OMRON_dataJson_skeleton.json /home/nanashi/zwq/Temporal Action Detection/R-C3D/experiments/OMRON/test/results.json
在shell命令中注释,debug
KeyError: 4
python KeyError: 4_jacke121的专栏-CSDN博客
dict字典
Python中字典(dict)的用法详解小白努力-CSDN博客
如果用字典里没有的键访问数据,会输出错误如下:
问题出自:
tmp = {'label':classes[lab], 'score':nms_in[i][2], 'segment': nms_in[i][0:2]}
注释debug缩小范围
classes[lab]
在后面输出classes字典,查看里面内容。
(py27) nanashi@allez:~/zwq/Temporal Action Detection/R-C3D/experiments/OMRON/test$ python log_analysis.py test_log.txt
{0: 'Background', 1: u'Grasp', 2: u'Adjustment', 3: u'Transportation'}
【Python】append()方法_点墨漫雪的博客-CSDN博客_append()方法
list(set())的作用_syn_40609919的博客-CSDN博客
list(set())的功能是:对原列表去重并按从小到大排序。
.iteritems()
python字典的遍历,items()和iteritems()用法_艾宾浩斯的美酒的博客-CSDN博客_iteritems
发现是这个OMRON_dataJson_skeleton.json里面没有Inspection动作,少了一个分类。
2021年3月16日20点53分
修改log_analysis.py文件,在字典里添加4, u'Inspection'
继续
在脚本里运行到get_detection_performance.py时后报错:
.py: error: too few arguments
python - Argparse库使用报错too few arguments - IT屋-程序员软件开发技术分享社区 (it1352.com)
import argparse
import numpy as np
from eval_detection import ANETdetection
def main(ground_truth_filename, prediction_filename,
subset='validation', tiou_thresholds=np.linspace(0.5, 0.95, 10),
verbose=True, check_status=True):
anet_detection = ANETdetection(ground_truth_filename, prediction_filename,
subset=subset, tiou_thresholds=tiou_thresholds,
verbose=verbose, check_status=True)
anet_detection.evaluate()
def parse_input():
description = ('This script allows you to evaluate the ActivityNet '
'detection task which is intended to evaluate the ability '
'of algorithms to temporally localize activities in '
'untrimmed video sequences.')
p = argparse.ArgumentParser(description=description)
p.add_argument('ground_truth_filename',
help='Full path to json file containing the ground truth.')
p.add_argument('prediction_filename',
help='Full path to json file containing the predictions.')
p.add_argument('--subset', default='validation',
help=('String indicating subset to evaluate: '
'(training, validation)'))
p.add_argument('--tiou_thresholds', type=float, default=np.linspace(0.5, 0.5, 1), # (0.5, 0.5, 1) means IOU=0.5. If you want to use 0.6, it should be changed to (0.6, 0.6,1). If change it to (0.5,0.9,6), the result will be average result when IOU equals to 0.5, 0.6, 0.7, 0.8, 0.9 seperately.
help='Temporal intersection over union threshold.')
p.add_argument('--verbose', type=bool, default=True)
p.add_argument('--check_status', type=bool, default=True)
return p.parse_args()
if __name__ == '__main__':
args = parse_input()
main(**vars(args))
add_argument() 的使用方法_lly_zy的博客-CSDN博客
21:17
python脚本中error: unrecognized arguments: True错误_panda_33的博客-CSDN博客
fg_name : ../../frames/validation/OMRON_108_0677_T_skeleton
fg_name : ../../frames/validation/OMRON_108_1118_G_skeleton
fg_name : ../../frames/validation/OMRON_108_0988_G_skeleton
usage: get_detection_performance.py [-h] [--subset SUBSET]
[--tiou_thresholds TIOU_THRESHOLDS]
[--verbose VERBOSE]
[--check_status CHECK_STATUS]
ground_truth_filename prediction_filename
get_detection_performance.py: error: unrecognized arguments: Detection/R-C3D/experiments/OMRON/test/Evaluation/data/OMRON_dataJson_skeleton.json /home/nanashi/zwq/Temporal Action Detection/R-C3D/experiments/OMRON/test/results.json
把test的脚本,后半部分抠出来,单独出一个脚本,
在上面调试。
Shell脚本定义变量和重新赋值linux shell脚本之家 (jb51.net)
修改脚本中的文件名,把空格换成下划线。