Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

annotated face image databases representation in Haskell

Tags:

haskell

The difficulty is the following: different annotated-image databases have different sets of landmarks. For example IMM database has almost 60 ladmarks while BioID has about 17. Some of the landmarks are common "shared" between databases some of them aren't.

I would like to ask for an advice on how such data structures should be represented in Haskell? The task is to use different image databases, train them with the same tools, and be able to "cross" compare the results made by predictors that were trained with them?

enter image description here

Here some pseudocode to start:

-- 

data FaceIMM = LeftEye RightEye Nose Mouth Chin

data FaceBioID = LeftEye RightEye LeftNoseTip RightNoseTip NoseTop Mouth

...

-- training
--

predictor <- train confParameters landmarkDescriptors positionValues

...

fitter <- meanShifter . predictors

...

-- detection
--

fitBioID = fitterBioID face
fitIMM = fitterIMM face

...

-- comparison

errorBioID = distance (fitBioID - truth)
errorIMM = distance (fitIMM - truth)

compare errorBioID errorIMM

Just to be clear I already have "train" and "fit" functions, that are currently either store or accept lists of data. But I want to do better than that.

I don't expect to see completely polished data structure rather something that would help me to start approaching this problem.

EXTRA: In future I would also like to do:

  1. take an "intersection" of two image databases and train a fitter with small number of landmarks but bigger size of trained data.

  2. take an "union" of two image databases and train another fitter that will have the most number of landmarks in it but probably smaller size of trained data as only the points common to both databases would be used.

FRANCK: link to franck database

IMM: link to IMM database

BioID: link to BioID database

like image 278
ivan_a Avatar asked Sep 11 '13 06:09

ivan_a


1 Answers

The simples way is probably

import qualified Data.Map as M

data MarkType = LeftEye | RightEye | LeftNoseTip | RightNoseTip | NoseTop | Mouth

data MarkData = MarkData { mdX :: Int, mdY :: Int, ... }

type Face = M.Map MarkType MarkData

So you list individual mark identifiers from all datasets in MarkType and then a Face can have different marks, and if you want marks shared between 2 faces you do M.intersect.

like image 89
nponeccop Avatar answered Nov 09 '22 10:11

nponeccop