Commit dd1891bd authored by E144069X's avatar E144069X

Adapted the confusion matrix plot for marseille dataset

parent ec5f16f6
......@@ -710,11 +710,8 @@ def phaseNbHist(datasets,density):
def plotConfusionMatrix(exp_id,model_id,epochToProcess,dataset_test,test_part_beg,test_part_end):
resFilePaths = np.array(sorted(glob.glob("../results/{}/{}_epoch{}_*.csv".format(exp_id,model_id,epochToProcess)),key=utils.findNumbers))
conf = configparser.ConfigParser()
conf.read("../models/{}/{}.ini".format(exp_id,model_id))
conf = conf["default"]
videoDict = buildVideoNameDict(dataset_test,test_part_beg,test_part_end,True,resFilePaths)
videoDict = buildVideoNameDict(dataset_test,test_part_beg,test_part_end,True,resFilePaths,raiseError=False)
revDict = formatData.getReversedLabels()
labels = formatData.getLabels()
......@@ -735,7 +732,7 @@ def plotConfusionMatrix(exp_id,model_id,epochToProcess,dataset_test,test_part_be
pred = np.genfromtxt(resFilePath)
pred = pred[:,1:].argmax(axis=-1)
gt = load_data.getGT(videoDict[resFilePath],conf["dataset_val"])
gt = load_data.getGT(videoDict[resFilePath],dataset_test)
frameStart = (gt == -1).sum()
......@@ -757,7 +754,7 @@ def plotConfusionMatrix(exp_id,model_id,epochToProcess,dataset_test,test_part_be
plt.xlabel("Predictions")
plt.xticks(np.arange(len(labelInds)),labels,rotation=45)
plt.ylabel("Ground-truth")
plt.yticks(np.arange(len(labelInds_gt)),labels_gt)
plt.yticks(np.arange(len(labelInds_gt))*(len(labelInds)/len(labelInds_gt)),labels_gt)
plt.colorbar(img)
plt.tight_layout()
plt.savefig("../vis/{}/confMat_{}_epoch{}_{}.png".format(exp_id,model_id,epochToProcess,videoDict[resFilePath]))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment