services | platforms | author |
---|---|---|
data-lake-analytics |
dotnet |
saveenr |
REFERENCE ASSEMBLY ImageCommon;
REFERENCE ASSEMBLY FaceSdk;
REFERENCE ASSEMBLY ImageEmotion;
REFERENCE ASSEMBLY ImageTagging;
REFERENCE ASSEMBLY ImageOcr;
// Get the image data
@imgs =
EXTRACT
FileName string,
ImgData byte[]
FROM @"/usqlext/samples/cognition/{FileName}.jpg"
USING new Cognition.Vision.ImageExtractor();
// Extract the number of objects on each image and tag them
@tags =
PROCESS @imgs
PRODUCE FileName,
NumObjects int,
Tags SQL.MAP<string, float?>
READONLY FileName
USING new Cognition.Vision.ImageTagger();
@tags_serialized =
SELECT FileName,
NumObjects,
String.Join(";", Tags.Select(x => String.Format("{0}:{1}", x.Key, x.Value))) AS TagsString
FROM @tags;
OUTPUT @tags_serialized
TO "/tags.csv"
USING Outputers.Csv();