GithubHelp home page GithubHelp logo

microsoft / cognitive-emotion-windows Goto Github PK

View Code? Open in Web Editor NEW
79.0 64.0 46.0 1.82 MB

Windows SDK for the Microsoft Emotion API, part of Cognitive Services

Home Page: https://www.microsoft.com/cognitive-services/en-us/emotion-api

License: Other

C# 100.00%

cognitive-emotion-windows's Introduction

Microsoft Emotion API: Windows Client Library & Sample

This repo contains the Windows client library & sample for the Microsoft Emotion API, an offering within Microsoft Cognitive Services, formerly known as Project Oxford.

The Client Library

This client library is a thin C# client wrapper for the Microsoft Emotion API.

The easiest way to use this client library is to get microsoft.projectoxford.emotion package from nuget. Please go to Emotion API Package in nuget for more details.

Order expressions

You can call the function ToRankedList from the Scores class, for example:

IEnumerable<KeyValuePair<string, float>> collection = myScores.ToRankedList();

The Sample

This sample is a Windows WPF application to demonstrate the use of Microsoft Cognitive Services Emotion API. It demonstrates emotion API by specifying a URL or using a stream.

Build the sample

  1. Starting in the folder where you clone the repository (this folder)
  2. In a git command line tool, type git submodule init (or do this through a UI)
  3. Pull in the shared Windows code by calling git submodule update
  4. Start Microsoft Visual Studio 2015 and select File > Open > Project/Solution.
  5. Go to Sample-WPF Folder.
  6. Double-click the Visual Studio 2015 Solution (.sln) file EmotionAPI-WPF-Samples.
  7. Press Ctrl+Shift+B, or select Build > Build Solution.

Run the sample

After the build is complete, press F5 to run the sample.

First, you must obtain a Emotion API subscription key by following the instructions on our website.

Locate the text edit box saying "Paste your subscription key here to start" on the top right corner. Paste your subscription key. You can choose to persist your subscription key in your machine by clicking "Save Key" button. When you want to delete the subscription key from the machine, click "Delete Key" to remove it from your machine.

Click on "Select Scenario" to use samples of different scenarios, and follow the instructions on screen.

Microsoft will receive the images you upload and may use them to improve Emotion API and related services. By submitting an image, you confirm you have consent from everyone in it.

Contributing

We welcome contributions. Feel free to file issues and pull requests on the repo and we'll address them as we can. Learn more about how you can help on our Contribution Rules & Guidelines.

You can reach out to us anytime with questions and suggestions using our communities below:

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

License

All Microsoft Cognitive Services SDKs and samples are licensed with the MIT License. For more details, see LICENSE.

Sample images are licensed separately, please refer to LICENSE-IMAGE.

Developer Code of Conduct

Developers using Cognitive Services, including this client library & sample, are expected to follow the “Developer Code of Conduct for Microsoft Cognitive Services”, found at http://go.microsoft.com/fwlink/?LinkId=698895.

cognitive-emotion-windows's People

Contributors

chsienki avatar cthrash avatar delfu avatar lightfrenzy avatar microsoft-github-policy-service[bot] avatar msftgits avatar oliverwm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cognitive-emotion-windows's Issues

Exception in emotion detection

From @basimolimajeed on July 8, 2016 15:14

Hi, tried to run the sample for emotion detection on windows 10. The image is loaded then I get this exception:
[16:02:47.891793]: EmotionServiceClient is created
[16:02:47.910295]: Calling EmotionServiceClient.RecognizeAsync()...
[16:02:54.305999]: Microsoft.ProjectOxford.Common.ClientException: Exception of type 'Microsoft.ProjectOxford.Common.ClientException' was thrown.
at Microsoft.ProjectOxford.Common.ServiceClient.d__222.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.ProjectOxford.Common.ServiceClient.<PostAsync>d__202.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.ProjectOxford.Emotion.EmotionServiceClient.d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.ProjectOxford.Emotion.EmotionServiceClient.d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at EmotionAPI_WPF_Samples.DetectEmotionUsingStreamPage.d__1.MoveNext() in C:\Users\basim\Source\Repos\ProjectOxford-ClientSDK\Emotion\Windows\Sample-WPF\DetectEmotionUsingStreamPage.xaml.cs:line 113

[16:02:54.336011]: Detection Result:
[16:02:54.346018]: No emotion is detected. This might be due to:
image is too small to detect faces
no faces are in the images
faces poses make it difficult to detect emotions
or other factors

Any idea why?
Thanks

Copied from original issue: microsoft/ProjectOxford-ClientSDK#87

Emotion.Scores is always null

Context:
Using:

  • .NET Framework 4.6
  • Microsoft.ProjectOxford.Emotion 1.0.341
  • Microsoft.ProjectOxford.Common 1.0.324
  • Newtonsoft.Json 10.0.3

Problem:

Calling EmotionServiceClient.RecognizeAsync returns an Emotion[] array with elements having their Emotion.FaceRectangle property properly set.

However Emotion.Scores property is always null.

With JSON.NET tracing enabled, we can see:

Deserialized JSON: 
[
  {
    "faceRectangle": {
      "height": 129,
      "left": 96,
      "top": 78,
      "width": 129
    },
    "scores": {
      "anger": 5.43854822E-11,
      "contempt": 1.81638086E-07,
      "disgust": 9.657062E-10,
      "fear": 5.90438E-14,
      "happiness": 0.9999829,
      "neutral": 1.6907894E-05,
      "sadness": 5.581749E-10,
      "surprise": 8.70113E-10
    }
  }
]

It seems like Emotion.Scores is null because Microsoft.ProjectOxford.Emotion.Contract.Emotion class is used. On the other hand, when using Microsoft.ProjectOxford.Common.Contract.Emotion to deserialize the API response, the scores property is properly deserialized:

void Main()
{
	var test = JsonConvert.DeserializeObject<Microsoft.ProjectOxford.Emotion.Contract.Emotion[]>(apiResponse);
// test.Scores is null
    var test2 = JsonConvert.DeserializeObject<Microsoft.ProjectOxford.Common.Contract.Emotion[]>(apiResponse);
// test2.Scores is not null
}

const string apiResponse= @"[
  {
    ""faceRectangle"": {
      ""height"": 129,
      ""left"": 96,
      ""top"": 78,
      ""width"": 129
    },
    ""scores"": {
	""anger"": 5.43854822E-11,
      ""contempt"": 1.81638086E-07,
      ""disgust"": 9.657062E-10,
      ""fear"": 5.90438E-14,
      ""happiness"": 0.9999829,
      ""neutral"": 1.6907894E-05,
      ""sadness"": 5.581749E-10,
      ""surprise"": 8.70113E-10
	}
  }
]";

Why IEmotionServiceClient internal?

Is there any reason to make this interface internal?

I'd like to be able to mock this client without having to write our own wrapper around it...

Call the service inside LongRunning Task

When call RecognizeAsync inside Task with LongRunning option, the RecognizeAsync does not returns.

Task.Factory.StartNew(async () => 
{
     EmotionServiceClient service = new EmotionServiceClient(...);
     ...
     await service.RecognizeAsync(...); // Never ends....
}, TaskCreationOptions.LongRunning);

I didn't checked RecognizeInVideoAsync but I expect the same behavior.

.net standard

Hi guys,

Any plans to port this to .net standard?

System.Windows.Markup.XamlParseException was unhandled

I used this image url http://www.photl.com/www3/photos/2011/03/25/0815/wm369392tt.jpg
And It threw an exception -

System.Windows.Markup.XamlParseException was unhandled
Message: An unhandled exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll
Additional information: 'Initialization of 'System.Windows.Media.Imaging.CroppedBitmap' threw an exception.' Line number '15' and line position '75'.

Full Stack Trace is here-

'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities\14.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.0__b77a5c561934e089\System.Windows.Forms.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities.Sync\14.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.Sync.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.Debugger.Runtime\14.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Debugger.Runtime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'F:\Cognitive-Emotion-Windows-master\Cognitive-Emotion-Windows\Sample-WPF\bin\Debug\EmotionAPI-WPF-Samples.vshost.exe'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Net.Http.WebRequest\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Net.Http.WebRequest.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.CSharp\v4.0_4.0.0.0__b03f5f7f11d50a3a\Microsoft.CSharp.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.Linq.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Data.DataSetExtensions\v4.0_4.0.0.0__b77a5c561934e089\System.Data.DataSetExtensions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Net.Http\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Net.Http.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xaml\v4.0_4.0.0.0__b77a5c561934e089\System.Xaml.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\WindowsBase\v4.0_4.0.0.0__31bf3856ad364e35\WindowsBase.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\PresentationCore\v4.0_4.0.0.0__31bf3856ad364e35\PresentationCore.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework\v4.0_4.0.0.0__31bf3856ad364e35\PresentationFramework.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The thread 0x3604 has exited with code 0 (0x0).
The thread 0x3690 has exited with code 0 (0x0).
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'F:\Cognitive-Emotion-Windows-master\Cognitive-Emotion-Windows\Sample-WPF\bin\Debug\EmotionAPI-WPF-Samples.exe'. Symbols loaded.
Step into: Stepping over non-user code 'EmotionAPI_WPF_Samples.App..ctor'
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Step into: Stepping over non-user code 'EmotionAPI_WPF_Samples.App.InitializeComponent'
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'F:\Cognitive-Emotion-Windows-master\Cognitive-Emotion-Windows\Sample-WPF\bin\Debug\SampleUserControlLibrary.dll'. Symbols loaded.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework.Aero2\v4.0_4.0.0.0__31bf3856ad364e35\PresentationFramework.Aero2.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework-SystemXmlLinq\v4.0_4.0.0.0__b77a5c561934e089\PresentationFramework-SystemXmlLinq.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework-SystemXml\v4.0_4.0.0.0__b77a5c561934e089\PresentationFramework-SystemXml.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'C:\Users\muham\AppData\Local\Temp\VisualStudio.XamlDiagnostics.11316\WpfXamlDiagnosticsTap.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'C:\Windows\assembly\GAC\Microsoft.VisualStudio.OLE.Interop\7.1.40304.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.OLE.Interop.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\UIAutomationTypes\v4.0_4.0.0.0__31bf3856ad364e35\UIAutomationTypes.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Accessibility\v4.0_4.0.0.0__b03f5f7f11d50a3a\Accessibility.dll'. Cannot find or open the PDB file.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\UIAutomationProvider\v4.0_4.0.0.0__31bf3856ad364e35\UIAutomationProvider.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'F:\Cognitive-Emotion-Windows-master\Cognitive-Emotion-Windows\Sample-WPF\bin\Debug\Microsoft.ProjectOxford.Emotion.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Runtime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=ImageSource; DataItem=null; target element is 'CroppedBitmap' (HashCode=47670010); target property is 'Source' (type 'BitmapSource')
System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=UIRect; DataItem=null; target element is 'CroppedBitmap' (HashCode=47670010); target property is 'SourceRect' (type 'Int32Rect')
System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=ImageSource; DataItem=null; target element is 'CroppedBitmap' (HashCode=44066115); target property is 'Source' (type 'BitmapSource')
System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=UIRect; DataItem=null; target element is 'CroppedBitmap' (HashCode=44066115); target property is 'SourceRect' (type 'Int32Rect')
The thread 0x3618 has exited with code 0 (0x0).
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Deployment\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Deployment.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'F:\Cognitive-Emotion-Windows-master\Cognitive-Emotion-Windows\Sample-WPF\bin\Debug\Microsoft.ProjectOxford.Common.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Threading.Tasks\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Threading.Tasks.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Linq\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Linq.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'F:\Cognitive-Emotion-Windows-master\Cognitive-Emotion-Windows\Sample-WPF\bin\Debug\Newtonsoft.Json.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Net.Primitives\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Net.Primitives.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.IO\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.IO.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Text.Encoding\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Text.Encoding.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Numerics\v4.0_4.0.0.0__b77a5c561934e089\System.Numerics.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Serialization\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'EmotionAPI-WPF-Samples.vshost.exe' (CLR v4.0.30319: EmotionAPI-WPF-Samples.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework-SystemData\v4.0_4.0.0.0__b77a5c561934e089\PresentationFramework-SystemData.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The thread 0x1c68 has exited with code 0 (0x0).
The thread 0x36a8 has exited with code 0 (0x0).
The thread 0x36e8 has exited with code 0 (0x0).
The thread 0x3248 has exited with code 0 (0x0).
The thread 0x34b0 has exited with code 0 (0x0).
The thread 0x332c has exited with code 0 (0x0).
The thread 0x2f84 has exited with code 0 (0x0).
The thread 0x132c has exited with code 0 (0x0).
The program '[11316] EmotionAPI-WPF-Samples.vshost.exe' has exited with code 0 (0x0).

Project can't be loaded

Hello, I used this page (https://www.microsoft.com/cognitive-services/en-us/emotion-api/documentation/getstarted) as a referance and tried to execute each step as it's written.

But soon as I opened the project in Visual studio it gives an error:

One or more projects in the solution were not loaded correctly. Please see the Output Window for details.

After clicking okay, trying to ignore the issue, I go to the next step, Managing NuGet Packages. When I try to install Newtonsoft.Json, it said that it's already installed, but i can still upgrade it. I go on to the next step with both updating, and non-updating methods.

Next step is building and running the solution. When I build it, i see 2 errors, 5 warnings.

Errors:

  1. Severity Code Description Project File Line Suppression State
    Error The tag 'VideoResultControl' does not exist in XML namespace 'clr-namespace:SampleUserControlLibrary;assembly=SampleUserControlLibrary'. Line 28 Position 10. EmotionAPI-WPF-Samples C:\Users\kaanb\Desktop\Cognitive-Emotion-Windows-master\Sample-WPF\EmotionDetectionUsingVideoPage.xaml 28
  2. Severity Code Description Project File Line Suppression State
    Error The tag 'SampleScenarios' does not exist in XML namespace 'clr-namespace:SampleUserControlLibrary;assembly=SampleUserControlLibrary'. Line 12 Position 10. EmotionAPI-WPF-Samples C:\Users\kaanb\Desktop\Cognitive-Emotion-Windows-master\Sample-WPF\MainWindow.xaml 12

Warnings:

  1. Severity Code Description Project File Line Suppression State
    Warning The referenced component 'SampleUserControlLibrary' could not be found. EmotionAPI-WPF-Samples
  2. Severity Code Description Project File Line Suppression State
    Warning The referenced project '..\Cognitive-Common-Windows\SampleUserControlLibrary\SampleUserControlLibrary.csproj' does not exist. EmotionAPI-WPF-Samples
  3. Severity Code Description Project File Line Suppression State
    Warning The referenced project '..\Cognitive-Common-Windows\SampleUserControlLibrary\SampleUserControlLibrary.csproj' does not exist. EmotionAPI-WPF-Samples
  4. Severity Code Description Project File Line Suppression State
    Warning The tag 'VideoResultControl' does not exist in XML namespace 'clr-namespace:SampleUserControlLibrary;assembly=SampleUserControlLibrary'. Line 28 Position 10. EmotionAPI-WPF-Samples C:\Users\kaanb\Desktop\Cognitive-Emotion-Windows-master\Sample-WPF\EmotionDetectionUsingVideoPage.xaml 28
  5. Severity Code Description Project File Line Suppression State
    Warning The tag 'SampleScenarios' does not exist in XML namespace 'clr-namespace:SampleUserControlLibrary;assembly=SampleUserControlLibrary'. Line 12 Position 10. EmotionAPI-WPF-Samples C:\Users\kaanb\Desktop\Cognitive-Emotion-Windows-master\Sample-WPF\MainWindow.xaml 12

As you can predict, I cannot run this program after that. It should be running and asking me for the activation code, to advance.

Can you help me?

[System.Threading.Tasks.TaskCanceledException: A task was canceled] occured while using the Detect emotion in a video

[12:03:35.598941]: System.Threading.Tasks.TaskCanceledException: A task was canceled.
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.ProjectOxford.Common.ServiceClient.d__222.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.ProjectOxford.Common.ServiceClient.<PostAsync>d__202.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.ProjectOxford.Emotion.EmotionServiceClient.d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at EmotionAPI_WPF_Samples.EmotionDetectionUsingVideoPage.d__5.MoveNext() in C:\OUT\Sample-WPF\EmotionDetectionUsingVideoPage.xaml.cs:line 68

Above is the stack trace

error json failed to deserialze in emotionServiceClient.RecognizeInVideoAsync call with a string

Hi all,

I'm trying to call the emotionServiceClient.RecognizeInVideoAsync call with a string (as it's one of its overloaded functions) but it doesn't work. When I look a the package using "Telerik Fiddler" I get:
{"error":{"code":"BadArgument","message":"Failed to deserialize JSON request."}}

Also when I use emotionServiceClient.RecognizeAsync with a similar string (but for an image) it work without problem.

Can you help?

Thanks,
Ahmed

Method 'Microsoft.ProjectOxford.Common.ServiceClient.PostAsync' not found ?

hi guys
i'm used Emotion API package of nuget in my project and calling the API code as bellow:

Emotion[] emotionResult;
EmotionServiceClient emotionClient = new EmotionServiceClient(Constants.EmotionApiKey);
using (var photoStream = photo.GetStream())
{
emotionResult = await emotionClient.RecognizeAsync(photoStream);
if (emotionResult.Any())
{}
}

but , got exception when BOLD CODE is executed .
pic_004

so , anybody else known why and how to solve it ?

Thanks so much .

Error from running sample in Visual Studio

[06:20:41.583882]: VisionServiceClient is created
[06:20:41.585884]: Calling VisionServiceClient.AnalyzeImageAsync()...
[06:20:42.095822]: Microsoft.ProjectOxford.Vision.ClientException: Exception of type 'Microsoft.ProjectOxford.Vision.ClientException' was thrown.
at Microsoft.ProjectOxford.Vision.VisionServiceClient.HandleException(Exception exception)
at Microsoft.ProjectOxford.Vision.VisionServiceClient.b__42_1[TRequest,TResponse](Exception e)
at System.AggregateException.Handle(Func2 predicate) at Microsoft.ProjectOxford.Vision.VisionServiceClient.<SendAsync>d__422.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.ProjectOxford.Vision.VisionServiceClient.d__211.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at CallSite.Target(Closure , CallSite , Object ) at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0) at Microsoft.ProjectOxford.Vision.VisionServiceClient.<AnalyzeImageAsync>d__19.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()
at VisionAPI_WPF_Samples.AnalyzePage.d__2.MoveNext() in C:\Users\archba\Desktop\CognitiveVisionWindows\Sample-WPF\AnalyzePage.xaml.cs:line 117
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at VisionAPI_WPF_Samples.AnalyzePage.d__3.MoveNext() in C:\Users\archba\Desktop\CognitiveVisionWindows\Sample-WPF\AnalyzePage.xaml.cs:line 145
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at VisionAPI_WPF_Samples.ImageScenarioPage.d__15.MoveNext() in C:\Users\archba\Desktop\CognitiveVisionWindows\Sample-WPF\ImageScenarioPage.cs:line 90

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.