#! /usr/bin/python import numpy as np import matplotlib.pyplot as plt import sys import os out_dir = sys.argv[1] #frames distribution plt.cla() x = np.loadtxt("frames.txt",usecols=(0,)) y = range(1,len(x)+1) width=0.8 plt.bar(y,x/x.sum()*100,width=width) plt.xlim(0.8,26) plt.xticks([i+width/2. for i in range(1,len(x),5)], range(1,len(x),5)) plt.xlabel("Individual") plt.ylabel("Frame ratio [%]") plt.ylim(0,17) ax = plt.gca() #ax.set_aspect(1) plt.savefig(os.path.join(out_dir,"frames.pdf")) l = ["3","5","10","all"] #10-fold, naive plt.cla() #ax = plt.subplot(121) plt.axis([0,100,50,100]) #ax.set_aspect(2) for i in l: x,y = np.loadtxt(i+"_nb_off.mat",unpack=True) plt.plot(100*x,100*y,label="$n_p=$ "+i,linewidth=0.8) plt.xlabel("Recall [%]") plt.ylabel("Precision [%]") plt.legend(loc="best") plt.savefig(os.path.join(out_dir,"offline-nb.pdf")) #10-fold, SHT #ax = plt.subplot(122) #plt.axis([0,100,50,100]) #ax.set_aspect(2) plt.cla() for i in l: x,y = np.loadtxt(i+"_sht_off.mat",unpack=True) plt.plot(100*x,100*y,label="$n_p=$ "+i,linewidth=0.8) plt.xlabel("Recall [%]") plt.ylabel("Precision [%]") plt.legend(loc="best") plt.axis([0,100,50,100]) plt.savefig(os.path.join(out_dir,"offline-sht.pdf")) #online,NB plt.cla() for i in l: x,y = np.loadtxt(i+"_nb_on.mat",unpack=True) plt.plot(100*x,100*y,label="$n_p=$ "+i,linewidth=0.8,markersize=4) plt.xlabel("Recall [%]") plt.ylabel("Precision [%]") plt.legend(loc="best") plt.savefig(os.path.join(out_dir,"online-nb.pdf")) #online,SHT plt.cla() for i in l: x,y = np.loadtxt(i+"_sht_on.mat",unpack=True) plt.plot(100*x,100*y,label="$n_p=$ "+i,linewidth=0.8,markersize=4) plt.xlabel("Recall [%]") plt.ylabel("Precision [%]") plt.legend(loc="best") plt.savefig(os.path.join(out_dir,"online-sht.pdf")) #face plt.cla() x,y = np.loadtxt("all_nb_off.mat",unpack=True) a,b = np.loadtxt("face.csv",delimiter=",", unpack=True) plt.plot(100*x,100*y,linewidth=0.8,label="Skeleton") plt.plot(100*a,100*b,linewidth=0.8,label="Face") plt.xlabel("Recall [%]") plt.ylabel("Precision [%]") plt.legend(loc="best") plt.savefig(os.path.join(out_dir,"face.pdf")) #back plt.cla() x,y = np.loadtxt("back_all_sht_on.mat",unpack=True) a,b = np.loadtxt("all_sht_on.mat",unpack=True) c,d = np.loadtxt("front_back_all_sht.mat",unpack=True) plt.plot(100*a,100*b,linewidth=0.8,label="Train/test toward") plt.plot(100*x,100*y,linewidth=0.8,label="Train/test away") plt.plot(100*c,100*d,linewidth=0.8,label="Train toward test away") plt.xlabel("Recall [%]") plt.ylabel("Precision [%]") plt.legend(loc="best") plt.savefig(os.path.join(out_dir,"back.pdf")) #variance-reduction plt.cla() x,y = np.loadtxt("half-var-all_sht_on.mat",unpack=True) a,b = np.loadtxt("all_sht_on.mat",unpack=True) plt.plot(100*x,100*y,linewidth=0.8,label="Reduced noise") plt.plot(100*a,100*b,linewidth=0.8,label="Original noise") plt.xlabel("Recall [%]") plt.ylabel("Precision [%]") plt.legend(loc="best") plt.savefig(os.path.join(out_dir,"var.pdf"))