yoloV 3テストmapとPR曲線を描く
3283 ワード
参考1:https://blog.csdn.net/qq_33350808/article/details/83178002
2:https://blog.csdn.net/weixin_43717579/article/details/89380229
3:https://blog.csdn.net/babyzbb636/article/details/100535563
トレーニングコマンド:./darknet.exe detector train data/obj.data yolo-obj.cfg darknet53.conv.74 | tee train_yolov3.log
ps:For training with mAP (mean average precisions) calculation for each 4 Epochs (set valid=valid.txt or train.txt in obj.data file) and run: darknet.exe detector train data/obj.data yolo-obj.cfg darknet53.conv.74 -map
テスト:最初のステップ:./darknet detector valid data/obj.data yolo-obj.cfg backup/yolo-obj_last.Weights第2部:python.\reval_voc_py3.py --voc_dir E:\darknet-master\build\darknet\x64\data\VOCdevkit --year 2007 --image_set test --classes E:\darknet-master\build\darknet\x64\data\obj.names testForTower 1:テストセットのImageSetsMainにはtestしか必要ありません.txtここでのtestと(コマンドであるimage_set testのtest)と(comp 4_det_test_tower.txtのtest)は一致する必要がある2:毎回キャッシュファイルannotsを削除する必要がある.pkl
PRカーブを描画し、AP値を出力します。
2:https://blog.csdn.net/weixin_43717579/article/details/89380229
3:https://blog.csdn.net/babyzbb636/article/details/100535563
トレーニングコマンド:./darknet.exe detector train data/obj.data yolo-obj.cfg darknet53.conv.74 | tee train_yolov3.log
ps:For training with mAP (mean average precisions) calculation for each 4 Epochs (set valid=valid.txt or train.txt in obj.data file) and run: darknet.exe detector train data/obj.data yolo-obj.cfg darknet53.conv.74 -map
テスト:最初のステップ:./darknet detector valid data/obj.data yolo-obj.cfg backup/yolo-obj_last.Weights第2部:python.\reval_voc_py3.py --voc_dir E:\darknet-master\build\darknet\x64\data\VOCdevkit --year 2007 --image_set test --classes E:\darknet-master\build\darknet\x64\data\obj.names testForTower 1:テストセットのImageSetsMainにはtestしか必要ありません.txtここでのtestと(コマンドであるimage_set testのtest)と(comp 4_det_test_tower.txtのtest)は一致する必要がある2:毎回キャッシュファイルannotsを削除する必要がある.pkl
PRカーブを描画し、AP値を出力します。 #coding=utf-8
import _pickle as cPickle
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif']=[u'NSimSun']
plt.rcParams['axes.unicode_minus']=False
fr = open('tower_pr.pkl','rb')# open pkl
inf = cPickle.load(fr)
fr.close()
# fbad = open('tower_pr.pkl','rb')# open pkl
# inf_bad = cPickle.load(fbad)
# fbad.close()
x=inf['rec']
y=inf['prec']
plt.figure()
plt.xlabel(' ',size=15)
plt.ylabel(' ',size=15)
plt.xticks(fontproperties = 'Times New Roman', size = 14)
plt.yticks(fontproperties = 'Times New Roman', size = 14)
plt.plot(x,y)
plt.savefig("PR .svg",bbox_inches='tight') #plt show
plt.show()
print('AP:',inf['ap'])
テスト画像:darknet.exe detector test data/obj.data yolo-obj.cfg yolo-obj_100.weights(最後の重みを自分の重みに変更します).端末は画像のパスを入力するように注意し、テスト画像の絶対パスを入力すると効果が得られます.
一括テスト:https://blog.csdn.net/yuyifan1991/article/details/94614130
上記のリンクに従って構成した後、コマンド:./darknet detector test data/obj.data yolo-obj.cfg backup/yolo-obj_1800.weights test.txt
損失値曲線を描く: import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif']=[u'SimHei']
plt.rcParams['axes.unicode_minus']=False
# log_loss.txt lines, (start_ite) (end_ite)。
lines = 1800
start_ite = 0 #log_loss.txt
end_ite = 1800 #log_loss.txt
step = 2 # ,
igore = 190 # loss , igore , b
data_path = 'train_log_loss.txt' #log_loss 。
result_path = './quanju_loss0607'
names = ['loss', 'avg', 'rate', 'seconds', 'images']
result = pd.read_csv(data_path, skiprows=[x for x in range(lines)
if (x
#coding=utf-8
import _pickle as cPickle
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif']=[u'NSimSun']
plt.rcParams['axes.unicode_minus']=False
fr = open('tower_pr.pkl','rb')# open pkl
inf = cPickle.load(fr)
fr.close()
# fbad = open('tower_pr.pkl','rb')# open pkl
# inf_bad = cPickle.load(fbad)
# fbad.close()
x=inf['rec']
y=inf['prec']
plt.figure()
plt.xlabel(' ',size=15)
plt.ylabel(' ',size=15)
plt.xticks(fontproperties = 'Times New Roman', size = 14)
plt.yticks(fontproperties = 'Times New Roman', size = 14)
plt.plot(x,y)
plt.savefig("PR .svg",bbox_inches='tight') #plt show
plt.show()
print('AP:',inf['ap'])
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif']=[u'SimHei']
plt.rcParams['axes.unicode_minus']=False
# log_loss.txt lines, (start_ite) (end_ite)。
lines = 1800
start_ite = 0 #log_loss.txt
end_ite = 1800 #log_loss.txt
step = 2 # ,
igore = 190 # loss , igore , b
data_path = 'train_log_loss.txt' #log_loss 。
result_path = './quanju_loss0607'
names = ['loss', 'avg', 'rate', 'seconds', 'images']
result = pd.read_csv(data_path, skiprows=[x for x in range(lines)
if (x