Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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