Skip to content

There is a bug with typecasting in Azure Cognitive part #6586

Closed

Description

Bug Report

  • import path .../services/cognitiveservices/v1.0/face"
  • SDK version: 34.0.0
  • Go Version: go1.13.1 darwin/amd64

What happened?

When I try to call AddPhoto method of Cognitive through a picture that includes more than 1 face remote service returns me an error with description like "there is more 1 face", after that I call the Detect method to get coordinates of required face and then send it again, but AddFace answers me that coordinates are incorrect.

Instead of sending correct coordinates it sends value like this <int32 Value> <int32 Value> <int32 Value> <int32 Value>

What did you expect or want to happen?

I send coordinates and picture then receive a correct answer with persisted_face_id

How can we reproduce it?

Use face.LargeFaceListClient and call AddFaceFromURL set the valid targetFace with []int32{} and send a request to a mock server to have an opportunity to see the result of that request.

Btw, I've found the reason.

Here we are calling autorest.Encode("query", targetFace, ",") and this is the reason of that behavior.

if targetFace != nil && len(targetFace) > 0 {
queryParameters["targetFace"] = autorest.Encode("query", targetFace, ",")
}

As we know, targetFace is a slice of int32, but autorest.Encode under the hood wants to get a slice of strings or some types derived from string.
Look:

https://github.com/Azure/go-autorest/blob/b965d219bd9d10676384ef8f05da2e2441df9829/autorest/utility.go#L143-L157

So, now I don't really understand where we have to fix it. Either in go-autorest or here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Cognitive Servicescustomer-reportedIssues that are reported by GitHub users external to the Azure organization.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions