microsoft / ProjectOxford-ClientSDK

This repo has moved :house: Visit our website for the latest SDKs & Samples
https://www.microsoft.com/cognitive-services/en-us/sdk-sample
Other
965 stars 640 forks source link

EmotionServiceClient does not return scores #102

Open bveldkamp opened 6 years ago

bveldkamp commented 6 years ago

With version 1.0.341 of Microsoft.ProjectOxford.Emotion, the Scores property is null, although I can see scores when inspecting the request with Fiddler.

My code is

async void RecognizeEmotion(string imageFilePath)
{
    var client =new Microsoft.ProjectOxford.Emotion.EmotionServiceClient(EmotionKey);

    using (var imageStream = File.OpenRead(imageFilePath))
    {
        var emotions = await client.RecognizeAsync(imageStream);
        foreach (var emotion in emotions)
        {
            Console.WriteLine($@"Scores are {(emotion.Scores == null ? "" : "not ")}null");
        }
    }
}

The response from the service is: [{"faceRectangle":{"height":606,"left":2642,"top":1268,"width":606},"scores":{"anger":0.00768282,"contempt":0.00425829645,"disgust":0.02712952,"fear":0.00047837582,"happiness":0.0009950536,"neutral":0.798720837,"sadness":0.152901679,"surprise":0.007833431}}]

Am I missing something, or is there something wrong in the Emotion code?

GKersten commented 6 years ago

I am experiencing the same issue ATM. Did you find a solution?

Edit: Seems to be an issue when we created a new UWP .NET Standard project. When using .NET Framework it seems to work.

bveldkamp commented 6 years ago

No solution yet, I'm using .NET Framework.

This seems to be related: https://github.com/Microsoft/Cognitive-Emotion-Windows/issues/26