Detect Object
Note:
- Each time the Detect Object task is executed, it triggers an API request to the back-end. This call is deducted from the external calls limit available for the service from which the task is executed, based on your pricing plan.
- Only actual executions that receive a response are counted, not the number of times the task appears in the script. For example, if Detect Object task is placed inside a for each task that iterates five times, the number of external API calls consumed will be five, even though the task appears only once in the script.
Table of Contents
Description
The zoho.ai.detectObject task detects objects from the input image. Click here for the list of object categories this task can detect.
Syntax
<response> = zoho.ai.detectObject(<file>);
where:
| Params | Data type | Description |
|---|---|---|
| <response> | KEY-VALUE | Specifies the objects detected from the input file and their coordinates. |
| <file> | FILE | Specifies the file object that contains the image file from which objects need to be detected. Note:
|
Example
The following script extracts and returns the objects such as person, chair, laptop, etc., that are available in the input image.
image = invokeurl [ url : "https://st.focusedcollection.com/18590116/i/1800/focused_220909150-stock-photo-group-business-people-working-office.jpg" ]; response = zoho.ai.detectObject(image);
where:
responseThe KEY-VALUE response that represents the objects detected from the image file and their coordinates.
imageThe FILE that represents the image from which objects need to be detected.
Response Format
Success Response
The success response will be returned in the following format:
{
"data": {
"detection": [
{
"category": "person",
"coordinates": {
"ymin": "0.09889359",
"xmin": "0.36033365",
"ymax": "0.4674538",
"xmax": "0.90111893"
},
"accuracy": "0.9999038"
},
{
"category": "person",
"coordinates": {
"ymin": "0.6769759",
"xmin": "0.13946709",
"ymax": "0.9323825",
"xmax": "0.74334395"
},
"accuracy": "0.9996403"
},
{
"category": "person",
"coordinates": {
"ymin": "0.19069281",
"xmin": "0.30147356",
"ymax": "0.32138097",
"xmax": "0.37876928"
},
"accuracy": "0.93886554"
},
{
"category": "person",
"coordinates": {
"ymin": "0.41176188",
"xmin": "0.28800115",
"ymax": "0.7079046",
"xmax": "0.8212157"
},
"accuracy": "0.914988"
},
{
"category": "cup",
"coordinates": {
"ymin": "0.50251013",
"xmin": "0.5412055",
"ymax": "0.5488396",
"xmax": "0.5911263"
},
"accuracy": "0.82785475"
},
{
"category": "chair",
"coordinates": {
"ymin": "0.5360593",
"xmin": "0.30517107",
"ymax": "0.6863361",
"xmax": "0.40787065"
},
"accuracy": "0.9263675"
},
{
"category": "chair",
"coordinates": {
"ymin": "0.005246768",
"xmin": "0.5437859",
"ymax": "0.25210744",
"xmax": "0.9349979"
},
"accuracy": "0.77300894"
},
{
"category": "laptop",
"coordinates": {
"ymin": "0.26221845",
"xmin": "0.4746042",
"ymax": "0.45911294",
"xmax": "0.5859201"
},
"accuracy": "0.99141645"
}
]
},
"message": "success"
}
Failure Response
The failure response when the file size exceeded the allowed limit will be returned in the following format:
The zoho.ai.detectObject integration task failed because the size of the supplied input file exceeded the allowed limit of 10MB. (Line No - 114)The failure response for an unsupported input file will be returned in the following format:
{ "error":
{
"code":400,
"message":"image file content is not allowed"
},
"status":"Failed"
}