Skip to product menu
close
EXPLORE ALL PRODUCTS

Sales

CRM

Comprehensive CRM platform for customer-facing teams.

CRM
Voice

Cloud Contact Center Software for businesses.

Voice
Sign

Digital signature app for businesses.

Sign
Forms

Build online forms for every business need.

Forms
Bigin

Simple CRM for small businesses moving from spreadsheets.

Bigin
SalesIQ

Live chat app to engage and convert website visitors.

SalesIQ
Bookings

Appointment scheduling app for consultations with customers.

Bookings
RouteIQ

Comprehensive sales map visualization and optimal route planning solution.

RouteIQ
Thrive

Loyalty platform to reward, retain, and grow your customer base.

Thrive
Suites
CRM Plus

Unified platform to deliver top-notch customer experience.

CRM Plus

Marketing

Campaigns

Create, send, and track targeted email campaigns that drive sales.

Campaigns
Voice

Cloud Contact Center Software for businesses.

Voice
Sign

Digital signature app for businesses.

Sign
Forms

Build online forms for every business need.

Forms
Social

All-in-one social media management software.

Social
Survey

Design surveys to reach and interact with your audience.

Survey
SalesIQ

Live chat app to engage and convert website visitors.

SalesIQ
Sites

Online website builder with extensive customisation options.

Sites
Backstage

End-to-end event management software.

Backstage
PageSense

Website conversion optimization and personalisation platform.

PageSense
Marketing Automation

All-in-one marketing automation software.

Marketing Automation
LandingPage

Smart landing page builder to increase conversion rates

LandingPage
Webinar

Webinar platform for webcasting online webinars.

Webinar
NEW
LeadChain

Sync, manage, and convert leads across channels seamlessly.

LeadChain
NEW
Domains

Easy domain registration, transfer, and secured DNS management.

Domains
NEW
CommunitySpaces

Online community platform for individuals and businesses to grow their network and brand.

CommunitySpaces
Thrive

Loyalty platform to reward, retain, and grow your customer base.

Thrive
Publish

Manage all your local business listings on a single platform.

Publish
Suites
Marketing Plus

Unified marketing platform for marketing teams.

Marketing Plus

Commerce and POS

Commerce

eCommerce platform to manage and market your online store.

Commerce

Service

Desk

Helpdesk software to deliver great customer support.

Desk
Assist

Remote support and unattended remote access software.

Assist
Voice

Cloud Contact Center Software for businesses.

Voice
SalesIQ

Live chat app to engage and convert website visitors.

SalesIQ
Bookings

Appointment scheduling app for consultations with customers.

Bookings
FSM

End-to-end field service management platform for service businesses.

FSM
Lens

Interactive remote assistance software with augmented reality.

Lens
Solo

The all-in-one toolkit for solopreneurs.

Solo
Suites
Service Plus

Unified platform for customer service and support teams.

Service Plus

Finance

Books

Powerful accounting platform for growing businesses.

Books
Expense

Effortless expense reporting platform.

Expense
Sign

Digital signature app for businesses.

Sign
Inventory

Powerful stock management and inventory control software.

Inventory
FREE
Invoice

100% Free invoicing solution.

Invoice
Billing

End-to-end billing solution for your business.

Billing
NEW
Payroll

Payroll software with automated tax payments and filing.

Payroll
Commerce

eCommerce platform to manage and market your online store.

Commerce
Checkout

Collect payments online with custom branded pages.

Checkout
Practice

Practice management software for accounting firms.

Practice
Solo

The all-in-one toolkit for solopreneurs.

Solo
NEW
Payments

Unified payment solution built for all businesses.

Payments
Suites
Finance Plus

All-in-one suite to manage your operations and finances.

Finance Plus

Email, Storage, and Collaboration

Mail

Secure email service for teams of all sizes.

Mail
Voice

Cloud Contact Center Software for businesses.

Voice
Sign

Digital signature app for businesses.

Sign
WorkDrive

Online file management for teams.

WorkDrive
Bookings

Appointment scheduling app for consultations with customers.

Bookings
Cliq

Stay in touch with teams no matter where you are.

Cliq
Notebook

Beautiful home for all your notes.

Notebook
Meeting

Online meeting software for all your video conferencing & webinar needs.

Meeting
Connect

Employee experience platform to communicate, engage, and build positive employee relations.

Connect
Learn

Knowledge and learning management platform.

Learn
Office Integrator

Built in document editors for web apps.

Office Integrator
Writer

Word processor for focused writing and discussions.

Writer
TeamInbox

Shared inboxes for teams.

TeamInbox
ZeptoMail

Secure and reliable transactional email sending service.

ZeptoMail
Show

Create, edit, and share slides with a sleek presentation app.

Show
Tables

Work management tool to connect people, processes, and information.

Tables
Sheet

Spreadsheet software for collaborative teams.

Sheet
Office Suite

Powerful collaborative work platform for teams.

Office Suite
Calendar

Online business calendar to manage events and schedule appointments.

Calendar
ToDo

Collaborative task management for individuals and teams.

ToDo
FREE
PDF Editor

Collaborative online PDF editing tool.

PDF Editor
Suites
Workplace

Application suite built to improve team productivity and collaboration.

Workplace

Human Resources

Expense

Effortless expense reporting platform.

Expense
Recruit

Intuitive recruiting platform built to provide hiring solutions.

Recruit
People

Organize, automate, and simplify your HR processes.

People
Sign

Digital signature app for businesses.

Sign
NEW
Payroll

Payroll software with automated tax payments and filing.

Payroll
Shifts

Employee scheduling and time tracking app.

Shifts
Workerly

Manage temporary staffing with an employee scheduling solution.

Workerly
Suites
People Plus

Comprehensive HR platform for seamless employee experiences.

People Plus

Security and IT Management

Creator

AI-powered platform to build custom business apps.

Creator
Assist

Remote support and unattended remote access software.

Assist
Vault

Online password manager for teams.

Vault
Directory

Workforce identity and access management solution for cloud businesses.

Directory
Lens

Interactive remote assistance software with augmented reality.

Lens
QEngine

Test automation software to build, manage, execute, and report testcases.

QEngine
Catalyst

Pro-code platform to build and deploy your apps.

Catalyst
RPA

Automate manual, tedious, and repetitive tasks easily.

RPA
NEW
eProtect

Comprehensive email security and archiving for every business.

eProtect
FREE
OneAuth

Secure multi-factor authenticator (MFA) for all your online accounts.

OneAuth
Toolkit

Complete resource for any admin-related lookup queries.

Toolkit

BI and Analytics

Analytics

Modern self-service BI and analytics platform.

Analytics
DataPrep

AI-powered ETL tool for effective data integration and movement.

DataPrep
IoT

Harnessing IoT analytics for real-time operational intelligence.

IoT
Embedded BI

Embedded analytics and white label BI solutions, tailored for your needs.

Embedded BI

Project Management

Projects

Manage, track, and collaborate on projects with teams.

Projects
Sprints

Planning and tracking tool for scrum teams.

Sprints
BugTracker

Automatic bug tracking software for managing bugs.

BugTracker
Solo

The all-in-one toolkit for solopreneurs.

Solo
Suites
Projects Plus

Unified project management platform for intelligent, data-driven work.

Projects Plus

Developer Platforms

Creator

AI-powered platform to build custom business apps.

Creator
Flow

Automate business workflows by creating smart integrations.

Flow
Office Integrator

Built in document editors for web apps.

Office Integrator
DataPrep

AI-powered ETL tool for effective data integration and movement.

DataPrep
ZeptoMail

Secure and reliable transactional email sending service.

ZeptoMail
Tables

Work management tool to connect people, processes, and information.

Tables
QEngine

Test automation software to build, manage, execute, and report testcases.

QEngine
Catalyst

Pro-code platform to build and deploy your apps.

Catalyst
RPA

Automate manual, tedious, and repetitive tasks easily.

RPA
IoT

Build, deploy, and scale IoT solutions for connected businesses.

IoT
Apptics

Application analytics for all apps.

Apptics
Embedded BI

Embedded analytics and white label BI solutions, tailored for your needs.

Embedded BI

IoT

IoT

Low-code IoT platform and solutions for connected businesses.

IoT
CRM Plus

Unified platform to deliver top-notch customer experience.

Try now
CRM Plus
Service Plus

Unified platform for customer service and support teams.

Try now
Service Plus
Finance Plus

All-in-one suite to manage your operations and finances.

Try now
Finance Plus
People Plus

Comprehensive HR platform for seamless employee experiences.

Try now
People Plus
Workplace

Application suite built to improve team productivity and collaboration.

Try now
Workplace
Marketing Plus

Unified marketing platform for marketing teams.

Try now
Marketing Plus
Projects Plus

Unified project management platform for intelligent, data-driven work.

Try now
Projects Plus
All-in-one suite

Zoho One

The Operating System for Business

Run your entire business on Zoho with our unified cloud software, designed to help you break down silos between departments and increase organizational efficiency.

TRY ZOHO ONE
Zoho Marketplace

With over 2000 ready-to-use extensions across 40+ categories, connect your favorite business tools with the Zoho products you already use.

EXPLORE MARKETPLACE

Join us for the biggest low-code event of the year. Register now!

x
Skip to main content

Choose where you’d like to start

 

Detect Face

Overview

The zoho.ai.detectFace task detects all the faces in the image and returns the bounding box coordinates of the faces detected. Additionally, the emotion, gender, and pose attributes of the face can also be detected.

For example, using this task, you can predict if a seminar was engaging based on the audience's facial expressions. Learn more.

Note: 
  • The prediction results may not be accurate, which is the case with any AI prediction. However, we are working on improving this.
  • The prediction results are dynamic. The same script may produce different outcomes based on the machine's knowledge.

Syntax

<response>  =  zoho.ai.detectFace(<input_image>,  <is_dominant_face>,  <attribute_list>);

where:

ParamsData typeDescription

<response>

 KEY-VALUE

 Specifies the predicted face coordinates, emotion, gender, and position of all faces in the   image.

<input_image>

 File

 Specifies the file object that contains the image.

 Note: 
  • The file can only be fetched from the cloud using the invokeUrl task.
  • This task cannot be applied directly to the Zoho Creator image or file upload field.
  • The file can be an image of .png, .jpg, or .jpeg format.
  • The maximum allowed file size is 5MB.

<is_dominant_face>

 Boolean  (true/false)

 Specifies the condition to return the data of prominent face or all faces in the   image. 

 true - Returns bounding box of prominent face.

 false - Returns bounding boxes of all faces in the image.

 

<attribute_list>

(optional)

 List

 Specifies the list of values to return. The supported values are:

  • gender - Includes gender of the face (Male / Female) in the returned response.
  • emotion - Emotion of the face (Angry / Fear / Happy / Neutral / Sad / Surprise)
  • pose -Returns angle/pose of the face (Yaw/Pitch/ Roll)

Example 1: Detect faces in an image

The following script detects the face in the image and returns its coordinates.

image_file  =  invokeurl
    [
         url : "https://c0.wallpaperflare.com/preview/52/764/33/twin-boys.jpg"
      ];

 response  =   zoho.ai.detectFace(image_file, false);

Where:

"https://c0.wallpaperflare.com/preview/52/764/33/twin-boys.jpg"
is the TEXT that represents the URL of the image that needs to be analyzed.
response
is the KEY-VALUE response that represents the objects detected from the image file and their coordinates.
image_file
is the FILE that represents the image from which the faces will be detected.
false
is the BOOLEAN value that specifies the task will return all the faces in the image.
 

Example 2: Detect additional attributes like gender, emotion and pose.

The following script detects the faces in the image and returns its response with face coordinates, gender, emotion, and pose.

image_file  =  invokeurl
     [
         url :"https://c0.wallpaperflare.com/preview/52/764/33/twin-boys.jpg"
     ];
​
     attribute_list  =  list();
     attribute_list.add("gender");
     attribute_list.add("emotion");
     attribute_list.add("pose");

     response  =  zoho.ai.detectFace(image_file, false, attribute_list);

Where:

attribute_list
is the LIST of values that need to be returned. Click here to learn more about list function.

Example 3: Apply zoho.ai.detectface task on an image uploaded in a Zoho Creator field

Note: This example is only applicable for Zoho Creator.

The below code downloads the image from the field through API and returns its response with zoho.ai.detectFace task. The zoho.ai.detectFace task cannot be used with Zoho Creator’s form fields. Before that, you need to establish a connection within the application. In order to download the uploaded file in the form, you need download file API to use it with the zoho.ai.detectFace task.

 // Replace <account_owner_name> with  the  user name of the Creator accounts owner.
 // Replace <app_link_name> the link name of the target application.
 // Replace <report_link_name> with  the link name of the target report.
 // Replace <record_ID > with the ID of the record from which you want to download the file.
 // Replace <field_link_name> with the link name of the target file upload or image field.

 image_file  =  invokeurl
     [
     url: "https://creator.zoho.com/api/v2/<account_owner_name>/<app_link_name>/report/<report_link_name>/<record_ID>/<field_link_name>/download"
     type : GET
     connection: "creator_oauth_connection"
     ];
 
  attribute_list  =  List();
  attribute_list.add("gender");
  attribute_list.add("emotion");
  attribute_list.add("pose");
 
  response  =  zoho.ai.detectFace(image_file,  false,  attribute_list);

Where:

"https://creator.zoho.com/api/v2/<account_owner_name>/
<app_link_name>/report/<report_link_name>/<record_id>
/<field_link_name>/download</field_link_name
</record_id></report_link_name></app_link_name></account_owner_name>"
is the TEXT that represents the URL specified in the Zoho Creator to download the required image through Zoho Creator - Download File API.
creator_oauth_connection
is the TEXT that represents the name of the connection, created using the default service Zoho OAuth. While creating the connection, include scopes as mentioned in the Zoho Creator - Download File API.
 

Scenario 1: Fetch required data from the response

Consider an image where you need to know the total count of people. This can be done by detecting the number of faces in the image. The zoho.ai.detectFace task stores the number of faces found data in the response as numFacesFound. This particular data can be fetched using the get() function. Refer to the following script for better understanding.

 image_file  =  invokeurl
     [
        url : "https://ylpapp.isb.edu/user/Passport_photo_samples/Sample-9---wrong.jpg"
     ];
 // Create a variable to store the response.
 response  =  zoho.ai.detectFace(image_file,  false);
 // Fetch the "numFacesFound" data from response using get() function.
 number_of_faces  =  response.get("numFacesFound");

Scenario 2: Predict, whether the program was engaging based on the facial expression of the audience

Consider an image with a group of people sitting in an auditorium. By analyzing the facial emotions of the people in the picture, we can conclude whether the program is engaging or not.

If the number of happy faces exceeds 50% of the total face count, we can conclude that the program is engaging, otherwise it is not engaging.

The following script fulfils the above-said scenario.

 image_file  =  invokeurl
     [
      url : "https://media.istockphoto.com/photos/diverse-human-faces-picture-id1187245319?k=20&m=1187245319&s=612x612&w=0&h=byaOZWGwYLZI3YoGagQEiFds05DHjmcRfSynTeTrPe4="
      type : GET
     ];
 // Create a variable -face_data to store the data as list by using get() and toList() function.
 face_data  =   zoho.ai.detectFace(image_file, false, {"emotion"}).get("data").toList();
  count  =  0;
 // Create a variable - total_face to stores the total face count in the image using size() function.
 total_face  =  face_data.size(); 

  for each  index  face  in  face_data
  {
     detect_emotion  =  face_data.get(face).get("emotion").get("prediction");

     if(detect_emotion  ==  "happy")
     {
         count  =  count + 1;
     }
  }

  if(count  >  total_face / 2)
  {
     response  =  "The seminar was engaging";
  }
  else
  {
     response  =  "The seminar was not engaging";
  }

Scenario 3: Populate Zoho Creator field with predicted emotion

Note: This scenario is only applicable for Zoho Creator.

Let’s consider a situation where you need to auto-populate predicted emotion on a single line field based on the image uploaded in the file upload / image field. The emotion can be fetched from the response of zoho.ai.detectFace task using get() function. This action can be performed with the help of Zoho Creator - Download File API.

The following script detects the emotion from the uploaded image and updates another Zoho Creator field with the predicted emotion:

// url - Contains the download file API I URL to download the uploaded image 
// account_owner_name - Replace with the  user name of the Creator account. 
// app_link_name - Replace with the link name of the target application. 
// report_link_name - Replace with the link name of the target report. 
// record_ID - Replace with the ID of the record from which you want to download the file. 
// field_link_name - Replace with the link name of the target file upload or image field. 

 image_file  =  invokeurl 
     [ 
       url: "https://creator.zoho.com/api/v2/<account_owner_name>/<app_link_name>/report/<report_link_name>/<record_ID>/<field_link_name>/download" 
       type : GET 
       connection: "zoho_oauth_connection" 
      ]; 
       
// Create a variable to store the data of prominent face 
detect_emotion  =  zoho.ai.detectFace(image_file,true,{"emotion"}).getJson("data").getJson("emotion").getJson("prediction"); 

// Specify a form field where the emotion needs to be populated. 
// Replace "predicted_emotion" with your single line field_link_name . 
 input.predicted_emotion  =  detect_emotion; 

Response Format

Success Response

  • The success response will be returned in the following format.

    {    "data": [
         {
          "faceCoordinate": [
            "0.565",
            "0.273",
            "0.760",
            "0.590"
          ],
          "gender": {
            "prediction": "male",
            "confidence": {
              "female": "0.028",
              "male": "0.972"
            }
          },
          "emotion": {
            "prediction": "happy",
            "confidence": {
              "angry": "0.0",
              "fear": "0.0",
              "happy": "0.999",
              "neutral": "0.0",
              "sad": "0.0",
              "surprise": "0.0"
            }
          },
          "pose": {
            "yaw": "-4.6450",
            "pitch": "-7.8978",
            "roll": "-1.0229"
          }
        }
      ],
      "numFacesFound": 1,
      "executionMessage": "Faces found",
      "message": "success"
    }

 

Failure Response

  • The error message when the file size exceeded the allowed limit will be returned in the following format:

     
     "The zoho.ai.detectFace integration task failed because the size of the supplied input file exceeded the allowed limit of 5MB."
     
  • The failure response when the image is not in the specified format(.png, .jpg,or .jpeg).

    {    "error":{
        "code": 400,
        "message": "null file format is not allowed"
      },
      "status": "Failed"
    }
     

 

Related Links

Get Started Now

Execute