Detecção facial com Deluge: dominando a task zoho.ai.detectFace

Detecção facial com Deluge: dominando a task zoho.ai.detectFace

Fala, pessoal!

Hoje quero compartilhar com vocês uma das tasks de Inteligência Artificial mais interessantes do Deluge: a zoho.ai.detectFace. Com ela, conseguimos detectar rostos em imagens diretamente nos nossos scripts, sem precisar de nenhuma API externa de visão computacional. Todo o conteúdo deste artigo é baseado na documentação oficial da Zoho.

O que é a zoho.ai.detectFace?  

A task zoho.ai.detectFace detecta todos os rostos presentes em uma imagem e retorna as coordenadas da caixa delimitadora (bounding box) de cada rosto detectado. Além disso, ela pode retornar atributos adicionais do rosto: emoção, gênero e pose.

Um exemplo prático: dá para prever se um seminário foi envolvente analisando as expressões faciais da plateia em uma foto. Vamos ver esse cenário mais adiante.

Pontos de atenção antes de começar  

A documentação oficial destaca alguns pontos importantes:

       Consumo de chamadas externas: cada execução da task dispara uma requisição de API ao back-end, que é descontada do limite de chamadas externas do serviço, conforme o seu plano. E atenção: o que conta são as execuções reais que recebem resposta, não quantas vezes a task aparece no script. Se ela estiver dentro de um for each que itera 5 vezes, serão consumidas 5 chamadas externas, mesmo que a task apareça apenas uma vez no script.

       Precisão: como toda predição de IA, os resultados podem não ser precisos. A Zoho informa que está trabalhando para melhorar isso.

       Resultados dinâmicos: o mesmo script pode produzir resultados diferentes, conforme o conhecimento da máquina.

Sintaxe  

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

Entendendo cada parâmetro:

Parâmetro

Tipo de dado

Descrição

<response>

KEY-VALUE

Especifica as coordenadas previstas dos rostos e, se solicitado, a emoção, o gênero e a posição de todos os rostos da imagem.

<input_image>

FILE

Especifica o objeto de arquivo que contém a imagem.

Nota: o arquivo só pode ser obtido da nuvem usando a task invokeUrl. Esta task não pode ser aplicada diretamente em campos de imagem ou de upload de arquivo do Zoho Creator. O arquivo pode ser uma imagem nos formatos .png, .jpg ou .jpeg. O tamanho máximo permitido é de 5MB.

<is_dominant_face>

BOOLEAN (true/false)

Especifica a condição para retornar os dados do rosto predominante ou de todos os rostos da imagem.

true - Retorna a bounding box do rosto predominante.

false - Retorna as bounding boxes de todos os rostos da imagem.

<attribute_list> (opcional)

LIST

Especifica a lista de valores a retornar. Os valores suportados são:

gender - Inclui o gênero do rosto na resposta retornada: Male (Masculino) / Female (Feminino).

emotion - Emoção do rosto: Angry (Raiva) / Fear (Medo) / Happy (Feliz) / Neutral (Neutro) / Sad (Triste) / Surprise (Surpresa).

pose - Retorna o ângulo/pose do rosto: Yaw (Guinada - rotação horizontal, para os lados) / Pitch (Inclinação - rotação vertical, para cima e para baixo) / Roll (Rolagem - inclinação lateral da cabeça).

 

Exemplo 1: Detectar rostos em uma imagem  

O script abaixo detecta o rosto da imagem e retorna suas coordenadas:

image_file = invokeurl

    [

         url: "https://c0.wallpaperflare.com/preview/52/764/33/twin-boys.jpg"

    ];

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

Aqui, image_file é o FILE que representa a imagem da qual os rostos serão detectados, false é o valor BOOLEAN que especifica que a task retornará todos os rostos da imagem, e response é o KEY-VALUE que representa os objetos detectados na imagem e suas coordenadas.

Exemplo 2: Detectar atributos adicionais como gênero, emoção e pose  

O script a seguir detecta os rostos da imagem e retorna a resposta com coordenadas dos rostos, gênero, emoção e 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);

A attribute_list é a LIST de valores que precisam ser retornados.

Exemplo 3: Usar a task com imagem enviada em um campo do Zoho Creator  

Nota: este exemplo é aplicável apenas ao Zoho Creator.

O código abaixo baixa a imagem do campo através da API e retorna a resposta com a task zoho.ai.detectFace. A task não pode ser usada diretamente com os campos de formulário do Zoho Creator. Antes, é necessário estabelecer uma connection dentro da aplicação. Para baixar o arquivo enviado no formulário, é preciso usar a Download File API com a task zoho.ai.detectFace:

// Substitua <account_owner_name> pelo nome de usuário do dono da conta Creator.

// Substitua <app_link_name> pelo link name da aplicação alvo.

// Substitua <report_link_name> pelo link name do relatório alvo.

// Substitua <record_ID> pelo ID do registro do qual deseja baixar o arquivo.

// Substitua <field_link_name> pelo link name do campo de upload ou imagem.

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

Onde creator_oauth_connection é o TEXT que representa o nome da connection, criada usando o serviço padrão Zoho OAuth. Ao criar a connection, inclua os scopes mencionados na documentação da Zoho Creator - Download File API.

Resumindo  

       Detecta todos os rostos de uma imagem (ou só o predominante) com bounding box

       Atributos opcionais: gender, emotion e pose

       A imagem deve vir da nuvem via invokeUrl (.png, .jpg ou .jpeg, máximo de 5MB)

       No Zoho Creator, use a Download File API com uma connection para imagens de campos de formulário

       Cada execução consome uma chamada externa do limite do seu plano

Links úteis (documentação oficial)  

       Detect Face - Zoho Deluge

       Artificial Intelligence Tasks

       invokeURL Task

       Download File API - Zoho Creator

       Connections - Zoho Creator

 

E aí, já usou as AI Tasks do Deluge em algum projeto? Conta nos comentários!

 


      Zoho Campaigns Resources


        • Desk Community Learning Series


        • Digest


        • Functions


        • Meetups


        • Kbase


        • Resources


        • Glossary


        • Desk Marketplace


        • MVP Corner


        • Word of the Day


        • Ask the Experts


          • Sticky Posts

          • Participe dos encontros exclusivos Zoho User Groups (ZUGs)

            Temos um convite especial para você! Participe dos Zoho User Groups (ZUGs), encontros presenciais que conectam usuários, especialistas e parceiros da Zoho. Esses eventos são a oportunidade perfeita para compartilhar melhores práticas e descobrir como
          • Boas Práticas na Comunidade Zoho Brasil

            Participar da Comunidade Zoho Brasil pode ser uma experiência enriquecedora e colaborativa, mas para que isso aconteça, devemos sempre contribuir para um ambiente positivo e construtivo. Aqui estão algumas dicas de boas práticas para garantir que todos
          • Seja muito bem-vindo à Comunidade Zoho Brasil!

            É com muita empolgação que convidamos você a fazer parte deste novo espaço de colaboração, interação e troca de conhecimentos! Na Comunidade Zoho Brasil você poderá criar tópicos de conversa nos fóruns e também colaborar em discussões produtivas iniciadas
          • A assistente de redação inteligente do Zoho Writer, Zia, agora oferece suporte ao português brasileiro!

            Obtenha sugestões contextuais de ortografia e gramática e melhore a qualidade geral do seu conteúdo com a Zia ao escrever em português. Estamos treinando a Zia em um novo idioma para atender à crescente demanda dos nossos usuários por acesso multilíngue.

          Zoho CRM Plus Resources

            Zoho Books Resources


              Zoho Subscriptions Resources

                Zoho Projects Resources


                  Zoho Sprints Resources


                    Zoho Orchestly Resources


                      Zoho Creator Resources


                        Zoho WorkDrive Resources



                          Zoho CRM Resources

                          • CRM Community Learning Series

                            CRM Community Learning Series


                          • Tips

                            Tips

                          • Functions

                            Functions

                          • Meetups

                            Meetups

                          • Kbase

                            Kbase

                          • Resources

                            Resources

                          • Digest

                            Digest

                          • CRM Marketplace

                            CRM Marketplace

                          • MVP Corner

                            MVP Corner




                            Zoho Writer Writer

                            Get Started. Write Away!

                            Writer is a powerful online word processor, designed for collaborative work.

                              Zoho CRM コンテンツ



                                ご検討中の方

                                  • Recent Topics

                                  • Global Sets for Multi-Select pick lists

                                    When is this feature coming to Zoho CRM? It would be very useful now we have got used to having it for the normal pick lists.
                                  • Bank Transaction Rules Link Under Each Bank Account

                                    Hello, can you'll move the "transaction rules" button or link back under each bank account? It is now on Bank Overview, if I am working on a specific bank account, I don't want to go out to overview to check the rules. That button displays rules for all
                                  • Nested notebooks

                                    Dear Sir/Madam, I would like to know if it is possible to nest notebooks. It would be very helpful when there are too many, as it would improve organization. Thank you for your response. Best regards.
                                  • Zia Agents looks promising, but I still cannot deploy my first agent or connect WhatsApp after weeks of support tickets

                                    Hi Everyone, I am posting here because I am stuck and need practical help from someone who has successfully deployed a Zia Agent with WhatsApp. Zia Agents looks like a very promising product. I have watched the platform expand quickly, and I have noticed
                                  • Zoho CRM

                                    Cuándo voy a adjuntar un archivo .pdf en un registro en el campo Archivo obtengo el siguiente error:
                                  • Implement Meeting Polls in Zoho Bookings

                                    Dear Zoho Bookings Support Team, We'd like to propose a feature enhancement related to appointment scheduling within Zoho Bookings. Current Functionality: Zoho Bookings excels at streamlining individual appointment scheduling. Users can set availability
                                  • Recording Salaries and wages in zoho books with bank fees

                                    Hello Community, I am posting this questions to understand the best way to record the salary and payroll expenses in zoho books. The way it works here, For example if I have 3 employees and each employee salary is lets say $1000. I usually use the bank
                                  • API - Available Stock Definitions

                                    Okay, Zoho team... your copywriters fell down on the job for this one :) I think these warrant a bit more explanation as to what they include and what they don't.
                                  • [BUG] WebTabs in ZohoCRM now have a spurious "\" displayed along with some additional HTML Head code included

                                    An example of the issue can be seen below:
                                  • CNIL - Suivi de Pixel

                                    Bonjour à tous, À la suite de la nouvelle recommandation de la CNIL sur les pixels de suivi dans les e-mails, savez-vous si Zoho Campaigns permet : de conditionner le suivi des ouvertures au consentement de chaque contact ; de proposer un lien permettant
                                  • Scheduled import

                                    The tutorial shows a scheduled import option but this option doesn't appear to be available when using Zoho DB.
                                  • #4 Choosing How My Invoice Should Look

                                    Day 4: Meera had the basics sorted. Her business name was there, the address looked right, and her logo finally appeared where it should. But the invoice still did not quite look like hers. Her old studio used invoices that were clean, tightly laid out,
                                  • Transaction rules for "Owner's Contribution" ?

                                    I have a bank account where a lot of the deposits are "Owner's Contributions" (i.e., the business owner investing money in the company). Is it possible to create a Transaction Rule to automatically recognize these? They all have the same verbiage from
                                  • DYK 12: Turn Email into Work Items

                                    Did you know you can add work items to your Zoho Projects portal directly from your inbox? The initial step of important collaborations start over an email, and most of these require an immediate follow-up by creating a task, or reporting an issue. During
                                  • Custom Function not getting package details when triggered from Workflow Rules.

                                    I have a custom function for Packages that submits a form in our Creator app that we use to generate custom shipping labels (internal staff complete deliveries so we cannot generate shipping labels straight from Inventory). When the function is executed
                                  • how to Solve Conflict Invoices in Zoho POS

                                    Hello Team, I am facing a repeated issue in Zoho POS while saving a sale that contains service-based items. My products are intentionally created as Service (Non-Inventory) items because I do not want to track stock for them. However, every time I try
                                  • ¿Cuándo estará disponible la edición de Zoho POS para México?

                                    He estado revisando las capacidades de Zoho POS y su evolución dentro de la estrategia de Zoho for Retail, y me parece que existe una oportunidad muy interesante para el mercado mexicano. Zoho POS ya ofrece funcionalidades para gestionar ventas, inventario,
                                  • Important update for Zoho RPA Windows Agent users

                                    Hi everyone, We would like to share an important update for Zoho RPA Windows Agent users running Windows Server 2016 or Windows Server 2019. The new Zoho RPA Windows Agent 6.0.0 and later versions are not supported on Windows Server 2016 and Windows Server
                                  • Multi-Option Estimates: One Estimate, Multiple Choices

                                    Every service request can have multiple solutions. Multi-Option Estimates help you present these different solutions in a single estimate with its own name, parts, price, and total. Each option can differ in scope, approach, or price — whatever choices
                                  • Delete CRM Portal

                                    How do I delete portals from my CRM? I created one just to test, it is not in use and is disabled but it's existence is preventing me from marking fields in modules as "required" unless I make it 'read/write' in the portal first. I'd rather just delete
                                  • Marketing Tip #32: Improve SEO and customer confidence with an FAQ section

                                    Before making a purchase, customers often have simple questions about delivery times, returns, product usage, or sizing. If they can’t quickly find answers, they may leave your store without buying. Adding a clear FAQ (Frequently Asked Questions) section
                                  • Contact removed when picking ticket template.

                                    hi new to Desk rolling out to company, replacing Freshdesk. Is there way to keep the in context contact when selecting a template? When you choose a template you lose the contact!
                                  • ZOHO Campaigns in ZOHO Analytics - Campaigns vs Contacts Table

                                    There seems to be information in the Zoho Campaigns table such as Unique Opens and Unique Clicks that can't be found in the Campaigns vs Contacts table where only Opens and Clicks are shown on a per contact level. Is there a way to bring Unique Opens
                                  • Zoho Publish is now available in Zoho One!

                                    Hello Zoho One users, We’re excited to announce that Zoho Publish is now included as part of the Zoho One suite! As businesses grow, managing Google Business Profiles across many locations becomes challenging. Business information needs to stay accurate,
                                  • How to change an employee mail id

                                    Hi, Does the administrator have the rights to edit an  employees mail id. 
                                  • Cousin Domain Verification in Zoho Mail: Identify and block look-alike domains

                                    Phishing attacks often rely on domain names that closely resemble legitimate ones. This makes it difficult for users to identify fraudulent emails at first glance. Zoho Mail's Cousin Domain Verification feature allows administrators to define trusted
                                  • How do I add 2 agents under the same email?

                                    I have 2 agents who use the same email address. I added one, but when adding the second agent, it says that the email is already registered. How do I configure this properly?
                                  • Zoho Desk API modifiedTimeRange returns HTTP 500 around 2026-03-08T02:00:00.000Z

                                    Hello Zoho Support Team, We are experiencing a reproducible HTTP 500 Internal Server Error when querying the Zoho Desk API search endpoint with a specific modifiedTimeRange boundary. ### API Endpoint GET /api/v1/tickets/search ### Reproduction Steps &
                                  • Updating an Invoice Line Item's Discount Account via API Call / Deluge Custom Function

                                    I need help updating an invoice line item's discount account via API. Below is a screenshot of the line item field I am referring to. Now the field to the left of the highlighted field (discount account) is the sales income account. I am able to modify
                                  • Collaborate Visually with Whiteboard in Zoho Projects

                                    Whiteboard in Zoho Projects allows you to collaborate visually by creating diagrams, annotating designs, and sketching project workflows using shapes, text, and images within project modules. Team members can work simultaneously, improving productivity
                                  • Associate project with timer on iPhone

                                    When I start the timer without first associating a project (on my iPhone), its starts fine but now when I need to associate a project, and click on the link, I get a list of EVERY project I've ever put into Zoho Books. It used to just show active projects.
                                  • Sales Tax Refund on Commerce Order

                                    I've looked high and low. Relatively new to ZOHO but not to systems in general. How do we produce a refund for sales tax charged and paid for by a customer in error? This does not impact inventory stock. Simply for accounting and getting the $ back to
                                  • Importing Chart of Accounts from Quickbooks -- "Debit or Credit"?

                                    I'm trying to switch from QB to Zoho Books. I've prepped my chart of accounts and put it into the format following the structure of the sample CSV file. But one thing that does not exist at all on the Quickbooks side is the Zoho column for "Debit or Credit".
                                  • Long term pricing for customers managing multiple organizations

                                    I've been using Zoho extensively for quite some time and genuinely think it's one of the most powerful and customizable business platforms available. Between Zoho Books and Zoho Analytics, I've invested a significant amount of time building automations,
                                  • Default Status for Appointments to Completed

                                    We use Zoho Bookings integrated with Zoho Desk to book time for tech support sessions, we've configured it to only allow for a contact to book a single session to avoid customers overbooking time that may not be needed. The trouble is, once a session
                                  • Customer User Fields for use in Rules

                                    Hi, I would like to be able to add custom fields to the users, such as Department or Role, which can then be used in Rules, Reports, etc. as a condition. A use case is limiting Global lists or Choices based on the users Custom Field, so one form can be
                                  • Add ZeptoMail to Zoho One

                                    Hi Zoho Team, I would like to request that ZeptoMail be added as a fully included application within Zoho One. Why this is important Zoho One is positioned as a unified business operating system that brings the applications an organization needs under
                                  • Item image on document

                                    I know what I am asking may not be possible, but I will ask anyway, maybe I will get lucky, and someone else is doing it. My business is based on special orders only from various online stores. When I send a quote to a client, I generate a separate quote
                                  • Dashboard Metric Drill-Down Shows Stale Data

                                    Summary: When clicking between different metric components on a custom dashboard, the drill-down list shows data from the previously opened metric instead of the one just clicked. Steps to Reproduce: Create a custom dashboard with multiple pre-defined/templatized
                                  • Zoho Marketing Automation WhatsApp Campaign Import Sync for Zoho Analytics

                                    WhatsApp is a critical channel in modern marketing, yet WhatsApp Campaign metrics from Zoho Marketing Automation currently cannot be natively imported into Zoho Analytics via the default advanced analytics connector. Integrating this into the standard
                                  • Next Page