Skip to content

Instantly share code, notes, and snippets.

@SamVanhoutte
Created January 19, 2017 07:43
Show Gist options
  • Save SamVanhoutte/eec797c6c709c8ce26c92896fa75bec4 to your computer and use it in GitHub Desktop.
Save SamVanhoutte/eec797c6c709c8ce26c92896fa75bec4 to your computer and use it in GitHub Desktop.
REFERENCE ASSEMBLY ImageCommon;
REFERENCE ASSEMBLY FaceSdk;
REFERENCE ASSEMBLY ImageEmotion;
REFERENCE ASSEMBLY ImageTagging;
REFERENCE ASSEMBLY ImageOcr;
@imgs =
EXTRACT FileName string, ImgData byte[]
FROM @"/data/employees/{FileName:*}.jpg"
USING new Cognition.Vision.ImageExtractor();
@faces =
PROCESS @imgs
PRODUCE FileName,
NumFaces int,
FaceAge string,
FaceGender string
READONLY FileName
USING new Cognition.Vision.FaceDetector();
@emotions =
PROCESS @imgs
PRODUCE FileName string,
NumFaces int,
Emotion string
READONLY FileName
USING new Cognition.Vision.EmotionAnalyzer();
@texts =
PROCESS @imgs
PRODUCE FileName,
Text string
READONLY FileName
USING new Cognition.Vision.OcrExtractor();
@results =
SELECT f.FileName, f.NumFaces, f.FaceAge, f.FaceGender,
e.Emotion,
t.Text
FROM @faces AS f
JOIN @emotions AS e ON f.FileName == e.FileName
JOIN @texts AS t ON f.FileName == t.FileName;
OUTPUT @results
TO "/data/employees/results.csv"
USING Outputters.Csv();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment