Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add areaOfInterest and detectObject to CV API #4771

Merged
merged 4 commits into from
Dec 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -227,42 +227,48 @@
}
},
"ComputerVisionError": {
"type": "object",
"description": "Details about the API request error.",
"required": [
"code",
"message"
],
"type": "object",
"properties": {
"code": {
"type": "string",
"description": "The error code.",
"enum": [
"InvalidImageUrl",
"InvalidImageFormat",
"InvalidImageSize",
"NotSupportedVisualFeature",
"UnsupportedMediaType",
"InvalidImageUrl",
"NotSupportedFeature",
"NotSupportedImage",
"InvalidDetails",
"NotSupportedLanguage",
"BadArgument",
"FailedToProcess",
"Timeout",
"InternalServerError",
"InvalidImageSize",
"BadArgument",
"DetectFaceError",
"NotSupportedLanguage",
"InvalidThumbnailSize",
"InvalidDetails",
"InvalidModel",
"CancelledRequest",
"NotSupportedVisualFeature",
"FailedToProcess",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be a breaking change for your API - current SDKs will not be able to handle these new enums. Only enums with "modelAsString" set to true are allowed to add new enum values.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you help clarify? If the service returns one of these new values in the JSON, aren't current clients screwed anyway?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jianghaolu Any comments?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes That's what I mean by saying the rest API is going to break the clients.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aren't current clients screwed anyway

This doesn't justify breaking the clients after breaking the APIs. If this list is supposed to grow you should mark "modelAsString" to true in this PR. This PR is bringing breaking changes anyways (unfortunately) but there will be no more in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it to true to prevent future breaking changes. Also in here.

"Unspecified",
"StorageException"
],
"x-ms-enum": {
"name": "ComputerVisionErrorCodes",
"modelAsString": false
"modelAsString": true
}
},
"message": {
"type": "string",
"description": "A message explaining the error reported by the service."
"description": "A message explaining the error reported by the service.",
"type": "string"
},
"requestId": {
"type": "string",
"description": "A unique request identifier."
"description": "A unique request identifier.",
"type": "string"
}
}
},
Expand All @@ -273,7 +279,7 @@
],
"properties": {
"url": {
"description": "Publicly reachable URL of an image",
"description": "Publicly reachable URL of an image.",
"type": "string"
}
}
Expand Down Expand Up @@ -320,7 +326,7 @@
},
"Endpoint": {
"name": "Endpoint",
"description": "Supported Cognitive Services endpoints",
"description": "Supported Cognitive Services endpoints.",
"x-ms-parameter-location": "client",
"required": true,
"type": "string",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"parameters": {
"Endpoint": "https://westus.api.cognitive.microsoft.com",
"Ocp-Apim-Subscription-Key": "{API key}",
"visualFeatures": ["Categories", "Adult", "Tags", "Description", "Faces", "Color", "ImageType"],
"details": "Celebrities",
"visualFeatures": ["Categories", "Adult", "Tags", "Description", "Faces", "Color", "ImageType", "Objects"],
"details": ["Celebrities", "Landmarks"],
"language": "en",
"Image": "{binary}"
},
Expand Down Expand Up @@ -116,7 +116,23 @@
"imageType": {
"clipArtType": 0,
"lineDrawingType": 0
}
},
"objects": [
{
"rectangle": {
"x": 0,
"y": 0,
"w": 50,
"h": 50
},
"object": "tree",
"confidence": 0.9,
"parent": {
"object": "plant",
"confidence": 0.95
}
}
]
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"parameters": {
"Endpoint": "https://westus.api.cognitive.microsoft.com",
"Ocp-Apim-Subscription-Key": "{API key}",
"visualFeatures": "Categories,Adult,Tags,Description,Faces,Color,ImageType",
"details": "Celebrities,Landmarks",
"visualFeatures": ["Categories", "Adult", "Tags", "Description", "Faces", "Color", "ImageType", "Objects"],
"details": ["Celebrities", "Landmarks"],
"language": "en",
"ImageUrl": "{url}"
},
Expand Down Expand Up @@ -122,7 +122,23 @@
"imageType": {
"clipArtType": 0,
"lineDrawingType": 0
}
},
"objects": [
{
"rectangle": {
"x": 0,
"y": 0,
"w": 50,
"h": 50
},
"object": "tree",
"confidence": 0.9,
"parent": {
"object": "plant",
"confidence": 0.95
}
}
]
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"parameters": {
"Endpoint": "https://westus.api.cognitive.microsoft.com",
"Ocp-Apim-Subscription-Key": "{API key}",
"maxCandidates": "1",
"maxCandidates": 1,
"Image": "{binary}"
},
"responses": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"parameters": {
"Endpoint": "https://westus.api.cognitive.microsoft.com",
"Ocp-Apim-Subscription-Key": "{API key}",
"maxCandidates": "1",
"maxCandidates": 1,
"ImageUrl": "{url}"
},
"responses": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"parameters": {
"Endpoint": "https://westus.api.cognitive.microsoft.com",
"Ocp-Apim-Subscription-Key": "{API key}",
"Image": "{binary}"
},
"responses": {
"200": {
"body": {
"objects": [
{
"rectangle": {
"x": 0,
"y": 0,
"w": 50,
"h": 50
},
"object": "tree",
"confidence": 0.9,
"parent": {
"object": "plant",
"confidence": 0.95
}
}
],
"requestId": "1ad0e45e-b7b4-4be3-8042-53be96103337",
"metadata": {
"width": 100,
"height": 100,
"format": "Jpeg"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just an idea, wouldn't jpeg or JPEG be better?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but for all the of other services it's Jpeg and I think it's better to keep them consistent.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, what services you are referring to? I searched before and didn't find anyother..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh you mean other operations, I thought you mean other services

}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"parameters": {
"Endpoint": "https://westus.api.cognitive.microsoft.com",
"Ocp-Apim-Subscription-Key": "{API key}",
"ImageUrl": "{url}"
},
"responses": {
"200": {
"body": {
"objects": [
{
"rectangle": {
"x": 0,
"y": 0,
"w": 50,
"h": 50
},
"object": "tree",
"confidence": 0.9,
"parent": {
"object": "plant",
"confidence": 0.95
}
}
],
"requestId": "1ad0e45e-b7b4-4be3-8042-53be96103337",
"metadata": {
"width": 100,
"height": 100,
"format": "Jpeg"
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"parameters": {
"Endpoint": "https://westus.api.cognitive.microsoft.com",
"Ocp-Apim-Subscription-Key": "{API key}",
"Image": "{binary}"
},
"responses": {
"200": {
"headers": {},
"body": {
"areaOfInterest": {
"h": 951,
"w": 950,
"x": 160,
"y": 0
},
"requestId": "ed2de1c6-fb55-4686-b0da-4da6e05d283f",
"metadata": {
"format": "Jpeg",
"height": 951,
"width": 1378
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"parameters": {
"Endpoint": "https://westus.api.cognitive.microsoft.com",
"Ocp-Apim-Subscription-Key": "{API key}",
"ImageUrl": "{url}"
},
"responses": {
"200": {
"headers": {},
"body": {
"areaOfInterest": {
"h": 951,
"w": 950,
"x": 160,
"y": 0
},
"requestId": "ed2de1c6-fb55-4686-b0da-4da6e05d283f",
"metadata": {
"format": "Jpeg",
"height": 951,
"width": 1378
}
}
}
}
}