Skip to product menu
close
  • Recent Launches
    Press Space or Enter to display list of options
EXPLORE ALL PRODUCTS

Recent Launches

New

Payroll software with automated tax payments and filing.

Try now
New

Robotic process automation software to automate high-volume, rule-based tasks.

Try for free
New

Low-code IoT platform and solutions for connected businesses.

Try now
New

Business formation service to launch and grow your businesses.

Try now
New

Privacy-friendly application analytics solution.

Try for free

Sales

 
CRM

Comprehensive CRM platform for customer-facing teams.

CRM
 
Bigin

Simple CRM for small businesses moving from spreadsheets.

Bigin
 
Forms

Build online forms for every business need.

Forms
 
SalesIQ

Live chat app to engage and convert website visitors.

SalesIQ
 
Bookings

Appointment scheduling app for consultations with customers.

Bookings
 
Sign

Digital signature app for businesses.

Sign
 
RouteIQ

Comprehensive sales map visualization and optimal route planning solution.

RouteIQ
 
Thrive

Complete loyalty and affiliate management platform.

Thrive
 
Voice

Cloud Contact Center Software for businesses.

Voice
 
Suites
CRM Plus

Unified platform to deliver top-notch customer experience.

CRM Plus

Marketing

 
Social

All-in-one social media management software.

Social
 
Campaigns

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

Campaigns
 
Forms

Build online forms for every business need.

Forms
 
Survey

Design surveys to reach and interact with your audience.

Survey
 
Sites

Online website builder with extensive customisation options.

Sites
 
PageSense

Website conversion optimization and personalisation platform.

PageSense
 
Backstage

End-to-end event management software.

Backstage
 
Webinar

Webinar platform for webcasting online webinars.

Webinar
 
Marketing Automation

All-in-one marketing automation software.

Marketing Automation
 
LandingPage

Smart landing page builder to increase conversion rates

LandingPage
 
Publish

Manage all your local business listings on a single platform.

Publish
 
SalesIQ

Live chat app to engage and convert website visitors.

SalesIQ
 
Sign

Digital signature app for businesses.

Sign
 
Thrive

Complete loyalty and affiliate management platform.

Thrive
 
Voice

Cloud Contact Center Software for businesses.

Voice
 
NEW
LeadChain

Sync, manage, and convert leads across channels seamlessly.

LeadChain
 
NEW
CommunitySpaces

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

CommunitySpaces
 
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
 
Lens

Interactive remote assistance software with augmented reality.

Lens
 
FSM

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

FSM
 
SalesIQ

Live chat app to engage and convert website visitors.

SalesIQ
 
Voice

Cloud Contact Center Software for businesses.

Voice
 
NEW
Solo

The all-in-one toolkit for solopreneurs.

Solo
 
Bookings

Appointment scheduling app for consultations with customers.

Bookings
 
Suites
Service Plus

Unified platform for customer service and support teams.

Service Plus

Finance

 
Books

Powerful accounting platform for growing businesses.

Books
 
FREE
Invoice

100% Free invoicing solution.

Invoice
 
Expense

Effortless expense reporting platform.

Expense
 
Inventory

Powerful stock management and inventory control software.

Inventory
 
Billing

End-to-end billing solution for your business.

Billing
 
Checkout

Collect payments online with custom branded pages.

Checkout
 
NEW
Payroll

Payroll software with automated tax payments and filing.

Payroll
 
NEW
Solo

The all-in-one toolkit for solopreneurs.

Solo
 
Practice

Practice management software for accounting firms.

Practice
 
Sign

Digital signature app for businesses.

Sign
 
Commerce

eCommerce platform to manage and market your online store.

Commerce
 
Suites
Finance Plus

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

Finance Plus

Email and Collaboration

 
Mail

Secure email service for teams of all sizes.

Mail
 
Meeting

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

Meeting
 
Writer

Word processor for focused writing and discussions.

Writer
 
Sheet

Spreadsheet software for collaborative teams.

Sheet
 
Show

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

Show
 
Notebook

Beautiful home for all your notes.

Notebook
 
Cliq

Stay in touch with teams no matter where you are.

Cliq
 
Connect

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

Connect
 
Bookings

Appointment scheduling app for consultations with customers.

Bookings
 
TeamInbox

Shared inboxes for teams.

TeamInbox
 
WorkDrive

Online file management for teams.

WorkDrive
 
Sign

Digital signature app for businesses.

Sign
 
Office Suite

Powerful collaborative work platform for teams.

Office Suite
 
Office Integrator

Built in document editors for web apps.

Office Integrator
 
ZeptoMail

Secure and reliable transactional email sending service.

ZeptoMail
 
Calendar

Online business calendar to manage events and schedule appointments.

Calendar
 
Learn

Knowledge and learning management platform.

Learn
 
Voice

Cloud Contact Center Software for businesses.

Voice
 
ToDo

Collaborative task management for individuals and teams.

ToDo
 
Tables

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

Tables
 
FREE
PDF Editor

Collaborative online PDF editing tool.

PDF Editor
 
Suites
Workplace

Application suite built to improve team productivity and collaboration.

Workplace

Human Resources

 
People

Organize, automate, and simplify your HR processes.

People
 
Recruit

Intuitive recruiting platform built to provide hiring solutions.

Recruit
 
Expense

Effortless expense reporting platform.

Expense
 
Workerly

Manage temporary staffing with an employee scheduling solution.

Workerly
 
NEW
Payroll

Payroll software with automated tax payments and filing.

Payroll
 
Shifts

Employee scheduling and time tracking app.

Shifts
 
Sign

Digital signature app for businesses.

Sign
 
Suites
People Plus

Comprehensive HR platform for seamless employee experiences.

People Plus

Security and IT Management

 
Creator

Build custom apps to simplify business processes.

Creator
 
Directory

Workforce identity and access management solution for cloud businesses.

Directory
 
FREE
OneAuth

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

OneAuth
 
Vault

Online password manager for teams.

Vault
 
Catalyst

Pro-code platform to build and deploy your apps.

Catalyst
 
Toolkit

Complete resource for any admin-related lookup queries.

Toolkit
 
Lens

Interactive remote assistance software with augmented reality.

Lens
 
Assist

Remote support and unattended remote access software.

Assist
 
QEngine

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

QEngine
 
NEW
RPA

Automate manual, tedious, and repetitive tasks easily.

RPA

BI and Analytics

 
Analytics

Modern self-service BI and analytics platform.

Analytics
 
Embedded BI

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

Embedded BI
 
DataPrep

AI-powered data preparation service for your data-driven organization.

DataPrep
 
NEW
IoT

Harnessing IoT analytics for real-time operational intelligence.

IoT

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
 
NEW
Solo

The all-in-one toolkit for solopreneurs.

Solo

Developer Platforms

 
Creator

Build custom apps to simplify business processes.

Creator
 
Flow

Automate business workflows by creating smart integrations.

Flow
 
Catalyst

Pro-code platform to build and deploy your apps.

Catalyst
 
Office Integrator

Built in document editors for web apps.

Office Integrator
 
ZeptoMail

Secure and reliable transactional email sending service.

ZeptoMail
 
QEngine

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

QEngine
 
Tables

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

Tables
 
NEW
RPA

Automate manual, tedious, and repetitive tasks easily.

RPA
 
NEW
Apptics

Application analytics for all apps.

Apptics
 
Embedded BI

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

Embedded BI
 
NEW
IoT

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

IoT
 
DataPrep

AI-powered data preparation service for your data-driven organization.

DataPrep

IoT

 
NEW
IoT

Low-code IoT platform and solutions for connected businesses.

IoT

Search Result

 
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
 
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 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
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