Commit cd9017b98b71c09988cecf6e4cfe0521b57ef0c2
1 parent
962049bb
second draft of likely quantize implementation
Showing
1 changed file
with
11 additions
and
10 deletions
share/openbr/likely/face_recognition.tex
| @@ -18,16 +18,17 @@ As Likely is a literate programming language, this document is both the source c | @@ -18,16 +18,17 @@ As Likely is a literate programming language, this document is both the source c | ||
| 18 | 18 | ||
| 19 | \section{Quantization} | 19 | \section{Quantization} |
| 20 | \begin{likely} | 20 | \begin{likely} |
| 21 | +quantize-lo := data.min-element | ||
| 22 | +quantize-hi := data.max-element | ||
| 23 | +quantize-scale := (/ 255 (- quantize-hi quantize-lo)) | ||
| 24 | + | ||
| 21 | quantize := | 25 | quantize := |
| 22 | - training-data :-> | 26 | + () :-> |
| 23 | src :-> | 27 | src :-> |
| 24 | { | 28 | { |
| 25 | dst := (imitate-size src (imitate-dimensions u8 src.type)) | 29 | 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) | 30 | + (dst src) :=> |
| 31 | + dst :<- src.(- quantize-lo).(* quantize-scale) | ||
| 31 | } | 32 | } |
| 32 | \end{likely} | 33 | \end{likely} |
| 33 | 34 | ||
| @@ -36,11 +37,11 @@ The top level definition of the face recognition algorithm. | @@ -36,11 +37,11 @@ The top level definition of the face recognition algorithm. | ||
| 36 | 37 | ||
| 37 | \begin{likely} | 38 | \begin{likely} |
| 38 | face-recognition := | 39 | face-recognition := |
| 40 | +{ | ||
| 41 | + algorithm := (quantize) | ||
| 39 | src :-> | 42 | src :-> |
| 40 | - { | ||
| 41 | - algorithm := (quantize data) | ||
| 42 | - (algorithm src) | ||
| 43 | - } | 43 | + src.algorithm |
| 44 | +} | ||
| 44 | \end{likely} | 45 | \end{likely} |
| 45 | 46 | ||
| 46 | \section{Entry Point} | 47 | \section{Entry Point} |