Object Recognition

Object Recognition detects, locates, and recognizes individual objects in an image file. Zia Object Recognition can identify 80 different kinds of objects from images.

You can provide a .jpg/.jpeg or .png file as the input. Refer to the API documentation for the request and response formats.

The detectObject() method is used detect and identify the objects in the image, and the input file is passed as an argument to this method. It returns the coordinates of each object, their type, and the confidence score of each recognition.

The zia reference used below is defined in the component instance page. The promise returned here is resolved to a JSON object.

Copiedvar zia = app.zia(); 
zia.detectObject(fs.createReadStream('./sampimage.jpg')) //Pass the input file
	.then((result) => {
		console.log(result);
	})
	.catch((err) => console.log(err.toString())); //Push errors to Catalyst Logs

A sample response that you will receive for each version is shown below:

Node.js

Copied{
   "objects":[
      {
         "co_ordinates":[
            322,
            125,
            708,
            1201
         ],
         "object_type":"person",
         "confidence":"99.82"
      }
   ]
}
Copied{
   "objects":[
      {
         "co_ordinates":[
            "322",
            "125",
            "708",
            "1201"
         ],
         "object_type":"person",
         "confidence":"99.82"
      }
   ]
}