microsoft / Cognitive-Face-Windows

Windows SDK for the Microsoft Face API, part of Cognitive Services
https://www.microsoft.com/cognitive-services/en-us/face-api
Other
177 stars 161 forks source link

exception of type 'Microsoft.ProjectOxford.Face.FaceApiException' was thrown #55

Closed cissemy closed 5 years ago

cissemy commented 5 years ago

Hi, I keep getting the error : exception of type 'Microsoft.ProjectOxford.Face.FaceApiException' was thrown. I am using standard price tier and my code is :

Private Shared Function CreateFaceClient() As IFaceServiceClient Return New FaceServiceClient("key", "https://eastus2.api.cognitive.microsoft.com/face/v1.0") End Function

Private Async Sub Button4_ClickAsync(sender As Object, e As EventArgs) Handles Button4.Click Button4.Enabled = False Try If CameraControl1.TakeSnapshot() Is Nothing Then MsgBox("Take a Picture First") Exit Sub End If Dim url As String = Path.Combine(My.Computer.FileSystem.SpecialDirectories.Temp, "faceapi.jpg") ' "C:\Users\Cisse\Desktop\08388022IJJSB.jpg" CameraControl1.TakeSnapshot().Save(url, Imaging.ImageFormat.Jpeg) Dim personGroupId As String = "1" Dim faceServiceclient As IFaceServiceClient = CreateFaceClient() Using fs As Stream = File.OpenRead(url) Dim faces = Await faceServiceclient.DetectAsync(fs) Dim faceIds = faces.Select(Function(face) face.FaceId).ToArray() Dim results = Await faceServiceclient.IdentifyAsync(personGroupId, faceIds) For Each identifyResult In results ' MsgBox(identifyResult.FaceId.ToString()) If identifyResult.Candidates.Length = 0 Then MsgBox("No one identified") Else Dim candidateid = identifyResult.Candidates(0).PersonId Dim person = Await faceServiceclient.GetPersonAsync(personGroupId, candidateid) MsgBox("Welcome :" & person.Name & Space(2) & person.UserData)

                End If
            Next
        End Using
    Catch ex As Exception
        MsgBox(ex.Message)
    Finally
        Button4.Enabled = True
    End Try

End Sub
lebronJ commented 5 years ago

Hi @cissemy, hopefully you can provide more details e.g. exception error message. It is difficult to judge what is wrong from your current description.

To validate your subscription key, you can test it with the samle: https://github.com/Microsoft/Cognitive-Face-Windows/tree/master/Sample-WPF.

cissemy commented 5 years ago

Hi, My subscription is valid

lebronJ commented 5 years ago

Could you catch the exception and show the exception error message?

cissemy commented 5 years ago

Ok

On Wed, Jan 16, 2019 at 7:57 PM Siqi Liu notifications@github.com wrote:

Could you catch the exception and show the exception error message?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Microsoft/Cognitive-Face-Windows/issues/55#issuecomment-455001716, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFUidqEOQzfenS9wcq0chZatziDv72Xks5vD8pkgaJpZM4Z_Exr .

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

cissemy commented 5 years ago

Hi, I am getting the following error message: attached file. This happen when the system does not recognize a face from webcam. Let say i register the same face twice under 2 different personId. So when i delete 1 person instead of of the detecting the face as the personId non deleted (since the 2 personId are the same person), it throw that error. Thanks

On Thu, Jan 17, 2019 at 11:02 AM CISSE M.Y. cissemy@gmail.com wrote:

Ok

On Wed, Jan 16, 2019 at 7:57 PM Siqi Liu notifications@github.com wrote:

Could you catch the exception and show the exception error message?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Microsoft/Cognitive-Face-Windows/issues/55#issuecomment-455001716, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFUidqEOQzfenS9wcq0chZatziDv72Xks5vD8pkgaJpZM4Z_Exr .

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

lebronJ commented 5 years ago

Sorry but we have not received your attached file. Maybe you need post it on GitHub.

Your description is kind of confusing to us, but guess you may forget to train the person group before calling identify.

cissemy commented 5 years ago

Hi, I do not train the group before identify. I do not train the group after deleting a person. Could that be the reason ?

On Wed, Jan 23, 2019 at 1:35 AM Siqi Liu notifications@github.com wrote:

Sorry but we have not received your attached file. Maybe you need post it on GitHub.

Your description is kind of confusing to us, but guess you may forget to train the person group before calling identify.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Microsoft/Cognitive-Face-Windows/issues/55#issuecomment-456687432, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFUiaTNh-vhLdbavVk5Yu7h3d3h-0Naks5vGAKugaJpZM4Z_Exr .

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

lebronJ commented 5 years ago

Yes, as our API reference says, "Training is a crucial step that only a trained person group can be used by Face - Identify."

cissemy commented 5 years ago

Thanks. Let say i add one person and his/her face .How can I train that particular person (rest endpoint) ? I will try and let you know.

On Wed, Jan 23, 2019 at 4:39 AM Siqi Liu notifications@github.com wrote:

Yes, as our API reference https://westus.dev.cognitive.microsoft.com/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395249 says, "Training is a crucial step that only a trained person group can be used by Face - Identify."

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Microsoft/Cognitive-Face-Windows/issues/55#issuecomment-456734245, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFUiZ8kcNOxSDO6kP_ceI19e7Mw8qjgks5vGC2-gaJpZM4Z_Exr .

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

lebronJ commented 5 years ago
  1. We only support training towards the whole person group.
  2. Identify will use the last training results. If no change to the person group after last training, no need to train before identify.
cissemy commented 5 years ago

Thanks What is the rest endpoint for the group training?

On Wed, Jan 23, 2019 at 5:03 AM Siqi Liu notifications@github.com wrote:

  1. We only support training towards the whole person group.
  2. Identify will use the last training results. If no change to the person group after last training, no need to train before identify.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Microsoft/Cognitive-Face-Windows/issues/55#issuecomment-456742010, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFUiT5QLt7V4xqDWSvthMKdUwuTBQaIks5vGDNigaJpZM4Z_Exr .

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

cissemy commented 5 years ago

Hi, Everything seems to be working fine since I trained back the group. Thanks

On Wed, Jan 23, 2019 at 5:10 AM CISSE M.Y. cissemy@gmail.com wrote:

Thanks What is the rest endpoint for the group training?

On Wed, Jan 23, 2019 at 5:03 AM Siqi Liu notifications@github.com wrote:

  1. We only support training towards the whole person group.
  2. Identify will use the last training results. If no change to the person group after last training, no need to train before identify.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Microsoft/Cognitive-Face-Windows/issues/55#issuecomment-456742010, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFUiT5QLt7V4xqDWSvthMKdUwuTBQaIks5vGDNigaJpZM4Z_Exr .

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

lebronJ commented 5 years ago

Glad to know you have solved all your issues. Would you mind closing this issue?

cissemy commented 5 years ago

yes.

On Sun, Jan 27, 2019 at 10:32 PM Siqi Liu notifications@github.com wrote:

Glad to know you have solved all your issues. Would you mind closing this issue?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Microsoft/Cognitive-Face-Windows/issues/55#issuecomment-457989081, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFUidfnTGWWyJNcas8UowJoyiJo-AAhks5vHm81gaJpZM4Z_Exr .

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028