diff options
| author | Thibaut Horel <thibaut.horel@gmail.com> | 2012-03-04 13:01:08 -0800 |
|---|---|---|
| committer | Thibaut Horel <thibaut.horel@gmail.com> | 2012-03-04 13:23:18 -0800 |
| commit | d7b0798050f72f08bcb3995c465efeb9bf9f516d (patch) | |
| tree | d23b2f6d33ee68c585e7a754a78f31bf066eb8a2 | |
| parent | 88f7c5cc1cabcade583c41c55d9df3e5d8cab300 (diff) | |
| download | kinect-d7b0798050f72f08bcb3995c465efeb9bf9f516d.tar.gz | |
Set font size, figsize, and bounding box of plots
Started taking Brano's comments into account (section 3)
| -rwxr-xr-x | data/combined/graphs/plots.py | 87 | ||||
| -rwxr-xr-x | data/pair-matching/roc.py | 9 | ||||
| -rw-r--r-- | graphics/back.pdf | bin | 17955 -> 17795 bytes | |||
| -rw-r--r-- | graphics/face.pdf | bin | 14824 -> 14783 bytes | |||
| -rw-r--r-- | graphics/frames.pdf | bin | 10850 -> 10867 bytes | |||
| -rw-r--r-- | graphics/limbs.pdf | bin | 0 -> 45439 bytes | |||
| -rw-r--r-- | graphics/offline-nb.pdf | bin | 17143 -> 17130 bytes | |||
| -rw-r--r-- | graphics/offline-sht.pdf | bin | 20594 -> 20304 bytes | |||
| -rw-r--r-- | graphics/online-nb.pdf | bin | 17929 -> 17894 bytes | |||
| -rw-r--r-- | graphics/online-sht.pdf | bin | 24868 -> 24070 bytes | |||
| -rw-r--r-- | graphics/roc.pdf | bin | 20447 -> 20430 bytes | |||
| -rw-r--r-- | graphics/var.pdf | bin | 16186 -> 16101 bytes | |||
| -rw-r--r-- | uniqueness.tex | 51 |
13 files changed, 81 insertions, 66 deletions
diff --git a/data/combined/graphs/plots.py b/data/combined/graphs/plots.py index 98b9bc5..6f37b27 100755 --- a/data/combined/graphs/plots.py +++ b/data/combined/graphs/plots.py @@ -6,12 +6,17 @@ import matplotlib.mlab as mlab import sys import os import scipy +import matplotlib as mpl +mpl.rcParams['font.size'] = 8 +mpl.rcParams['lines.linewidth'] = 0.5 +mpl.rcParams['figure.figsize'] = 6,5 +mpl.rcParams['legend.fontsize'] = 8 +mpl.rcParams['axes.linewidth'] = 0.8 out_dir = sys.argv[1] - #limbs distribution -plt.cla() +plt.figure() data = np.loadtxt("../limbs-avg-zdiff/data.csv",delimiter=",") data = data[#(data[:,1] == 25) ((data != -1).all(1)) @@ -21,13 +26,13 @@ data = data[:,7:]*100 mean = data.mean(0) var = data.std(0) for i in range(len(mean)): - plt.subplot(3,3,i+1) - n,b,p = plt.hist(data[:,i],bins=50,normed=1) + ax = plt.subplot(2,5,i+1) + n,b,p = plt.hist(data[:,i],bins=100,normed=1,linewidth=0) plt.plot(b,mlab.normpdf(b,mean[i],var[i])) -plt.savefig(os.path.join(out_dir,"limbs.pdf")) +plt.savefig(os.path.join(out_dir,"limbs.pdf"),bbox_inches="tight",pad_inches=0.05) #frames distribution -plt.cla() +fig = plt.figure(figsize=(6,4)) x = np.loadtxt("frames.txt",usecols=(0,)) y = range(1,len(x)+1) width=0.8 @@ -38,88 +43,88 @@ plt.xlabel("Individual") plt.ylabel("Frame ratio [%]") plt.ylim(0,17) ax = plt.gca() -plt.savefig(os.path.join(out_dir,"frames.pdf")) +plt.savefig(os.path.join(out_dir,"frames.pdf"),bbox_inches="tight",pad_inches=0.05) l = ["3","5","10","all"] #10-fold, naive -plt.cla() -#ax = plt.subplot(121) -plt.axis([0,100,50,100]) -#ax.set_aspect(2) +plt.figure() 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.plot(100*x,100*y,label="$n_p=$ "+i) plt.xlabel("Recall [%]") plt.ylabel("Precision [%]") plt.legend(loc="best") -plt.savefig(os.path.join(out_dir,"offline-nb.pdf")) +plt.axis([0,100,50,100]) +plt.savefig(os.path.join(out_dir,"offline-nb.pdf"),bbox_inches="tight",pad_inches=0.05) + #10-fold, SHT -#ax = plt.subplot(122) -#plt.axis([0,100,50,100]) -#ax.set_aspect(2) -plt.cla() +plt.figure() 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.plot(100*x,100*y,label="$n_p=$ "+i) plt.xlabel("Recall [%]") plt.ylabel("Precision [%]") - plt.legend(loc="best") - + plt.legend(loc="lower left") plt.axis([0,100,50,100]) -plt.savefig(os.path.join(out_dir,"offline-sht.pdf")) +plt.savefig(os.path.join(out_dir,"offline-sht.pdf"),bbox_inches="tight",pad_inches=0.05) #online,NB -plt.cla() +plt.figure() 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.plot(100*x,100*y,label="$n_p=$ "+i) plt.xlabel("Recall [%]") plt.ylabel("Precision [%]") plt.legend(loc="best") -plt.savefig(os.path.join(out_dir,"online-nb.pdf")) +plt.axis([0,100,50,100]) +plt.savefig(os.path.join(out_dir,"online-nb.pdf"),bbox_inches="tight",pad_inches=0.05) + #online,SHT -plt.cla() +plt.figure() 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.plot(100*x,100*y,label="$n_p=$ "+i) plt.xlabel("Recall [%]") plt.ylabel("Precision [%]") plt.legend(loc="best") -plt.savefig(os.path.join(out_dir,"online-sht.pdf")) - +plt.axis([0,100,50,100]) +plt.savefig(os.path.join(out_dir,"online-sht.pdf"),bbox_inches="tight",pad_inches=0.05) #face -plt.cla() +plt.figure() 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.plot(100*x,100*y,label="Skeleton") +plt.plot(100*a,100*b,label="Face") plt.xlabel("Recall [%]") plt.ylabel("Precision [%]") plt.legend(loc="best") -plt.savefig(os.path.join(out_dir,"face.pdf")) +plt.axis([0,100,50,100]) +plt.savefig(os.path.join(out_dir,"face.pdf"),bbox_inches="tight",pad_inches=0.05) #back -plt.cla() +plt.figure() 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.plot(100*a,100*b,label="Train/test toward") +plt.plot(100*x,100*y,label="Train/test away") +plt.plot(100*c,100*d,label="Train toward test away") plt.xlabel("Recall [%]") plt.ylabel("Precision [%]") plt.legend(loc="best") -plt.savefig(os.path.join(out_dir,"back.pdf")) +plt.axis([0,100,50,100]) +plt.savefig(os.path.join(out_dir,"back.pdf"),bbox_inches="tight",pad_inches=0.05) #variance-reduction -plt.cla() +plt.figure() 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.plot(100*x,100*y,label="Reduced noise") +plt.plot(100*a,100*b,label="Original noise") plt.xlabel("Recall [%]") plt.ylabel("Precision [%]") plt.legend(loc="best") -plt.savefig(os.path.join(out_dir,"var.pdf")) +plt.axis([0,100,50,100]) +plt.savefig(os.path.join(out_dir,"var.pdf"),bbox_inches="tight",pad_inches=0.05) diff --git a/data/pair-matching/roc.py b/data/pair-matching/roc.py index c121e97..19a1acf 100755 --- a/data/pair-matching/roc.py +++ b/data/pair-matching/roc.py @@ -2,9 +2,16 @@ import sys import numpy as np import matplotlib.pyplot as plt +import matplotlib as mpl import math from sets import ImmutableSet +mpl.rcParams['font.size'] = 8 +mpl.rcParams['lines.linewidth'] = 0.5 +mpl.rcParams['figure.figsize'] = 6,5 +mpl.rcParams['legend.fontsize'] = 8 +mpl.rcParams['axes.linewidth'] = 0.8 + def distance(a,b): return math.sqrt(np.square(a-b).sum()) @@ -68,7 +75,7 @@ if __name__ == "__main__": true_pos = true_pos[indices] plt.plot(false_pos,true_pos,label="$\sigma$ = "+str(s)) plt.legend(loc="lower right") - plt.savefig("roc.pdf") + plt.savefig("roc.pdf",bbox_inches="tight",pad_inches=0.05) plt.show() diff --git a/graphics/back.pdf b/graphics/back.pdf Binary files differindex 86ff2f2..ebda274 100644 --- a/graphics/back.pdf +++ b/graphics/back.pdf diff --git a/graphics/face.pdf b/graphics/face.pdf Binary files differindex 3f87ef6..c92b8c2 100644 --- a/graphics/face.pdf +++ b/graphics/face.pdf diff --git a/graphics/frames.pdf b/graphics/frames.pdf Binary files differindex cca65bf..819e23b 100644 --- a/graphics/frames.pdf +++ b/graphics/frames.pdf diff --git a/graphics/limbs.pdf b/graphics/limbs.pdf Binary files differnew file mode 100644 index 0000000..fe92ce2 --- /dev/null +++ b/graphics/limbs.pdf diff --git a/graphics/offline-nb.pdf b/graphics/offline-nb.pdf Binary files differindex 8c468bd..cf1a43b 100644 --- a/graphics/offline-nb.pdf +++ b/graphics/offline-nb.pdf diff --git a/graphics/offline-sht.pdf b/graphics/offline-sht.pdf Binary files differindex 637ea99..9ef1a03 100644 --- a/graphics/offline-sht.pdf +++ b/graphics/offline-sht.pdf diff --git a/graphics/online-nb.pdf b/graphics/online-nb.pdf Binary files differindex 03c561e..3cdc3cb 100644 --- a/graphics/online-nb.pdf +++ b/graphics/online-nb.pdf diff --git a/graphics/online-sht.pdf b/graphics/online-sht.pdf Binary files differindex 46d4b6c..067fbd2 100644 --- a/graphics/online-sht.pdf +++ b/graphics/online-sht.pdf diff --git a/graphics/roc.pdf b/graphics/roc.pdf Binary files differindex d5a0c79..2d4a42b 100644 --- a/graphics/roc.pdf +++ b/graphics/roc.pdf diff --git a/graphics/var.pdf b/graphics/var.pdf Binary files differindex 97fb5a1..d51105c 100644 --- a/graphics/var.pdf +++ b/graphics/var.pdf diff --git a/uniqueness.tex b/uniqueness.tex index 76b7461..2ed0f93 100644 --- a/uniqueness.tex +++ b/uniqueness.tex @@ -6,6 +6,7 @@ recognizable biometric is their uniqueness. Are skeletons consistently and sufficiently distinct to use them for person recognition? \subsection{Face recognition benchmark} +\label{sec:frb} A good way to understand the uniqueness of a metric is to look at how well an algorithm based on it performs in the \emph{pair-matching @@ -25,27 +26,30 @@ curve, which plots the true-positive rate against the false-positive rate as the threshold of the algorithm varies. Note that in this benchmark the identity information of the individuals appearing in the pairs is not available, which means that the algorithms cannot form additional image pairs from the input -data. This is referred to as the \emph{Image-restricted} setting in the LFW +data. This is referred to as the \emph{image-restricted} setting in the LFW benchmark. \subsection{Experiment design} -In order to run an experiment similar to the one used in the face pair-matching -problem, we use the Goldman Osteological Dataset \cite{deadbodies}. This -dataset consists of skeletal measurements of 1538 skeletons uncovered around -the world and dating from throughout the last several thousand years. Given the -way these data were collected, only a partial view of the skeleton is -available, we keep six measurements: the lengths of four bones (radius, -humerus, femur, and tibia) and the breadth and height of the pelvis. Because -of missing values, this reduces the size of the dataset to 1191. +In order to run an experiment similar to the one used in the face +pair-matching problem (Section~\ref{sec:frb}), we use the Goldman +Osteological Dataset \cite{deadbodies}. This dataset consists of +skeletal measurements of 1538 skeletons uncovered around the world and +dating from throughout the last several thousand years. Given the way +these data were collected, only a partial view of the skeleton is +available, we keep six measurements: the lengths of four bones +(radius, humerus, femur, and tibia) and the breadth and height of the +pelvis. Because of missing values, this reduces the size of the +dataset to 1191. -From this dataset, 1191 matched pairs and 1191 unmatched pairs are generated. -In practice, the exact measurements of the bones of living subjects are not -directly accessible. Therefore, measurements are likely to have an error rate, -whose variance depends on the method of collection (\eg measuring limbs over -clothing versus on bare skin). Since there is only one sample per skeleton, we -simulate this error by adding independent random Gaussian noise to each -measurement of the pairs. +From this dataset, 1191 matched pairs and 1191 unmatched pairs are +generated. In practice, the exact measurements of the bones of living +subjects are not directly accessible. Therefore, measurements are +likely to have an error rate, whose variance depends on the method of +collection (\eg measuring limbs over clothing versus on bare +skin). Since there is only one sample per skeleton, we simulate this +error by adding independent random Gaussian noise to each measurement +of the pairs. \subsection{Results} @@ -53,26 +57,25 @@ We evaluate the performance of the pair-matching problem on the dataset by using threshold algorithm: for a given threshold, a pair will be classified as \emph{matched} if the Euclidean distance between the two skeletons is lower than the threshold, and \emph{unmatched} otherwise. Formally, let -$(s_1,s_2)$ be an input pair of the algorithm -($s_i\in\mathbf{R}_+^{6}$, these are the six bone measurements), +$(\bs_1,\bs_2)$ be an input pair of the algorithm +($\bs_i\in\mathbf{R}_+^{6}$, these are the six bone measurements), the output of the algorithm for the threshold $\delta$ is defined as: \begin{displaymath} - A_\delta(s_1,s_2) = \begin{cases} - 1 & \text{if $d(s_1,s_2) < \delta$}\\ + A_\delta(\bs_1,\bs_2) = \begin{cases} + 1 & \text{if $d(\bs_1,\bs_2) < \delta$}\\ 0 & \text{otherwise} \end{cases} \end{displaymath} \begin{figure}[t] \begin{center} - \includegraphics[width=10cm]{graphics/roc.pdf} + \includegraphics[width=0.6\columnwidth]{graphics/roc.pdf} \end{center} \vspace{-1.5\baselineskip} - \caption{ROC curve (true positive rate - vs. false positive rate) for several standard deviations of the + \caption{ROC curve for several standard deviations of the noise and for the state-of-the-art \emph{Associate-Predict} face - detection algorithm} + detection algorithm. The standard deviation $\sigma$ is shown in millimeters} \label{fig:roc} \end{figure} |
