Habilidade cognitiva de Análise de ImagensImage Analysis cognitive skill
A habilidade Análise de Imagens extrai um conjunto avançado de recursos visuais com base no conteúdo da imagem.The Image Analysis skill extracts a rich set of visual features based on the image content. Por exemplo, é possível gerar uma legenda de uma imagem, criar marcas ou identificar celebridades e pontos de referência.For example, you can generate a caption from an image, generate tags, or identify celebrities and landmarks. Essa habilidade usa os modelos de machine learning fornecidos pela Pesquisa Visual Computacional nos Serviços Cognitivos.This skill uses the machine learning models provided by Computer Vision in Cognitive Services.
Observação
Volumes pequenos (menos de 20 transações) podem ser executados gratuitamente no Azure Pesquisa Cognitiva, mas cargas de trabalho maiores exigem a anexação de um recurso de serviços cognitivas cobráveis.Small volumes (under 20 transactions) can be executed for free in Azure Cognitive Search, but larger workloads require attaching a billable Cognitive Services resource. As cobranças são geradas ao chamar APIs nos Serviços Cognitivos e para a extração de imagem, como parte do estágio de quebra de documento na Pesquisa Cognitiva do Azure.Charges accrue when calling APIs in Cognitive Services, and for image extraction as part of the document-cracking stage in Azure Cognitive Search. Não há encargos para extração de texto em documentos.There are no charges for text extraction from documents.
A execução de habilidades integradas é cobrada nos preços pagos conforme o uso dos Serviços Cognitivos existentes.Execution of built-in skills is charged at the existing Cognitive Services pay-as-you go price. O preço da extração de imagem é descrito na página de preços da Pesquisa Cognitiva do Azure.Image extraction pricing is described on the Azure Cognitive Search pricing page.
@odata.type
Microsoft.Skills.Vision.ImageAnalysisSkillMicrosoft.Skills.Vision.ImageAnalysisSkill
Parâmetros de habilidadesSkill parameters
Os parâmetros diferenciam maiúsculas de minúsculas.Parameters are case-sensitive.
Nome do parâmetroParameter name | DescriçãoDescription |
---|---|
defaultLanguageCode |
Uma cadeia de caracteres que indica o idioma para retornar.A string indicating the language to return. O serviço retorna resultados de reconhecimento no idioma especificado.The service returns recognition results in a specified language. Se este parâmetro não for especificado, o valor padrão é “en”.If this parameter is not specified, the default value is "en". Idiomas com suporte:Supported languages are: en - inglês (padrão)en - English (default) es -espanholes - Spanish ja -japonêsja - Japanese pt -Portuguêspt - Portuguese zh - chinês Simplificadozh - Simplified Chinese |
visualFeatures |
Uma matriz de cadeias de caracteres que indica os tipos de recurso visuais para retornar.An array of strings indicating the visual feature types to return. Tipos de recurso válido visuais:Valid visual feature types include:
|
details |
Uma matriz de cadeias de caracteres que indica qual domínio específico de detalhes retornar.An array of strings indicating which domain-specific details to return. Tipos de recurso válido visuais:Valid visual feature types include:
|
Entradas de habilidadesSkill inputs
Nome de entradaInput name | DescriçãoDescription |
---|---|
image |
Tipo complexo.Complex Type. Atualmente só funciona com o campo "/document/normalized_images" produzido pelo indexador de BLOBs do Microsoft Azure quando imageAction é definido como um valor diferente de none .Currently only works with "/document/normalized_images" field, produced by the Azure Blob indexer when imageAction is set to a value other than none . Para obter mais informações, confira este exemplo.See the sample for more information. |
Exemplo de definição de habilidadeSample skill definition
{
"description": "Extract image analysis.",
"@odata.type": "#Microsoft.Skills.Vision.ImageAnalysisSkill",
"context": "/document/normalized_images/*",
"defaultLanguageCode": "en",
"visualFeatures": [
"tags",
"categories",
"description",
"faces",
"brands"
],
"inputs": [
{
"name": "image",
"source": "/document/normalized_images/*"
}
],
"outputs": [
{
"name": "categories"
},
{
"name": "tags"
},
{
"name": "description"
},
{
"name": "faces"
},
{
"name": "brands"
}
]
}
Índice de exemplo (somente para os campos categorias, descrição, rostos e marcas)Sample index (for only the categories, description, faces and tags fields)
{
"fields": [
{
"name": "id",
"type": "Edm.String",
"key": true,
"searchable": true,
"filterable": false,
"facetable": false,
"sortable": true
},
{
"name": "blob_uri",
"type": "Edm.String",
"searchable": true,
"filterable": false,
"facetable": false,
"sortable": true
},
{
"name": "content",
"type": "Edm.String",
"sortable": false,
"searchable": true,
"filterable": false,
"facetable": false
},
{
"name": "categories",
"type": "Collection(Edm.ComplexType)",
"fields": [
{
"name": "name",
"type": "Edm.String",
"searchable": true,
"filterable": false,
"facetable": false
},
{
"name": "score",
"type": "Edm.Double",
"searchable": false,
"filterable": false,
"facetable": false
},
{
"name": "detail",
"type": "Edm.ComplexType",
"fields": [
{
"name": "celebrities",
"type": "Collection(Edm.ComplexType)",
"fields": [
{
"name": "name",
"type": "Edm.String",
"searchable": true,
"filterable": false,
"facetable": false
},
{
"name": "faceBoundingBox",
"type": "Collection(Edm.ComplexType)",
"fields": [
{
"name": "x",
"type": "Edm.Int32",
"searchable": false,
"filterable": false,
"facetable": false
},
{
"name": "y",
"type": "Edm.Int32",
"searchable": false,
"filterable": false,
"facetable": false
}
]
},
{
"name": "confidence",
"type": "Edm.Double",
"searchable": false,
"filterable": false,
"facetable": false
}
]
},
{
"name": "landmarks",
"type": "Collection(Edm.ComplexType)",
"fields": [
{
"name": "name",
"type": "Edm.String",
"searchable": true,
"filterable": false,
"facetable": false
},
{
"name": "confidence",
"type": "Edm.Double",
"searchable": false,
"filterable": false,
"facetable": false
}
]
}
]
}
]
},
{
"name": "description",
"type": "Collection(Edm.ComplexType)",
"fields": [
{
"name": "tags",
"type": "Collection(Edm.String)",
"searchable": true,
"filterable": false,
"facetable": false
},
{
"name": "captions",
"type": "Collection(Edm.ComplexType)",
"fields": [
{
"name": "text",
"type": "Edm.String",
"searchable": true,
"filterable": false,
"facetable": false
},
{
"name": "confidence",
"type": "Edm.Double",
"searchable": false,
"filterable": false,
"facetable": false
}
]
}
]
},
{
"name": "faces",
"type": "Collection(Edm.ComplexType)",
"fields": [
{
"name": "age",
"type": "Edm.Int32",
"searchable": false,
"filterable": false,
"facetable": false
},
{
"name": "gender",
"type": "Edm.String",
"searchable": false,
"filterable": false,
"facetable": false
},
{
"name": "faceBoundingBox",
"type": "Collection(Edm.ComplexType)",
"fields": [
{
"name": "x",
"type": "Edm.Int32",
"searchable": false,
"filterable": false,
"facetable": false
},
{
"name": "y",
"type": "Edm.Int32",
"searchable": false,
"filterable": false,
"facetable": false
}
]
}
]
},
{
"name": "tags",
"type": "Collection(Edm.ComplexType)",
"fields": [
{
"name": "name",
"type": "Edm.String",
"searchable": true,
"filterable": false,
"facetable": false
},
{
"name": "confidence",
"type": "Edm.Double",
"searchable": false,
"filterable": false,
"facetable": false
}
]
}
]
}
Exemplo de mapeamento de campo de saída (para o índice acima)Sample output field mapping (for the above index)
"outputFieldMappings": [
{
"sourceFieldName": "/document/normalized_images/*/categories/*",
"targetFieldName": "categories"
},
{
"sourceFieldName": "/document/normalized_images/*/tags/*",
"targetFieldName": "tags"
},
{
"sourceFieldName": "/document/normalized_images/*/description",
"targetFieldName": "description"
},
{
"sourceFieldName": "/document/normalized_images/*/faces/*",
"targetFieldName": "faces"
},
{
"sourceFieldName": "/document/normalized_images/*/brands/*/name",
"targetFieldName": "brands"
}
Variação em mapeamentos de campo de saída (propriedades aninhadas)Variation on output field mappings (nested properties)
Você pode definir mapeamentos de campo de saída para propriedades de nível inferior, como apenas pontos de referência ou celebridades.You can define output field mappings to lower-level properties, such as just landmarks or celebrities. Nesse caso, verifique se o seu esquema de índice tem um campo para conter pontos de referência especificamente.In this case, make sure your index schema has a field to contain landmarks specifically.
"outputFieldMappings": [
{
"sourceFieldName": "/document/normalized_images/*/categories/detail/celebrities/*",
"targetFieldName": "celebrities"
}
Entrada de exemploSample input
{
"values": [
{
"recordId": "1",
"data": {
"image": {
"data": "BASE64 ENCODED STRING OF A JPEG IMAGE",
"width": 500,
"height": 300,
"originalWidth": 5000,
"originalHeight": 3000,
"rotationFromOriginal": 90,
"contentOffset": 500,
"pageNumber": 2
}
}
}
]
}
Saída de exemploSample output
{
"values": [
{
"recordId": "1",
"data": {
"categories": [
{
"name": "abstract_",
"score": 0.00390625
},
{
"name": "people_",
"score": 0.83984375,
"detail": {
"celebrities": [
{
"name": "Satya Nadella",
"faceBoundingBox": [
{
"x": 273,
"y": 309
},
{
"x": 395,
"y": 309
},
{
"x": 395,
"y": 431
},
{
"x": 273,
"y": 431
}
],
"confidence": 0.999028444
}
],
"landmarks": [
{
"name": "Forbidden City",
"confidence": 0.9978346
}
]
}
}
],
"adult": {
"isAdultContent": false,
"isRacyContent": false,
"isGoryContent": false,
"adultScore": 0.0934349000453949,
"racyScore": 0.068613491952419281,
"goreScore": 0.08928389008070282
},
"tags": [
{
"name": "person",
"confidence": 0.98979085683822632
},
{
"name": "man",
"confidence": 0.94493889808654785
},
{
"name": "outdoor",
"confidence": 0.938492476940155
},
{
"name": "window",
"confidence": 0.89513939619064331
}
],
"description": {
"tags": [
"person",
"man",
"outdoor",
"window",
"glasses"
],
"captions": [
{
"text": "Satya Nadella sitting on a bench",
"confidence": 0.48293603002174407
}
]
},
"requestId": "0dbec5ad-a3d3-4f7e-96b4-dfd57efe967d",
"metadata": {
"width": 1500,
"height": 1000,
"format": "Jpeg"
},
"faces": [
{
"age": 44,
"gender": "Male",
"faceBoundingBox": [
{
"x": 1601,
"y": 395
},
{
"x": 1653,
"y": 395
},
{
"x": 1653,
"y": 447
},
{
"x": 1601,
"y": 447
}
]
}
],
"objects": [
{
"rectangle": {
"x": 25,
"y": 43,
"w": 172,
"h": 140
},
"object": "person",
"confidence": 0.931
}
],
"brands":[
{
"name":"Microsoft",
"confidence": 0.903,
"rectangle":{
"x":20,
"y":97,
"w":62,
"h":52
}
}
]
}
}
]
}
Casos de erroError cases
Nos casos de erro a seguir, nenhum elemento é extraído.In the following error cases, no elements are extracted.
Código do ErroError Code | DescriçãoDescription |
---|---|
NotSupportedLanguage |
O idioma fornecido não tem suporte.The language provided is not supported. |
InvalidImageUrl |
A URL da imagem está incorretamente formatada ou não está acessível.Image URL is badly formatted or not accessible. |
InvalidImageFormat |
Os dados de entrada não são uma imagem válida.Input data is not a valid image. |
InvalidImageSize |
A imagem de entrada é muito grande.Input image is too large. |
NotSupportedVisualFeature |
O tipo de destino especificado não é válido.Specified feature type is not valid. |
NotSupportedImage |
Imagem sem suporte, por exemplo, pornografia infantil.Unsupported image, for example, child pornography. |
InvalidDetails |
Modelo de domínio específico sem suporte.Unsupported domain-specific model. |
Se você receber o erro semelhante a "One or more skills are invalid. Details: Error in skill #<num>: Outputs are not supported by skill: Landmarks"
, verifique o caminho.If you get the error similar to "One or more skills are invalid. Details: Error in skill #<num>: Outputs are not supported by skill: Landmarks"
, check the path. Celebridades e pontos de referência são propriedades em detail
.Both celebrities and landmarks are properties under detail
.
"categories":[
{
"name":"building_",
"score":0.97265625,
"detail":{
"landmarks":[
{
"name":"Forbidden City",
"confidence":0.92013400793075562
}
]