2009-09-14

Haar Classifier

  1. Preparing the following files
    • ..\OpenCV\samples\c\convert_cascade.exe
    • ..\OpenCV\bin\createsamples.exe
    • ..\OpenCV\bin\haartraining.exe

  2. Preparing positive and negative samples
    • Negative( "..\negative\" )
      • dir /b/s > neg.txt
      • replacing "..\" to ""
    • Positive( "..\positive\" )
      • dir /b/s > pos.txt
      • replacing "..\" to ""
      • adding "NUM X Y WIDTH HEIGHT" to each end of line
        e.g. positive\a.png 1 0 0

  3. Moving "pos.txt" and "neg.txt" to "..\"

  4. Creating the positive vector
    createsamples -info pos.txt -vec pos.vec -num POSTOTAL -w WIDTH -h HEIGHT
    e.g. createsamples -info pos.txt -vec pos.vec -num 35784 -w 32 -h 24

  5. (Optional) Checking samples
    createsamples -vec pos.vec -w WIDTH -h HEIGHT
    e.g. createsamples -vec pos.vec -w 32 -h 24

  6. Training
    haartraining -data data\cascade -vec pos.vec -bg neg.txt -npos POSTOTAL -nneg NEGTOTAL -nstages STAGE -mem MEMORY -mode ALL -w WIDTH –h HEIGHT
    e.g. haartraining -data data\cascade -vec pos.vec -bg neg.txt -npos 35784 -nneg 3240 -nstages 30 -mem 1000 -mode ALL -w 32 –h 24

  7. Generating a xml file
    convert_cascade --size="x" PATH CLASSIFIER
    e.g. convert_cascade --size="32x24" \data\cascade\ haarcascade.xml



[Reference]

2009-06-23

LaTex Memo

Command
[Create PDF]
pdflatex FILENAME



Basic example
\documentclass[parameter]{format}
\usepackage{name}
\begin{document}
\title{string}
\author{string}
\section{string}
\subsection{string}
\end{document}

[\documentclass]
parameter
e.g. 10pt, a4paper
format
e.g. article, report, CLS file name

[\usepackage]
name
e.g. subfigure, graphicx



Image insertion
\begin{figure}
\begin{center}
\includegraphics[format]{name}
\caption{string}
\label{string}
\end{center}
\end{figure}

[\begin{center}]
置中

[\includegraphics]
format
e.g: width=0.4\textwidth
name
e.g: name.png, name.jpg

[\caption{string}]
圖片的標題

[\label{string}]
\ref{string}用



Subfigure
\subfigure[string]
{
  \label{string}
  \includegraphics[format]{name}
}
\subfigure[string]
{
  \label{string}
  \includegraphics[format]{name}
}

[\subfigure]
string
子圖標題



Bibliography
\begin{thebibliography}{num}
\bibitem{tag}
\end{thebibliography}

[\begin{thebibliography}]
num
起始數字

[\bibitem]
tag
\cite{tag}用

2009-06-15

Vision for a Smart Kiosk

Vision for a Smart Kiosk
James M. Rehg, Maria Loughlin, Keith Waters



The kiosk interface supports public interaction with multiple users.

[Obtained Information]
  • three dimensional location
  • body language
  • facial expressions

[Modules]
  • Motion blob detection
  • Color tracking
    a color histogram model of each user's shirt
  • Stereo triangulation
  • DECface
  • Behavior

[DECface Agent]
  • speak an arbitrary piece of text at a specific speech rate in one of eight voices from one of eight faces
  • the creation of simple facial expressions under control of a facial muscle model
  • simple head and eye rotation

[Taxonomy of vision tasks]

Features
Attributes
Behaviors
Distant
(Dist)
whole body
position
monitor
Midrange
(Mid)
head and torso
orientation
entice
Proximate
(Prox)
face / hands
expression
communicate

[Experiments]
  • 推測position的正確性
  • tracking和behvior模組的測試

[Conclusion]
  • Color is a valuable feature for tracking people in real-time.

2009-06-12

Median filter

[Step][Example]
  1. Decide a window with odd samples.
  2. Calculate the median of these samples.

[Purpose]
  • 消除雜訊

2009-06-08

Funny about Molly




2009-05-27

Solving a learning system (Ax=b) by iterative methods

Jacobi Method
for i = 1 : n
 x[ i ]k+1 = ( b[ i ]
        - SIGMA(j = 1 : i-1)( a[ i ][ j ] * x[ j ]k )
        - SIGMA(j = i+1 : n)( a[ i ][ j ] * x[ j ]k ) )
      / a[ i ][ i ]
end

[Convergence]
M = diag( diag( A ) ) N = - ( A - M )
若M-1*N的eigenvalue皆在-1~1之間的話,則其會收斂。



Gauss-Seidal Method
for i = 1 : n
 x[ i ]k+1 = ( b[ i ]
        - SIGMA(j = 1 : i-1)( a[ i ][ j ] * x[ j ]k+1 )
        - SIGMA(j = i+1 : n)( a[ i ][ j ] * x[ j ]k ) )
      / a[ i ][ i ]
end



Steepest Descent Method
x(0) = initial guess
r(0) = b - A * x(0)
k = 0
while rk != 0
 k = k + 1
 alpha(k) = ( (rk-1)' * rk-1 ) / ( (rk-1)' * A * rk-1 )
 xk = xk-1 - alphak * rk-1
 rk = b - A * xk
end



Conjugate Gradient Method
k = 0
r(0) = b - A * x(0)
while rk != 0
 k = k + 1
 if k = 1
  p(1) = r(0)
 else
  betak = ( (rk-1)' * rk-1 ) / ( (rk-2)' * rk-2 )
  pk = rk-1 + betak * pk-1
 end
 alphak = ( (rk-1)' * rk-1 ) / ( (pk)' * A * pk )
 xk = xk-1 + alphak * pk
 rk = rk-1 - alphak * A * pk
end
x = xk



[Reference]

2009-05-19

Evaluation


Actual condition
True
False
Test
result
True
True Positive (TP)
False Positive (FP)
False
False Negative (FN)
True Negative (TN)

Accuracy = ( TN + TP ) / ( TP + FN + FP + TN )

Precision = TP / ( TP + FP )

Recall = TP / ( TP + FN )