aboutsummaryrefslogtreecommitdiff
path: root/report2/paper.md
blob: 0ceeedd20b1977e828deddd8ff69f407b40029c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# Summary
In this report we analysed how distance metrics learning affects classification
accuracy for the dataset CUHK03. The baseline method used for classification is
Nearest Neighbors based on Euclidean distance. The improved approach we propose 
mixes Jaccardian and Mahalanobis metrics to obtain a ranklist that takes into 
account also the reciprocal neighbors. This approach is computationally more 
complex, since the matrices representing distances are effectively calculated 
twice. However it is possible to observe a significant accuracy improvement of 
around 10% for the $@rank1$ case. Accuracy improves overall, especially for
$@rankn$ cases with low n.

# Formulation of the Addresssed Machine Learning Problem

## CUHK03

The dataset CUHK03 contains 14096 pictures of people captured from two 
different cameras. The feature vectors used come from passing the
rescaled images through ResNet50. Each feature vector contains 2048
features that we use for classification. The pictures represent 1467 different
people and each of them appears between 9 and 10 times. The separation of
train_idx, query_idx and gallery_idx allows to perform taining and validation 
on a training set (train_idx, adequately split between test, train and 
validation keeping the same number of identities). This prevents overfitting 
the algorithm to the specific data associated with query_idx and gallery_idx.

## Probelm to solve

The problem to solve is to create a ranklist for each image of the query set
by finding the nearest neighbor(s) within a gallery set. However gallery images
with the same label and taken from the same camera as the query image should
not be considered when forming the ranklist.

## Nearest Neighbor ranklist

Nearest Neighbor aims to find the gallery image whose feature are the closest to
the ones of a query image, predicting the class of the query image as the same 
of its nearest neighbor(s). The distance between images can be calculated through
different distance metrics, however one of the most commonly used is euclidean
distance, represented as $d=\sqrt{\sum (x-y)^{2}}$.

EXPLAIN KNN BRIEFLY


# Baseline Evaluation

\begin{figure}
\begin{center}
\includegraphics[width=20em]{fig/baseline.pdf}
\caption{Recognition accuracy of baseline Nearest Neighbor @rank k}
\label{fig:baselineacc}
\end{center}
\end{figure}

\begin{figure}
\begin{center}
\includegraphics[width=22em]{fig/eucranklist.png}
\caption{Ranklist @rank10 generated for 5 query images}
\label{fig:eucrank}
\end{center}
\end{figure}


# Suggested Improvement

\begin{figure}
\begin{center}
\includegraphics[width=24em]{fig/ranklist.png}
\caption{Ranklist (improved method) @rank10 generated for 5 query images}
\label{fig:ranklist2}
\end{center}
\end{figure}

\begin{figure}
\begin{center}
\includegraphics[width=20em]{fig/comparison.pdf}
\caption{Comparison of recognition accuracy @rank k}
\label{fig:baselineacc}
\end{center}
\end{figure}

\begin{figure}
\begin{center}
\includegraphics[width=17em]{fig/pqvals.pdf}
\caption{Recognition accuracy varying K1 and K2}
\label{fig:pqvals}
\end{center}
\end{figure}


# Conclusion

# References

# Appendix