https://blog.csdn.net/qq_33350808/article/details/83178002#commentBox
这个大佬写的非常全
主要是把自己需要的的指令写下来,省的下次还得自己编辑
一、
./darknet detector valid /home/shs/darknet/cfg/voc.data /home/shs/darknet/cfg/yolov3-voc.cfg yolov3-voc_10000.weights -out ""
在result文件夹生成car.txt文件,
这里还得需要重命名为comp4_det_test_car.txt
二、
在刚才大佬的评论区后面有百度云,下载下来reval_voc_py3.py和voc_eval_py3.py,避免每次下载直接贴大佬代码
reval_voc_py3.py
#!/usr/bin/env python
import os, sys, argparse
import numpy as np
import _pickle as cPickle
#import cPickle
from voc_eval_py3 import voc_eval
def parse_args():
"""
Parse input arguments
"""
parser = argparse.ArgumentParser(description='Re-evaluate results')
parser.add_argument('output_dir', nargs=1, help='results directory',
type=str)
parser.add_argument('--voc_dir', dest='voc_dir', default='data/VOCdevkit', type=str)
parser.add_argument('--year', dest='year', default='2017', type=str)
parser.add_argument('--image_set', dest='image_set', default='test', type=str)
parser.add_argument('--classes', dest='class_file', default='data/voc.names', type=str)
if len(sys.argv) == 1:
parser.print_help()
sys.exit(1)
args = parser.parse_args()
return args
def get_voc_results_file_template(image_set, out_dir = 'results'):
filename = 'comp4_det_' + image_set + '_{:s}.txt'
path = os.path.join(out_dir, filename)
return path
def do_python_eval(devkit_path, year, image_set, classes, output_dir = 'results'):
annopath = os.path.join(
devkit_path,
'VOC' + year,
'Annotations',
'{}.xml')
imagesetfile = os.path.join(
devkit_path,
'VOC' + year,
'ImageSets',
'Main',
image_set + '.txt')
cachedir = os.path.join(devkit_path, 'annotations_cache')
aps = []
# The PASCAL VOC metric changed in 2010
use_07_metric = True if int(year) < 2010 else False
print('VOC07 metric? ' + ('Yes' if use_07_metric else 'No'))
print('devkit_path=',devkit_path,', year = ',year)
if not os.path.isdir(output