Find objects from Images — Simple flow

Balamurugan Balakreshnan
4 min readJan 1, 2022

--

Azure Cognitive Services Computer Vision and Custom Vision

Use Computer vision to identify objects in an image

Use Case

  • Identify objects in an image which are common in a range of scenarios
  • Check for condition on objects detected For Example if certain objects are present in an image
  • Use Custom vision to detect more custom objects
  • use other cognitive services to infuse AI into the process
  • Event based

Architecture

Logic Flow

Code

  • Configure Azure Storage
  • Now sent to Analyze image
  • Delete existing files
  • Save the output
  • Parse JSON
{
"properties": {
"categories": {
"items": {
"properties": {
"detail": {
"properties": {
"celebrities": {
"type": "array"
}
},
"type": "object"
},
"name": {
"type": "string"
},
"score": {
"type": "number"
}
},
"required": [
"name",
"score",
"detail"
],
"type": "object"
},
"type": "array"
},
"description": {
"properties": {
"captions": {
"items": {
"properties": {
"confidence": {
"type": "number"
},
"text": {
"type": "string"
}
},
"required": [
"text",
"confidence"
],
"type": "object"
},
"type": "array"
},
"tags": {
"items": {
"type": "string"
},
"type": "array"
}
},
"type": "object"
},
"faces": {
"items": {
"properties": {
"age": {
"type": "integer"
},
"faceRectangle": {
"properties": {
"height": {
"type": "integer"
},
"left": {
"type": "integer"
},
"top": {
"type": "integer"
},
"width": {
"type": "integer"
}
},
"type": "object"
},
"gender": {
"type": "string"
}
},
"required": [
"age",
"gender",
"faceRectangle"
],
"type": "object"
},
"type": "array"
},
"metadata": {
"properties": {
"format": {
"type": "string"
},
"height": {
"type": "integer"
},
"width": {
"type": "integer"
}
},
"type": "object"
},
"modelVersion": {
"type": "string"
},
"objects": {
"items": {
"properties": {
"confidence": {
"type": "number"
},
"object": {
"type": "string"
},
"parent": {
"properties": {
"confidence": {
"type": "number"
},
"object": {
"type": "string"
}
},
"type": "object"
},
"rectangle": {
"properties": {
"h": {
"type": "integer"
},
"w": {
"type": "integer"
},
"x": {
"type": "integer"
},
"y": {
"type": "integer"
}
},
"type": "object"
}
},
"required": [
"rectangle",
"object",
"confidence"
],
"type": "object"
},
"type": "array"
},
"requestId": {
"type": "string"
},
"tags": {
"items": {
"properties": {
"confidence": {
"type": "number"
},
"name": {
"type": "string"
}
},
"required": [
"name",
"confidence"
],
"type": "object"
},
"type": "array"
}
},
"type": "object"
}
  • Set the condition
  • If True then send to custom vision
  • Send to custom vision
  • Delete existing files
  • Save the data to blob as json

Original article — Samples2021/computervision1.md at main · balakreshnan/Samples2021 (github.com)

--

--

No responses yet