Commit 962049bbdaaa51f00d47559f27704256239919c2

Authored by Josh Klontz
1 parent 0f880500

first draft of quantize in Likely

share/openbr/likely/face_recognition.tex
@@ -16,6 +16,21 @@ This document represents a long-term effort to port the OpenBR face recognition @@ -16,6 +16,21 @@ This document represents a long-term effort to port the OpenBR face recognition
16 As Likely is a literate programming language, this document is both the source code \emph{and} the documentation. 16 As Likely is a literate programming language, this document is both the source code \emph{and} the documentation.
17 \end{abstract} 17 \end{abstract}
18 18
  19 +\section{Quantization}
  20 +\begin{likely}
  21 +quantize :=
  22 + training-data :->
  23 + src :->
  24 + {
  25 + dst := (imitate-size src (imitate-dimensions u8 src.type))
  26 + lo := training-data.min-element
  27 + hi := training-data.max-element
  28 + scale := (/ 255 (- hi lo))
  29 + (dst src lo scale) :=>
  30 + dst :<- src.(- lo).(* scale)
  31 + }
  32 +\end{likely}
  33 +
19 \section{Consolidated Algorithm} 34 \section{Consolidated Algorithm}
20 The top level definition of the face recognition algorithm. 35 The top level definition of the face recognition algorithm.
21 36
@@ -23,9 +38,8 @@ The top level definition of the face recognition algorithm. @@ -23,9 +38,8 @@ The top level definition of the face recognition algorithm.
23 face-recognition := 38 face-recognition :=
24 src :-> 39 src :->
25 { 40 {
26 - dst := src.imitate  
27 - (dst src) :=>  
28 - dst :<- src 41 + algorithm := (quantize data)
  42 + (algorithm src)
29 } 43 }
30 \end{likely} 44 \end{likely}
31 45
@@ -33,7 +47,7 @@ face-recognition := @@ -33,7 +47,7 @@ face-recognition :=
33 The entry point to the outside world is a single C function \texttt{face\_recognition} that takes as input a \texttt{likely\_mat} (the input image) and outputs a new \texttt{likely\_mat} (the feature vector). 47 The entry point to the outside world is a single C function \texttt{face\_recognition} that takes as input a \texttt{likely\_mat} (the input image) and outputs a new \texttt{likely\_mat} (the feature vector).
34 48
35 \begin{likely} 49 \begin{likely}
36 -(extern u8CXY "face_recognition" u8CXY face-recognition) 50 +(extern u8X "face_recognition" f32X face-recognition)
37 \end{likely} 51 \end{likely}
38 52
39 -\end{document}  
40 \ No newline at end of file 53 \ No newline at end of file
  54 +\end{document}